diff --git a/client/src/main/java/client/gui/container/GuiTile.java b/client/src/main/java/client/gui/container/GuiTile.java index 018826d..c5a0591 100755 --- a/client/src/main/java/client/gui/container/GuiTile.java +++ b/client/src/main/java/client/gui/container/GuiTile.java @@ -27,6 +27,6 @@ public class GuiTile extends GuiContainer this.drawString(this.tile.getStatus().color + this.tileInv.getCommandName() + " - " + this.tile.getStatus().name, 8, 6); this.drawString(this.playerInv.getCommandName(), 8, this.ySize - 96 + 2); this.drawString(String.format("Temperatur: %d °", this.tile.getTemperature()), 8, 18); - this.drawString(this.tile.formatDisplay((ContainerTile)this.inventorySlots), 8, 28); + this.drawString(this.tile.formatDisplay(), 8, 28); } } diff --git a/client/src/main/java/client/network/ClientLoginHandler.java b/client/src/main/java/client/network/ClientLoginHandler.java index 2721d05..0509522 100755 --- a/client/src/main/java/client/network/ClientLoginHandler.java +++ b/client/src/main/java/client/network/ClientLoginHandler.java @@ -168,8 +168,8 @@ public class ClientLoginHandler implements IClientLoginHandler { this.connection.closeChannel("Der Server unterstützt keine der vorhandenen\nAuthentifizierungsmethoden\n\nUnterstützt vom Server: " + (!passwordAuth && !pubkeyAuth ? "Keine" : ((passwordAuth ? "Passwort" : "") + (passwordAuth && pubkeyAuth ? " und " : "") + (pubkeyAuth ? "Pubkey" : ""))) + "\n\nVorhanden in Konfiguration für '" + this.server.getName() + "': " + (this.server.getPassword().isEmpty() && this.server.getKeypair() == null ? "Keine" : - ((!this.server.getPassword().isEmpty() ? "Passwort" : "") + - (!this.server.getPassword().isEmpty() && this.server.getKeypair() != null ? " und " : "") + (this.server.getKeypair() != null ? "Pubkey" : "")))); + ((this.server.getPassword().isEmpty() ? "Passwort" : "") + + (this.server.getPassword().isEmpty() && this.server.getKeypair() != null ? " und " : "") + (this.server.getKeypair() != null ? "Pubkey" : "")))); return; } if(auth && pubkeyAuth && this.server.getKeypair() != null) { diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java b/client/src/main/java/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java new file mode 100755 index 0000000..ae555c7 --- /dev/null +++ b/client/src/main/java/client/renderer/tileentity/TileEntityMobSpawnerRenderer.java @@ -0,0 +1,38 @@ +package client.renderer.tileentity; + +import org.lwjgl.opengl.GL11; + +import client.Client; +import common.entity.Entity; +import common.tileentity.TileEntityMobSpawner; + +public class TileEntityMobSpawnerRenderer extends TileEntitySpecialRenderer +{ + public void renderTileEntityAt(TileEntityMobSpawner te, double x, double y, double z, float partialTicks, int destroyStage) + { + GL11.glPushMatrix(); + GL11.glTranslatef((float)x + 0.5F, (float)y, (float)z + 0.5F); + renderMob(te, x, y, z, partialTicks); + GL11.glPopMatrix(); + } + + /** + * Render the mob inside the mob spawner. + */ + public static void renderMob(TileEntityMobSpawner mobSpawnerLogic, double posX, double posY, double posZ, float partialTicks) + { + Entity entity = mobSpawnerLogic.createRenderEntity(mobSpawnerLogic.getWorld()); + + if (entity != null) + { + float f = 0.4375F; + GL11.glTranslatef(0.0F, 0.4F, 0.0F); + GL11.glRotatef((float)(mobSpawnerLogic.getPrevMobRotation() + (mobSpawnerLogic.getMobRotation() - mobSpawnerLogic.getPrevMobRotation()) * (double)partialTicks) * 10.0F, 0.0F, 1.0F, 0.0F); + GL11.glRotatef(-30.0F, 1.0F, 0.0F, 0.0F); + GL11.glTranslatef(0.0F, -0.4F, 0.0F); + GL11.glScalef(f, f, f); + entity.setLocationAndAngles(posX, posY, posZ, 0.0F, 0.0F); + Client.CLIENT.getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, partialTicks); + } + } +} diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityRendererDispatcher.java b/client/src/main/java/client/renderer/tileentity/TileEntityRendererDispatcher.java index 88572fc..149cb2b 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntityRendererDispatcher.java +++ b/client/src/main/java/client/renderer/tileentity/TileEntityRendererDispatcher.java @@ -11,6 +11,7 @@ import common.entity.Entity; import common.tileentity.TileEntity; import common.tileentity.TileEntityBanner; import common.tileentity.TileEntityChest; +import common.tileentity.TileEntityMobSpawner; import common.tileentity.TileEntityPiston; import common.tileentity.TileEntitySign; import common.util.BlockPos; @@ -46,6 +47,7 @@ public class TileEntityRendererDispatcher private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); + this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityPistonRenderer()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index dbfdf90..00a3a76 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -695,6 +695,18 @@ public class WorldClient extends AWorldClient this.playSoundAtPos(blockPosIn, SoundEvent.GLASS, 1.0F); break; + case 2004: + for (int k = 0; k < 20; ++k) + { + double d3 = (double)blockPosIn.getX() + 0.5D + ((double)this.rand.floatv() - 0.5D) * 2.0D; + double d5 = (double)blockPosIn.getY() + 0.5D + ((double)this.rand.floatv() - 0.5D) * 2.0D; + double d7 = (double)blockPosIn.getZ() + 0.5D + ((double)this.rand.floatv() - 0.5D) * 2.0D; + this.spawnParticle(ParticleType.SMOKE_NORMAL, d3, d5, d7, 0.0D, 0.0D, 0.0D); + this.spawnParticle(ParticleType.FLAME, d3, d5, d7, 0.0D, 0.0D, 0.0D); + } + + return; + case 2005: ItemDye.spawnBonemealParticles(this, blockPosIn, data); } diff --git a/client/src/main/resources/textures/blocks/mob_spawner.png b/client/src/main/resources/textures/blocks/mob_spawner.png index c248eec..7d55217 100755 Binary files a/client/src/main/resources/textures/blocks/mob_spawner.png and b/client/src/main/resources/textures/blocks/mob_spawner.png differ diff --git a/common/src/main/java/common/block/tech/BlockMobSpawner.java b/common/src/main/java/common/block/tech/BlockMobSpawner.java index 12399c6..4a46f35 100755 --- a/common/src/main/java/common/block/tech/BlockMobSpawner.java +++ b/common/src/main/java/common/block/tech/BlockMobSpawner.java @@ -1,11 +1,91 @@ package common.block.tech; +import common.block.BlockContainer; +import common.block.Material; +import common.item.CheatTab; +import common.item.Item; +import common.model.BlockLayer; +import common.rng.Random; import common.tileentity.TileEntity; import common.tileentity.TileEntityMobSpawner; +import common.util.BlockPos; +import common.world.State; import common.world.World; -public class BlockMobSpawner extends BlockMachine { - public TileEntity createNewTileEntity(World world) { - return new TileEntityMobSpawner(); - } +public class BlockMobSpawner extends BlockContainer +{ + public BlockMobSpawner() + { + super(Material.SOLID); + this.setTab(CheatTab.TECHNOLOGY); + } + + /** + * Returns a new instance of a block's tile entity class. Called on placing the block. + */ + public TileEntity createNewTileEntity(World worldIn) + { + return new TileEntityMobSpawner(); + } + + /** + * Get the Item that this Block should drop when harvested. + */ + public Item getItemDropped(State state, Random rand, int fortune) + { + return null; + } + + /** + * Returns the quantity of items to drop on block destruction. + */ + public int quantityDropped(Random random) + { + return 0; + } + + /** + * Spawns this Block's drops into the World as EntityItems. + */ + public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + { + super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + int i = worldIn.rand.rangeBonus(15, 29, 14); + this.dropXpOnBlockBreak(worldIn, pos, i); + } + + /** + * Used to determine ambient occlusion and culling when rebuilding chunks for render + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render + */ + public int getRenderType() + { + return 3; + } + + public BlockLayer getBlockLayer() + { + return BlockLayer.CUTOUT; + } + + public Item getItem(World worldIn, BlockPos pos) + { + return null; + } + + public boolean isXrayVisible() + { + return true; + } + + public boolean isMagnetic() { + return true; + } } diff --git a/common/src/main/java/common/block/tech/BlockTianReactor.java b/common/src/main/java/common/block/tech/BlockTianReactor.java index 9d3ae88..0ba0921 100755 --- a/common/src/main/java/common/block/tech/BlockTianReactor.java +++ b/common/src/main/java/common/block/tech/BlockTianReactor.java @@ -11,7 +11,7 @@ import common.world.State; import common.world.World; public class BlockTianReactor extends BlockMachine { - public TileEntity createNewTileEntity(World world) { + public TileEntity createNewTileEntity(World worldIn) { return new TileEntityTianReactor(); } diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index abb3594..67196f2 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -610,7 +610,7 @@ public abstract class BlockRegistry { registerBlock(2000, "core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) .setDisplay("Chunk-Lade-Kern")); registerBlock(2001, "mob_spawner", - (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Mob-Spawner")); + (new BlockMobSpawner()).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Monsterspawner")); registerBlock(2002, "workbench", (new BlockWorkbench(3)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank")); registerBlock(2003, "furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen") .setTab(CheatTab.TECHNOLOGY)); diff --git a/common/src/main/java/common/init/DispenserRegistry.java b/common/src/main/java/common/init/DispenserRegistry.java index db74a2a..ede321e 100755 --- a/common/src/main/java/common/init/DispenserRegistry.java +++ b/common/src/main/java/common/init/DispenserRegistry.java @@ -138,7 +138,7 @@ public abstract class DispenserRegistry { double d1 = (double)((float)source.getBlockPos().getY() + 0.2F); double d2 = source.getZ() + (double)enumfacing.getFrontOffsetZ(); Entity entity = ItemMonsterPlacer.spawnCreature(source.getWorld(), ((ItemMonsterPlacer)stack.getItem()).getSpawnedId(), - d0, d1, d2, false); + d0, d1, d2); if (entity instanceof EntityLiving && stack.hasDisplayName()) { diff --git a/common/src/main/java/common/init/TileRegistry.java b/common/src/main/java/common/init/TileRegistry.java index 4ebcac4..0435bd3 100755 --- a/common/src/main/java/common/init/TileRegistry.java +++ b/common/src/main/java/common/init/TileRegistry.java @@ -41,6 +41,7 @@ public abstract class TileRegistry { addMapping(TileEntityDispenser.class, "Trap"); addMapping(TileEntityDropper.class, "Dropper"); addMapping(TileEntitySign.class, "Sign"); + addMapping(TileEntityMobSpawner.class, "MobSpawner"); addMapping(TileEntityPiston.class, "Piston"); addMapping(TileEntityBrewingStand.class, "Cauldron"); addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); @@ -50,6 +51,5 @@ public abstract class TileRegistry { addMapping(TileEntityComparator.class, "Comparator"); addMapping(TileEntityBanner.class, "Banner"); addMapping(TileEntityTianReactor.class, "TianReactor"); - addMapping(TileEntityMobSpawner.class, "MobSpawner"); } } diff --git a/common/src/main/java/common/inventory/ContainerTile.java b/common/src/main/java/common/inventory/ContainerTile.java index e697fff..ff7169a 100755 --- a/common/src/main/java/common/inventory/ContainerTile.java +++ b/common/src/main/java/common/inventory/ContainerTile.java @@ -99,11 +99,7 @@ public class ContainerTile extends Container public void onCraftGuiOpened(ICrafting listener) { super.onCraftGuiOpened(listener); - listener.sendProgressBarUpdate(this, this.resources.length, this.tile.getTemperature()); - listener.sendProgressBarUpdate(this, this.resources.length + 1, this.tile.getStatus().ordinal()); - for(int z = 0; z < this.resources.length; z++) { - listener.sendProgressBarUpdate(this, z, this.tile.getResource(z).getValue()); - } +// listener.sendAllWindowProperties(this, this.machine); } public void updateProgressBar(int id, int data) @@ -122,14 +118,14 @@ public class ContainerTile extends Container for (int i = 0; i < this.crafters.size(); ++i) { - ICrafting listener = this.crafters.get(i); + ICrafting icrafting = (ICrafting)this.crafters.get(i); if(this.temperature != this.tile.getTemperature()) - listener.sendProgressBarUpdate(this, this.resources.length, this.tile.getTemperature()); + icrafting.sendProgressBarUpdate(this, this.resources.length, this.tile.getTemperature()); if(this.status != this.tile.getStatus()) - listener.sendProgressBarUpdate(this, this.resources.length + 1, this.tile.getStatus().ordinal()); + icrafting.sendProgressBarUpdate(this, this.resources.length + 1, this.tile.getStatus().ordinal()); for(int z = 0; z < this.resources.length; z++) { if(this.resources[z] != this.tile.getResource(z).getValue()) - listener.sendProgressBarUpdate(this, z, this.tile.getResource(z).getValue()); + icrafting.sendProgressBarUpdate(this, z, this.tile.getResource(z).getValue()); } } diff --git a/common/src/main/java/common/item/ItemMonsterPlacer.java b/common/src/main/java/common/item/ItemMonsterPlacer.java index c7faf25..9747a18 100755 --- a/common/src/main/java/common/item/ItemMonsterPlacer.java +++ b/common/src/main/java/common/item/ItemMonsterPlacer.java @@ -9,11 +9,14 @@ import common.dimension.Dimension; import common.entity.Entity; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; +import common.init.Blocks; import common.init.EntityInfo; import common.init.EntityRegistry; import common.init.UniverseRegistry; import common.model.Model; import common.model.ModelProvider; +import common.tileentity.TileEntity; +import common.tileentity.TileEntityMobSpawner; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; @@ -80,6 +83,26 @@ public class ItemMonsterPlacer extends Item { State iblockstate = worldIn.getState(pos); + if (iblockstate.getBlock() == Blocks.mob_spawner) + { + TileEntity tileentity = worldIn.getTileEntity(pos); + + if (tileentity instanceof TileEntityMobSpawner) + { +// MobSpawnerBaseLogic mobspawnerbaselogic = ((TileEntityMobSpawner)tileentity).getSpawnerBaseLogic(); + ((TileEntityMobSpawner)tileentity).setEntityName(this.entityId); + tileentity.markDirty(); + worldIn.markBlockForUpdate(pos); + +// if (!playerIn.creative) +// { + --stack.size; +// } + + return true; + } + } + pos = pos.offset(side); double d0 = 0.0D; @@ -91,7 +114,7 @@ public class ItemMonsterPlacer extends Item // int amount = Math.min(stack.stackSize, 128); // for(int z = 0; z < amount; z++) { - Entity entity = spawnCreature(worldIn, this.entityId, (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D, false); + Entity entity = spawnCreature(worldIn, this.entityId, (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); if (entity != null) { @@ -153,7 +176,7 @@ public class ItemMonsterPlacer extends Item { // int amount = Math.min(itemStackIn.stackSize, 128); // for(int z = 0; z < amount; z++) { - Entity entity = spawnCreature(worldIn, this.entityId, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D, false); + Entity entity = spawnCreature(worldIn, this.entityId, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); if (entity != null) { @@ -184,21 +207,38 @@ public class ItemMonsterPlacer extends Item } } - public static EntityLiving spawnCreature(World worldIn, String entityID, double x, double y, double z, boolean check) { + /** + * Spawns the creature specified by the egg's type in the location specified by the last three parameters. + * Parameters: world, entityID, x, y, z. + */ + public static Entity spawnCreature(World worldIn, String entityID, double x, double y, double z) + { if (!EntityRegistry.SPAWN_EGGS.containsKey(entityID)) + { return null; - Entity entity = EntityRegistry.createEntityByName(entityID, worldIn); - if(!(entity instanceof EntityLiving living)) - return null; - living.setLocationAndAngles(x, y, z, ExtMath.wrapf(worldIn.rand.floatv() * 360.0F), 0.0F); - if(check && !living.isNotColliding()) - return null; - living.headYaw = living.rotYaw; - living.yawOffset = living.rotYaw; - living.onInitialSpawn(null); - worldIn.spawnEntityInWorld(living); - living.playLivingSound(); - return living; + } + else + { + Entity entity = null; + + for (int i = 0; i < 1; ++i) + { + entity = EntityRegistry.createEntityByName(entityID, worldIn); + + if (entity instanceof EntityLiving) + { + EntityLiving entityliving = (EntityLiving)entity; + entity.setLocationAndAngles(x, y, z, ExtMath.wrapf(worldIn.rand.floatv() * 360.0F), 0.0F); + entityliving.headYaw = entityliving.rotYaw; + entityliving.yawOffset = entityliving.rotYaw; + entityliving.onInitialSpawn(null); + worldIn.spawnEntityInWorld(entity); + entityliving.playLivingSound(); + } + } + + return entity; + } } // /** diff --git a/common/src/main/java/common/item/ItemNpcSpawner.java b/common/src/main/java/common/item/ItemNpcSpawner.java index edc04b2..a586fa8 100755 --- a/common/src/main/java/common/item/ItemNpcSpawner.java +++ b/common/src/main/java/common/item/ItemNpcSpawner.java @@ -33,25 +33,16 @@ public class ItemNpcSpawner extends Item this.setTab(CheatTab.SPAWNERS); this.spawned = spawned; } - - public CharacterInfo getSpawnedChar() { - return this.spawned; - } - - public String getCharName() { - CharacterInfo info = this.spawned; // SpeciesRegistry.CHARACTERS.get(stack.getMetadata() % SpeciesRegistry.CHARACTERS.size()); - String species = EntityRegistry.getEntityName(info.species.id); - if(info.species.prefix && info.type != null && !info.type.toString().isEmpty()) - species = info.type.toString(); - String character = info.name; - return species + (character.isEmpty() ? "" : (" " + character)); - } public String getDisplay(ItemStack stack) { String item = "Erschaffe"; - - item = item + " " + this.getCharName(); + CharacterInfo info = this.spawned; // SpeciesRegistry.CHARACTERS.get(stack.getMetadata() % SpeciesRegistry.CHARACTERS.size()); + String species = EntityRegistry.getEntityName(info.species.id); + if(info.species.prefix && info.type != null && !info.type.toString().isEmpty()) + species = info.type.toString(); + String character = info.name; + item = item + " " + species + (character.isEmpty() ? "" : (" " + character)); return item; } @@ -90,7 +81,7 @@ public class ItemNpcSpawner extends Item // int amount = Math.min(stack.stackSize, 128); // for(int z = 0; z < amount; z++) { - Entity entity = spawnNpc(worldIn, this.spawned, (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D, false); + Entity entity = spawnNpc(worldIn, this.spawned, (double)pos.getX() + 0.5D, (double)pos.getY() + d0, (double)pos.getZ() + 0.5D); if (entity != null) { @@ -144,7 +135,7 @@ public class ItemNpcSpawner extends Item { // int amount = Math.min(itemStackIn.stackSize, 128); // for(int z = 0; z < amount; z++) { - Entity entity = spawnNpc(worldIn, this.spawned, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D, false); + Entity entity = spawnNpc(worldIn, this.spawned, (double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D); if (entity != null) { @@ -170,8 +161,9 @@ public class ItemNpcSpawner extends Item } } - public static EntityNPC spawnNpc(World worldIn, CharacterInfo character, double x, double y, double z, boolean check) + public static Entity spawnNpc(World worldIn, CharacterInfo character, double x, double y, double z) { +// CharacterInfo character = SpeciesRegistry.CHARACTERS.get(entityID % SpeciesRegistry.CHARACTERS.size()); EntityNPC entity; try { entity = character.species.clazz.getConstructor(World.class).newInstance(worldIn); @@ -180,11 +172,10 @@ public class ItemNpcSpawner extends Item throw new RuntimeException(e); } entity.setLocationAndAngles(x, y, z, ExtMath.wrapf(worldIn.rand.floatv() * 360.0F), 0.0F); - if(check && !entity.isNotColliding()) - return null; entity.headYaw = entity.rotYaw; entity.yawOffset = entity.rotYaw; entity.onInitialSpawn(new CharacterTypeData(character)); +// entity.setFromInfo(character); worldIn.spawnEntityInWorld(entity); return entity; } diff --git a/common/src/main/java/common/tileentity/TileEntityDevice.java b/common/src/main/java/common/tileentity/TileEntityDevice.java index 40d1c1a..3b48d6b 100755 --- a/common/src/main/java/common/tileentity/TileEntityDevice.java +++ b/common/src/main/java/common/tileentity/TileEntityDevice.java @@ -42,18 +42,9 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo this.resources = resources; } - protected int getTempIncrement() { - return -1; - } - - protected int getTempDecrement() { - return -1; - } - - protected int getMaxTemp() { - return Integer.MAX_VALUE; - } - + protected abstract int getTempIncrement(); + protected abstract int getTempDecrement(); + protected abstract int getMaxTemp(); protected abstract boolean executeFunction(); public MachineResource getResource(int slot) { @@ -212,10 +203,7 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo if(this.worldObj != null && !this.worldObj.client && this.status != Status.BROKEN) { int envTemp = (int)this.worldObj.getTemperatureC(this.getPos()); if(this.executeFunction()) { - if(this.getTempIncrement() < 0) - this.temperature = envTemp; - else - this.temperature += this.getTempIncrement(); + this.temperature += this.getTempIncrement(); this.status = this.temperature >= (this.getMaxTemp() * 9) / 10 ? Status.OVERHEAT : Status.RUNNING; if(this.temperature > this.getMaxTemp()) { this.status = Status.BROKEN; @@ -231,10 +219,7 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo int dec = this.getTempDecrement(); if(dec != 0) { int prev = this.temperature; - if(dec < 0) - this.temperature = envTemp; - else - this.temperature -= dec; + this.temperature -= dec; this.temperature = ExtMath.clampi(this.temperature, envTemp, Integer.MAX_VALUE); if(prev != this.temperature) this.markDirty(); @@ -333,5 +318,5 @@ public abstract class TileEntityDevice extends TileEntityLockable implements IHo return 0x8080ff; } - public abstract String formatDisplay(ContainerTile inv); + public abstract String formatDisplay(); } diff --git a/common/src/main/java/common/tileentity/TileEntityMobSpawner.java b/common/src/main/java/common/tileentity/TileEntityMobSpawner.java index 89ff3d4..1b7591a 100755 --- a/common/src/main/java/common/tileentity/TileEntityMobSpawner.java +++ b/common/src/main/java/common/tileentity/TileEntityMobSpawner.java @@ -1,70 +1,150 @@ package common.tileentity; +import common.entity.Entity; import common.entity.types.EntityLiving; +import common.init.Blocks; import common.init.EntityRegistry; -import common.inventory.ContainerTile; -import common.item.ItemMonsterPlacer; -import common.item.ItemNpcSpawner; -import common.item.ItemStack; +import common.model.ParticleType; +import common.network.Packet; +import common.packet.SPacketUpdateTileEntity; import common.tags.TagObject; +import common.util.BlockPos; +import common.util.BoundingBox; import common.vars.Vars; +import common.world.World; -public class TileEntityMobSpawner extends TileEntityDevice implements ITickable +public class TileEntityMobSpawner extends TileEntity implements ITickable { - public TileEntityMobSpawner() { - super(1); - } - - private int spawnDelay = 20; + private int spawnDelay = 20; + private String mobID = "Pig"; + private double mobRotation; + private double prevMobRotation; private int minSpawnDelay = 200; private int maxSpawnDelay = 800; + private int spawnCount = 4; + private Entity cachedEntity; + private int maxNearbyEntities = 6; + private int activatingRangeFromPlayer = 16; private int spawnRange = 4; - - public boolean isItemValidForSlot(int index, ItemStack stack) { - return index == 0 ? stack.getItem() instanceof ItemMonsterPlacer || stack.getItem() instanceof ItemNpcSpawner : false; - } - - public String getName() { - return "Mob-Spawner"; - } - - public String getGuiID() { - return "mob_spawner"; - } - - public String formatDisplay(ContainerTile inv) { - ItemStack stack = inv.getSlot(0).getStack(); - if(stack == null) - return "Kein Spawner vorhanden"; - return String.format("Erschaffe: %s", stack.getItem() instanceof ItemMonsterPlacer egg ? EntityRegistry.getEntityName(egg.getSpawnedId()) : ((stack.getItem() instanceof ItemNpcSpawner egg ? egg.getCharName() : ""))); - } - protected boolean executeFunction() { - if(!Vars.mobs || !Vars.spawners || !this.hasAmount(0, 1)) - return false; - if (this.spawnDelay == -1) - this.resetTimer(); - if (this.spawnDelay > 0) { - --this.spawnDelay; + public Packet getDescriptionPacket() + { + return new SPacketUpdateTileEntity(this); + } + + public boolean receiveClientEvent(int id, int type) + { + if (id == 1 && this.worldObj.client) + { + this.spawnDelay = this.minSpawnDelay; return true; } - ItemStack stack = this.getStackInSlot(0); - if(stack == null) - return true; - double x = (double)this.pos.getX() + (this.worldObj.rand.doublev() - this.worldObj.rand.doublev()) * (double)this.spawnRange + 0.5D; - double y = (double)(this.pos.getY() + this.worldObj.rand.zrange(3) - 1); - double z = (double)this.pos.getZ() + (this.worldObj.rand.doublev() - this.worldObj.rand.doublev()) * (double)this.spawnRange + 0.5D; - EntityLiving entity = null; - if(stack.getItem() instanceof ItemMonsterPlacer egg) - entity = ItemMonsterPlacer.spawnCreature(this.worldObj, egg.getSpawnedId(), x, y, z, true); - else if(stack.getItem() instanceof ItemNpcSpawner egg) - entity = ItemNpcSpawner.spawnNpc(this.worldObj, egg.getSpawnedChar(), x, y, z, true); - if (entity == null) - return true; - this.decrStackSize(0, 1); - entity.spawnExplosionParticle(); - this.resetTimer(); - return true; + else + { + return super.receiveClientEvent(id, type); + } + } + +// public boolean hasSpecialNBT() +// { +// return true; +// } + + public int getColor() { + return 0xff0000; + } + + public void update() + { + BlockPos blockpos = this.pos; + if (this.worldObj.isAnyPlayerWithinRangeAt((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D, (double)this.activatingRangeFromPlayer)) + { + if (this.worldObj.client) + { + double d3 = (double)((float)blockpos.getX() + this.worldObj.rand.floatv()); + double d4 = (double)((float)blockpos.getY() + this.worldObj.rand.floatv()); + double d5 = (double)((float)blockpos.getZ() + this.worldObj.rand.floatv()); + this.worldObj.spawnParticle(ParticleType.SMOKE_NORMAL, d3, d4, d5, 0.0D, 0.0D, 0.0D); + this.worldObj.spawnParticle(ParticleType.FLAME, d3, d4, d5, 0.0D, 0.0D, 0.0D); + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + } + + this.prevMobRotation = this.mobRotation; + this.mobRotation = (this.mobRotation + (double)(1000.0F / ((float)this.spawnDelay + 200.0F))) % 360.0D; + } + else + { + if(!Vars.mobs || !Vars.spawners) { + return; + } + + if (this.spawnDelay == -1) + { + this.resetTimer(); + } + + if (this.spawnDelay > 0) + { + --this.spawnDelay; + return; + } + + boolean flag = false; + + for (int i = 0; i < this.spawnCount; ++i) + { + Entity entity = EntityRegistry.createEntityByName(this.mobID, this.worldObj); + + if (entity == null) + { + return; + } + + int j = this.worldObj.getEntitiesWithinAABB(entity.getClass(), (new BoundingBox((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ(), (double)(blockpos.getX() + 1), (double)(blockpos.getY() + 1), (double)(blockpos.getZ() + 1))).expand((double)this.spawnRange, (double)this.spawnRange, (double)this.spawnRange)).size(); + + if (j >= this.maxNearbyEntities) + { + this.resetTimer(); + return; + } + + double d0 = (double)blockpos.getX() + (this.worldObj.rand.doublev() - this.worldObj.rand.doublev()) * (double)this.spawnRange + 0.5D; + double d1 = (double)(blockpos.getY() + this.worldObj.rand.zrange(3) - 1); + double d2 = (double)blockpos.getZ() + (this.worldObj.rand.doublev() - this.worldObj.rand.doublev()) * (double)this.spawnRange + 0.5D; + EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving)entity : null; + entity.setLocationAndAngles(d0, d1, d2, this.worldObj.rand.floatv() * 360.0F, 0.0F); + + if (entityliving == null || entityliving.getCanSpawnHere() && entityliving.isNotColliding()) + { + if (entity instanceof EntityLiving && entity.worldObj != null) + { +// if (entity instanceof EntityLiving) +// { + ((EntityLiving)entity).onInitialSpawn(null); +// } + + entity.worldObj.spawnEntityInWorld(entity); + } + this.worldObj.playAuxSFX(2004, blockpos, 0); + + if (entityliving != null) + { + entityliving.spawnExplosionParticle(); + } + + flag = true; + } + } + + if (flag) + { + this.resetTimer(); + } + } + } } private void resetTimer() @@ -78,31 +158,86 @@ public class TileEntityMobSpawner extends TileEntityDevice implements ITickable int i = this.maxSpawnDelay - this.minSpawnDelay; this.spawnDelay = this.minSpawnDelay + this.worldObj.rand.zrange(i); } + + this.worldObj.addBlockEvent(TileEntityMobSpawner.this.pos, Blocks.mob_spawner, 1, 0); } public void readTags(TagObject nbt) { super.readTags(nbt); + this.mobID = nbt.getString("EntityId"); this.spawnDelay = nbt.getShort("Delay"); if (nbt.hasShort("MinSpawnDelay")) { this.minSpawnDelay = nbt.getShort("MinSpawnDelay"); this.maxSpawnDelay = nbt.getShort("MaxSpawnDelay"); + this.spawnCount = nbt.getShort("SpawnCount"); + } + + if (nbt.hasShort("MaxNearbyEntities")) + { + this.maxNearbyEntities = nbt.getShort("MaxNearbyEntities"); + this.activatingRangeFromPlayer = nbt.getShort("RequiredPlayerRange"); } if (nbt.hasShort("SpawnRange")) { this.spawnRange = nbt.getShort("SpawnRange"); } + + if (this.worldObj != null) + { + this.cachedEntity = null; + } } public void writeTags(TagObject nbt) { super.writeTags(nbt); - nbt.setShort("Delay", (short)this.spawnDelay); - nbt.setShort("MinSpawnDelay", (short)this.minSpawnDelay); - nbt.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay); - nbt.setShort("SpawnRange", (short)this.spawnRange); + String s = this.mobID; + + if (s != null && !s.isEmpty()) + { + nbt.setString("EntityId", s); + nbt.setShort("Delay", (short)this.spawnDelay); + nbt.setShort("MinSpawnDelay", (short)this.minSpawnDelay); + nbt.setShort("MaxSpawnDelay", (short)this.maxSpawnDelay); + nbt.setShort("SpawnCount", (short)this.spawnCount); + nbt.setShort("MaxNearbyEntities", (short)this.maxNearbyEntities); + nbt.setShort("RequiredPlayerRange", (short)this.activatingRangeFromPlayer); + nbt.setShort("SpawnRange", (short)this.spawnRange); + } + } + + public Entity createRenderEntity(World worldIn) + { + if (this.cachedEntity == null) + { + this.cachedEntity = EntityRegistry.createEntityByName(this.mobID, worldIn); + +// if (entity != null) +// { +//// entity = this.spawnNewEntity(entity, false); +// this.cachedEntity = entity; +// } + } + + return this.cachedEntity; + } + + public double getMobRotation() + { + return this.mobRotation; + } + + public double getPrevMobRotation() + { + return this.prevMobRotation; + } + + public void setEntityName(String name) + { + this.mobID = name; } } diff --git a/common/src/main/java/common/tileentity/TileEntityTianReactor.java b/common/src/main/java/common/tileentity/TileEntityTianReactor.java index f276bde..17b8703 100755 --- a/common/src/main/java/common/tileentity/TileEntityTianReactor.java +++ b/common/src/main/java/common/tileentity/TileEntityTianReactor.java @@ -3,7 +3,6 @@ package common.tileentity; import common.init.Blocks; import common.init.ItemRegistry; import common.init.Items; -import common.inventory.ContainerTile; import common.item.ItemStack; import common.tileentity.MachineResource.Type; @@ -47,7 +46,7 @@ public class TileEntityTianReactor extends TileEntityDevice { return "tian_reactor"; } - public String formatDisplay(ContainerTile inv) { + public String formatDisplay() { return String.format("Gespeicherte Energie: %d TF", this.getResource(0).getValue()); } diff --git a/server/src/main/java/server/vars/SVars.java b/server/src/main/java/server/vars/SVars.java index 7d5a0f2..50518ba 100644 --- a/server/src/main/java/server/vars/SVars.java +++ b/server/src/main/java/server/vars/SVars.java @@ -11,13 +11,7 @@ public abstract class SVars extends Vars { @Var(name = "spawnVillagers") public static boolean spawnVillager = true; @Var(name = "spawnCagedVillagers") - public static boolean spawnCageMobs = true; - @Var(name = "spawnBridgeMages") - public static boolean spawnBridgeMobs = true; - @Var(name = "spawnMineshaftArachnoids") - public static boolean spawnMineshaftMobs = true; - @Var(name = "spawnStrongholdHaunters") - public static boolean spawnStrongholdMobs = true; + public static boolean spawnCagedVillager = true; @Var(name = "spawnHutMages") public static boolean spawnHutMage = true; @Var(name = "daylightCycle") @@ -88,8 +82,6 @@ public abstract class SVars extends Vars { public static int minPassLength = 8; @Var(name = "port", min = 1024, max = 32767, nonDefault = true) public static int port = -1; - @Var(name = "spawnDungeonMobs") - public static int spawnDungeonMobs = 4; @Var(name = "gravity") public static float gravity = 1.0f; diff --git a/server/src/main/java/server/world/Converter.java b/server/src/main/java/server/world/Converter.java index 7b7bc10..b6b79cb 100644 --- a/server/src/main/java/server/world/Converter.java +++ b/server/src/main/java/server/world/Converter.java @@ -78,6 +78,7 @@ import common.tileentity.TileEntityDropper; import common.tileentity.TileEntityEnchantmentTable; import common.tileentity.TileEntityFurnace; import common.tileentity.TileEntityHopper; +import common.tileentity.TileEntityMobSpawner; import common.tileentity.TileEntitySign; import common.util.Facing; import common.util.NibbleArray; @@ -342,6 +343,7 @@ public abstract class Converter { mapTile(TileEntityDispenser.class, "Trap", "dispenser"); mapTile(TileEntityDropper.class, "Dropper", "dropper"); mapTile(TileEntitySign.class, "Sign", "sign"); + mapTile(TileEntityMobSpawner.class, "MobSpawner", "mob_spawner"); // mapTile(TileEntityPiston.class, "Piston", "piston"); mapTile(TileEntityEnchantmentTable.class, "EnchantTable", "enchanting_table"); mapTile(TileEntityBeacon.class, "Beacon", "beacon"); @@ -574,7 +576,7 @@ public abstract class Converter { return Blocks.fire.getState().withProperty(BlockFire.AGE, data); } }, 51); - mapBlock(Blocks.iron_bars, 52); + mapBlock(Blocks.mob_spawner, 52); mapBlockData(Blocks.oak_stairs, 53); mapBlockData(Blocks.chest, 54); mapBlockData(Blocks.redstone, 55); diff --git a/server/src/main/java/server/worldgen/FeatureDungeons.java b/server/src/main/java/server/worldgen/FeatureDungeons.java index 719f09b..9eeb4e3 100755 --- a/server/src/main/java/server/worldgen/FeatureDungeons.java +++ b/server/src/main/java/server/worldgen/FeatureDungeons.java @@ -1,28 +1,22 @@ package server.worldgen; -import java.lang.reflect.InvocationTargetException; - import common.block.Material; -import common.entity.npc.EntityArachnoid; -import common.entity.npc.EntityUndead; -import common.entity.npc.EntityZombie; -import common.entity.types.EntityLiving; import common.init.Blocks; import common.init.Items; import common.item.RngLoot; +import common.log.Log; import common.rng.Random; import common.rng.WeightedList; import common.tileentity.TileEntity; import common.tileentity.TileEntityChest; +import common.tileentity.TileEntityMobSpawner; import common.util.BlockPos; import common.util.Facing; -import common.world.World; -import server.vars.SVars; import server.world.WorldServer; public class FeatureDungeons { - private static final Class[] MOB_TYPES = new Class[] {EntityUndead.class, EntityZombie.class, EntityZombie.class, EntityArachnoid.class}; + private static final String[] SPAWNERTYPES = new String[] {"Undead", "Zombie", "Zombie", "Arachnoid"}; private final int chance; @@ -154,15 +148,16 @@ public class FeatureDungeons } } - if(SVars.mobs && SVars.spawnDungeonMobs > 0) { - for(int z = 0; z < SVars.spawnDungeonMobs; z++) { - EntityLiving entity = this.pickMobSpawner(rand, worldIn); - entity.setLocationAndAngles((double)position.getX() + rand.doublev(), (double)position.getY(), (double)position.getZ() + rand.doublev(), worldIn.rand.floatv() * 360.0F, 0.0F); - entity.onInitialSpawn(null); - worldIn.spawnEntityInWorld(entity); - if(rand.chance(5)) - break; - } + worldIn.setState(position, Blocks.mob_spawner.getState(), 2); + TileEntity tileentity = worldIn.getTileEntity(position); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).setEntityName(this.pickMobSpawner(rand)); + } + else + { + Log.TICK.warn("Konnte kein Mob-Spawner-Objekt bei (" + position.getX() + ", " + position.getY() + ", " + position.getZ() + ") erstellen"); } return true; @@ -173,13 +168,11 @@ public class FeatureDungeons } } - private EntityLiving pickMobSpawner(Random rand, WorldServer world) + /** + * Randomly decides which spawner to use in a dungeon + */ + private String pickMobSpawner(Random p_76543_1_) { - try { - return rand.pick(MOB_TYPES).getConstructor(World.class).newInstance(world); - } - catch(InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { - throw new RuntimeException(e); - } + return SPAWNERTYPES[p_76543_1_.zrange(SPAWNERTYPES.length)]; } } diff --git a/server/src/main/java/server/worldgen/structure/StructureBridge.java b/server/src/main/java/server/worldgen/structure/StructureBridge.java index 42ccbd3..8af531e 100755 --- a/server/src/main/java/server/worldgen/structure/StructureBridge.java +++ b/server/src/main/java/server/worldgen/structure/StructureBridge.java @@ -3,13 +3,13 @@ package server.worldgen.structure; import java.util.List; import common.collect.Lists; -import common.entity.npc.EntityDarkMage; import common.init.Blocks; import common.rng.Random; import common.tags.TagObject; +import common.tileentity.TileEntity; +import common.tileentity.TileEntityMobSpawner; import common.util.BlockPos; import common.util.Facing; -import server.vars.SVars; import server.world.WorldServer; import server.worldgen.LootConstants; @@ -1364,17 +1364,20 @@ public class StructureBridge this.fillWithBlocks(worldIn, structureBoundingBoxIn, 1, 6, 8, 5, 7, 8, Blocks.blood_brick_fence.getState(), Blocks.blood_brick_fence.getState(), false); this.fillWithBlocks(worldIn, structureBoundingBoxIn, 2, 8, 8, 4, 8, 8, Blocks.blood_brick_fence.getState(), Blocks.blood_brick_fence.getState(), false); - if (!this.hasSpawner && SVars.mobs && SVars.spawnBridgeMobs) + if (!this.hasSpawner) { BlockPos blockpos = new BlockPos(this.getXWithOffset(3, 5), this.getYWithOffset(5), this.getZWithOffset(3, 5)); if (structureBoundingBoxIn.isVecInside(blockpos)) { this.hasSpawner = true; - EntityDarkMage entity = new EntityDarkMage(worldIn); - entity.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, worldIn.rand.floatv() * 360.0F, 0.0F); - entity.onInitialSpawn(null); - worldIn.spawnEntityInWorld(entity); + worldIn.setState(blockpos, Blocks.mob_spawner.getState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).setEntityName("DarkMage"); + } } } diff --git a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java index 7ede565..a586573 100755 --- a/server/src/main/java/server/worldgen/structure/StructureMineshaft.java +++ b/server/src/main/java/server/worldgen/structure/StructureMineshaft.java @@ -4,17 +4,17 @@ import java.util.LinkedList; import java.util.List; import common.entity.item.EntityChestCart; -import common.entity.npc.EntityArachnoid; import common.init.Blocks; import common.init.Items; import common.item.RngLoot; import common.rng.Random; import common.rng.WeightedList; import common.tags.TagObject; +import common.tileentity.TileEntity; +import common.tileentity.TileEntityMobSpawner; import common.util.BlockPos; import common.util.Facing; import common.world.State; -import server.vars.SVars; import server.world.WorldServer; import server.worldgen.LootConstants; @@ -360,7 +360,7 @@ public class StructureMineshaft this.generateChestContents(worldIn, structureBoundingBoxIn, randomIn, 0, 0, k1 + 1, RngLoot.addToList(LootConstants.MINESHAFT_CHEST, Items.enchanted_book.getRandom(randomIn)), 3 + randomIn.zrange(4)); } - if (this.hasSpiders && !this.spawnerPlaced && SVars.mobs && SVars.spawnMineshaftMobs) + if (this.hasSpiders && !this.spawnerPlaced) { int l1 = this.getYWithOffset(0); int i2 = k1 - 1 + randomIn.zrange(3); @@ -371,10 +371,13 @@ public class StructureMineshaft if (structureBoundingBoxIn.isVecInside(blockpos)) { this.spawnerPlaced = true; - EntityArachnoid entity = new EntityArachnoid(worldIn); - entity.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY(), (double)blockpos.getZ() + 0.5D, worldIn.rand.floatv() * 360.0F, 0.0F); - entity.onInitialSpawn(null); - worldIn.spawnEntityInWorld(entity); + worldIn.setState(blockpos, Blocks.mob_spawner.getState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).setEntityName("Arachnoid"); + } } } } diff --git a/server/src/main/java/server/worldgen/structure/StructureStronghold.java b/server/src/main/java/server/worldgen/structure/StructureStronghold.java index b96c6c4..870a53b 100755 --- a/server/src/main/java/server/worldgen/structure/StructureStronghold.java +++ b/server/src/main/java/server/worldgen/structure/StructureStronghold.java @@ -7,15 +7,15 @@ import common.block.artificial.BlockSlab; import common.block.artificial.BlockStoneBrick; import common.collect.Lists; import common.collect.Maps; -import common.entity.npc.EntityHaunter; import common.init.Blocks; import common.init.Items; import common.item.RngLoot; import common.rng.Random; import common.tags.TagObject; +import common.tileentity.TileEntity; +import common.tileentity.TileEntityMobSpawner; import common.util.BlockPos; import common.util.Facing; -import server.vars.SVars; import server.world.WorldServer; import server.worldgen.LootConstants; @@ -899,7 +899,7 @@ public class StructureStronghold // this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(j1).withProperty(BlockPortalFrame.ORB, Boolean.valueOf(randomIn.floatv() > 0.9F)), 7, 3, 10, structureBoundingBoxIn); // this.setBlockState(worldIn, Blocks.end_portal_frame.getStateFromMeta(j1).withProperty(BlockPortalFrame.ORB, Boolean.valueOf(randomIn.floatv() > 0.9F)), 7, 3, 11, structureBoundingBoxIn); - if (!this.hasSpawner && SVars.mobs && SVars.spawnStrongholdMobs) + if (!this.hasSpawner) { i = this.getYWithOffset(3); BlockPos blockpos = new BlockPos(this.getXWithOffset(5, 6), i, this.getZWithOffset(5, 6)); @@ -907,10 +907,13 @@ public class StructureStronghold if (structureBoundingBoxIn.isVecInside(blockpos)) { this.hasSpawner = true; - EntityHaunter entity = new EntityHaunter(worldIn); - entity.setLocationAndAngles((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 1.0D, (double)blockpos.getZ() + 0.5D, worldIn.rand.floatv() * 360.0F, 0.0F); - entity.onInitialSpawn(null); - worldIn.spawnEntityInWorld(entity); + worldIn.setState(blockpos, Blocks.mob_spawner.getState(), 2); + TileEntity tileentity = worldIn.getTileEntity(blockpos); + + if (tileentity instanceof TileEntityMobSpawner) + { + ((TileEntityMobSpawner)tileentity).setEntityName("Haunter"); + } } } diff --git a/server/src/main/java/server/worldgen/structure/StructureVillage.java b/server/src/main/java/server/worldgen/structure/StructureVillage.java index d88fb76..d16ea42 100755 --- a/server/src/main/java/server/worldgen/structure/StructureVillage.java +++ b/server/src/main/java/server/worldgen/structure/StructureVillage.java @@ -1921,7 +1921,7 @@ public class StructureVillage protected void spawnVillager(WorldServer worldIn, StructureBoundingBox p_74893_2_, int x, int y, int z) { - if (!this.villagerSpawned && SVars.mobs && SVars.spawnCageMobs) + if (!this.villagerSpawned && SVars.mobs && SVars.spawnCagedVillager) { int j = this.getXWithOffset(x, z); int k = this.getYWithOffset(y);