Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
private final ArrayList<ChunkCoordinates> chests = new ArrayList<ChunkCoordinates>();
this.chests.add(new ChunkCoordinates(i + 2, j - 2, k + 3));
if (!this.chests.isEmpty())
{
if(par1World.getBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ) != Blocks.chest) par1World.setBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ, Blocks.chest, 0, 2);
TileEntityChest chest = (TileEntityChest) par1World.getTileEntity(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ);
if (chest != null)
{
for (int o = 0; o < chest.getSizeInventory(); o++)
{
chest.setInventorySlotContents(o, null);
}
ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST);
WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand));
}
this.chests.clear();
}
Эмм...Вообще есть метод уже созданный...BlesseNtumble написал(а):Код:private final ArrayList<ChunkCoordinates> chests = new ArrayList<ChunkCoordinates>(); this.chests.add(new ChunkCoordinates(i + 2, j - 2, k + 3)); if (!this.chests.isEmpty()) { if(par1World.getBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ) != Blocks.chest) par1World.setBlock(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ, Blocks.chest, 0, 2); TileEntityChest chest = (TileEntityChest) par1World.getTileEntity(this.chests.get(0).posX, this.chests.get(0).posY, this.chests.get(0).posZ); if (chest != null) { for (int o = 0; o < chest.getSizeInventory(); o++) { chest.setInventorySlotContents(o, null); } ChestGenHooks info = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); WeightedRandomChestContent.generateChestContents(rand, info.getItems(rand), chest, info.getCount(rand)); } this.chests.clear(); }