Added dynamic tools
This commit is contained in:
1 parent
9829a76824
commit
844a63f518
6 files changed
+160
-153
No files matched your search
@@ -184,17 +184,17 @@ public class BukkitUtils
|
||||
return y;
|
||||
}
|
||||
|
||||
public static int modifyContainer(BlockState b, ItemStack item) throws Exception {
|
||||
if (!(b instanceof ContainerBlock))
|
||||
throw new Exception("No container");
|
||||
final Inventory inv = ((ContainerBlock)b).getInventory();
|
||||
if (item.getAmount() < 0) {
|
||||
item.setAmount(-item.getAmount());
|
||||
final ItemStack tmp = inv.removeItem(item).get(0);
|
||||
return tmp != null ? tmp.getAmount() : 0;
|
||||
} else if (item.getAmount() > 0) {
|
||||
final ItemStack tmp = inv.addItem(item).get(0);
|
||||
return tmp != null ? tmp.getAmount() : 0;
|
||||
public static int modifyContainer(BlockState b, ItemStack item) {
|
||||
if (b instanceof ContainerBlock) {
|
||||
final Inventory inv = ((ContainerBlock)b).getInventory();
|
||||
if (item.getAmount() < 0) {
|
||||
item.setAmount(-item.getAmount());
|
||||
final ItemStack tmp = inv.removeItem(item).get(0);
|
||||
return tmp != null ? tmp.getAmount() : 0;
|
||||
} else if (item.getAmount() > 0) {
|
||||
final ItemStack tmp = inv.addItem(item).get(0);
|
||||
return tmp != null ? tmp.getAmount() : 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user