Fixes chest items.

This commit is contained in:
Tastybento 2017-12-09 12:00:24 -08:00
parent e741c3f5fa
commit 07661eed38

View File

@ -13,6 +13,7 @@ import org.bukkit.block.BlockState;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.Chest; import org.bukkit.material.Chest;
@ -377,7 +378,7 @@ public class IslandBuilder {
y = islandHeight; y = islandHeight;
// Add tree (natural) // Add tree (natural)
Location treeLoc = new Location(world, x, y + 5D, z); Location treeLoc = new Location(world, x, y + 5D, z);
treeLoc.getBlock().getRelative(BlockFace.DOWN).setType(Material.NETHERRACK); treeLoc.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
world.generateTree(treeLoc, TreeType.TREE); world.generateTree(treeLoc, TreeType.TREE);
// Place the cow // Place the cow
//Location location = new Location(world, x, (islandHeight + 5), z - 2); //Location location = new Location(world, x, (islandHeight + 5), z - 2);
@ -495,12 +496,10 @@ public class IslandBuilder {
state.setData(chest); state.setData(chest);
state.update(); state.update();
if (chestItems.length > 0) { if (chestItems.length > 0) {
Bukkit.getLogger().info("DEBUG: chest items = " + chestItems.toString()); InventoryHolder chestBlock = (InventoryHolder) state;
org.bukkit.block.Chest chestBlock = (org.bukkit.block.Chest) state; for (ItemStack item: chestItems) {
chestBlock.getInventory().addItem(chestItems); chestBlock.getInventory().addItem(item);
chestBlock.update(); }
} else {
Bukkit.getLogger().info("DEBUG: no chest items");
} }
} }
} }