Introduction of trapdoor
This commit is contained in:
@@ -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.util.Identifier;
|
||||
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;
|
||||
|
||||
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 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 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) {
|
||||
Block block = new Block(settings);
|
||||
@@ -78,7 +80,15 @@ public class CherryBlocks {
|
||||
}
|
||||
|
||||
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);
|
||||
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
|
||||
@@ -94,4 +104,4 @@ public class CherryBlocks {
|
||||
// Register unique logs
|
||||
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ public class CherryItems {
|
||||
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, ItemGroup.BUILDING_BLOCKS);
|
||||
registerBlockItem("cherry_fence_gate", CherryBlocks.CHERRYFENCEGATE, ItemGroup.BUILDING_BLOCKS);
|
||||
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
|
||||
registerBlockItem("cherry_trapdoor", CherryBlocks.CHERRYTRAPDOOR, ItemGroup.BUILDING_BLOCKS);
|
||||
}
|
||||
|
||||
// Register a standard blockItem
|
||||
|
||||
Reference in New Issue
Block a user