20 lines
1.0 KiB
Java
20 lines
1.0 KiB
Java
package com.thebrokenrail.scriptcraft.api.bridge;
|
|
|
|
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
|
import com.thebrokenrail.scriptcraft.core.ValueUtil;
|
|
import net.minecraft.inventory.Inventory;
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
class InventoryBridges {
|
|
static void register() {
|
|
ScriptCraftCore.addBridge("Inventory.get", args -> ((Inventory) args[0]).getInvStack((int) ValueUtil.toDouble(args[1], 0)));
|
|
ScriptCraftCore.addBridge("Inventory.take", args -> ((Inventory) args[0]).takeInvStack((int) ValueUtil.toDouble(args[1], 0), (int) ValueUtil.toDouble(args[2], 0)));
|
|
ScriptCraftCore.addBridge("Inventory.set", args -> {
|
|
((Inventory) args[0]).setInvStack((int) ValueUtil.toDouble(args[1], 0), (ItemStack) args[2]);
|
|
return null;
|
|
});
|
|
ScriptCraftCore.addBridge("Inventory.size", args -> ((Inventory) args[0]).getInvSize());
|
|
ScriptCraftCore.addBridge("Inventory.getMaxStackSize", args -> ((Inventory) args[0]).getInvMaxStackAmount());
|
|
}
|
|
}
|