introduction of cherry door
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package net.parsell.cherry.common.blocks;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.enums.DoorHinge;
|
||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
public class CherryDoor extends DoorBlock{
|
||||
public CherryDoor(Settings settings) {
|
||||
super(settings);
|
||||
this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(FACING, Direction.NORTH)).with(OPEN, false)).with(HINGE, DoorHinge.LEFT)).with(POWERED, false)).with(HALF, DoubleBlockHalf.LOWER));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.parsell.cherry.core;
|
||||
|
||||
import com.google.common.collect.ImmutableMap.Builder;
|
||||
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||
@@ -10,8 +11,10 @@ import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.FenceBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
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.mixin.AxeItemAccessor;
|
||||
|
||||
public class CherryBlocks {
|
||||
@@ -21,7 +24,8 @@ public class CherryBlocks {
|
||||
public static final Block CHERRYWOODSTRIPPED = registerPillar("stripped_cherry_wood", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_WOOD), 5, 5);
|
||||
public static final Block CHERRYLEAVES = registerLeaves("cherry_leaves", FabricBlockSettings.copyOf(Blocks.OAK_LEAVES), 30, 60, 6649929);
|
||||
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);
|
||||
public static final Block CHERRYFENCE = registerFence("cherry_fence", FabricBlockSettings.copyOf(Blocks.OAK_FENCE), 5, 20); // TODO: Textures, 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)
|
||||
|
||||
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
||||
Block block = new Block(settings);
|
||||
@@ -54,6 +58,14 @@ public class CherryBlocks {
|
||||
return block;
|
||||
}
|
||||
|
||||
private static Block registerDoor(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
|
||||
Block block = new CherryDoor(settings);
|
||||
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
||||
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
||||
BlockRenderLayerMap.INSTANCE.putBlock(block, RenderLayer.getCutout());
|
||||
return block;
|
||||
}
|
||||
|
||||
public static void init(){
|
||||
// Register unique logs
|
||||
Builder<Block, Block> STRIPPED_BLOCKS = new Builder<Block, Block>();
|
||||
|
||||
@@ -17,6 +17,7 @@ public class CherryItems {
|
||||
registerBlockItem("cherry_leaves", CherryBlocks.CHERRYLEAVES, ItemGroup.BUILDING_BLOCKS, 6649929);
|
||||
registerBlockItem("cherry_planks", CherryBlocks.CHERRYPLANKS, ItemGroup.BUILDING_BLOCKS);
|
||||
registerBlockItem("cherry_fence", CherryBlocks.CHERRYFENCE, ItemGroup.BUILDING_BLOCKS);
|
||||
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
|
||||
}
|
||||
|
||||
// Register a standard blockItem
|
||||
|
||||
Reference in New Issue
Block a user