protected boolean generateChestContents(World worldIn, StructureBoundingBox boundingBoxIn, Random rand, int x, int y, int z, List<WeightedRandomChestContent> listIn, int max) { BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (boundingBoxIn.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getBlock().getMaterial() == Material.air) { int i = rand.nextBoolean() ? 1 : 0; worldIn.setBlockState(blockpos, Blocks.rail.getStateFromMeta(this.getMetadataWithOffset(Blocks.rail, i)), 2); EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F)); WeightedRandomChestContent.generateChestContents(rand, listIn, entityminecartchest, max); worldIn.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot) { BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (structurebb.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR) { IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST); this.setBlockState(worldIn, iblockstate, x, y, z, structurebb); EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F)); entityminecartchest.setLootTable(loot, randomIn.nextLong()); worldIn.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
/** * Adds chest to the structure and sets its contents */ protected boolean generateChest(World worldIn, StructureBoundingBox structurebb, Random randomIn, int x, int y, int z, ResourceLocation loot) { BlockPos blockpos = new BlockPos(this.getXWithOffset(x, z), this.getYWithOffset(y), this.getZWithOffset(x, z)); if (structurebb.isVecInside(blockpos) && worldIn.getBlockState(blockpos).getMaterial() == Material.AIR && worldIn.getBlockState(blockpos.down()).getMaterial() != Material.AIR) { IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, randomIn.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST); this.setBlockState(worldIn, iblockstate, x, y, z, structurebb); EntityMinecartChest entityminecartchest = new EntityMinecartChest(worldIn, (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F)); entityminecartchest.setLootTable(loot, randomIn.nextLong()); worldIn.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) { int var9 = this.getXWithOffset(par4, par6); int var10 = this.getYWithOffset(par5); int var11 = this.getZWithOffset(par4, par6); if (par2StructureBoundingBox.isVecInside(var9, var10, var11) && par1World.getBlock(var9, var10, var11).getMaterial() == Material.air) { int var12 = par3Random.nextBoolean() ? 1 : 0; par1World.setBlock(var9, var10, var11, Blocks.rail, this.func_151555_a(Blocks.rail, var12), 2); EntityMinecartChest var13 = new EntityMinecartChest(par1World, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F)); WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, var13, par8); par1World.spawnEntityInWorld(var13); return true; } else { return false; } }
@Override public Map<Object, Object> getMinecartData(EntityMinecart cart) { Map<Object, Object> ret = new HashMap<Object, Object>(); if (cart.getClass() == EntityMinecartEmpty.class) { ret.put("__CART_TYPE__", "basic"); ret.put("occupied", cart.riddenByEntity != null); if (cart.riddenByEntity != null) ret.put("username", cart.riddenByEntity.getEntityName()); } else if (cart.getClass() == EntityMinecartChest.class) { ret.put("__CART_TYPE__", "storage"); } else if (cart.getClass() == EntityMinecartFurnace.class) { ret.put("__CART_TYPE__", "furnace"); NBTTagCompound workaround = new NBTTagCompound(); cart.writeToNBT(workaround); ret.put("fuel", workaround.getInteger("Fuel")); } else if (cart.getClass() == EntityMinecartHopper.class) { ret.put("__CART_TYPE__", "hopper"); } else if (cart.getClass() == EntityMinecartTNT.class) { ret.put("__CART_TYPE__", "tnt"); } else if (cart.getClass() == EntityMinecartMobSpawner.class) { ret.put("__CART_TYPE__", "spawner"); } return ret.containsKey("__CART_TYPE__") ? ret : null; }
/** * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. */ @Override protected boolean generateChest(World world, StructureBoundingBox structureboundingbox, Random rand, int x, int y, int z, ResourceLocation loot) { BlockPos blockpos = new BlockPos(getXWithOffset(x, z), getYWithOffset(y), getZWithOffset(x, z)); if (structureboundingbox.isVecInside(blockpos) && world.getBlockState(blockpos).getMaterial() == Material.AIR) { IBlockState iblockstate = Blocks.RAIL.getDefaultState().withProperty(BlockRail.SHAPE, rand.nextBoolean() ? BlockRailBase.EnumRailDirection.NORTH_SOUTH : BlockRailBase.EnumRailDirection.EAST_WEST); setBlockState(world, iblockstate, x, y, z, structureboundingbox); EntityMinecartChest entityminecartchest = new EntityMinecartChest(world, blockpos.getX() + 0.5F, blockpos.getY() + 0.5F, blockpos.getZ() + 0.5F); entityminecartchest.setLootTable(loot, rand.nextLong()); world.spawnEntity(entityminecartchest); return true; } else return false; }
protected boolean generateStructureChestContents(World p_74879_1_, StructureBoundingBox p_74879_2_, Random p_74879_3_, int p_74879_4_, int p_74879_5_, int p_74879_6_, WeightedRandomChestContent[] p_74879_7_, int p_74879_8_) { int i1 = this.getXWithOffset(p_74879_4_, p_74879_6_); int j1 = this.getYWithOffset(p_74879_5_); int k1 = this.getZWithOffset(p_74879_4_, p_74879_6_); if (p_74879_2_.isVecInside(i1, j1, k1) && p_74879_1_.getBlock(i1, j1, k1).getMaterial() == Material.air) { int l1 = p_74879_3_.nextBoolean() ? 1 : 0; p_74879_1_.setBlock(i1, j1, k1, Blocks.rail, this.getMetadataWithOffset(Blocks.rail, l1), 2); EntityMinecartChest entityminecartchest = new EntityMinecartChest(p_74879_1_, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F)); WeightedRandomChestContent.generateChestContents(p_74879_3_, p_74879_7_, entityminecartchest, p_74879_8_); p_74879_1_.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
public static EntityMinecart func_94090_a(World p_94090_0_, double p_94090_1_, double p_94090_3_, double p_94090_5_, int p_94090_7_) { switch(p_94090_7_) { case 1: return new EntityMinecartChest(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); case 2: return new EntityMinecartFurnace(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); case 3: return new EntityMinecartTNT(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); case 4: return new EntityMinecartMobSpawner(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); case 5: return new EntityMinecartHopper(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); default: return new EntityMinecartEmpty(p_94090_0_, p_94090_1_, p_94090_3_, p_94090_5_); } }
/** * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. */ protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) { int i1 = this.getXWithOffset(par4, par6); int j1 = this.getYWithOffset(par5); int k1 = this.getZWithOffset(par4, par6); if (par2StructureBoundingBox.isVecInside(i1, j1, k1) && par1World.getBlockId(i1, j1, k1) == 0) { par1World.setBlock(i1, j1, k1, Block.rail.blockID, this.getMetadataWithOffset(Block.rail.blockID, par3Random.nextBoolean() ? 1 : 0), 2); EntityMinecartChest entityminecartchest = new EntityMinecartChest(par1World, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F)); WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, entityminecartchest, par8); par1World.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
/** * Used to generate chests with items in it. ex: Temple Chests, Village Blacksmith Chests, Mineshaft Chests. */ protected boolean generateStructureChestContents(World par1World, StructureBoundingBox par2StructureBoundingBox, Random par3Random, int par4, int par5, int par6, WeightedRandomChestContent[] par7ArrayOfWeightedRandomChestContent, int par8) { int i1 = this.getXWithOffset(par4, par6); int j1 = this.getYWithOffset(par5); int k1 = this.getZWithOffset(par4, par6); if (par2StructureBoundingBox.isVecInside(i1, j1, k1) && par1World.getBlock(i1, j1, k1).getMaterial() == Material.air) { int l1 = par3Random.nextBoolean() ? 1 : 0; par1World.setBlock(i1, j1, k1, Blocks.rail, this.getMetadataWithOffset(Blocks.rail, l1), 2); EntityMinecartChest entityminecartchest = new EntityMinecartChest(par1World, (double)((float)i1 + 0.5F), (double)((float)j1 + 0.5F), (double)((float)k1 + 0.5F)); WeightedRandomChestContent.generateChestContents(par3Random, par7ArrayOfWeightedRandomChestContent, entityminecartchest, par8); par1World.spawnEntityInWorld(entityminecartchest); return true; } else { return false; } }
private int getEntityColor(Entity entity) { if(entity instanceof EntityMinecartChest) return Utils.Colors.ORANGE; else if(entity instanceof EntityItemFrame && ((EntityItemFrame) entity).getDisplayedItem().getItem() instanceof ItemShulkerBox) return Utils.Colors.YELLOW; else return -1; }
@Override public void render(ItemStack stack) { String id = "empty"; Class<? extends EntityMinecart> clazz = EntityMinecartEmpty.class; if(stack.getItem() == Items.CHEST_MINECART){ id = "chest"; clazz = EntityMinecartChest.class; } if(stack.getItem() == Items.FURNACE_MINECART){ id = "furnace"; clazz = EntityMinecartFurnace.class; } if(stack.getItem() == Items.TNT_MINECART){ id = "tnt"; clazz = EntityMinecartTNT.class; } if(stack.getItem() == Items.HOPPER_MINECART){ id = "hopper"; clazz = EntityMinecartHopper.class; } if(stack.getItem() == Items.COMMAND_BLOCK_MINECART){ id = "commandblock"; clazz = EntityMinecartCommandBlock.class; } EntityMinecart minecart = getMinecart(id, clazz); if(minecart == null){ return; } renderMinecart(minecart, lastTransform, true); }
@SubscribeEvent public void MinecartInteractEvent(MinecartInteractEvent event) { if (event.entity instanceof EntityMinecartChest) { ItemStack curItem = event.player.getCurrentEquippedItem(); EntityMinecartChest oldCart = (EntityMinecartChest) event.entity; if (curItem != null && curItem.getItem() == WoodIronUpgrade) { EntityIronChestCart ironCart = new EntityIronChestCart(oldCart.worldObj); ironCart.copyDataFrom(event.entity, true); ironCart.setDisplayTileData(0); if (!event.entity.worldObj.isRemote) { oldCart.worldObj.spawnEntityInWorld(ironCart); } for (int i = 0; i < oldCart.getSizeInventory(); i++) { oldCart.setInventorySlotContents(i, null); } oldCart.setDead(); event.player.destroyCurrentEquippedItem(); event.setCanceled(true); } else if (curItem != null && curItem.getItem() == WoodCopperUpgrade) { EntityCopperChestCart copperCart = new EntityCopperChestCart(oldCart.worldObj); copperCart.copyDataFrom(event.entity, true); copperCart.setDisplayTileData(3); if (!event.entity.worldObj.isRemote) { oldCart.worldObj.spawnEntityInWorld(copperCart); } for (int i = 0; i < oldCart.getSizeInventory(); i++) { oldCart.setInventorySlotContents(i, null); } oldCart.setDead(); event.player.destroyCurrentEquippedItem(); event.setCanceled(true); } } }
protected boolean func_74879_a(World p_74879_1_, StructureBoundingBox p_74879_2_, Random p_74879_3_, int p_74879_4_, int p_74879_5_, int p_74879_6_, WeightedRandomChestContent[] p_74879_7_, int p_74879_8_) { int var9 = this.func_74865_a(p_74879_4_, p_74879_6_); int var10 = this.func_74862_a(p_74879_5_); int var11 = this.func_74873_b(p_74879_4_, p_74879_6_); if(p_74879_2_.func_78890_b(var9, var10, var11) && p_74879_1_.func_72798_a(var9, var10, var11) == 0) { p_74879_1_.func_72832_d(var9, var10, var11, Block.field_72056_aG.field_71990_ca, this.func_74863_c(Block.field_72056_aG.field_71990_ca, p_74879_3_.nextBoolean()?1:0), 2); EntityMinecartChest var12 = new EntityMinecartChest(p_74879_1_, (double)((float)var9 + 0.5F), (double)((float)var10 + 0.5F), (double)((float)var11 + 0.5F)); WeightedRandomChestContent.func_76293_a(p_74879_3_, p_74879_7_, var12, p_74879_8_); p_74879_1_.func_72838_d(var12); return true; } else { return false; } }
@Override public void onRender() { if(isEnabled()) { for (Object o : Wrapper.getWorld().loadedTileEntityList) { if (o instanceof TileEntityChest) { TileEntityChest chest = (TileEntityChest) o; this.drawChestESP(chest, chest.getPos().getX(), chest.getPos().getY(), chest.getPos().getZ()); } if (o instanceof TileEntityEnderChest) { TileEntityEnderChest enderChest = (TileEntityEnderChest) o; this.drawEnderChestESP(enderChest, enderChest.getPos().getX(), enderChest.getPos().getY(), enderChest.getPos().getZ()); } if (o instanceof TileEntityFurnace) { TileEntityFurnace furnace = (TileEntityFurnace) o; RenderUtils.blockESP(furnace.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityDispenser) { TileEntityDispenser dispenser = (TileEntityDispenser) o; RenderUtils.blockESP(dispenser.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityDropper) { TileEntityDropper dropper = (TileEntityDropper) o; RenderUtils.blockESP(dropper.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityHopper) { TileEntityHopper hopper = (TileEntityHopper) o; RenderUtils.blockESP(hopper.getPos(), Color.white, 1.0, 1.0); } if (o instanceof TileEntityShulkerBox) { TileEntityShulkerBox shulker = (TileEntityShulkerBox) o; RenderUtils.blockESP(shulker.getPos(), Color.yellow, 1.0, 1.0); } } for (Entity e: Wrapper.getWorld().loadedEntityList) { if (e instanceof EntityMinecartChest) { RenderUtils.blockESP(e.getPosition(), Color.green, 1.0, 1.0); } if (e instanceof EntityMinecartFurnace || e instanceof EntityMinecartHopper) { RenderUtils.blockESP(e.getPosition(), Color.white, 1.0, 1.0); } } } }
public static DataFixer createFixer() { DataFixer datafixer = new DataFixer(512); WorldInfo.registerFixes(datafixer); EntityPlayer.registerFixesPlayer(datafixer); AnvilChunkLoader.registerFixes(datafixer); ItemStack.registerFixes(datafixer); EntityArmorStand.registerFixesArmorStand(datafixer); EntityArrow.registerFixesArrow(datafixer); EntityBat.registerFixesBat(datafixer); EntityBlaze.registerFixesBlaze(datafixer); EntityCaveSpider.registerFixesCaveSpider(datafixer); EntityChicken.registerFixesChicken(datafixer); EntityCow.registerFixesCow(datafixer); EntityCreeper.registerFixesCreeper(datafixer); EntityDragonFireball.registerFixesDragonFireball(datafixer); EntityDragon.registerFixesDragon(datafixer); EntityEnderman.registerFixesEnderman(datafixer); EntityEndermite.registerFixesEndermite(datafixer); EntityFallingBlock.registerFixesFallingBlock(datafixer); EntityLargeFireball.registerFixesLargeFireball(datafixer); EntityFireworkRocket.registerFixesFireworkRocket(datafixer); EntityGhast.registerFixesGhast(datafixer); EntityGiantZombie.registerFixesGiantZombie(datafixer); EntityGuardian.registerFixesGuardian(datafixer); EntityHorse.registerFixesHorse(datafixer); EntityItem.registerFixesItem(datafixer); EntityItemFrame.registerFixesItemFrame(datafixer); EntityMagmaCube.registerFixesMagmaCube(datafixer); EntityMinecartChest.registerFixesMinecartChest(datafixer); EntityMinecartCommandBlock.registerFixesMinecartCommand(datafixer); EntityMinecartFurnace.registerFixesMinecartFurnace(datafixer); EntityMinecartHopper.registerFixesMinecartHopper(datafixer); EntityMinecartEmpty.registerFixesMinecartEmpty(datafixer); EntityMinecartMobSpawner.registerFixesMinecartMobSpawner(datafixer); EntityMinecartTNT.registerFixesMinecartTNT(datafixer); EntityLiving.registerFixesMob(datafixer); EntityMob.registerFixesMonster(datafixer); EntityMooshroom.registerFixesMooshroom(datafixer); EntityOcelot.registerFixesOcelot(datafixer); EntityPig.registerFixesPig(datafixer); EntityPigZombie.registerFixesPigZombie(datafixer); EntityRabbit.registerFixesRabbit(datafixer); EntitySheep.registerFixesSheep(datafixer); EntityShulker.registerFixesShulker(datafixer); EntitySilverfish.registerFixesSilverfish(datafixer); EntitySkeleton.registerFixesSkeleton(datafixer); EntitySlime.registerFixesSlime(datafixer); EntitySmallFireball.registerFixesSmallFireball(datafixer); EntitySnowman.registerFixesSnowman(datafixer); EntitySnowball.registerFixesSnowball(datafixer); EntitySpectralArrow.registerFixesSpectralArrow(datafixer); EntitySpider.registerFixesSpider(datafixer); EntitySquid.registerFixesSquid(datafixer); EntityEgg.registerFixesEgg(datafixer); EntityEnderPearl.registerFixesEnderPearl(datafixer); EntityExpBottle.registerFixesExpBottle(datafixer); EntityPotion.registerFixesPotion(datafixer); EntityTippedArrow.registerFixesTippedArrow(datafixer); EntityVillager.registerFixesVillager(datafixer); EntityIronGolem.registerFixesIronGolem(datafixer); EntityWitch.registerFixesWitch(datafixer); EntityWither.registerFixesWither(datafixer); EntityWitherSkull.registerFixesWitherSkull(datafixer); EntityWolf.registerFixesWolf(datafixer); EntityZombie.registerFixesZombie(datafixer); TileEntityPiston.registerFixesPiston(datafixer); TileEntityFlowerPot.registerFixesFlowerPot(datafixer); TileEntityFurnace.registerFixesFurnace(datafixer); TileEntityChest.registerFixesChest(datafixer); TileEntityDispenser.registerFixes(datafixer); TileEntityDropper.registerFixesDropper(datafixer); TileEntityBrewingStand.registerFixesBrewingStand(datafixer); TileEntityHopper.registerFixesHopper(datafixer); BlockJukebox.registerFixesJukebox(datafixer); TileEntityMobSpawner.registerFixesMobSpawner(datafixer); registerFixes(datafixer); return datafixer; }
public StorageMinecart() { super(new EntityMinecartChest(null)); }
protected StorageMinecart(EntityMinecartChest entityMC) { super(entityMC); }
/** This method is used to create a new instance of {@link Entity Corundum Entity} to wrap around the given {@link Minecraft net.minecraft.entity.Entity}. * * @param entityMC * is the Minecraft Entity that will wrapped with a new {@link Entity Corundum Entity} <tt>Object</tt>. * @return a new Entity created using the given {@link net.minecraft.entity.Entity Minecraft Entity}. */ @Override public StorageMinecart fromMC(EntityMinecartChest entityMC) { return new StorageMinecart(entityMC); }