TheBrokenRail
b1604023ad
All checks were successful
ScriptCraft/pipeline/head This commit looks good
35 lines
1.9 KiB
Java
35 lines
1.9 KiB
Java
package com.thebrokenrail.scriptcraft.bridge;
|
|
|
|
import com.thebrokenrail.scriptcraft.api.CustomBlock;
|
|
import com.thebrokenrail.scriptcraft.api.CustomBlockEntity;
|
|
import com.thebrokenrail.scriptcraft.api.CustomBlockWithEntity;
|
|
import com.thebrokenrail.scriptcraft.api.CustomItem;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.block.entity.BlockEntityType;
|
|
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.registerBlockWithEntity", args -> {
|
|
Registry.register(Registry.BLOCK, new Identifier((String) args[0]), new CustomBlockWithEntity((Block.Settings) args[1], new Identifier((String) args[0])));
|
|
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier((String) args[0]), BlockEntityType.Builder.create(() -> new CustomBlockEntity(Registry.BLOCK_ENTITY_TYPE.get(new Identifier((String) args[0])), new Identifier((String) args[0])), Registry.BLOCK.get(new Identifier((String) args[0]))).build(null));
|
|
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;
|
|
});
|
|
}
|
|
}
|