Fence Gate pattern
This commit is contained in:
parent
1dc48360dc
commit
7d0363483c
7 changed files with 146 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -9,15 +10,48 @@ import net.minecraft.block.BlockState;
|
|||
import net.minecraft.block.FenceGateBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
|
||||
public class BlockGate extends FenceGateBlock
|
||||
{
|
||||
public class BlockGate extends FenceGateBlock implements Patterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
public BlockGate(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).nonOpaque());
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data, String block) {
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("wall")) {
|
||||
if (block.contains("open")) {
|
||||
return Patterned.createJson(Patterned.GATE_MODEL_WALL_OPEN, parentId, block);
|
||||
} else {
|
||||
return Patterned.createJson(Patterned.GATE_MODEL_WALL_CLOSED, parentId, block);
|
||||
}
|
||||
}
|
||||
if (block.contains("open")) {
|
||||
return Patterned.createJson(Patterned.GATE_MODEL_OPEN, parentId, block);
|
||||
}
|
||||
return Patterned.createJson(Patterned.GATE_MODEL_CLOSED, parentId, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.GATE_STATES_PATTERN;
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ public interface Patterned {
|
|||
public final static Identifier PLATE_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_pressure_plate.json");
|
||||
public final static Identifier DOOR_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_door.json");
|
||||
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");
|
||||
|
||||
//Models Block
|
||||
public final static Identifier BASE_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_block.json");
|
||||
|
@ -48,6 +49,10 @@ public interface Patterned {
|
|||
public final static Identifier DOOR_MODEL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_door_bottom.json");
|
||||
public final static Identifier DOOR_MODEL_BOTTOM_HINGE = BetterEnd.makeID("patterns/block/pattern_door_bottom_hinge.json");
|
||||
public final static Identifier SAPLING_MODEL = BetterEnd.makeID("patterns/block/pattern_sapling.json");
|
||||
public final static Identifier GATE_MODEL_CLOSED = BetterEnd.makeID("patterns/block/pattern_fence_gate_closed.json");
|
||||
public final static Identifier GATE_MODEL_WALL_CLOSED = BetterEnd.makeID("patterns/block/pattern_wall_gate_closed.json");
|
||||
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");
|
||||
|
||||
//Models Item
|
||||
public final static Identifier WALL_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/template_fence_gate",
|
||||
"textures": {
|
||||
"texture": "betterend:block/%parent%"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/template_fence_gate_open",
|
||||
"textures": {
|
||||
"texture": "betterend:block/%parent%"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/template_fence_gate_wall",
|
||||
"textures": {
|
||||
"texture": "betterend:block/%parent%"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "block/template_fence_gate_wall_open",
|
||||
"textures": {
|
||||
"texture": "betterend:block/%parent%"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
"variants": {
|
||||
"facing=east,in_wall=false,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_closed",
|
||||
"uvlock": true,
|
||||
"y": 270
|
||||
},
|
||||
"facing=east,in_wall=false,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_open",
|
||||
"uvlock": true,
|
||||
"y": 270
|
||||
},
|
||||
"facing=east,in_wall=true,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_closed",
|
||||
"uvlock": true,
|
||||
"y": 270
|
||||
},
|
||||
"facing=east,in_wall=true,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_open",
|
||||
"uvlock": true,
|
||||
"y": 270
|
||||
},
|
||||
"facing=north,in_wall=false,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_closed",
|
||||
"uvlock": true,
|
||||
"y": 180
|
||||
},
|
||||
"facing=north,in_wall=false,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_open",
|
||||
"uvlock": true,
|
||||
"y": 180
|
||||
},
|
||||
"facing=north,in_wall=true,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_closed",
|
||||
"uvlock": true,
|
||||
"y": 180
|
||||
},
|
||||
"facing=north,in_wall=true,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_open",
|
||||
"uvlock": true,
|
||||
"y": 180
|
||||
},
|
||||
"facing=south,in_wall=false,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_closed",
|
||||
"uvlock": true
|
||||
},
|
||||
"facing=south,in_wall=false,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_open",
|
||||
"uvlock": true
|
||||
},
|
||||
"facing=south,in_wall=true,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_closed",
|
||||
"uvlock": true
|
||||
},
|
||||
"facing=south,in_wall=true,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_open",
|
||||
"uvlock": true
|
||||
},
|
||||
"facing=west,in_wall=false,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_closed",
|
||||
"uvlock": true,
|
||||
"y": 90
|
||||
},
|
||||
"facing=west,in_wall=false,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_open",
|
||||
"uvlock": true,
|
||||
"y": 90
|
||||
},
|
||||
"facing=west,in_wall=true,open=false": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_closed",
|
||||
"uvlock": true,
|
||||
"y": 90
|
||||
},
|
||||
"facing=west,in_wall=true,open=true": {
|
||||
"model": "betterend:pattern/%block%/%block%_wall_open",
|
||||
"uvlock": true,
|
||||
"y": 90
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue