From 4bf3a967495365e72e58fb497cac62358cb7b117 Mon Sep 17 00:00:00 2001 From: Justin Parsell Date: Sat, 20 Mar 2021 21:55:52 -0400 Subject: [PATCH] introduced cherry button --- .../common/blocks/CherryButtonBlock.java | 10 ++ .../net/parsell/cherry/core/CherryBlocks.java | 9 ++ .../cherry/blockstates/cherry_button.json | 118 ++++++++++++++++++ .../resources/assets/cherry/lang/en_us.json | 3 +- .../cherry/models/block/cherry_button.json | 6 + .../models/block/cherry_button_inventory.json | 6 + .../models/block/cherry_button_pressed.json | 6 + .../cherry/models/item/cherry_button.json | 3 + 8 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/parsell/cherry/common/blocks/CherryButtonBlock.java create mode 100644 src/main/resources/assets/cherry/blockstates/cherry_button.json create mode 100644 src/main/resources/assets/cherry/models/block/cherry_button.json create mode 100644 src/main/resources/assets/cherry/models/block/cherry_button_inventory.json create mode 100644 src/main/resources/assets/cherry/models/block/cherry_button_pressed.json create mode 100644 src/main/resources/assets/cherry/models/item/cherry_button.json diff --git a/src/main/java/net/parsell/cherry/common/blocks/CherryButtonBlock.java b/src/main/java/net/parsell/cherry/common/blocks/CherryButtonBlock.java new file mode 100644 index 0000000..ec73df0 --- /dev/null +++ b/src/main/java/net/parsell/cherry/common/blocks/CherryButtonBlock.java @@ -0,0 +1,10 @@ +package net.parsell.cherry.common.blocks; + +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.WoodenButtonBlock; + +public class CherryButtonBlock extends WoodenButtonBlock { + public CherryButtonBlock(AbstractBlock.Settings settings) { + super(settings); + } +} diff --git a/src/main/java/net/parsell/cherry/core/CherryBlocks.java b/src/main/java/net/parsell/cherry/core/CherryBlocks.java index 8975080..e9b96ab 100644 --- a/src/main/java/net/parsell/cherry/core/CherryBlocks.java +++ b/src/main/java/net/parsell/cherry/core/CherryBlocks.java @@ -35,6 +35,8 @@ public class CherryBlocks { public static final Block CHERRYTRAPDOOR = registerTrapDoor("cherry_trapdoor", FabricBlockSettings.copyOf(Blocks.OAK_TRAPDOOR), 5, 20); //TODO: recipe, loot_tables, tags (as required) public static final Block CHERRYSLAB = registerSlab("cherry_slab", FabricBlockSettings.copyOf(Blocks.OAK_SLAB), 5, 20); // TODO: recipe, loot tables, tags (as required) public static final Block CHERRYSTAIRS = registerStair("cherry_stairs", CHERRYPLANKS.getDefaultState(), FabricBlockSettings.copyOf(Blocks.OAK_STAIRS), 5, 20); //TODO: recipe, loot tables, tags (as required) + public static final Block CHERRYBUTTON = registerButton("cherry_button", FabricBlockSettings.copyOf(Blocks.OAK_BUTTON), 5, 20); + public static final Block CHERRYPRESSUREPLATE = reigsterPressurePlate("cherry_pressure_plate", FabricBlockSettings.copyOf(Blocks.OAK_PRESSURE_PLATE), 5, 20); private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) { Block block = new Block(settings); @@ -57,6 +59,13 @@ public class CherryBlocks { return block; } + private static Block registerButton(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) { + Block block = new CherryButtonBlock(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); diff --git a/src/main/resources/assets/cherry/blockstates/cherry_button.json b/src/main/resources/assets/cherry/blockstates/cherry_button.json new file mode 100644 index 0000000..fca46f8 --- /dev/null +++ b/src/main/resources/assets/cherry/blockstates/cherry_button.json @@ -0,0 +1,118 @@ +{ + "variants": { + "face=ceiling,facing=east,powered=false": { + "model": "cherry:block/cherry_button", + "y": 270, + "x": 180 + }, + "face=ceiling,facing=east,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 270, + "x": 180 + }, + "face=ceiling,facing=north,powered=false": { + "model": "cherry:block/cherry_button", + "y": 180, + "x": 180 + }, + "face=ceiling,facing=north,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 180, + "x": 180 + }, + "face=ceiling,facing=south,powered=false": { + "model": "cherry:block/cherry_button", + "x": 180 + }, + "face=ceiling,facing=south,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "x": 180 + }, + "face=ceiling,facing=west,powered=false": { + "model": "cherry:block/cherry_button", + "y": 90, + "x": 180 + }, + "face=ceiling,facing=west,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 90, + "x": 180 + }, + "face=floor,facing=east,powered=false": { + "model": "cherry:block/cherry_button", + "y": 90 + }, + "face=floor,facing=east,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 90 + }, + "face=floor,facing=north,powered=false": { + "model": "cherry:block/cherry_button" + }, + "face=floor,facing=north,powered=true": { + "model": "cherry:block/cherry_button_pressed" + }, + "face=floor,facing=south,powered=false": { + "model": "cherry:block/cherry_button", + "y": 180 + }, + "face=floor,facing=south,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 180 + }, + "face=floor,facing=west,powered=false": { + "model": "cherry:block/cherry_button", + "y": 270 + }, + "face=floor,facing=west,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 270 + }, + "face=wall,facing=east,powered=false": { + "model": "cherry:block/cherry_button", + "y": 90, + "x": 90, + "uvlock": true + }, + "face=wall,facing=east,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 90, + "x": 90, + "uvlock": true + }, + "face=wall,facing=north,powered=false": { + "model": "cherry:block/cherry_button", + "x": 90, + "uvlock": true + }, + "face=wall,facing=north,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "x": 90, + "uvlock": true + }, + "face=wall,facing=south,powered=false": { + "model": "cherry:block/cherry_button", + "y": 180, + "x": 90, + "uvlock": true + }, + "face=wall,facing=south,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 180, + "x": 90, + "uvlock": true + }, + "face=wall,facing=west,powered=false": { + "model": "cherry:block/cherry_button", + "y": 270, + "x": 90, + "uvlock": true + }, + "face=wall,facing=west,powered=true": { + "model": "cherry:block/cherry_button_pressed", + "y": 270, + "x": 90, + "uvlock": true + } + } + } \ No newline at end of file diff --git a/src/main/resources/assets/cherry/lang/en_us.json b/src/main/resources/assets/cherry/lang/en_us.json index 7c38031..a6d06f0 100644 --- a/src/main/resources/assets/cherry/lang/en_us.json +++ b/src/main/resources/assets/cherry/lang/en_us.json @@ -10,5 +10,6 @@ "block.cherry.cherry_door": "Cherry Door", "block.cherry.cherry_trapdoor": "Cherry Trapdoor", "block.cherry.cherry_slab": "Cherry Slab", - "block.cherry.cherry_stairs": "Cherry Stairs" + "block.cherry.cherry_stairs": "Cherry Stairs", + "block.cherry.cherry_button": "Cherry Button" } \ No newline at end of file diff --git a/src/main/resources/assets/cherry/models/block/cherry_button.json b/src/main/resources/assets/cherry/models/block/cherry_button.json new file mode 100644 index 0000000..f28bf73 --- /dev/null +++ b/src/main/resources/assets/cherry/models/block/cherry_button.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button", + "textures": { + "texture": "cherry:block/cherry_planks" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/cherry/models/block/cherry_button_inventory.json b/src/main/resources/assets/cherry/models/block/cherry_button_inventory.json new file mode 100644 index 0000000..fc02828 --- /dev/null +++ b/src/main/resources/assets/cherry/models/block/cherry_button_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button_inventory", + "textures": { + "texture": "cherry:block/cherry_planks" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/cherry/models/block/cherry_button_pressed.json b/src/main/resources/assets/cherry/models/block/cherry_button_pressed.json new file mode 100644 index 0000000..d1cc131 --- /dev/null +++ b/src/main/resources/assets/cherry/models/block/cherry_button_pressed.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/button_pressed", + "textures": { + "texture": "cherry:block/cherry_planks" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/cherry/models/item/cherry_button.json b/src/main/resources/assets/cherry/models/item/cherry_button.json new file mode 100644 index 0000000..7f5d018 --- /dev/null +++ b/src/main/resources/assets/cherry/models/item/cherry_button.json @@ -0,0 +1,3 @@ +{ + "parent": "cherry:block/cherry_button_inventory" + } \ No newline at end of file