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.
Twine/src/main/java/com/thebrokenrail/twine/Twine.java

74 lines
3.9 KiB
Java
Raw Normal View History

2020-06-14 03:04:21 +00:00
package com.thebrokenrail.twine;
2020-06-17 16:26:44 +00:00
import com.thebrokenrail.twine.advancement.BoatCriterion;
import com.thebrokenrail.twine.block.CreativeItemSpawnerBlock;
2020-06-17 21:57:52 +00:00
import com.thebrokenrail.twine.block.CreativeURLOpenerBlock;
2020-06-14 03:04:21 +00:00
import com.thebrokenrail.twine.block.GlowingObsidianBlock;
import com.thebrokenrail.twine.item.BackpackItem;
import com.thebrokenrail.twine.item.DivinerItem;
import com.thebrokenrail.twine.mixin.CriteriaHook;
2020-06-17 16:26:44 +00:00
import com.thebrokenrail.twine.util.backpack.gui.BackpackScreenHandler;
import com.thebrokenrail.twine.util.boat.gui.BoatCraftingScreenHandler;
2020-06-14 03:04:21 +00:00
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
2020-06-15 23:14:36 +00:00
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.block.Block;
2020-06-16 00:30:22 +00:00
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
2020-06-17 16:26:44 +00:00
import net.minecraft.screen.CraftingScreenHandler;
2020-06-14 03:04:21 +00:00
import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.tag.Tag;
2020-06-14 03:04:21 +00:00
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class Twine implements ModInitializer {
public static final String NAMESPACE = "twine";
public static final GlowingObsidianBlock GLOWING_OBSIDIAN = new GlowingObsidianBlock();
public static final CreativeItemSpawnerBlock CREATIVE_ITEM_SPAWNER_BLOCK = new CreativeItemSpawnerBlock();
2020-06-17 21:57:52 +00:00
public static final CreativeURLOpenerBlock CREATIVE_URL_OPENER_BLOCK = new CreativeURLOpenerBlock();
2020-06-14 03:04:21 +00:00
public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(new Identifier(NAMESPACE, "item_group"), () -> new ItemStack(GLOWING_OBSIDIAN));
public static final Item SMALL_BACKPACK = new BackpackItem(false);
public static final Item LARGE_BACKPACK = new BackpackItem(true);
public static final Item DIVINER = new DivinerItem();
public static final Tag<Block> ARTIFICIAL_BLOCKS_TAG = TagRegistry.block(new Identifier(NAMESPACE, "artificial_blocks"));
2020-06-14 03:04:21 +00:00
public static final int STAGE_COUNT = 6;
public static final int STAGE_TIME = 24000;
2020-06-15 23:14:36 +00:00
public static ScreenHandlerType<? extends GenericContainerScreenHandler> BACKPACK_SCREEN_TYPE;
2020-06-17 16:26:44 +00:00
public static ScreenHandlerType<? extends CraftingScreenHandler> BOAT_CRAFTING_SCREEN_TYPE;
2020-06-15 23:14:36 +00:00
2020-06-17 16:26:44 +00:00
public static BoatCriterion BOAT_CRITERION = CriteriaHook.callRegister(new BoatCriterion());
2020-06-14 03:04:21 +00:00
@Override
public void onInitialize() {
2020-06-17 16:26:44 +00:00
BACKPACK_SCREEN_TYPE = ScreenHandlerRegistry.registerExtended(new Identifier(NAMESPACE, "backpack"), BackpackScreenHandler::new);
BOAT_CRAFTING_SCREEN_TYPE = ScreenHandlerRegistry.registerSimple(new Identifier(NAMESPACE, "boat_crafting"), BoatCraftingScreenHandler::new);
2020-06-15 23:14:36 +00:00
2020-06-14 03:04:21 +00:00
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "small_backpack"), SMALL_BACKPACK);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "large_backpack"), LARGE_BACKPACK);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "diviner"), DIVINER);
2020-06-14 03:04:21 +00:00
Registry.register(Registry.BLOCK, new Identifier(NAMESPACE, "glowing_obsidian"), GLOWING_OBSIDIAN);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "glowing_obsidian"), new BlockItem(GLOWING_OBSIDIAN, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.BLOCK, new Identifier(NAMESPACE, "creative_item_spawner"), CREATIVE_ITEM_SPAWNER_BLOCK);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "creative_item_spawner"), new BlockItem(CREATIVE_ITEM_SPAWNER_BLOCK, new Item.Settings().group(ITEM_GROUP)));
2020-06-17 21:57:52 +00:00
Registry.register(Registry.BLOCK, new Identifier(NAMESPACE, "creative_url_opener"), CREATIVE_URL_OPENER_BLOCK);
Registry.register(Registry.ITEM, new Identifier(NAMESPACE, "creative_url_opener"), new BlockItem(CREATIVE_URL_OPENER_BLOCK, new Item.Settings().group(ITEM_GROUP)));
2020-06-14 03:04:21 +00:00
}
}