introduction of pressure plate
This commit is contained in:
parent
4bf3a96749
commit
75ffe5fad7
|
@ -0,0 +1,12 @@
|
|||
package net.parsell.cherry.common.blocks;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
|
||||
public class CherryPressurePlate extends PressurePlateBlock{
|
||||
public CherryPressurePlate(PressurePlateBlock.ActivationRule type, AbstractBlock.Settings settings){
|
||||
super (type, settings);
|
||||
this.setDefaultState((BlockState)((BlockState)this.stateManager.getDefaultState()).with(POWERED, false));
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ import net.minecraft.block.FenceBlock;
|
|||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.block.PillarBlock;
|
||||
import net.minecraft.block.PressurePlateBlock;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
@ -36,7 +37,7 @@ public class CherryBlocks {
|
|||
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);
|
||||
public static final Block CHERRYPRESSUREPLATE = registerPressurePlate("cherry_pressure_plate", PressurePlateBlock.ActivationRule.EVERYTHING, 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);
|
||||
|
@ -66,6 +67,13 @@ public class CherryBlocks {
|
|||
return block;
|
||||
}
|
||||
|
||||
private static Block registerPressurePlate(String blockID, PressurePlateBlock.ActivationRule rule, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
||||
Block block = new CherryPressurePlate(rule, 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);
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"variants": {
|
||||
"powered=false": {
|
||||
"model": "cherry:block/cherry_pressure_plate"
|
||||
},
|
||||
"powered=true": {
|
||||
"model": "cherry:block/cherry_pressure_plate_down"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/pressure_plate_up",
|
||||
"textures": {
|
||||
"texture": "cherry:block/cherry_planks"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:block/pressure_plate_down",
|
||||
"textures": {
|
||||
"texture": "cherry:block/cherry_planks"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "cherry:block/cherry_pressure_plate"
|
||||
}
|
Loading…
Reference in New Issue