net.minecraft.entity.Entity Java Examples
The following examples show how to use
net.minecraft.entity.Entity.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ItemThiefArmor.java From HexxitGear with GNU General Public License v3.0 | 6 votes |
@Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer) { if (entity instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entity; if (player.isPotionActive(Potion.invisibility)) return "/textures/armor/invisible.png"; } // If the helmet slot, return helmet texture map if (slot == 0) return "/textures/maps/HoodHelmet.png"; if (stack.itemID == HexxitGear.thiefLeggings.itemID) return "/textures/armor/thief2.png"; return "/textures/armor/thief.png"; }
Example #2
Source File: ThermiteTeleportationHandler.java From Thermos with GNU General Public License v3.0 | 6 votes |
public static void transferEntityToDimension(Entity ent, int dim, ServerConfigurationManager manager, Environment environ) { if (ent instanceof EntityPlayerMP) { transferPlayerToDimension((EntityPlayerMP) ent, dim, manager, environ); return; } WorldServer worldserver = manager.getServerInstance().worldServerForDimension(ent.dimension); ent.dimension = dim; WorldServer worldserver1 = manager.getServerInstance().worldServerForDimension(ent.dimension); worldserver.removePlayerEntityDangerously(ent); if (ent.riddenByEntity != null) { ent.riddenByEntity.mountEntity(null); } if (ent.ridingEntity != null) { ent.mountEntity(null); } ent.isDead = false; transferEntityToWorld(ent, worldserver, worldserver1); }
Example #3
Source File: HackTickHandler.java From PneumaticCraft with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void worldTick(TickEvent.WorldTickEvent event){ if(event.phase == TickEvent.Phase.END) { try { for(Entity entity : (List<Entity>)event.world.loadedEntityList) { HackingEntityProperties hackingProps = (HackingEntityProperties)entity.getExtendedProperties("PneumaticCraftHacking"); if(hackingProps != null) { hackingProps.update(entity); } else { Log.warning("Extended entity props HackingEntityProperties couldn't be found in the entity " + entity.getCommandSenderName()); } } } catch(Throwable e) { //Catching a CME which I have no clue on what might cause it. } } }
Example #4
Source File: MoCEntityOstrich.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
@Override protected void attackEntity(Entity entity, float f) { /*if (attackTime <= 0 && (f < 3.0D) && (entity.boundingBox.maxY > boundingBox.minY) && (entity.boundingBox.minY < boundingBox.maxY)) { }*/ if (this.attackTime <= 0 && f < 2.0F && entity.boundingBox.maxY > this.boundingBox.minY && entity.boundingBox.minY < this.boundingBox.maxY) { this.attackTime = 20; openMouth(); flapWings(); entity.attackEntityFrom(DamageSource.causeMobDamage(this), 3); //this.attackEntityAsMob(par1Entity); } }
Example #5
Source File: BloodBlock.java From the-hallow with MIT License | 6 votes |
@Override public void onEntityCollision(BlockState blockState, World world, BlockPos pos, Entity entity) { if(!world.isClient) { if (pos.equals(entity.getBlockPos())) { if (entity instanceof ItemEntity && !((ItemEntity) entity).getStack().isEmpty()) { ItemEntity itemEntity = (ItemEntity) entity; ItemStack stack = itemEntity.getStack(); if (stack.getItem() instanceof DyeableItem) { DyeableItem item = (DyeableItem) stack.getItem(); if (item.hasColor(stack)) item.setColor(stack, 0xFF0000 | item.getColor(stack)); else item.setColor(stack, 0xFF0000); return; } } } } super.onEntityCollision(blockState, world, pos, entity); }
Example #6
Source File: CraftEventFactory.java From Thermos with GNU General Public License v3.0 | 6 votes |
private static EntityDamageEvent callEntityDamageEvent(Entity damager, Entity damagee, DamageCause cause, Map<DamageModifier, Double> modifiers, Map<DamageModifier, Function<? super Double, Double>> modifierFunctions) { EntityDamageEvent event; if (damager != null) { event = new EntityDamageByEntityEvent(damager.getBukkitEntity(), damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } else { event = new EntityDamageEvent(damagee.getBukkitEntity(), cause, modifiers, modifierFunctions); } callEvent(event); if (!event.isCancelled()) { event.getEntity().setLastDamageCause(event); } return event; }
Example #7
Source File: CraftEventFactory.java From Thermos with GNU General Public License v3.0 | 6 votes |
public static boolean handleNonLivingEntityDamageEvent(Entity entity, DamageSource source, double damage) { if (entity instanceof EntityEnderCrystal && !(source instanceof EntityDamageSource)) { return false; } final EnumMap<DamageModifier, Double> modifiers = new EnumMap<DamageModifier, Double>(DamageModifier.class); final EnumMap<DamageModifier, Function<? super Double, Double>> functions = new EnumMap(DamageModifier.class); modifiers.put(DamageModifier.BASE, damage); functions.put(DamageModifier.BASE, ZERO); final EntityDamageEvent event = handleEntityDamageEvent(entity, source, modifiers, functions); if (event == null) { return false; } return event.isCancelled() || (event.getDamage() == 0 && !(entity instanceof EntityItemFrame)); // Cauldron - fix frame removal }
Example #8
Source File: MixinPlayerChat_MeCommand.java From Galaxy with GNU Affero General Public License v3.0 | 6 votes |
@SuppressWarnings("UnresolvedMixinReference") @Inject( method = "method_13238", at = @At( value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;broadcastChatMessage(Lnet/minecraft/text/Text;Lnet/minecraft/network/MessageType;Ljava/util/UUID;)V", ordinal = 0 ), locals = LocalCapture.CAPTURE_FAILSOFT ) private static void onCommand(CommandContext<ServerCommandSource> context, CallbackInfoReturnable<Integer> cir, TranslatableText translatableText, Entity entity) { if (!(entity instanceof ServerPlayerEntity)) return; Main main = Main.Companion.getMain(); ServerPlayerEntity player = (ServerPlayerEntity) entity; if (main == null || !main.getEventManager().emit(new PlayerChatEvent(player, translatableText)).getCancel()) { player.server.getPlayerManager().broadcastChatMessage(translatableText, MessageType.CHAT, entity.getUuid()); } else { cir.setReturnValue(0); cir.cancel(); player.server.sendSystemMessage(translatableText.append(" (Canceled)"), entity.getUuid()); } }
Example #9
Source File: MoCModelMouse.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
@Override public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { super.render(entity, f, f1, f2, f3, f4, f5); setRotationAngles(f, f1, f2, f3, f4, f5); Head.render(f5); EarR.render(f5); EarL.render(f5); WhiskerR.render(f5); WhiskerL.render(f5); Tail.render(f5); FrontL.render(f5); FrontR.render(f5); RearL.render(f5); RearR.render(f5); BodyF.render(f5); }
Example #10
Source File: MoCEntityWerewolf.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
@Override public void onDeath(DamageSource damagesource) { Entity entity = damagesource.getEntity(); if ((scoreValue > 0) && (entity != null)) { entity.addToPlayerScore(this, scoreValue); } if (entity != null) { entity.onKillEntity(this); } //unused_flag = true; if (!worldObj.isRemote) { for (int i = 0; i < 2; i++) { int j = getDropItemId(); if (j > 0) { dropItem(j, 1); } } } }
Example #11
Source File: EntityVillageLord.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
private void dropRepTo(Entity entity) { if (entity == null) { return; } if (!(entity instanceof EntityPlayer)) { return; } EntityPlayer player = (EntityPlayer) entity; CivilizationType civ = getCivilization(); if (civ == null) { return; } PlayerCivilizationCapabilityImpl.get(player).adjustReputation(civ, -5); }
Example #12
Source File: MoCEntityCrocodile.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
@Override protected Entity findPlayerToAttack() { if (getHasCaughtPrey()) { return null; } if (worldObj.difficultySetting > 0)// && getIsAdult()) { double attackD = 12D; if (getIsResting()) { attackD = 6D; } EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(this, attackD); if((entityplayer != null) && getIsAdult()) { return entityplayer; } EntityLiving entityliving = getClosestEntityLiving(this, attackD); return entityliving; } return null; }
Example #13
Source File: SelectionManager.java From litematica with GNU Lesser General Public License v3.0 | 6 votes |
public boolean changeSelection(World world, Entity entity, int maxDistance) { AreaSelection area = this.getCurrentSelection(); if (area != null) { RayTraceWrapper trace = RayTraceUtils.getWrappedRayTraceFromEntity(world, entity, maxDistance); if (trace.getHitType() == HitType.SELECTION_BOX_CORNER || trace.getHitType() == HitType.SELECTION_BOX_BODY || trace.getHitType() == HitType.SELECTION_ORIGIN) { this.changeSelection(area, trace); return true; } else if (trace.getHitType() == HitType.MISS) { area.clearCurrentSelectedCorner(); area.setSelectedSubRegionBox(null); area.setOriginSelected(false); return true; } } return false; }
Example #14
Source File: MoCEntityAnimal.java From mocreaturesdev with GNU General Public License v3.0 | 6 votes |
/** * This method must be overrided to work in conjunction with our * onLivingUpdate update packets. It is currently used to fix mount bug when * players reconnect. */ @Override public void mountEntity(Entity par1Entity) { if (updateMount()) { if (par1Entity == null) { if (this.ridingEntity != null) { this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double) this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch); this.ridingEntity.riddenByEntity = null; } this.ridingEntity = null; } else { this.ridingEntity = par1Entity; par1Entity.riddenByEntity = this; } } else { super.mountEntity(par1Entity); } }
Example #15
Source File: BlockHeatSink.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
@Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ TileEntityHeatSink heatSink = (TileEntityHeatSink)world.getTileEntity(x, y, z); if(heatSink.getHeatExchangerLogic(ForgeDirection.UNKNOWN).getTemperature() > 323) { entity.setFire(3); } }
Example #16
Source File: EntityUtils.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public static void setGlowing(Entity entity, Formatting color, String teamName) { Team team = mc.world.getScoreboard().getTeamNames().contains(teamName) ? mc.world.getScoreboard().getTeam(teamName) : mc.world.getScoreboard().addTeam(teamName); mc.world.getScoreboard().addPlayerToTeam( entity instanceof PlayerEntity ? entity.getEntityName() : entity.getUuidAsString(), team); mc.world.getScoreboard().getTeam(teamName).setColor(color); entity.setGlowing(true); }
Example #17
Source File: SpellRing.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
public boolean taxCaster(@Nonnull World world, SpellData data, double multiplier, boolean failSound) { if(data.getData(SpellData.DefaultKeys.CASTER) == null) return true; Entity caster = world.getEntityByID(data.getData(SpellData.DefaultKeys.CASTER)); if(caster == null) { Wizardry.LOGGER.warn("Caster was null!"); return true; } IManaCapability cap = ManaCapabilityProvider.getCap(caster); if (cap == null) return false; double manaDrain = getManaDrain(data) * multiplier; double burnoutFill = getBurnoutFill(data) * multiplier; boolean fail = false; try (ManaManager.CapManagerBuilder mgr = ManaManager.forObject(cap)) { if (mgr.getMana() < manaDrain) fail = true; mgr.removeMana(manaDrain); mgr.addBurnout(burnoutFill); } if (fail && failSound) { Vec3d origin = data.getOriginWithFallback(world); if (origin != null) world.playSound(null, new BlockPos(origin), ModSounds.SPELL_FAIL, SoundCategory.NEUTRAL, 1f, 1f); } return !fail; }
Example #18
Source File: TeleportEntity.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
public static boolean teleportEntityWithProjectile(Entity entity, Entity projectile, RayTraceResult rayTraceResult, float teleportDamage, boolean allowMounts, boolean allowRiders) { if (canTeleportEntity(entity) == false) { return false; } PositionHelper pos = new PositionHelper(rayTraceResult, projectile); // Hit a block, offset the position to not collide with the block if (rayTraceResult.typeOfHit == RayTraceResult.Type.BLOCK) { pos.adjustPositionToTouchFace(entity, rayTraceResult.sideHit); } Entity entNew = teleportEntity(entity, pos.posX, pos.posY, pos.posZ, projectile.getEntityWorld().provider.getDimension(), allowMounts, allowRiders); if (entNew != null) { if (teleportDamage != 0.0f) { // Inflict fall damage to the bottom most entity Entity bottom = EntityUtils.getBottomEntity(entNew); if (bottom instanceof EntityLivingBase) { bottom.attackEntityFrom(DamageSource.FALL, teleportDamage); } } entNew.fallDistance = 0.0f; return true; } return false; }
Example #19
Source File: EntitySelectorFromMobName.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
@Nullable @Override public Class<? extends Entity> getEntityClass() { if (entityClass == null) { entityClass = EntityList.getClass(mobName); } return entityClass; }
Example #20
Source File: DataTrackerManager.java From multiconnect with MIT License | 5 votes |
public static synchronized void startTrackingOldTrackedData(Entity entity) { for (Class<?> clazz = entity.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) { List<Pair<TrackedData<?>, ?>> trackedData = oldTrackedData.get(clazz); if (trackedData != null) { for (Pair<TrackedData<?>, ?> pair : trackedData) { doStartTracking(entity, pair.getLeft(), pair.getRight()); } } } }
Example #21
Source File: Aimbot.java From ForgeHax with MIT License | 5 votes |
private boolean isFiltered(Entity entity) { switch (EntityUtils.getRelationship(entity)) { case PLAYER: return target_players.get(); case FRIENDLY: case NEUTRAL: return target_mobs_friendly.get(); case HOSTILE: return target_mobs_hostile.get(); case INVALID: default: return false; } }
Example #22
Source File: ParticleSakuraLeaf.java From Sakura_mod with MIT License | 5 votes |
@Override public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotX, float rotXZ, float rotZ, float rotYZ, float rotXY) { // EffectRenderer will by default bind the vanilla particles texture, override with our own FMLClientHandler.instance().getClient().renderEngine.bindTexture(ClientProxy.leafTexture); GlStateManager.depthMask(false); GlStateManager.enableBlend(); GlStateManager.blendFunc(770, 1); super.renderParticle(buffer, entity, partialTicks, rotX, rotXZ, rotZ, rotYZ, rotXY); GlStateManager.disableBlend(); GlStateManager.depthMask(true); }
Example #23
Source File: BlockWall.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
@Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean p_185477_7_) { if (!p_185477_7_) { state = this.getActualState(state, worldIn, pos); } addCollisionBoxToList(pos, entityBox, collidingBoxes, CLIP_AABB_BY_INDEX[getAABBIndex(state)]); }
Example #24
Source File: ItemFakeHaloHead.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { if (worldIn.isRemote) return; try (ManaManager.CapManagerBuilder mgr = ManaManager.forObject(entityIn)) { mgr.setMaxMana(ConfigValues.crudeHaloBufferSize); mgr.setMaxBurnout(ConfigValues.crudeHaloBufferSize); mgr.removeBurnout(mgr.getMaxBurnout() * ConfigValues.haloGenSpeed * 2); } }
Example #25
Source File: BlockEnderUtilitiesPortal.java From enderutilities with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) { if (worldIn.isRemote == false) { if (entityIn instanceof EntityPlayer) { TickHandler.instance().addPlayerToTeleport((EntityPlayer) entityIn); } else { this.teleportEntity(worldIn, pos, state, entityIn); } } }
Example #26
Source File: LitematicaRenderer.java From litematica with GNU Lesser General Public License v3.0 | 5 votes |
private ICamera createCamera(Entity entity, float partialTicks) { double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks; double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks; double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks; this.entity = entity; this.camera = new Frustum(); this.camera.setPosition(x, y, z); return this.camera; }
Example #27
Source File: PathFinderDrone.java From PneumaticCraft with GNU General Public License v3.0 | 5 votes |
/** * Internal implementation of creating a path from an entity to a point */ private PathEntity createEntityPathTo(Entity par1Entity, double par2, double par4, double par6, float par8){ path.clearPath(); pointMap.clearMap(); boolean flag = isPathingInWater; int i = MathHelper.floor_double(par1Entity.boundingBox.minY + 0.5D); if(canEntityDrown && par1Entity.isInWater()) { i = (int)par1Entity.boundingBox.minY; for(Block j = worldMap.getBlock(MathHelper.floor_double(par1Entity.posX), i, MathHelper.floor_double(par1Entity.posZ)); j == Blocks.water || j == Blocks.flowing_water; j = worldMap.getBlock(MathHelper.floor_double(par1Entity.posX), i, MathHelper.floor_double(par1Entity.posZ))) { ++i; } flag = isPathingInWater; isPathingInWater = false; } else { i = MathHelper.floor_double(par1Entity.boundingBox.minY + 0.5D); } PathPoint pathpoint = openPoint(MathHelper.floor_double(par1Entity.boundingBox.minX), i, MathHelper.floor_double(par1Entity.boundingBox.minZ)); PathPoint pathpoint1 = openPoint(MathHelper.floor_double(par2 - par1Entity.width / 2.0F), MathHelper.floor_double(par4), MathHelper.floor_double(par6 - par1Entity.width / 2.0F)); PathPoint pathpoint2 = new PathPoint(MathHelper.floor_float(par1Entity.width + 1.0F), MathHelper.floor_float(par1Entity.height + 1.0F), MathHelper.floor_float(par1Entity.width + 1.0F)); PathEntity pathentity = addToPath(par1Entity, pathpoint, pathpoint1, pathpoint2, par8); isPathingInWater = flag; return pathentity; }
Example #28
Source File: ItemEspHack.java From Wurst7 with GNU General Public License v3.0 | 5 votes |
@Override public void onUpdate() { items.clear(); for(Entity entity : MC.world.getEntities()) if(entity instanceof ItemEntity) items.add((ItemEntity)entity); }
Example #29
Source File: ScanResult.java From GardenCollection with MIT License | 5 votes |
public ScanResult(byte type, int blockId, int blockMeta, Entity entity, String phenomena) { super(); this.type = type; this.id = blockId; this.meta = blockMeta; this.entity = entity; this.phenomena = phenomena; }
Example #30
Source File: TofuBlockUtils.java From TofuCraftReload with MIT License | 5 votes |
public static void onFallenUponFragileTofu(World par1World, Entity par5Entity, Block block, float par6, BlockUtils.IEntityWeightingBlockHandler handler) { if (!par1World.isRemote) { if (par6 > 0.5F) { if (!(par5Entity instanceof EntityPlayer) && !par1World.getGameRules().getBoolean("mobGriefing")) return; BlockUtils.handleEntityWeightingBlock(par1World, par5Entity, block, handler); } } }