Compare commits

...

9 Commits

43 changed files with 684 additions and 7 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

@ -1,27 +1,57 @@
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;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.block.FenceBlock;
import net.minecraft.block.FenceGateBlock;
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 {
public static final Block CHERRYLOG = registerPillar("cherry_log", FabricBlockSettings.copyOf(Blocks.OAK_LOG), 5, 5);
private static Builder<Block, Block> STRIPPABLE_BLOCKS = new Builder<Block, Block>();
public static final Block CHERRYLOGSTRIPPED = registerPillar("stripped_cherry_log", FabricBlockSettings.copyOf(Blocks.STRIPPED_OAK_LOG), 5, 5);
public static final Block CHERRYLOG = registerPillar("cherry_log", FabricBlockSettings.copyOf(Blocks.OAK_LOG), 5, 5, CHERRYLOGSTRIPPED);
public static final Block CHERRYWOOD = registerPillar("cherry_wood", FabricBlockSettings.copyOf(Blocks.OAK_WOOD), 5, 5);
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); // 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)
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);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
return block;
}
private static Block registerFence(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new FenceBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
return block;
}
private static Block registerFenceGate(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
Block block = new FenceGateBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
return block;
}
private static Block registerPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread){
Block block = new PillarBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
@ -29,6 +59,14 @@ public class CherryBlocks {
return block;
}
private static Block registerPillar(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, Block strippedVariant){
Block block = new PillarBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
STRIPPABLE_BLOCKS.put(block, strippedVariant);
return block;
}
private static Block registerLeaves(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread, int color){
Block block = new LeavesBlock(settings);
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
@ -39,6 +77,21 @@ 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(){
// Ensure not to overwrite on previous strippable logs
AxeItemAccessor.getStrippedLogs().forEach((log, strippedLog) -> {
STRIPPABLE_BLOCKS.put(log, strippedLog);
});
// Register unique logs
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
}
}

View File

@ -11,8 +11,14 @@ import net.minecraft.util.registry.Registry;
public class CherryItems {
private static void registerBlockItems(){
registerBlockItem("cherry_log", CherryBlocks.CHERRYLOG, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_wood", CherryBlocks.CHERRYWOOD, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("stripped_cherry_log", CherryBlocks.CHERRYLOGSTRIPPED, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("stripped_cherry_wood", CherryBlocks.CHERRYWOODSTRIPPED, ItemGroup.BUILDING_BLOCKS);
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_fence_gate", CherryBlocks.CHERRYFENCEGATE, ItemGroup.BUILDING_BLOCKS);
registerBlockItem("cherry_door", CherryBlocks.CHERRYDOOR, ItemGroup.BUILDING_BLOCKS);
}
// Register a standard blockItem

View File

@ -0,0 +1,22 @@
package net.parsell.cherry.mixin;
import java.util.Map;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.block.Block;
import net.minecraft.item.AxeItem;
@Mixin(AxeItem.class)
public interface AxeItemAccessor {
@Accessor("STRIPPED_BLOCKS")
public static Map<Block, Block> getStrippedLogs(){
throw new AssertionError();
}
@Accessor("STRIPPED_BLOCKS")
public static void setStrippedLogs(Map<Block, Block> STRIPPED_BLOCKS){
throw new AssertionError();
}
}

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

@ -0,0 +1,48 @@
{
"multipart": [
{
"apply": {
"model": "minecraft:block/acacia_fence_post"
}
},
{
"when": {
"north": "true"
},
"apply": {
"model": "minecraft:block/acacia_fence_side",
"uvlock": true
}
},
{
"when": {
"east": "true"
},
"apply": {
"model": "minecraft:block/acacia_fence_side",
"y": 90,
"uvlock": true
}
},
{
"when": {
"south": "true"
},
"apply": {
"model": "minecraft:block/acacia_fence_side",
"y": 180,
"uvlock": true
}
},
{
"when": {
"west": "true"
},
"apply": {
"model": "minecraft:block/acacia_fence_side",
"y": 270,
"uvlock": true
}
}
]
}

View File

@ -0,0 +1,80 @@
{
"variants": {
"facing=east,in_wall=false,open=false": {
"uvlock": true,
"y": 270,
"model": "minecraft:block/acacia_fence_gate"
},
"facing=east,in_wall=false,open=true": {
"uvlock": true,
"y": 270,
"model": "minecraft:block/acacia_fence_gate_open"
},
"facing=east,in_wall=true,open=false": {
"uvlock": true,
"y": 270,
"model": "minecraft:block/acacia_fence_gate_wall"
},
"facing=east,in_wall=true,open=true": {
"uvlock": true,
"y": 270,
"model": "minecraft:block/acacia_fence_gate_wall_open"
},
"facing=north,in_wall=false,open=false": {
"uvlock": true,
"y": 180,
"model": "minecraft:block/acacia_fence_gate"
},
"facing=north,in_wall=false,open=true": {
"uvlock": true,
"y": 180,
"model": "minecraft:block/acacia_fence_gate_open"
},
"facing=north,in_wall=true,open=false": {
"uvlock": true,
"y": 180,
"model": "minecraft:block/acacia_fence_gate_wall"
},
"facing=north,in_wall=true,open=true": {
"uvlock": true,
"y": 180,
"model": "minecraft:block/acacia_fence_gate_wall_open"
},
"facing=south,in_wall=false,open=false": {
"uvlock": true,
"model": "minecraft:block/acacia_fence_gate"
},
"facing=south,in_wall=false,open=true": {
"uvlock": true,
"model": "minecraft:block/acacia_fence_gate_open"
},
"facing=south,in_wall=true,open=false": {
"uvlock": true,
"model": "minecraft:block/acacia_fence_gate_wall"
},
"facing=south,in_wall=true,open=true": {
"uvlock": true,
"model": "minecraft:block/acacia_fence_gate_wall_open"
},
"facing=west,in_wall=false,open=false": {
"uvlock": true,
"y": 90,
"model": "minecraft:block/acacia_fence_gate"
},
"facing=west,in_wall=false,open=true": {
"uvlock": true,
"y": 90,
"model": "minecraft:block/acacia_fence_gate_open"
},
"facing=west,in_wall=true,open=false": {
"uvlock": true,
"y": 90,
"model": "minecraft:block/acacia_fence_gate_wall"
},
"facing=west,in_wall=true,open=true": {
"uvlock": true,
"y": 90,
"model": "minecraft:block/acacia_fence_gate_wall_open"
}
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"axis=y": {
"model": "cherry:block/cherry_wood"
},
"axis=z": {
"model": "cherry:block/cherry_wood",
"x": 90
},
"axis=x": {
"model": "cherry:block/cherry_wood",
"x": 90,
"y": 90
}
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"axis=y": {
"model": "cherry:block/stripped_cherry_log"
},
"axis=z": {
"model": "cherry:block/stripped_cherry_log",
"x": 90
},
"axis=x": {
"model": "cherry:block/stripped_cherry_log",
"x": 90,
"y": 90
}
}
}

View File

@ -0,0 +1,16 @@
{
"variants": {
"axis=y": {
"model": "cherry:block/stripped_cherry_wood"
},
"axis=z": {
"model": "cherry:block/stripped_cherry_wood",
"x": 90
},
"axis=x": {
"model": "cherry:block/stripped_cherry_wood",
"x": 90,
"y": 90
}
}
}

View File

@ -1,5 +1,11 @@
{
"block.cherry.cherry_log": "Cherry Log",
"block.cherry.cherry_wood": "Cherry Wood",
"block.cherry.stripped_cherry_log": "Stripped Cherry Log",
"block.cherry.stripped_cherry_wood": "Stripped Cherry Wood",
"block.cherry.cherry_leaves": "Cherry Leaves",
"block.cherry.cherry_planks": "Cherry Planks"
"block.cherry.cherry_planks": "Cherry Planks",
"block.cherry.cherry_fence": "Cherry Fence",
"block.cherry.cherry_fence_gate": "Cherry Fence Gate",
"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"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fence_gate",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fence_gate_open",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fence_gate_wall",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/template_fence_gate_wall_open",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/fence_inventory",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/fence_post",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/fence_side",
"textures": {
"texture": "minecraft:block/oak_planks"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "cherry:block/cherry_log",
"side": "cherry:block/cherry_log"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "cherry:block/stripped_cherry_log_top",
"side": "cherry:block/stripped_cherry_log"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "block/cube_column",
"textures": {
"end": "cherry:block/stripped_cherry_log",
"side": "cherry:block/stripped_cherry_log"
}
}

View File

@ -0,0 +1,4 @@
{
"parent": "cherry:block/cherry_wood"
}

View File

@ -0,0 +1,4 @@
{
"parent": "cherry:block/stripped_cherry_log"
}

View File

@ -0,0 +1,4 @@
{
"parent": "cherry:block/stripped_cherry_wood"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -6,7 +6,7 @@
"mixins": [
],
"client": [
"CherryMixin"
"AxeItemAccessor"
],
"injectors": {
"defaultRequire": 1

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "cherry:cherry_fence"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "cherry:cherry_planks"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "cherry:cherry_wood"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "cherry:stripped_cherry_wood"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "cherry:stripped_cherry_wood"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"group": "wooden_fence",
"pattern": [
"W#W",
"W#W"
],
"key": {
"#": {
"item": "minecraft:stick"
},
"W": {
"item": "cherry:cherry_planks"
}
},
"result": {
"item": "cherry:cherry_fence",
"count": 3
}
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"group": "bark",
"pattern": [
"##",
"##"
],
"key": {
"#": {
"item": "cherry:cherry_log"
}
},
"result": {
"item": "cherry:cherry_wood",
"count": 3
}
}

View File

@ -0,0 +1,17 @@
{
"type": "minecraft:crafting_shaped",
"group": "bark",
"pattern": [
"##",
"##"
],
"key": {
"#": {
"item": "cherry:stripped_cherry_log"
}
},
"result": {
"item": "cherry:stripped_cherry_wood",
"count": 3
}
}

View File

@ -1,6 +1,9 @@
{
"replace": false,
"values": [
"cherry:cherry_log"
"cherry:cherry_log",
"cherry:cherry_wood",
"cherry:stripped_cherry_log",
"cherry:stripped_cherry_wood"
]
}

View File

@ -1,6 +1,9 @@
{
"replace": false,
"values": [
"cherry:cherry_log"
"cherry:cherry_log",
"cherry:cherry_wood",
"cherry:stripped_cherry_log",
"cherry:stripped_cherry_wood"
]
}
}

View File

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

View File

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