@Override public void addInformation(World world, BlockPos pos, TileEntity te, List<String> infoList) { if (te instanceof TileEntityMobSpawner) { MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) te).getSpawnerBaseLogic(); ResourceLocation rl = Reflections.getEntityId(spawner); // infoList.add("Spawner Type: " + I18n.format("entity." + spawner.getEntityNameToSpawn() + ".name")); infoList.add("Spawner Type: " + (rl == null ? "?" : rl.toString())); if (Reflections.isActivated(spawner) || SemiBlockManager.getInstance(world).getSemiBlock(SemiBlockSpawnerAgitator.class, world, pos) != null) { infoList.add("Time until next spawn: " + PneumaticCraftUtils.convertTicksToMinutesAndSeconds(spawner.spawnDelay, false)); } else if (HackableMobSpawner.isHacked(world, pos)) { infoList.add("Spawner is hacked"); } else { infoList.add("Spawner is standing by"); } } }
@Override public void update() { super.update(); if (!world.isRemote) { TileEntityMobSpawner te = getTileEntity(); if(te != null){ MobSpawnerBaseLogic spawnerLogic = te.getSpawnerBaseLogic(); //Only tick the logic if it wasn't ticked already by the TE itself, to prevent double ticking. if(!Reflections.isActivated(spawnerLogic)){ //Temporarily add a fake player to the world to trick the spawner into thinking there's a player nearby EntityPlayer fakePlayer = FakePlayerFactory.get((WorldServer)world, FAKE_PLAYER_PROFILE); fakePlayer.posX = getPos().getX(); fakePlayer.posY = getPos().getY(); fakePlayer.posZ = getPos().getZ(); world.playerEntities.add(fakePlayer); spawnerLogic.updateSpawner(); world.playerEntities.remove(fakePlayer); } } } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner) { tileentity.readFromNBT(packetIn.getNbtCompound()); } } }
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(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
/** * Updates the NBTTagCompound metadata of instances of the following * entitytypes: Mob spawners, command blocks, beacons, skulls, flowerpot */ public void handleUpdateTileEntity(S35PacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); if (i == 1 && tileentity instanceof TileEntityMobSpawner || i == 2 && tileentity instanceof TileEntityCommandBlock || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner) { tileentity.readFromNBT(packetIn.getNbtCompound()); } } }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.world.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.world.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox) { tileentity.readFromNBT(packetIn.getNbtCompound()); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
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(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer()); this.mapSpecialRenderers.put(TileEntityShulkerBox.class, new TileEntityShulkerBoxRenderer(new ModelShulker())); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
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(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new TileEntityEnchantmentTableRenderer()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new TileEntityEndPortalRenderer()); this.mapSpecialRenderers.put(TileEntityEndGateway.class, new TileEntityEndGatewayRenderer()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); this.mapSpecialRenderers.put(TileEntityBanner.class, new TileEntityBannerRenderer()); this.mapSpecialRenderers.put(TileEntityStructure.class, new TileEntityStructureRenderer()); for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values()) { tileentityspecialrenderer.setRendererDispatcher(this); } }
protected void placeSpawnerAtCurrentPosition(World var1, Random var2, int var3, int var4, int var5, String var6, StructureBoundingBox var7) { final int var8 = this.getXWithOffset(var3, var5); final int var9 = this.getYWithOffset(var4); final int var10 = this.getZWithOffset(var3, var5); if (var7.isVecInside(var8, var9, var10) && var1.getBlock(var8, var9, var10) != Blocks.mob_spawner) { var1.setBlock(var8, var9, var10, Blocks.mob_spawner, 0, 3); final TileEntityMobSpawner var11 = (TileEntityMobSpawner) var1.getTileEntity(var8, var9, var10); if (var11 != null) { var11.func_145881_a().setEntityName(var6); } } }
@Override public void onReceiveClient(Minecraft client, WorldClient world, EntityPlayerSP player, MessageContext context) { BlockSystem blockSystem = BlockSystems.PROXY.getBlockSystemHandler(world).getBlockSystem(this.blockSystem); if (blockSystem != null) { if (blockSystem.isBlockLoaded(this.pos)) { TileEntity blockEntity = blockSystem.getTileEntity(this.pos); boolean commandBlock = this.type == 2 && blockEntity instanceof TileEntityCommandBlock; if (this.type == 1 && blockEntity instanceof TileEntityMobSpawner || commandBlock || this.type == 3 && blockEntity instanceof TileEntityBeacon || this.type == 4 && blockEntity instanceof TileEntitySkull || this.type == 5 && blockEntity instanceof TileEntityFlowerPot || this.type == 6 && blockEntity instanceof TileEntityBanner || this.type == 7 && blockEntity instanceof TileEntityStructure || this.type == 8 && blockEntity instanceof TileEntityEndGateway || this.type == 9 && blockEntity instanceof TileEntitySign) { blockEntity.readFromNBT(this.data); } else { blockEntity.onDataPacket(client.getConnection().getNetworkManager(), new SPacketUpdateTileEntity(this.pos, this.type, this.data)); } if (commandBlock && client.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock) client.currentScreen).updateGui(); } } } }
/** * Called from BlockMobSpawner on the client via asm generated onBlockPlacedBy */ public static void onBlockPlaced(World world, BlockPos pos, ItemStack stack) { if (!NEIClientConfig.hasSMPCounterPart()) { return; } TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(pos); if (tileentitymobspawner != null) { setDefaultTag(stack); String mobtype = IDtoNameMap.get(stack.getItemDamage()); if (mobtype != null) { NEIClientPacketHandler.sendMobSpawnerID(pos.getX(), pos.getY(), pos.getZ(), mobtype); tileentitymobspawner.getSpawnerBaseLogic().setEntityId(new ResourceLocation(mobtype)); } } }
/** * search in all loaded TileEntities for MobSpawners, * when a new MobSpawner gets found, display its type and coordinates in chat. * @param showKnown show already found spawners */ public static void findSpawners(boolean showKnown) { final Minecraft mc = Minecraft.getMinecraft(); if (mc == null || mc.theWorld == null || mc.theWorld.loadedTileEntityList == null) return; for (Object o : mc.theWorld.loadedTileEntityList) { if (o.getClass() == TileEntityMobSpawner.class) { final TileEntityMobSpawner spawnerTileEntity = (TileEntityMobSpawner) o; final BlockPos spawnerPos = spawnerTileEntity.getPos(); if (showKnown || !foundSpawners.contains(spawnerPos)) { if (!showKnown) foundSpawners.add(spawnerPos); // tell player about newly found spawner NBTTagCompound nbt = new NBTTagCompound(); spawnerTileEntity.writeToNBT(nbt); final String entityId = nbt.getString("EntityId"); mc.thePlayer.addChatMessage(getSpawnerFoundChatMessage(spawnerPos, entityId)); } } } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new RenderEndPortal()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator var1 = this.mapSpecialRenderers.values().iterator(); while (var1.hasNext()) { TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); var2.func_147497_a(this); } }
private void copyToSpawner(NBTTagCompound nbt, ItemStack stack, TileEntityMobSpawner mobSpawner, EntityPlayer player) { if(mobSpawner.func_145881_a().getRandomEntity() == null) { mobSpawner.func_145881_a().setRandomEntity(mobSpawner.func_145881_a().new WeightedRandomMinecart((NBTTagCompound) nbt.copy(), mobSpawner.func_145881_a().getEntityNameToSpawn())); } else { NBTTagCompound old = mobSpawner.func_145881_a().getRandomEntity().field_98222_b; if(nbt.hasKey("CustomAITasks")) old.setTag("CustomAITasks", nbt.getTag("CustomAITasks")); if(nbt.hasKey("CustomAITargetTasks")) old.setTag("CustomAITargetTasks", nbt.getTag("CustomAITargetTasks")); } player.addChatMessage(new ChatComponentText(EnumChatFormatting.ITALIC+"Successfully transfered AI data to the spawner")); // ModCustomAI.packetPipeline.sendToAll(new PacketUpdateMobSpawnerData(mobSpawner, fromNBTListToList((NBTTagList)nbt.getTag("CustomAITasks")), fromNBTListToList((NBTTagList)nbt.getTag("CustomAITargetTasks")))); mobSpawner.getWorldObj().markBlockForUpdate(mobSpawner.xCoord, mobSpawner.yCoord, mobSpawner.zCoord); }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
private TileEntityRendererDispatcher() { this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); this.mapSpecialRenderers.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.mapSpecialRenderers.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.mapSpecialRenderers.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.mapSpecialRenderers.put(TileEntityEndPortal.class, new RenderEndPortal()); this.mapSpecialRenderers.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.mapSpecialRenderers.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator iterator = this.mapSpecialRenderers.values().iterator(); while (iterator.hasNext()) { TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)iterator.next(); tileentityspecialrenderer.func_147497_a(this); } }
private TileEntityRenderer() { this.field_76966_m.put(TileEntitySign.class, new TileEntitySignRenderer()); this.field_76966_m.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.field_76966_m.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.field_76966_m.put(TileEntityChest.class, new TileEntityChestRenderer()); this.field_76966_m.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.field_76966_m.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.field_76966_m.put(TileEntityEndPortal.class, new RenderEndPortal()); this.field_76966_m.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.field_76966_m.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator var1 = this.field_76966_m.values().iterator(); while(var1.hasNext()) { TileEntitySpecialRenderer var2 = (TileEntitySpecialRenderer)var1.next(); var2.func_76893_a(this); } }
public void func_72468_a(Packet132TileEntityData p_72468_1_) { if(this.field_72563_h.field_71441_e.func_72899_e(p_72468_1_.field_73334_a, p_72468_1_.field_73332_b, p_72468_1_.field_73333_c)) { TileEntity var2 = this.field_72563_h.field_71441_e.func_72796_p(p_72468_1_.field_73334_a, p_72468_1_.field_73332_b, p_72468_1_.field_73333_c); if(var2 != null) { if(p_72468_1_.field_73330_d == 1 && var2 instanceof TileEntityMobSpawner) { var2.func_70307_a(p_72468_1_.field_73331_e); } else if(p_72468_1_.field_73330_d == 2 && var2 instanceof TileEntityCommandBlock) { var2.func_70307_a(p_72468_1_.field_73331_e); } else if(p_72468_1_.field_73330_d == 3 && var2 instanceof TileEntityBeacon) { var2.func_70307_a(p_72468_1_.field_73331_e); } else if(p_72468_1_.field_73330_d == 4 && var2 instanceof TileEntitySkull) { var2.func_70307_a(p_72468_1_.field_73331_e); } } } }
private TileEntityRenderer() { this.specialRendererMap.put(TileEntitySign.class, new TileEntitySignRenderer()); this.specialRendererMap.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer()); this.specialRendererMap.put(TileEntityPiston.class, new TileEntityRendererPiston()); this.specialRendererMap.put(TileEntityChest.class, new TileEntityChestRenderer()); this.specialRendererMap.put(TileEntityEnderChest.class, new TileEntityEnderChestRenderer()); this.specialRendererMap.put(TileEntityEnchantmentTable.class, new RenderEnchantmentTable()); this.specialRendererMap.put(TileEntityEndPortal.class, new RenderEndPortal()); this.specialRendererMap.put(TileEntityBeacon.class, new TileEntityBeaconRenderer()); this.specialRendererMap.put(TileEntitySkull.class, new TileEntitySkullRenderer()); Iterator iterator = this.specialRendererMap.values().iterator(); while (iterator.hasNext()) { TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)iterator.next(); tileentityspecialrenderer.setTileEntityRenderer(this); } }
protected void setMobSpawner(int[] pt, Block spawner, int metadata, String info) { if(world.setBlock(pt[0], pt[1], pt[2], spawner, metadata, 2)){ TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(pt[0], pt[1], pt[2]); if (tileentitymobspawner != null){ if(info.equals("UPRIGHT")) { if (random.nextInt(3) == 0) setMobSpawner(tileentitymobspawner, 1, 3); else setMobSpawner(tileentitymobspawner, 2, 0); }else if(info.equals("EASY")){ setMobSpawner(tileentitymobspawner, 2, 0); }else if(info.equals("MEDIUM")){ setMobSpawner(tileentitymobspawner, 3, 0); }else if(info.equals("HARD")){ setMobSpawner(tileentitymobspawner, 4, 0); }else if(EntityList.stringToClassMapping.containsKey(info)) tileentitymobspawner.func_145881_a().setEntityName(info); } } }
public void generate(IWorldEditor editor, Random rand, Coord cursor, int level){ Coord pos = new Coord(cursor); editor.setBlock(pos, new MetaBlock(Blocks.MOB_SPAWNER.getDefaultState()), true, true); TileEntity tileentity = editor.getTileEntity(pos); if (!(tileentity instanceof TileEntityMobSpawner)) return; TileEntityMobSpawner spawner = (TileEntityMobSpawner)tileentity; MobSpawnerBaseLogic spawnerLogic = spawner.getSpawnerBaseLogic(); NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("x", pos.getX()); nbt.setInteger("y", pos.getY()); nbt.setInteger("z", pos.getZ()); nbt.setTag("SpawnPotentials", getSpawnPotentials(rand, level)); spawnerLogic.readFromNBT(nbt); spawnerLogic.updateSpawner(); tileentity.markDirty(); }
@Override public boolean afterHackTick(World world, BlockPos pos) { MobSpawnerBaseLogic spawner = ((TileEntityMobSpawner) world.getTileEntity(pos)).getSpawnerBaseLogic(); spawner.prevMobRotation = spawner.getMobRotation(); spawner.spawnDelay = 10; return false; }
private void setSpawnPersistentEntities(boolean persistent){ TileEntityMobSpawner te = getTileEntity(); if(te != null){ MobSpawnerBaseLogic spawnerLogic = te.getSpawnerBaseLogic(); spawnerLogic.spawnData.getNbt().setBoolean("PersistenceRequired", persistent); } }
@SubscribeEvent public void onRender(RenderEvent event) { event.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR); for(TileEntity tileEntity : getWorld().loadedTileEntityList) { if(tileEntity instanceof TileEntityMobSpawner) { BlockPos pos = tileEntity.getPos(); GeometryTessellator.drawCuboid(event.getBuffer(), pos, GeometryMasks.Line.ALL, Utils.Colors.RED); } } event.getTessellator().draw(); }
public void renderTileEntityAt(TileEntityMobSpawner te, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x + 0.5F, (float)y, (float)z + 0.5F); renderMob(te.getSpawnerBaseLogic(), x, y, z, partialTicks); GlStateManager.popMatrix(); }
/** * Updates the NBTTagCompound metadata of instances of the following entitytypes: Mob spawners, command blocks, * beacons, skulls, flowerpot */ public void handleUpdateTileEntity(SPacketUpdateTileEntity packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) { TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos()); int i = packetIn.getTileEntityType(); boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock; if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 5 && tileentity instanceof TileEntityFlowerPot || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign) { tileentity.readFromNBT(packetIn.getNbtCompound()); } else { if(tileentity == null) { LOGGER.error("Received invalid update packet for null tile entity at {} with data: {}", packetIn.getPos(), packetIn.getNbtCompound()); return; } tileentity.onDataPacket(netManager, packetIn); } if (flag && this.gameController.currentScreen instanceof GuiCommandBlock) { ((GuiCommandBlock)this.gameController.currentScreen).updateGui(); } } }
public static void setMobSpawner(final World world, final int x, final int y, final int z, final Random rand) { world.setBlock(x, y, z, Blocks.mob_spawner, 0, 2); final TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getTileEntity(x, y, z); if (tileentitymobspawner != null) { tileentitymobspawner.func_145881_a().setEntityName(DungeonHooks.getRandomDungeonMob(rand)); } else { LogHelper.error("Failed to fetch mob spawner entity at (" + x + ", " + y + ", " + z + ")", new Object[0]); } }
@Override protected void handleTileEntities(Random rand) { for (final ChunkCoordinates spawnerCoords : this.spawners) { if (this.worldObj.getBlock(spawnerCoords.posX, spawnerCoords.posY, spawnerCoords.posZ) == Blocks.mob_spawner) { final TileEntityMobSpawner spawner = (TileEntityMobSpawner) this.worldObj.getTileEntity(spawnerCoords.posX, spawnerCoords.posY, spawnerCoords.posZ); if (spawner != null) { spawner.func_145881_a().setEntityName(RoomSpawnerMars.getMob(rand)); } } } }
@Override protected void handleTileEntities(Random rand) { for (final ChunkCoordinates spawnerCoords : this.spawners) { if (this.worldObj.getBlock(spawnerCoords.posX, spawnerCoords.posY, spawnerCoords.posZ) == Blocks.mob_spawner) { final TileEntityMobSpawner spawner = (TileEntityMobSpawner) this.worldObj.getTileEntity(spawnerCoords.posX, spawnerCoords.posY, spawnerCoords.posZ); if (spawner != null) { spawner.func_145881_a().setEntityName(RoomSpawnerMoon.getMob(rand)); } } } }