Ladder patterns
This commit is contained in:
parent
285addfc8b
commit
d99f8225a8
48 changed files with 62 additions and 695 deletions
|
@ -1,5 +1,7 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -15,17 +17,20 @@ import net.minecraft.state.property.DirectionProperty;
|
|||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.BlockMirror;
|
||||
import net.minecraft.util.BlockRotation;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.client.ERenderLayer;
|
||||
import ru.betterend.client.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable {
|
||||
public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable, Patterned {
|
||||
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
|
||||
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||
protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D);
|
||||
|
@ -45,15 +50,14 @@ public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable {
|
|||
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH:
|
||||
return NORTH_SHAPE;
|
||||
case SOUTH:
|
||||
return SOUTH_SHAPE;
|
||||
case WEST:
|
||||
return WEST_SHAPE;
|
||||
case EAST:
|
||||
default:
|
||||
return EAST_SHAPE;
|
||||
default:
|
||||
return NORTH_SHAPE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,4 +135,24 @@ public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable {
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data, String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.LADDER_ITEM_MODEL, blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.LADDER_MODEL, blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.LADDER_STATES_PATTERN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public interface Patterned {
|
|||
public final static Identifier SAPLING_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_sapling.json");
|
||||
public final static Identifier GATE_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_fence_gate.json");
|
||||
public final static Identifier TRAPDOOR_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_trapdoor.json");
|
||||
public final static Identifier LADDER_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_ladder.json");
|
||||
|
||||
//Models Block
|
||||
public final static Identifier BASE_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_block.json");
|
||||
|
@ -56,11 +57,13 @@ public interface Patterned {
|
|||
public final static Identifier GATE_MODEL_OPEN = BetterEnd.makeID("patterns/block/pattern_fence_gate_open.json");
|
||||
public final static Identifier GATE_MODEL_WALL_OPEN = BetterEnd.makeID("patterns/block/pattern_wall_gate_open.json");
|
||||
public final static Identifier TRAPDOOR_MODEL = BetterEnd.makeID("patterns/block/pattern_trapdoor.json");
|
||||
public final static Identifier LADDER_MODEL = BetterEnd.makeID("patterns/block/pattern_ladder.json");
|
||||
|
||||
//Models Item
|
||||
public final static Identifier WALL_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||
public final static Identifier FENCE_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_fence.json");
|
||||
public final static Identifier BUTTON_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||
public final static Identifier LADDER_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_ladder.json");
|
||||
public final static Identifier ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_item.json");
|
||||
|
||||
default String getStatesPattern(Reader data, String name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue