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.
ScriptCraft/src/main/java/com/thebrokenrail/scriptcraft/bridge/RegistryBridge.java

27 lines
1.2 KiB
Java
Raw Normal View History

2020-04-25 13:33:17 +00:00
package com.thebrokenrail.scriptcraft.bridge;
import com.thebrokenrail.scriptcraft.api.CustomBlock;
import com.thebrokenrail.scriptcraft.api.CustomItem;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
class RegistryBridge {
static void register() {
Bridges.addBridge("Registry.registerBlock", args -> {
Registry.register(Registry.BLOCK, new Identifier((String) args[0]), new CustomBlock((Block.Settings) args[1], new Identifier((String) args[0])));
return null;
});
Bridges.addBridge("Registry.registerItem", args -> {
Registry.register(Registry.ITEM, new Identifier((String) args[0]), new CustomItem((Item.Settings) args[1], new Identifier((String) args[0])));
return null;
});
Bridges.addBridge("Registry.registerBlockItem", args -> {
Registry.register(Registry.ITEM, new Identifier((String) args[0]), new BlockItem(Registry.BLOCK.get(new Identifier((String) args[2])), (Item.Settings) args[1]));
return null;
});
}
}