Introduction of trapdoor
This commit is contained in:
parent
33ffbd765f
commit
4b19f64b65
|
@ -0,0 +1,15 @@
|
||||||
|
package net.parsell.cherry.common.blocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.TrapdoorBlock;
|
||||||
|
import net.minecraft.block.enums.BlockHalf;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
|
||||||
|
public class CherryTrapdoorBlock extends TrapdoorBlock{
|
||||||
|
|
||||||
|
public CherryTrapdoorBlock(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH)).with(OPEN, false)).with(HALF, BlockHalf.BOTTOM)).with(POWERED, false)).with(WATERLOGGED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -15,7 +15,8 @@ import net.minecraft.block.PillarBlock;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.parsell.cherry.common.blocks.CherryDoor;
|
import net.parsell.cherry.common.blocks.CherryDoorBlock;
|
||||||
|
import net.parsell.cherry.common.blocks.CherryTrapdoorBlock;
|
||||||
import net.parsell.cherry.mixin.AxeItemAccessor;
|
import net.parsell.cherry.mixin.AxeItemAccessor;
|
||||||
|
|
||||||
public class CherryBlocks {
|
public class CherryBlocks {
|
||||||
|
@ -29,7 +30,8 @@ public class CherryBlocks {
|
||||||
public static final Block CHERRYPLANKS = registerBlock("cherry_planks", FabricBlockSettings.copyOf(Blocks.OAK_PLANKS), 5, 20);
|
public static final Block CHERRYPLANKS = registerBlock("cherry_planks", FabricBlockSettings.copyOf(Blocks.OAK_PLANKS), 5, 20);
|
||||||
public static final Block CHERRYFENCE = registerFence("cherry_fence", FabricBlockSettings.copyOf(Blocks.OAK_FENCE), 5, 20); // TODO: Textures, tags (as required)
|
public static final Block CHERRYFENCE = registerFence("cherry_fence", FabricBlockSettings.copyOf(Blocks.OAK_FENCE), 5, 20); // TODO: Textures, tags (as required)
|
||||||
public static final Block CHERRYFENCEGATE = registerFenceGate("cherry_fence_gate", FabricBlockSettings.copyOf(Blocks.OAK_FENCE_GATE), 5, 20); // Textures, recipe, loot_tables, tags (as required)
|
public static final Block CHERRYFENCEGATE = registerFenceGate("cherry_fence_gate", FabricBlockSettings.copyOf(Blocks.OAK_FENCE_GATE), 5, 20); // Textures, recipe, loot_tables, tags (as required)
|
||||||
public static final Block CHERRYDOOR = registerDoor("cherry_door", FabricBlockSettings.copyOf(Blocks.OAK_DOOR), 5, 20); // TODO: Textures, recipe, loot_tables, tags (as required)
|
public static final Block CHERRYDOOR = registerDoor("cherry_door", FabricBlockSettings.copyOf(Blocks.OAK_DOOR), 5, 20); // TODO: recipe, loot_tables, tags (as required)
|
||||||
|
public static final Block CHERRYTRAPDOOR = registerTrapDoor("cherry_trapdoor", FabricBlockSettings.copyOf(Blocks.OAK_TRAPDOOR), 5, 20); //TODO: recipe, loot_tables, tags (as required)
|
||||||
|
|
||||||
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
||||||
Block block = new Block(settings);
|
Block block = new Block(settings);
|
||||||
|
@ -78,7 +80,15 @@ public class CherryBlocks {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Block registerDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
|
private static Block registerDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
|
||||||
Block block = new CherryDoor(settings);
|
Block block = new CherryDoorBlock(settings);
|
||||||
|
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
||||||
|
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
||||||
|
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Block registerTrapDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
|
||||||
|
Block block = new CherryTrapdoorBlock(settings);
|
||||||
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
||||||
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
||||||
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
|
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class CherryItems {
|
||||||
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, ItemGroup.BUILDING_BLOCKS);
|
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, ItemGroup.BUILDING_BLOCKS);
|
||||||
registerBlockItem("cherry_fence_gate", CherryBlocks.CHERRYFENCEGATE, ItemGroup.BUILDING_BLOCKS);
|
registerBlockItem("cherry_fence_gate", CherryBlocks.CHERRYFENCEGATE, ItemGroup.BUILDING_BLOCKS);
|
||||||
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
|
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
|
||||||
|
registerBlockItem("cherry_trapdoor", CherryBlocks.CHERRYTRAPDOOR, ItemGroup.BUILDING_BLOCKS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register a standard blockItem
|
// Register a standard blockItem
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east,half=bottom,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_bottom",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=east,half=bottom,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=east,half=top,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_top",
|
||||||
|
"y": 90
|
||||||
|
},
|
||||||
|
"facing=east,half=top,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"x": 180,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=north,half=bottom,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_bottom"
|
||||||
|
},
|
||||||
|
"facing=north,half=bottom,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open"
|
||||||
|
},
|
||||||
|
"facing=north,half=top,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_top"
|
||||||
|
},
|
||||||
|
"facing=north,half=top,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"x": 180,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,half=bottom,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_bottom",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,half=bottom,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,half=top,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_top",
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=south,half=top,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"x": 180,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"facing=west,half=bottom,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_bottom",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=west,half=bottom,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=west,half=top,open=false": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_top",
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=west,half=top,open=true": {
|
||||||
|
"model": "cherry:block/cherry_trapdoor_open",
|
||||||
|
"x": 180,
|
||||||
|
"y": 90
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,5 +7,6 @@
|
||||||
"block.cherry.cherry_planks": "Cherry Planks",
|
"block.cherry.cherry_planks": "Cherry Planks",
|
||||||
"block.cherry.cherry_fence": "Cherry Fence",
|
"block.cherry.cherry_fence": "Cherry Fence",
|
||||||
"block.cherry.cherry_fence_gate": "Cherry Fence Gate",
|
"block.cherry.cherry_fence_gate": "Cherry Fence Gate",
|
||||||
"block.cherry.cherry_door": "Cherry Door"
|
"block.cherry.cherry_door": "Cherry Door",
|
||||||
|
"block.cherry.cherry_trapdoor": "Cherry Trapdoor"
|
||||||
}
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/template_orientable_trapdoor_bottom",
|
||||||
|
"textures": {
|
||||||
|
"texture": "cherry:block/cherry_trapdoor"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/template_orientable_trapdoor_open",
|
||||||
|
"textures": {
|
||||||
|
"texture": "cherry:block/cherry_trapdoor"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/template_orientable_trapdoor_top",
|
||||||
|
"textures": {
|
||||||
|
"texture": "cherry:block/cherry_trapdoor"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "cherry:block/cherry_trapdoor"
|
||||||
|
}
|
Loading…
Reference in New Issue