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 }
@Override public void onUpdate(EntityPlayerSP player) { if(isEnabled()) { currentMS = System.nanoTime() / 1000000; if(hasDelayRun((long)(1000 / crystalSpeed.getValue()))) { for (Entity e : Wrapper.getWorld().loadedEntityList) { if (player.getDistanceToEntity(e) < crystalRange.getValue()) { if (e instanceof EntityEnderCrystal) { Wrapper.getMinecraft().playerController.attackEntity(player, e); player.swingArm(EnumHand.MAIN_HAND); lastMS = System.nanoTime() / 1000000; break; } } } } } }
public void onCrystalDestroyed(EntityEnderCrystal crystal, DamageSource dmgSrc) { if (this.respawnState != null && this.crystals.contains(crystal)) { LOGGER.debug("Aborting respawn sequence"); this.respawnState = null; this.respawnStateTicks = 0; this.resetSpikeCrystals(); this.generatePortal(true); } else { this.findAliveCrystals(); Entity entity = this.world.getEntityFromUuid(this.dragonUniqueId); if (entity instanceof EntityDragon) { ((EntityDragon)entity).onCrystalDestroyed(crystal, new BlockPos(crystal), dmgSrc); } } }
public void onCrystalDestroyed(EntityEnderCrystal crystal, BlockPos pos, DamageSource dmgSrc) { EntityPlayer entityplayer; if (dmgSrc.getEntity() instanceof EntityPlayer) { entityplayer = (EntityPlayer)dmgSrc.getEntity(); } else { entityplayer = this.worldObj.getNearestAttackablePlayer(pos, 64.0D, 64.0D); } if (crystal == this.healingEnderCrystal) { this.attackEntityFromPart(this.dragonPartHead, DamageSource.causeExplosionDamage(entityplayer), 10.0F); } this.phaseManager.getCurrentPhase().onCrystalDestroyed(crystal, pos, dmgSrc, entityplayer); }
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { // Cauldron start - another fix for Proxy Worlds if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } // Cauldron end if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron || entity instanceof EntityThrowable || entity instanceof EntityDragon || entity instanceof EntityDragonPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityWeatherEffect || entity instanceof EntityTNTPrimed || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworkRocket || entity instanceof EntityVillager // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false) && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false) && !entity.isCreatureType(EnumCreatureType.waterCreature, false))) { return true; } return false; }
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity>) and this method has signature public void doRender(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doe */ public void doRender(EntityEnderCrystal entity, double x, double y, double z, float entityYaw, float partialTicks) { float f = (float)entity.innerRotation + partialTicks; GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); this.bindTexture(enderCrystalTextures); float f1 = MathHelper.sin(f * 0.2F) / 2.0F + 0.5F; f1 = f1 * f1 + f1; this.modelEnderCrystal.render(entity, 0.0F, f * 3.0F, f1 * 0.2F, 0.0F, 0.0F, 0.0625F); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, entityYaw, partialTicks); }
@Override public void doRender(EntityEnderCrystal crystal, double x, double y, double z, float p_76986_8_, float partialTickTime) { float rotation = crystal.innerRotation + partialTickTime; OpenGLHelper.pushMatrix(); OpenGLHelper.translate(x, y, z); bindTexture(TEXTURE); float f3 = MathHelper.sin(rotation * 0.2F) / 2.0F + 0.5F; f3 += f3 * f3; MODEL.render(crystal, 0.0F, rotation * 3.0F, f3 * 0.2F, 0.0F, 0.0F, 0.0625F); OpenGLHelper.popMatrix(); }
public void onUpdate(EntityPlayerSP player) { if(isEnabled()) { for (Entity e : Wrapper.getWorld().loadedEntityList) { if (e instanceof EntityEnderCrystal) { if (player.getDistanceToEntity(e) > distance.getValue() && player.getPosition().getY() >= e.getPosition().getY()) { Wrapper.getWorld().sendQuittingDisconnectingPacket(); Hacks.findMod(CrystalLog.class).toggle(); } } } } }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntityEnderCrystal.class); if (!(render instanceof RenderEnderCrystal)) { Config.warn("Not an instance of RenderEnderCrystal: " + render); return null; } else { RenderEnderCrystal renderendercrystal = (RenderEnderCrystal)render; if (!Reflector.RenderEnderCrystal_modelEnderCrystalNoBase.exists()) { Config.warn("Field not found: RenderEnderCrystal.modelEnderCrystalNoBase"); return null; } else { Reflector.setFieldValue(renderendercrystal, Reflector.RenderEnderCrystal_modelEnderCrystalNoBase, modelBase); renderendercrystal.shadowSize = shadowSize; return renderendercrystal; } } }
public IEntityRenderer makeEntityRender(ModelBase modelBase, float shadowSize) { RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager(); Render render = (Render)rendermanager.getEntityRenderMap().get(EntityEnderCrystal.class); if (!(render instanceof RenderEnderCrystal)) { Config.warn("Not an instance of RenderEnderCrystal: " + render); return null; } else { RenderEnderCrystal renderendercrystal = (RenderEnderCrystal)render; if (!Reflector.RenderEnderCrystal_modelEnderCrystal.exists()) { Config.warn("Field not found: RenderEnderCrystal.modelEnderCrystal"); return null; } else { Reflector.setFieldValue(renderendercrystal, Reflector.RenderEnderCrystal_modelEnderCrystal, modelBase); renderendercrystal.shadowSize = shadowSize; return renderendercrystal; } } }
private void findAliveCrystals() { this.ticksSinceCrystalsScanned = 0; this.aliveCrystals = 0; for (WorldGenSpikes.EndSpike worldgenspikes$endspike : BiomeEndDecorator.getSpikesForWorld(this.world)) { this.aliveCrystals += this.world.getEntitiesWithinAABB(EntityEnderCrystal.class, worldgenspikes$endspike.getTopBoundingBox()).size(); } LOGGER.debug("Found {} end crystals still alive", new Object[] {Integer.valueOf(this.aliveCrystals)}); }
private void respawnDragon(List<EntityEnderCrystal> crystalsIn) { if (this.dragonKilled && this.respawnState == null) { for (BlockPattern.PatternHelper blockpattern$patternhelper = this.findExitPortal(); blockpattern$patternhelper != null; blockpattern$patternhelper = this.findExitPortal()) { for (int i = 0; i < this.portalPattern.getPalmLength(); ++i) { for (int j = 0; j < this.portalPattern.getThumbLength(); ++j) { for (int k = 0; k < this.portalPattern.getFingerLength(); ++k) { BlockWorldState blockworldstate = blockpattern$patternhelper.translateOffset(i, j, k); if (blockworldstate.getBlockState().getBlock() == Blocks.BEDROCK || blockworldstate.getBlockState().getBlock() == Blocks.END_PORTAL) { this.world.setBlockState(blockworldstate.getPos(), Blocks.END_STONE.getDefaultState()); } } } } } this.respawnState = DragonSpawnManager.START; this.respawnStateTicks = 0; this.generatePortal(false); this.crystals = crystalsIn; } }
public void resetSpikeCrystals() { for (WorldGenSpikes.EndSpike worldgenspikes$endspike : BiomeEndDecorator.getSpikesForWorld(this.world)) { for (EntityEnderCrystal entityendercrystal : this.world.getEntitiesWithinAABB(EntityEnderCrystal.class, worldgenspikes$endspike.getTopBoundingBox())) { entityendercrystal.setEntityInvulnerable(false); entityendercrystal.setBeamTarget((BlockPos)null); } } }
public void onCrystalDestroyed(EntityEnderCrystal crystal, BlockPos pos, DamageSource dmgSrc, @Nullable EntityPlayer plyr) { if (plyr != null && !plyr.capabilities.disableDamage) { this.strafePlayer(plyr); } }
/** * Updates the state of the enderdragon's current endercrystal. */ private void updateDragonEnderCrystal() { if (this.healingEnderCrystal != null) { if (this.healingEnderCrystal.isDead) { this.healingEnderCrystal = null; } else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth()) { this.setHealth(this.getHealth() + 1.0F); } } if (this.rand.nextInt(10) == 0) { List<EntityEnderCrystal> list = this.world.<EntityEnderCrystal>getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expandXyz(32.0D)); EntityEnderCrystal entityendercrystal = null; double d0 = Double.MAX_VALUE; for (EntityEnderCrystal entityendercrystal1 : list) { double d1 = entityendercrystal1.getDistanceSqToEntity(this); if (d1 < d0) { d0 = d1; entityendercrystal = entityendercrystal1; } } this.healingEnderCrystal = entityendercrystal; } }
public void onCrystalDestroyed(EntityEnderCrystal crystal, BlockPos pos, DamageSource dmgSrc, @Nullable EntityPlayer plyr) { if (plyr != null) { this.strafePlayer(plyr); } }
/** * Updates the state of the enderdragon's current endercrystal. */ private void updateDragonEnderCrystal() { if (this.healingEnderCrystal != null) { if (this.healingEnderCrystal.isDead) { this.healingEnderCrystal = null; } else if (this.ticksExisted % 10 == 0 && this.getHealth() < this.getMaxHealth()) { this.setHealth(this.getHealth() + 1.0F); } } if (this.rand.nextInt(10) == 0) { List<EntityEnderCrystal> list = this.worldObj.<EntityEnderCrystal>getEntitiesWithinAABB(EntityEnderCrystal.class, this.getEntityBoundingBox().expandXyz(32.0D)); EntityEnderCrystal entityendercrystal = null; double d0 = Double.MAX_VALUE; for (EntityEnderCrystal entityendercrystal1 : list) { double d1 = entityendercrystal1.getDistanceSqToEntity(this); if (d1 < d0) { d0 = d1; entityendercrystal = entityendercrystal1; } } this.healingEnderCrystal = entityendercrystal; } }
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { // Cauldron start - another fix for Proxy Worlds if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } // Cauldron end if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron || entity instanceof EntityThrowable || entity instanceof EntityDragon || entity instanceof EntityDragonPart || entity instanceof EntityWither || entity instanceof EntityFireball || entity instanceof EntityWeatherEffect || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworkRocket || entity instanceof EntityVillager // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false) && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false) && !entity.isCreatureType(EnumCreatureType.waterCreature, false))) { return true; } return false; }
/** * These entities are excluded from Activation range checks. * * @param entity * @param world * @return boolean If it should always tick. */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { // Cauldron start - another fix for Proxy Worlds if (config == null && DimensionManager.getWorld(0) != null) { config = DimensionManager.getWorld(0).spigotConfig; } else { return true; } // Cauldron end if ( ( entity.activationType == 3 && config.miscActivationRange == 0 ) || ( entity.activationType == 2 && config.animalActivationRange == 0 ) || ( entity.activationType == 1 && config.monsterActivationRange == 0 ) || (entity.getClass().equals(EntityPlayer.class) && !(entity.getClass().equals(FakePlayer.class))) // Cauldron || entity.getClass().equals(EntityThrowable.class) || entity.getClass().equals(EntityDragon.class) || entity.getClass().equals(EntityDragonPart.class) || entity.getClass().equals(EntityWither.class) || entity.getClass().equals(EntityFireball.class) || entity.getClass().equals(EntityWeatherEffect.class) || entity.getClass().equals(EntityTNTPrimed.class) || entity.getClass().equals(EntityFallingBlock.class) || entity.getClass().equals(EntityEnderCrystal.class) || entity.getClass().equals(EntityFireworkRocket.class) || entity.getClass().equals(EntityVillager.class) // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false) && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false) && !entity.isCreatureType(EnumCreatureType.waterCreature, false))) { return true; } return false; }
public EntityConstructionRecipe(String recipeID, NonNullList<ItemStack> inputItems, Class<? extends Entity> output, Constructor constructor) { try { posterChild = (Entity) constructor.newInstance((World) null); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { //noinspection ConstantConditions posterChild = new EntityEnderCrystal(null); e.printStackTrace(); } this.recipeID = recipeID; this.inputItems = inputItems; this.output = output; this.constructor = constructor; }