introduction of cherry door

This commit is contained in:
Justin Parsell 2021-03-17 19:56:23 -04:00
parent 78eaec1b10
commit 03b856afef
9 changed files with 183 additions and 2 deletions

View File

@ -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));
}
}

View File

@ -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>();

View File

@ -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

View File

@ -0,0 +1,124 @@
{
"variants": {
"facing=east,half=lower,hinge=left,open=false": {
"model": "minecraft:block/oak_door_bottom"
},
"facing=east,half=lower,hinge=left,open=true": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 90
},
"facing=east,half=lower,hinge=right,open=false": {
"model": "minecraft:block/oak_door_bottom_hinge"
},
"facing=east,half=lower,hinge=right,open=true": {
"model": "minecraft:block/oak_door_bottom",
"y": 270
},
"facing=east,half=upper,hinge=left,open=false": {
"model": "minecraft:block/oak_door_top"
},
"facing=east,half=upper,hinge=left,open=true": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 90
},
"facing=east,half=upper,hinge=right,open=false": {
"model": "minecraft:block/oak_door_top_hinge"
},
"facing=east,half=upper,hinge=right,open=true": {
"model": "minecraft:block/oak_door_top",
"y": 270
},
"facing=north,half=lower,hinge=left,open=false": {
"model": "minecraft:block/oak_door_bottom",
"y": 270
},
"facing=north,half=lower,hinge=left,open=true": {
"model": "minecraft:block/oak_door_bottom_hinge"
},
"facing=north,half=lower,hinge=right,open=false": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 270
},
"facing=north,half=lower,hinge=right,open=true": {
"model": "minecraft:block/oak_door_bottom",
"y": 180
},
"facing=north,half=upper,hinge=left,open=false": {
"model": "minecraft:block/oak_door_top",
"y": 270
},
"facing=north,half=upper,hinge=left,open=true": {
"model": "minecraft:block/oak_door_top_hinge"
},
"facing=north,half=upper,hinge=right,open=false": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 270
},
"facing=north,half=upper,hinge=right,open=true": {
"model": "minecraft:block/oak_door_top",
"y": 180
},
"facing=south,half=lower,hinge=left,open=false": {
"model": "minecraft:block/oak_door_bottom",
"y": 90
},
"facing=south,half=lower,hinge=left,open=true": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 180
},
"facing=south,half=lower,hinge=right,open=false": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 90
},
"facing=south,half=lower,hinge=right,open=true": {
"model": "minecraft:block/oak_door_bottom"
},
"facing=south,half=upper,hinge=left,open=false": {
"model": "minecraft:block/oak_door_top",
"y": 90
},
"facing=south,half=upper,hinge=left,open=true": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 180
},
"facing=south,half=upper,hinge=right,open=false": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 90
},
"facing=south,half=upper,hinge=right,open=true": {
"model": "minecraft:block/oak_door_top"
},
"facing=west,half=lower,hinge=left,open=false": {
"model": "minecraft:block/oak_door_bottom",
"y": 180
},
"facing=west,half=lower,hinge=left,open=true": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 270
},
"facing=west,half=lower,hinge=right,open=false": {
"model": "minecraft:block/oak_door_bottom_hinge",
"y": 180
},
"facing=west,half=lower,hinge=right,open=true": {
"model": "minecraft:block/oak_door_bottom",
"y": 90
},
"facing=west,half=upper,hinge=left,open=false": {
"model": "minecraft:block/oak_door_top",
"y": 180
},
"facing=west,half=upper,hinge=left,open=true": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 270
},
"facing=west,half=upper,hinge=right,open=false": {
"model": "minecraft:block/oak_door_top_hinge",
"y": 180
},
"facing=west,half=upper,hinge=right,open=true": {
"model": "minecraft:block/oak_door_top",
"y": 90
}
}
}

View File

@ -5,5 +5,6 @@
"block.cherry.stripped_cherry_wood": "Stripped Cherry Wood",
"block.cherry.cherry_leaves": "Cherry Leaves",
"block.cherry.cherry_planks": "Cherry Planks",
"block.cherry.cherry_fence": "Cherry Fence"
"block.cherry.cherry_fence": "Cherry Fence",
"block.cherry.cherry_door": "Cherry Door"
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/door_top",
"textures": {
"top": "minecraft:block/acacia_door_top",
"bottom": "minecraft:block/acacia_door_bottom"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/door_top_rh",
"textures": {
"top": "minecraft:block/acacia_door_top",
"bottom": "minecraft:block/acacia_door_bottom"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/door_top",
"textures": {
"top": "minecraft:block/acacia_door_top",
"bottom": "minecraft:block/acacia_door_bottom"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/door_top_rh",
"textures": {
"top": "minecraft:block/acacia_door_top",
"bottom": "minecraft:block/acacia_door_bottom"
}
}