From 50b7ef02c79f780956b8407326edc982816159c5 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Mon, 28 May 2012 03:20:10 +0200 Subject: [PATCH] Updated for latest SpoutAPI/Vanilla version. --- pom.xml | 2 +- src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java | 7 +++++-- .../com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 6b6a720f9..a109bd479 100644 --- a/pom.xml +++ b/pom.xml @@ -93,7 +93,7 @@ org.spout vanilla - dev-SNAPSHOT + 1.2.5-SNAPSHOT diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java index 07d394eaa..af3d363d9 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java @@ -35,6 +35,7 @@ import org.spout.api.geo.discrete.Point; import org.spout.api.inventory.ItemStack; import org.spout.api.material.MaterialRegistry; import org.spout.api.player.Player; +import org.spout.vanilla.controller.living.player.VanillaPlayer; public class SpoutPlayer extends LocalPlayer { private Player player; @@ -49,7 +50,8 @@ public class SpoutPlayer extends LocalPlayer { @Override public int getItemInHand() { - ItemStack itemStack = player.getEntity().getInventory().getCurrentItem(); + VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); + ItemStack itemStack = vanillaPlayer.getInventory().getCurrentItem(); return itemStack != null ? itemStack.getMaterial().getId() : 0; } @@ -77,7 +79,8 @@ public class SpoutPlayer extends LocalPlayer { @Override public void giveItem(int type, int amt) { - player.getEntity().getInventory().addItem(new ItemStack(MaterialRegistry.get((short) type), amt), false); + VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); + vanillaPlayer.getInventory().addItem(new ItemStack(MaterialRegistry.get((short) type), amt), false); } @Override diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java index 6f2b20af2..311ca82e1 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayerBlockBag.java @@ -34,6 +34,7 @@ import org.spout.api.inventory.ItemStack; import org.spout.api.material.Material; import org.spout.api.material.MaterialRegistry; import org.spout.api.player.Player; +import org.spout.vanilla.controller.living.player.VanillaPlayer; public class SpoutPlayerBlockBag extends BlockBag { /** @@ -59,7 +60,8 @@ public class SpoutPlayerBlockBag extends BlockBag { */ private void loadInventory() { if (items == null) { - items = player.getEntity().getInventory().getContents(); + VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); + items = vanillaPlayer.getInventory().getContents(); } } @@ -206,7 +208,8 @@ public class SpoutPlayerBlockBag extends BlockBag { @Override public void flushChanges() { if (items != null) { - Inventory inv = player.getEntity().getInventory(); + VanillaPlayer vanillaPlayer = (VanillaPlayer) player.getEntity().getController(); + Inventory inv = vanillaPlayer.getInventory(); for (int i = 0; i < items.length && i < inv.getSize(); ++i) { inv.setItem(i, items[i]); }