public @Nullable Entity getEntity(@Nullable World world, boolean clone) { return getEntity(world, null, null, clone); }
@Override public @Nonnull BoundingBox getBounds() { if (isSpawnMode) { if (bounds != null) { return bounds; } bounds = ISpawnerCallback.super.getBounds(); if (capturedMob != null) { Entity ent = capturedMob.getEntity(world, false); if (ent != null) { int height = Math.max((int) Math.ceil(ent.height) - 1, 0); return bounds = bounds.setMaxY(bounds.maxY + height); } } } return new BoundingBox(getPos()); }
@Override protected void updateEntityClient() { if (isActive()) { double x = getPos().getX() + world.rand.nextFloat(); double y = getPos().getY() + world.rand.nextFloat(); double z = getPos().getZ() + world.rand.nextFloat(); world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, x, y, z, 0.0D, 0.0D, 0.0D); world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0.0D, 0.0D, 0.0D); this.prevMobRotation = this.mobRotation; this.mobRotation = (this.mobRotation + 1000.0F / ((1F - getProgress()) * 800F + 200.0F)) % 360.0D; if (cachedEntity == null && hasEntity()) { cachedEntity = capturedMob.getEntity(world, pos, null, false); if (cachedEntity != null) { cachedEntity.setDead(); } } } super.updateEntityClient(); }
Entity entity = getEntity(world, pos, null, clone); if (entity == null) { return null;
@Nullable Entity createEntity(DifficultyInstance difficulty, boolean forceAlive) { CapturedMob capturedMob = spawner.getEntity(); if (capturedMob == null) { return null; } Entity ent = capturedMob.getEntity(spawner.getSpawnerWorld(), spawner.getSpawnerPos(), difficulty, false); if (ent == null) { // Entity must have been removed from this save or is otherwise missing, so revert to blank spawner spawner.resetCapturedMob(); return null; } if (forceAlive && SpawnerConfig.poweredSpawnerMaxPlayerDistance.get() <= 0 && SpawnerConfig.poweredSpawnerDespawnTimeSeconds.get() > 0 && ent instanceof EntityLiving) { ent.getEntityData().setLong(BlockPoweredSpawner.KEY_SPAWNED_BY_POWERED_SPAWNER, spawner.getSpawnerWorld().getTotalWorldTime()); ((EntityLiving) ent).enablePersistence(); } return ent; }
private void mkMobsBox(ProbeMode mode, EioBox mobbox, World world, TOPData data) { if (data.hasMobs) { if (mode != ProbeMode.NORMAL || TopConfig.showMobsByDefault.get()) { mobbox.get().text(loc("top.action.header", loc(data.mobAction))); if (data.mobs.isEmpty()) { mobbox.get().text(loc("top.action.none")); } else if (data.mobs.size() <= 4) { for (CapturedMob capturedMob : data.mobs) { mobbox.get().horizontal(mobbox.center()).entity(capturedMob.getEntity(world, false)) .text(locRaw("entity." + capturedMob.getTranslationName() + ".name")); } } else { IProbeInfo mobList = mobbox.get().horizontal(mobbox.center()); int count = 0; for (CapturedMob capturedMob : data.mobs) { if (count++ >= 4) { mobList = mobbox.get().horizontal(mobbox.center()); count = 0; } mobList.entity(capturedMob.getEntity(world, false)); } } } else { mobbox.addMore(); } } }