3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-25 18:40:05 +01:00

Updated for latest SpoutAPI/Vanilla version.

Dieser Commit ist enthalten in:
TomyLobo 2012-05-28 03:20:10 +02:00
Ursprung 30515a65f5
Commit 50b7ef02c7
3 geänderte Dateien mit 11 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -93,7 +93,7 @@
<dependency> <dependency>
<groupId>org.spout</groupId> <groupId>org.spout</groupId>
<artifactId>vanilla</artifactId> <artifactId>vanilla</artifactId>
<version>dev-SNAPSHOT</version> <version>1.2.5-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>

Datei anzeigen

@ -35,6 +35,7 @@ import org.spout.api.geo.discrete.Point;
import org.spout.api.inventory.ItemStack; import org.spout.api.inventory.ItemStack;
import org.spout.api.material.MaterialRegistry; import org.spout.api.material.MaterialRegistry;
import org.spout.api.player.Player; import org.spout.api.player.Player;
import org.spout.vanilla.controller.living.player.VanillaPlayer;
public class SpoutPlayer extends LocalPlayer { public class SpoutPlayer extends LocalPlayer {
private Player player; private Player player;
@ -49,7 +50,8 @@ public class SpoutPlayer extends LocalPlayer {
@Override @Override
public int getItemInHand() { 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; return itemStack != null ? itemStack.getMaterial().getId() : 0;
} }
@ -77,7 +79,8 @@ public class SpoutPlayer extends LocalPlayer {
@Override @Override
public void giveItem(int type, int amt) { 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 @Override

Datei anzeigen

@ -34,6 +34,7 @@ import org.spout.api.inventory.ItemStack;
import org.spout.api.material.Material; import org.spout.api.material.Material;
import org.spout.api.material.MaterialRegistry; import org.spout.api.material.MaterialRegistry;
import org.spout.api.player.Player; import org.spout.api.player.Player;
import org.spout.vanilla.controller.living.player.VanillaPlayer;
public class SpoutPlayerBlockBag extends BlockBag { public class SpoutPlayerBlockBag extends BlockBag {
/** /**
@ -59,7 +60,8 @@ public class SpoutPlayerBlockBag extends BlockBag {
*/ */
private void loadInventory() { private void loadInventory() {
if (items == null) { 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 @Override
public void flushChanges() { public void flushChanges() {
if (items != null) { 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) { for (int i = 0; i < items.length && i < inv.getSize(); ++i) {
inv.setItem(i, items[i]); inv.setItem(i, items[i]);
} }