Iron trapdoors, sure

This commit is contained in:
quat1024 2023-07-20 20:25:22 -04:00
parent 85aa01dc05
commit 48e8d07d63
9 changed files with 134 additions and 5 deletions

View File

@ -20,10 +20,7 @@ import io.github.cottonmc.templates.block.TemplateWallBlock;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
import net.minecraft.block.AbstractBlock; import net.minecraft.block.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntityType; import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.item.BlockItem; import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -52,13 +49,14 @@ public class Templates implements ModInitializer {
//door? (hard cause its a multiblock) //door? (hard cause its a multiblock)
public static final Block FENCE = Registry.register(Registries.BLOCK, id("fence") , new TemplateFenceBlock(cp(Blocks.OAK_FENCE))); public static final Block FENCE = Registry.register(Registries.BLOCK, id("fence") , new TemplateFenceBlock(cp(Blocks.OAK_FENCE)));
public static final Block FENCE_GATE = Registry.register(Registries.BLOCK, id("fence_gate") , new TemplateFenceGateBlock(cp(Blocks.OAK_FENCE_GATE))); public static final Block FENCE_GATE = Registry.register(Registries.BLOCK, id("fence_gate") , new TemplateFenceGateBlock(cp(Blocks.OAK_FENCE_GATE)));
public static final Block IRON_TRAPDOOR = Registry.register(Registries.BLOCK, id("iron_trapdoor") , new TemplateTrapdoorBlock(cp(Blocks.IRON_TRAPDOOR), BlockSetType.IRON));
public static final Block LEVER = Registry.register(Registries.BLOCK, id("lever") , new TemplateLeverBlock(cp(Blocks.LEVER))); public static final Block LEVER = Registry.register(Registries.BLOCK, id("lever") , new TemplateLeverBlock(cp(Blocks.LEVER)));
public static final Block PANE = Registry.register(Registries.BLOCK, id("pane") , new TemplatePaneBlock(cp(Blocks.GLASS_PANE))); public static final Block PANE = Registry.register(Registries.BLOCK, id("pane") , new TemplatePaneBlock(cp(Blocks.GLASS_PANE)));
public static final Block POST = Registry.register(Registries.BLOCK, id("post") , new TemplatePostBlock(cp(Blocks.OAK_FENCE))); public static final Block POST = Registry.register(Registries.BLOCK, id("post") , new TemplatePostBlock(cp(Blocks.OAK_FENCE)));
public static final Block PRESSURE_PLATE = Registry.register(Registries.BLOCK, id("pressure_plate"), new TemplatePressurePlateBlock(cp(Blocks.OAK_PRESSURE_PLATE))); public static final Block PRESSURE_PLATE = Registry.register(Registries.BLOCK, id("pressure_plate"), new TemplatePressurePlateBlock(cp(Blocks.OAK_PRESSURE_PLATE)));
public static final Block SLAB = Registry.register(Registries.BLOCK, id("slab") , new TemplateSlabBlock(cp(Blocks.OAK_SLAB))); public static final Block SLAB = Registry.register(Registries.BLOCK, id("slab") , new TemplateSlabBlock(cp(Blocks.OAK_SLAB)));
public static final Block STAIRS = Registry.register(Registries.BLOCK, id("stairs") , new TemplateStairsBlock(cp(Blocks.OAK_STAIRS))); public static final Block STAIRS = Registry.register(Registries.BLOCK, id("stairs") , new TemplateStairsBlock(cp(Blocks.OAK_STAIRS)));
public static final Block TRAPDOOR = Registry.register(Registries.BLOCK, id("trapdoor") , new TemplateTrapdoorBlock(cp(Blocks.OAK_TRAPDOOR))); public static final Block TRAPDOOR = Registry.register(Registries.BLOCK, id("trapdoor") , new TemplateTrapdoorBlock(cp(Blocks.OAK_TRAPDOOR), BlockSetType.OAK));
public static final Block WALL = Registry.register(Registries.BLOCK, id("wall") , new TemplateWallBlock(TemplateInteractionUtil.makeSettings())); public static final Block WALL = Registry.register(Registries.BLOCK, id("wall") , new TemplateWallBlock(TemplateInteractionUtil.makeSettings()));
public static final Block SLOPE = Registry.register(Registries.BLOCK, id("slope") , new TemplateSlopeBlock(TemplateInteractionUtil.makeSettings())); public static final Block SLOPE = Registry.register(Registries.BLOCK, id("slope") , new TemplateSlopeBlock(TemplateInteractionUtil.makeSettings()));
//30 degree slope (shallow/deep) //30 degree slope (shallow/deep)
@ -75,6 +73,7 @@ public class Templates implements ModInitializer {
CUBE, CUBE,
FENCE, FENCE,
FENCE_GATE, FENCE_GATE,
IRON_TRAPDOOR,
LEVER, LEVER,
PANE, PANE,
POST, POST,
@ -107,6 +106,7 @@ public class Templates implements ModInitializer {
Registry.register(Registries.ITEM, id("cube") , new BlockItem(CUBE, new Item.Settings())); Registry.register(Registries.ITEM, id("cube") , new BlockItem(CUBE, new Item.Settings()));
Registry.register(Registries.ITEM, id("fence") , new BlockItem(FENCE, new Item.Settings())); Registry.register(Registries.ITEM, id("fence") , new BlockItem(FENCE, new Item.Settings()));
Registry.register(Registries.ITEM, id("fence_gate") , new BlockItem(FENCE_GATE, new Item.Settings())); Registry.register(Registries.ITEM, id("fence_gate") , new BlockItem(FENCE_GATE, new Item.Settings()));
Registry.register(Registries.ITEM, id("iron_trapdoor") , new BlockItem(IRON_TRAPDOOR, new Item.Settings()));
Registry.register(Registries.ITEM, id("lever") , new BlockItem(LEVER, new Item.Settings())); Registry.register(Registries.ITEM, id("lever") , new BlockItem(LEVER, new Item.Settings()));
Registry.register(Registries.ITEM, id("pane") , new BlockItem(PANE, new Item.Settings())); Registry.register(Registries.ITEM, id("pane") , new BlockItem(PANE, new Item.Settings()));
Registry.register(Registries.ITEM, id("post") , new BlockItem(POST, new Item.Settings())); Registry.register(Registries.ITEM, id("post") , new BlockItem(POST, new Item.Settings()));
@ -139,6 +139,7 @@ public class Templates implements ModInitializer {
e.add(FENCE_GATE); e.add(FENCE_GATE);
// <-- insert door here // <-- insert door here
e.add(TRAPDOOR); e.add(TRAPDOOR);
e.add(IRON_TRAPDOOR);
e.add(PRESSURE_PLATE); e.add(PRESSURE_PLATE);
e.add(BUTTON); e.add(BUTTON);
e.add(LEVER); e.add(LEVER);

View File

@ -62,6 +62,7 @@ public class TemplatesClient implements ClientModInitializer {
Templates.CUBE, Templates.CUBE,
Templates.FENCE, Templates.FENCE,
Templates.FENCE_GATE, Templates.FENCE_GATE,
Templates.IRON_TRAPDOOR,
Templates.LEVER, Templates.LEVER,
Templates.PANE, Templates.PANE,
Templates.POST, Templates.POST,
@ -129,6 +130,7 @@ public class TemplatesClient implements ClientModInitializer {
provider.assignItemModel(Templates.id("cube_special") , Templates.CUBE); provider.assignItemModel(Templates.id("cube_special") , Templates.CUBE);
provider.assignItemModel(Templates.id("fence_inventory_special") , Templates.FENCE); provider.assignItemModel(Templates.id("fence_inventory_special") , Templates.FENCE);
provider.assignItemModel(Templates.id("fence_gate_special") , Templates.FENCE_GATE); provider.assignItemModel(Templates.id("fence_gate_special") , Templates.FENCE_GATE);
provider.assignItemModel(Templates.id("trapdoor_bottom_special") , Templates.IRON_TRAPDOOR);
provider.assignItemModel(Templates.id("lever_special") , Templates.LEVER); //TODO vanilla uses its own item model provider.assignItemModel(Templates.id("lever_special") , Templates.LEVER); //TODO vanilla uses its own item model
//provider.assignItemModel(Templates.id("glass_pane_side_special"), Templates.PANE); //Done with a regular json model actually //provider.assignItemModel(Templates.id("glass_pane_side_special"), Templates.PANE); //Done with a regular json model actually
provider.assignItemModel(Templates.id("fence_post_inventory_special") , Templates.POST); provider.assignItemModel(Templates.id("fence_post_inventory_special") , Templates.POST);

View File

@ -0,0 +1,69 @@
{
"variants": {
"facing=east,half=bottom,open=false": {
"model": "templates:trapdoor_bottom_special",
"y": 90
},
"facing=east,half=bottom,open=true": {
"model": "templates:trapdoor_open_special",
"y": 90
},
"facing=east,half=top,open=false": {
"model": "templates:trapdoor_top_special",
"y": 90
},
"facing=east,half=top,open=true": {
"model": "templates:trapdoor_open_special",
"x": 180,
"y": 270
},
"facing=north,half=bottom,open=false": {
"model": "templates:trapdoor_bottom_special"
},
"facing=north,half=bottom,open=true": {
"model": "templates:trapdoor_open_special"
},
"facing=north,half=top,open=false": {
"model": "templates:trapdoor_top_special"
},
"facing=north,half=top,open=true": {
"model": "templates:trapdoor_open_special",
"x": 180,
"y": 180
},
"facing=south,half=bottom,open=false": {
"model": "templates:trapdoor_bottom_special",
"y": 180
},
"facing=south,half=bottom,open=true": {
"model": "templates:trapdoor_open_special",
"y": 180
},
"facing=south,half=top,open=false": {
"model": "templates:trapdoor_top_special",
"y": 180
},
"facing=south,half=top,open=true": {
"model": "templates:trapdoor_open_special",
"x": 180,
"y": 0
},
"facing=west,half=bottom,open=false": {
"model": "templates:trapdoor_bottom_special",
"y": 270
},
"facing=west,half=bottom,open=true": {
"model": "templates:trapdoor_open_special",
"y": 270
},
"facing=west,half=top,open=false": {
"model": "templates:trapdoor_top_special",
"y": 270
},
"facing=west,half=top,open=true": {
"model": "templates:trapdoor_open_special",
"x": 180,
"y": 90
}
}
}

View File

@ -7,6 +7,7 @@
"block.templates.cube": "Cube Template", "block.templates.cube": "Cube Template",
"block.templates.fence": "Fence Template", "block.templates.fence": "Fence Template",
"block.templates.fence_gate": "Fence Gate Template", "block.templates.fence_gate": "Fence Gate Template",
"block.templates.iron_trapdoor": "Iron Trapdoor Template",
"block.templates.lever": "Lever Template", "block.templates.lever": "Lever Template",
"block.templates.pane": "Pane Template", "block.templates.pane": "Pane Template",
"block.templates.post": "Post Template", "block.templates.post": "Post Template",

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"templates:iron_trapdoor"
]
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"templates:iron_trapdoor"
]
}

View File

@ -8,6 +8,7 @@
"templates:cube", "templates:cube",
"templates:fence", "templates:fence",
"templates:fence_gate", "templates:fence_gate",
"templates:iron_trapdoor",
"templates:lever", "templates:lever",
"templates:pane", "templates:pane",
"templates:post", "templates:post",

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "templates:iron_trapdoor"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,24 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"III",
"III",
"~X~"
],
"key": {
"I": {
"item": "minecraft:bamboo"
},
"~": {
"item": "minecraft:string"
},
"X": {
"item": "minecraft:iron_ingot"
}
},
"result": {
"item": "templates:iron_trapdoor",
"count": 4
},
"group": "templates"
}