This repository has been archived on 2023-11-26. You can view files and clone it, but cannot push or open issues or pull requests.
2020-04-28 20:18:22 +00:00
|
|
|
package com.thebrokenrail.scriptcraft.api.bridge;
|
|
|
|
|
|
|
|
import com.thebrokenrail.scriptcraft.core.ScriptCraftCore;
|
2020-06-07 21:58:49 +00:00
|
|
|
import com.thebrokenrail.scriptcraft.api.util.ValueUtil;
|
2020-04-28 20:18:22 +00:00
|
|
|
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());
|
2020-06-02 17:24:32 +00:00
|
|
|
|
|
|
|
ScriptCraftCore.addBridge("Inventory.isValid", args -> args[0] instanceof Inventory);
|
2020-04-28 20:18:22 +00:00
|
|
|
}
|
|
|
|
}
|