Patterns refactor
This commit is contained in:
parent
ce8ae2e7fe
commit
14434e4028
33 changed files with 397 additions and 356 deletions
|
@ -8,7 +8,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.blocks.basis.BlockPedestal;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class EndPedestal extends BlockPedestal {
|
||||
|
||||
|
@ -31,16 +31,16 @@ public class EndPedestal extends BlockPedestal {
|
|||
}
|
||||
};
|
||||
if (block.contains("column_top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
} else if (block.contains("column")) {
|
||||
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
return Patterns.createJson(Patterns.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
} else if (block.contains("top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_TOP, textures);
|
||||
} else if (block.contains("bottom")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
} else if (block.contains("pillar")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.blocks.basis.BlockPedestal;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class PedestalVanilla extends BlockPedestal {
|
||||
|
||||
|
@ -30,16 +30,16 @@ public class PedestalVanilla extends BlockPedestal {
|
|||
}
|
||||
};
|
||||
if (block.contains("column_top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
} else if (block.contains("column")) {
|
||||
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
return Patterns.createJson(Patterns.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
} else if (block.contains("top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_TOP, textures);
|
||||
} else if (block.contains("bottom")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
} else if (block.contains("pillar")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.io.Reader;
|
|||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockBark extends BlockPillar {
|
||||
public BlockBark(Settings settings) {
|
||||
|
@ -15,15 +15,13 @@ public class BlockBark extends BlockPillar {
|
|||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = getName(blockId);
|
||||
return Patterned.createJson(Patterned.BLOCK_BASE, BetterEnd.makeID(name), blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = getName(blockId);
|
||||
return Patterned.createJson(data, BetterEnd.makeID(name), blockId.getPath());
|
||||
return Patterns.createJson(data, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
private String getName(Identifier blockId) {
|
||||
|
|
|
@ -26,10 +26,11 @@ import net.minecraft.util.registry.Registry;
|
|||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.World;
|
||||
import ru.betterend.blocks.entities.EBarrelBlockEntity;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
|
||||
public class BlockBarrel extends BarrelBlock implements Patterned {
|
||||
public class BlockBarrel extends BarrelBlock implements BlockPatterned {
|
||||
public BlockBarrel(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).nonOpaque());
|
||||
}
|
||||
|
@ -89,21 +90,21 @@ public class BlockBarrel extends BarrelBlock implements Patterned {
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
if (block.contains("open")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_BARREL_OPEN, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BARREL_OPEN, texture, texture);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_BOTTOM_TOP, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BOTTOM_TOP, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_BARREL;
|
||||
return Patterns.STATE_BARREL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockBase extends Block implements Patterned {
|
||||
public class BlockBase extends Block implements BlockPatterned {
|
||||
public BlockBase(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
@ -24,18 +25,18 @@ public class BlockBase extends Block implements Patterned {
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, block);
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId.getPath(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ import net.minecraft.loot.context.LootContext;
|
|||
import net.minecraft.loot.context.LootContextParameters;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockBookshelf extends BlockBase {
|
||||
public BlockBookshelf(Block source) {
|
||||
|
@ -37,21 +37,19 @@ public class BlockBookshelf extends BlockBase {
|
|||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = getName(blockId);
|
||||
return Patterned.createJson(Patterned.BLOCK_BOOKSHELF, BetterEnd.makeID(name), blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BOOKSHELF, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = getName(blockId);
|
||||
return Patterned.createJson(data, BetterEnd.makeID(name), blockId.getPath());
|
||||
return Patterns.createJson(data, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
private String getName(Identifier blockId) {
|
||||
|
|
|
@ -13,10 +13,11 @@ import net.minecraft.loot.context.LootContext;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.BlockView;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndBlockEntities;
|
||||
|
||||
public class BlockChest extends ChestBlock implements Patterned {
|
||||
public class BlockChest extends ChestBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -45,7 +46,7 @@ public class BlockChest extends ChestBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,13 +54,13 @@ public class BlockChest extends ChestBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (path.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_CHEST, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_CHEST, blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_EMPTY, parentId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, parentId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockCraftingTable extends CraftingTableBlock implements Patterned {
|
||||
public class BlockCraftingTable extends CraftingTableBlock implements BlockPatterned {
|
||||
public BlockCraftingTable(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source));
|
||||
}
|
||||
|
@ -27,15 +28,15 @@ public class BlockCraftingTable extends CraftingTableBlock implements Patterned
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String blockName = blockId.getPath();
|
||||
return Patterned.createJson(Patterned.BLOCK_SIDED, new HashMap<String, String>() {
|
||||
return Patterns.createJson(Patterns.BLOCK_SIDED, new HashMap<String, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put("%particle%", blockName + "_front");
|
||||
|
@ -51,6 +52,6 @@ public class BlockCraftingTable extends CraftingTableBlock implements Patterned
|
|||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,10 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockDoor extends DoorBlock implements IRenderTypeable, Patterned {
|
||||
public class BlockDoor extends DoorBlock implements IRenderTypeable, BlockPatterned {
|
||||
public BlockDoor(Block block) {
|
||||
super(FabricBlockSettings.copy(block).nonOpaque());
|
||||
}
|
||||
|
@ -37,30 +38,30 @@ public class BlockDoor extends DoorBlock implements IRenderTypeable, Patterned {
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_MODEL, blockId);
|
||||
}
|
||||
if (block.contains("top_hinge")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_DOOR_TOP_HINGE, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_DOOR_TOP_HINGE, blockId, blockId);
|
||||
}
|
||||
if (block.contains("bottom_hinge")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_DOOR_BOTTOM_HINGE, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_DOOR_BOTTOM_HINGE, blockId, blockId);
|
||||
}
|
||||
if (block.contains("top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_DOOR_TOP, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_DOOR_TOP, blockId, blockId);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_DOOR_BOTTOM, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_DOOR_BOTTOM, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_DOOR;
|
||||
return Patterns.STATE_DOOR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import net.minecraft.world.WorldView;
|
|||
import net.minecraft.world.gen.feature.Feature;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
||||
public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizable, IRenderTypeable {
|
||||
|
@ -100,20 +100,20 @@ public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fe
|
|||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
if (block.contains("item")) {
|
||||
block = block.split("/")[1];
|
||||
return Patterned.createJson(Patterned.ITEM_BLOCK, block);
|
||||
return Patterns.createJson(Patterns.ITEM_BLOCK, block);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_SAPLING, block);
|
||||
return Patterns.createJson(Patterns.BLOCK_SAPLING, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SAPLING;
|
||||
return Patterns.STATE_SAPLING;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockFence extends FenceBlock implements Patterned {
|
||||
public class BlockFence extends FenceBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockFence extends FenceBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,16 +41,16 @@ public class BlockFence extends FenceBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_FENCE, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_FENCE, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("side")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_FENCE_SIDE, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_FENCE_SIDE, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_FENCE_POST, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_FENCE_POST, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_FENCE;
|
||||
return Patterns.STATE_FENCE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockGate extends FenceGateBlock implements Patterned {
|
||||
public class BlockGate extends FenceGateBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockGate extends FenceGateBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,19 +42,19 @@ public class BlockGate extends FenceGateBlock implements Patterned {
|
|||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("wall")) {
|
||||
if (block.contains("open")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_GATE_OPEN_WALL, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_GATE_OPEN_WALL, parentId.getPath(), blockId.getPath());
|
||||
} else {
|
||||
return Patterned.createJson(Patterned.BLOCK_GATE_CLOSED_WALL, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_GATE_CLOSED_WALL, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
}
|
||||
if (block.contains("open")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_GATE_OPEN, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_GATE_OPEN, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_GATE_CLOSED, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_GATE_CLOSED, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_GATE;
|
||||
return Patterns.STATE_GATE;
|
||||
}
|
||||
}
|
|
@ -27,10 +27,11 @@ import net.minecraft.world.WorldAccess;
|
|||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable, Patterned {
|
||||
public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable, BlockPatterned {
|
||||
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);
|
||||
|
@ -138,21 +139,21 @@ public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable, Pa
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_BLOCK, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_BLOCK, blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_LADDER, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_LADDER, blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_LADDER;
|
||||
return Patterns.STATE_LADDER;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockLeaves extends LeavesBlock implements Patterned, IRenderTypeable {
|
||||
public class BlockLeaves extends LeavesBlock implements BlockPatterned, IRenderTypeable {
|
||||
public BlockLeaves(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||
.allowsSpawning((state, world, pos, type) -> { return false; })
|
||||
|
@ -32,19 +33,19 @@ public class BlockLeaves extends LeavesBlock implements Patterned, IRenderTypeab
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, blockId.getPath());
|
||||
String blockId = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ import net.minecraft.world.WorldAccess;
|
|||
import ru.betterend.blocks.BlockProperties;
|
||||
import ru.betterend.blocks.BlockProperties.PedestalState;
|
||||
import ru.betterend.blocks.entities.PedestalBlockEntity;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
|
@ -304,8 +304,8 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -323,22 +323,22 @@ public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvid
|
|||
}
|
||||
};
|
||||
if (block.contains("column_top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||
} else if (block.contains("column")) {
|
||||
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
return Patterns.createJson(Patterns.BLOKC_PEDESTAL_COLUMN, textures);
|
||||
} else if (block.contains("top")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_TOP, textures);
|
||||
} else if (block.contains("bottom")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||
} else if (block.contains("pillar")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_PILLAR, textures);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
return Patterns.createJson(Patterns.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_PEDESTAL;
|
||||
return Patterns.STATE_PEDESTAL;
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -10,9 +10,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockPillar extends PillarBlock implements Patterned {
|
||||
public class BlockPillar extends PillarBlock implements BlockPatterned {
|
||||
public BlockPillar(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
@ -24,18 +25,18 @@ public class BlockPillar extends PillarBlock implements Patterned {
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(Patterned.BLOCK_PILLAR, blockId, blockId.getPath());
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(Patterns.BLOCK_PILLAR, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_PILLAR;
|
||||
return Patterns.STATE_PILLAR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockPressurePlate extends PressurePlateBlock implements Patterned {
|
||||
public class BlockPressurePlate extends PressurePlateBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockPressurePlate extends PressurePlateBlock implements Patterned
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,13 +41,13 @@ public class BlockPressurePlate extends PressurePlateBlock implements Patterned
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("down")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PLATE_DOWN, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_DOWN, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_PLATE_UP, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_UP, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_PLATE;
|
||||
return Patterns.STATE_PLATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,10 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockSign extends AbstractSignBlock implements Patterned {
|
||||
public class BlockSign extends AbstractSignBlock implements BlockPatterned {
|
||||
public static final IntProperty ROTATION = Properties.ROTATION;
|
||||
public static final BooleanProperty FLOOR = BooleanProperty.of("floor");
|
||||
private static final VoxelShape[] WALL_SHAPES = new VoxelShape[] {
|
||||
|
@ -154,7 +155,7 @@ public class BlockSign extends AbstractSignBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,14 +163,14 @@ public class BlockSign extends AbstractSignBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (path.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_MODEL, blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_EMPTY, parentId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, parentId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockSimpleLeaves extends BlockBaseNotFull implements IRenderTypeable {
|
||||
public BlockSimpleLeaves(MaterialColor color) {
|
||||
|
@ -38,19 +38,19 @@ public class BlockSimpleLeaves extends BlockBaseNotFull implements IRenderTypeab
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, blockId.getPath());
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SIMPLE;
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockSlab extends SlabBlock implements Patterned {
|
||||
public class BlockSlab extends SlabBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,18 +33,18 @@ public class BlockSlab extends SlabBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(Patterned.BLOCK_SLAB, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_SLAB, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_SLAB;
|
||||
return Patterns.STATE_SLAB;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockStairs extends StairsBlock implements Patterned {
|
||||
public class BlockStairs extends StairsBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockStairs extends StairsBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,16 +41,16 @@ public class BlockStairs extends StairsBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("inner")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_STAIR_INNER, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_STAIR_INNER, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("outer")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_STAIR_OUTER, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_STAIR_OUTER, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_STAIR, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_STAIR, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_STAIRS;
|
||||
return Patterns.STATE_STAIRS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockStoneButton extends StoneButtonBlock implements Patterned {
|
||||
public class BlockStoneButton extends StoneButtonBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockStoneButton extends StoneButtonBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,16 +41,16 @@ public class BlockStoneButton extends StoneButtonBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_BUTTON, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("pressed")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_BUTTON_PRESSED, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON_PRESSED, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_BUTTON, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_BUTTON;
|
||||
return Patterns.STATE_BUTTON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraft.world.WorldAccess;
|
|||
import net.minecraft.world.WorldView;
|
||||
import ru.betterend.blocks.AuroraCrystalBlock;
|
||||
import ru.betterend.interfaces.IColorProvider;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class BlockStoneLantern extends BlockBaseNotFull implements IColorProvider, Waterloggable {
|
||||
|
@ -126,21 +126,21 @@ public class BlockStoneLantern extends BlockBaseNotFull implements IColorProvide
|
|||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_STONE_LANTERN;
|
||||
return Patterns.STATE_STONE_LANTERN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String texture = Registry.BLOCK.getId(this).getPath();
|
||||
if (block.contains("ceil")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_STONE_LANTERN_CEIL, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_CEIL, texture, texture);
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_STONE_LANTERN_FLOOR, blockId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_FLOOR, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockStonePressurePlate extends PressurePlateBlock implements Patterned {
|
||||
public class BlockStonePressurePlate extends PressurePlateBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockStonePressurePlate extends PressurePlateBlock implements Patte
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,13 +41,13 @@ public class BlockStonePressurePlate extends PressurePlateBlock implements Patte
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("down")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_PLATE_DOWN, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_DOWN, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_PLATE_UP, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_UP, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_PLATE;
|
||||
return Patterns.STATE_PLATE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,10 @@ import net.minecraft.util.Identifier;
|
|||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Patterned {
|
||||
public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, BlockPatterned {
|
||||
public BlockTrapdoor(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).nonOpaque());
|
||||
}
|
||||
|
@ -34,15 +35,15 @@ public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Pat
|
|||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||
String block = Registry.BLOCK.getId(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelPattern(String block) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
String name = blockId.getPath();
|
||||
return Patterned.createJson(Patterned.BLOCK_TRAPDOOR, new HashMap<String, String>() {
|
||||
return Patterns.createJson(Patterns.BLOCK_TRAPDOOR, new HashMap<String, String>() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
{
|
||||
put("%block%", name);
|
||||
|
@ -53,6 +54,6 @@ public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Pat
|
|||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_TRAPDOOR;
|
||||
return Patterns.STATE_TRAPDOOR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockWall extends WallBlock implements Patterned {
|
||||
public class BlockWall extends WallBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockWall extends WallBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,19 +41,19 @@ public class BlockWall extends WallBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_WALL, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_WALL, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("side_tall")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_WALL_SIDE_TALL, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_WALL_SIDE_TALL, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("side")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_WALL_SIDE, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_WALL_SIDE, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_WALL_POST, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_WALL_POST, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_WALL;
|
||||
return Patterns.STATE_WALL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,10 @@ 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;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
import ru.betterend.patterns.Patterns;
|
||||
|
||||
public class BlockWoodenButton extends WoodenButtonBlock implements Patterned {
|
||||
public class BlockWoodenButton extends WoodenButtonBlock implements BlockPatterned {
|
||||
|
||||
private final Block parent;
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class BlockWoodenButton extends WoodenButtonBlock implements Patterned {
|
|||
public String getStatesPattern(Reader data) {
|
||||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
return Patterned.createJson(data, parentId, blockId.getPath());
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,16 +41,16 @@ public class BlockWoodenButton extends WoodenButtonBlock implements Patterned {
|
|||
Identifier blockId = Registry.BLOCK.getId(this);
|
||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||
if (block.contains("item")) {
|
||||
return Patterned.createJson(Patterned.ITEM_BUTTON, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.ITEM_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
if (block.contains("pressed")) {
|
||||
return Patterned.createJson(Patterned.BLOCK_BUTTON_PRESSED, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON_PRESSED, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
return Patterned.createJson(Patterned.BLOCK_BUTTON, parentId, blockId.getPath());
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier statePatternId() {
|
||||
return Patterned.STATE_BUTTON;
|
||||
return Patterns.STATE_BUTTON;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.betterend.mixin.client;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -17,13 +18,15 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.client.render.model.ModelLoader;
|
||||
import net.minecraft.client.render.model.json.JsonUnbakedModel;
|
||||
import net.minecraft.client.render.model.json.ModelVariantMap.DeserializationContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.resource.Resource;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.interfaces.IdentifiedContext;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.Patterned;
|
||||
|
||||
@Mixin(ModelLoader.class)
|
||||
public class ModelLoaderMixin {
|
||||
|
@ -50,29 +53,46 @@ public class ModelLoaderMixin {
|
|||
} catch (Exception ex) {
|
||||
String data[] = id.getPath().split("/");
|
||||
if (data.length > 1) {
|
||||
Identifier blockId = new Identifier(id.getNamespace(), data[1]);
|
||||
Block block = Registry.BLOCK.get(blockId);
|
||||
if (block instanceof Patterned) {
|
||||
String pattern;
|
||||
if (id.getPath().contains("item")) {
|
||||
pattern = ((Patterned) block).getModelPattern(id.getPath());
|
||||
} else {
|
||||
if (data.length > 2) {
|
||||
pattern = ((Patterned) block).getModelPattern(data[2]);
|
||||
} else {
|
||||
pattern = ((Patterned) block).getModelPattern(data[1]);
|
||||
}
|
||||
Identifier itemId = new Identifier(id.getNamespace(), data[1]);
|
||||
Optional<Block> block = Registry.BLOCK.getOrEmpty(itemId);
|
||||
if (block.isPresent()) {
|
||||
if (block.get() instanceof Patterned) {
|
||||
Patterned patterned = (Patterned) block.get();
|
||||
model = this.be_getModel(data, id, patterned);
|
||||
info.setReturnValue(model);
|
||||
info.cancel();
|
||||
}
|
||||
} else {
|
||||
Optional<Item> item = Registry.ITEM.getOrEmpty(itemId);
|
||||
if (item.isPresent() && item.get() instanceof Patterned) {
|
||||
Patterned patterned = (Patterned) item.get();
|
||||
model = this.be_getModel(data, id, patterned);
|
||||
info.setReturnValue(model);
|
||||
info.cancel();
|
||||
}
|
||||
model = JsonUnbakedModel.deserialize(pattern);
|
||||
model.id = id.toString();
|
||||
info.setReturnValue(model);
|
||||
info.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private JsonUnbakedModel be_getModel(String data[], Identifier id, Patterned patterned) {
|
||||
String pattern;
|
||||
if (id.getPath().contains("item")) {
|
||||
pattern = patterned.getModelPattern(id.getPath());
|
||||
} else {
|
||||
if (data.length > 2) {
|
||||
pattern = patterned.getModelPattern(data[2]);
|
||||
} else {
|
||||
pattern = patterned.getModelPattern(data[1]);
|
||||
}
|
||||
}
|
||||
JsonUnbakedModel model = JsonUnbakedModel.deserialize(pattern);
|
||||
model.id = id.toString();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Inject(method = "loadModel", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/render/model/json/ModelVariantMap$DeserializationContext;setStateFactory(Lnet/minecraft/state/StateManager;)V",
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.client.render.model.json.ModelVariantMap;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.interfaces.IdentifiedContext;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
|
||||
@Mixin(ModelVariantMap.class)
|
||||
public abstract class ModelVariantMapMixin {
|
||||
|
@ -33,8 +33,8 @@ public abstract class ModelVariantMapMixin {
|
|||
Identifier blockId = new Identifier(id.getNamespace(), data[1]);
|
||||
Block block = Registry.BLOCK.get(blockId);
|
||||
idContext.removeId();
|
||||
if (block instanceof Patterned) {
|
||||
String pattern = ((Patterned) block).getStatesPattern(reader);
|
||||
if (block instanceof BlockPatterned) {
|
||||
String pattern = ((BlockPatterned) block).getStatesPattern(reader);
|
||||
info.setReturnValue(deserialize(context, new StringReader(pattern)));
|
||||
info.cancel();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraft.resource.Resource;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.interfaces.Patterned;
|
||||
import ru.betterend.patterns.BlockPatterned;
|
||||
|
||||
@Mixin(NamespaceResourceManager.class)
|
||||
public abstract class NamespaceResourceManagerMixin {
|
||||
|
@ -35,9 +35,9 @@ public abstract class NamespaceResourceManagerMixin {
|
|||
if (data.length > 1) {
|
||||
Identifier blockId = BetterEnd.makeID(data[1].replace(".json", ""));
|
||||
Block block = Registry.BLOCK.get(blockId);
|
||||
if (block instanceof Patterned) {
|
||||
if (block instanceof BlockPatterned) {
|
||||
List<Resource> resources = Lists.newArrayList();
|
||||
resources.add(this.getResource(((Patterned) block).statePatternId()));
|
||||
resources.add(this.getResource(((BlockPatterned) block).statePatternId()));
|
||||
info.setReturnValue(resources);
|
||||
info.cancel();
|
||||
}
|
||||
|
|
14
src/main/java/ru/betterend/patterns/BlockPatterned.java
Normal file
14
src/main/java/ru/betterend/patterns/BlockPatterned.java
Normal file
|
@ -0,0 +1,14 @@
|
|||
package ru.betterend.patterns;
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public interface BlockPatterned extends Patterned {
|
||||
default String getStatesPattern(Reader data) {
|
||||
return null;
|
||||
}
|
||||
default Identifier statePatternId() {
|
||||
return null;
|
||||
}
|
||||
}
|
7
src/main/java/ru/betterend/patterns/Patterned.java
Normal file
7
src/main/java/ru/betterend/patterns/Patterned.java
Normal file
|
@ -0,0 +1,7 @@
|
|||
package ru.betterend.patterns;
|
||||
|
||||
public interface Patterned {
|
||||
default String getModelPattern(String name) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,147 +1,132 @@
|
|||
package ru.betterend.interfaces;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public interface Patterned {
|
||||
//Blockstates
|
||||
public final static Identifier STATE_SIMPLE = BetterEnd.makeID("patterns/blockstate/pattern_block.json");
|
||||
public final static Identifier STATE_SLAB = BetterEnd.makeID("patterns/blockstate/pattern_slab.json");
|
||||
public final static Identifier STATE_STAIRS = BetterEnd.makeID("patterns/blockstate/pattern_stairs.json");
|
||||
public final static Identifier STATE_WALL = BetterEnd.makeID("patterns/blockstate/pattern_wall.json");
|
||||
public final static Identifier STATE_FENCE = BetterEnd.makeID("patterns/blockstate/pattern_fence.json");
|
||||
public final static Identifier STATE_BUTTON = BetterEnd.makeID("patterns/blockstate/pattern_button.json");
|
||||
public final static Identifier STATE_PILLAR = BetterEnd.makeID("patterns/blockstate/pattern_pillar.json");
|
||||
public final static Identifier STATE_PLATE = BetterEnd.makeID("patterns/blockstate/pattern_pressure_plate.json");
|
||||
public final static Identifier STATE_DOOR = BetterEnd.makeID("patterns/blockstate/pattern_door.json");
|
||||
public final static Identifier STATE_SAPLING = BetterEnd.makeID("patterns/blockstate/pattern_sapling.json");
|
||||
public final static Identifier STATE_GATE = BetterEnd.makeID("patterns/blockstate/pattern_fence_gate.json");
|
||||
public final static Identifier STATE_TRAPDOOR = BetterEnd.makeID("patterns/blockstate/pattern_trapdoor.json");
|
||||
public final static Identifier STATE_LADDER = BetterEnd.makeID("patterns/blockstate/pattern_ladder.json");
|
||||
public final static Identifier STATE_BARREL = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json");
|
||||
public final static Identifier STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json");
|
||||
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
||||
|
||||
//Models Block
|
||||
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
||||
public final static Identifier BLOCK_BASE = BetterEnd.makeID("patterns/block/pattern_block.json");
|
||||
public final static Identifier BLOCK_SIDED = BetterEnd.makeID("patterns/block/pattern_block_sided.json");
|
||||
public final static Identifier BLOCK_BOTTOM_TOP = BetterEnd.makeID("patterns/block/pattern_block_bottom_top.json");
|
||||
public final static Identifier BLOCK_SLAB = BetterEnd.makeID("patterns/block/pattern_slab.json");
|
||||
public final static Identifier BLOCK_STAIR = BetterEnd.makeID("patterns/block/pattern_stairs.json");
|
||||
public final static Identifier BLOCK_STAIR_INNER = BetterEnd.makeID("patterns/block/pattern_inner_stairs.json");
|
||||
public final static Identifier BLOCK_STAIR_OUTER = BetterEnd.makeID("patterns/block/pattern_outer_stairs.json");
|
||||
public final static Identifier BLOCK_WALL_POST = BetterEnd.makeID("patterns/block/pattern_wall_post.json");
|
||||
public final static Identifier BLOCK_WALL_SIDE = BetterEnd.makeID("patterns/block/pattern_wall_side.json");
|
||||
public final static Identifier BLOCK_WALL_SIDE_TALL = BetterEnd.makeID("patterns/block/pattern_wall_side_tall.json");
|
||||
public final static Identifier BLOCK_FENCE_POST = BetterEnd.makeID("patterns/block/pattern_fence_post.json");
|
||||
public final static Identifier BLOCK_FENCE_SIDE = BetterEnd.makeID("patterns/block/pattern_fence_side.json");
|
||||
public final static Identifier BLOCK_BUTTON = BetterEnd.makeID("patterns/block/pattern_button.json");
|
||||
public final static Identifier BLOCK_BUTTON_PRESSED = BetterEnd.makeID("patterns/block/pattern_button_pressed.json");
|
||||
public final static Identifier BLOCK_PILLAR = BetterEnd.makeID("patterns/block/pattern_pillar.json");
|
||||
public final static Identifier BLOCK_PLATE_UP = BetterEnd.makeID("patterns/block/pattern_pressure_plate_up.json");
|
||||
public final static Identifier BLOCK_PLATE_DOWN = BetterEnd.makeID("patterns/block/pattern_pressure_plate_down.json");
|
||||
public final static Identifier BLOCK_DOOR_TOP = BetterEnd.makeID("patterns/block/pattern_door_top.json");
|
||||
public final static Identifier BLOCK_DOOR_TOP_HINGE = BetterEnd.makeID("patterns/block/pattern_door_top_hinge.json");
|
||||
public final static Identifier BLOCK_DOOR_BOTTOM = BetterEnd.makeID("patterns/block/pattern_door_bottom.json");
|
||||
public final static Identifier BLOCK_DOOR_BOTTOM_HINGE = BetterEnd.makeID("patterns/block/pattern_door_bottom_hinge.json");
|
||||
public final static Identifier BLOCK_SAPLING = BetterEnd.makeID("patterns/block/pattern_sapling.json");
|
||||
public final static Identifier BLOCK_GATE_CLOSED = BetterEnd.makeID("patterns/block/pattern_fence_gate_closed.json");
|
||||
public final static Identifier BLOCK_GATE_CLOSED_WALL = BetterEnd.makeID("patterns/block/pattern_wall_gate_closed.json");
|
||||
public final static Identifier BLOCK_GATE_OPEN = BetterEnd.makeID("patterns/block/pattern_fence_gate_open.json");
|
||||
public final static Identifier BLOCK_GATE_OPEN_WALL = BetterEnd.makeID("patterns/block/pattern_wall_gate_open.json");
|
||||
public final static Identifier BLOCK_TRAPDOOR = BetterEnd.makeID("patterns/block/pattern_trapdoor.json");
|
||||
public final static Identifier BLOCK_LADDER = BetterEnd.makeID("patterns/block/pattern_ladder.json");
|
||||
public final static Identifier BLOCK_BARREL_OPEN = BetterEnd.makeID("patterns/block/pattern_barrel_open.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_DEFAULT = BetterEnd.makeID("patterns/block/pattern_pedestal_default.json");
|
||||
public final static Identifier BLOKC_PEDESTAL_COLUMN = BetterEnd.makeID("patterns/block/pattern_pedestal_column.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_COLUMN_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_column_top.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_top.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_pedestal_bottom.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_PILLAR = BetterEnd.makeID("patterns/block/pattern_pedestal_pillar.json");
|
||||
public final static Identifier BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
|
||||
public final static Identifier BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
|
||||
public final static Identifier BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
|
||||
|
||||
//Models Item
|
||||
public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||
public final static Identifier ITEM_FENCE = BetterEnd.makeID("patterns/item/pattern_fence.json");
|
||||
public final static Identifier ITEM_BUTTON = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||
public final static Identifier ITEM_CHEST = BetterEnd.makeID("patterns/item/pattern_chest.json");
|
||||
public final static Identifier ITEM_BLOCK = BetterEnd.makeID("patterns/item/pattern_block_item.json");
|
||||
public final static Identifier ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_item.json");
|
||||
|
||||
default String getStatesPattern(Reader data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
default String getModelPattern(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Identifier statePatternId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
default Identifier modelPatternId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String createJson(Reader data, Identifier parent, String name) {
|
||||
try (BufferedReader buffer = new BufferedReader(data)) {
|
||||
return buffer.lines().collect(Collectors.joining())
|
||||
.replace("%parent%", parent.getPath())
|
||||
.replace("%block%", name);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, Identifier parent, String block) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining())
|
||||
.replace("%parent%", parent.getPath())
|
||||
.replace("%block%", block);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, String texture) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining())
|
||||
.replace("%texture%", texture);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, Map<String, String> textures) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining());
|
||||
for (Entry<String, String> texture : textures.entrySet()) {
|
||||
json = json.replace(texture.getKey(), texture.getValue());
|
||||
}
|
||||
return json;
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
package ru.betterend.patterns;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
import net.minecraft.util.Identifier;
|
||||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class Patterns {
|
||||
|
||||
//Blockstates
|
||||
public final static Identifier STATE_SIMPLE = BetterEnd.makeID("patterns/blockstate/pattern_block.json");
|
||||
public final static Identifier STATE_SLAB = BetterEnd.makeID("patterns/blockstate/pattern_slab.json");
|
||||
public final static Identifier STATE_STAIRS = BetterEnd.makeID("patterns/blockstate/pattern_stairs.json");
|
||||
public final static Identifier STATE_WALL = BetterEnd.makeID("patterns/blockstate/pattern_wall.json");
|
||||
public final static Identifier STATE_FENCE = BetterEnd.makeID("patterns/blockstate/pattern_fence.json");
|
||||
public final static Identifier STATE_BUTTON = BetterEnd.makeID("patterns/blockstate/pattern_button.json");
|
||||
public final static Identifier STATE_PILLAR = BetterEnd.makeID("patterns/blockstate/pattern_pillar.json");
|
||||
public final static Identifier STATE_PLATE = BetterEnd.makeID("patterns/blockstate/pattern_pressure_plate.json");
|
||||
public final static Identifier STATE_DOOR = BetterEnd.makeID("patterns/blockstate/pattern_door.json");
|
||||
public final static Identifier STATE_SAPLING = BetterEnd.makeID("patterns/blockstate/pattern_sapling.json");
|
||||
public final static Identifier STATE_GATE = BetterEnd.makeID("patterns/blockstate/pattern_fence_gate.json");
|
||||
public final static Identifier STATE_TRAPDOOR = BetterEnd.makeID("patterns/blockstate/pattern_trapdoor.json");
|
||||
public final static Identifier STATE_LADDER = BetterEnd.makeID("patterns/blockstate/pattern_ladder.json");
|
||||
public final static Identifier STATE_BARREL = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json");
|
||||
public final static Identifier STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json");
|
||||
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
||||
|
||||
//Models Block
|
||||
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
||||
public final static Identifier BLOCK_BASE = BetterEnd.makeID("patterns/block/pattern_block.json");
|
||||
public final static Identifier BLOCK_SIDED = BetterEnd.makeID("patterns/block/pattern_block_sided.json");
|
||||
public final static Identifier BLOCK_BOTTOM_TOP = BetterEnd.makeID("patterns/block/pattern_block_bottom_top.json");
|
||||
public final static Identifier BLOCK_SLAB = BetterEnd.makeID("patterns/block/pattern_slab.json");
|
||||
public final static Identifier BLOCK_STAIR = BetterEnd.makeID("patterns/block/pattern_stairs.json");
|
||||
public final static Identifier BLOCK_STAIR_INNER = BetterEnd.makeID("patterns/block/pattern_inner_stairs.json");
|
||||
public final static Identifier BLOCK_STAIR_OUTER = BetterEnd.makeID("patterns/block/pattern_outer_stairs.json");
|
||||
public final static Identifier BLOCK_WALL_POST = BetterEnd.makeID("patterns/block/pattern_wall_post.json");
|
||||
public final static Identifier BLOCK_WALL_SIDE = BetterEnd.makeID("patterns/block/pattern_wall_side.json");
|
||||
public final static Identifier BLOCK_WALL_SIDE_TALL = BetterEnd.makeID("patterns/block/pattern_wall_side_tall.json");
|
||||
public final static Identifier BLOCK_FENCE_POST = BetterEnd.makeID("patterns/block/pattern_fence_post.json");
|
||||
public final static Identifier BLOCK_FENCE_SIDE = BetterEnd.makeID("patterns/block/pattern_fence_side.json");
|
||||
public final static Identifier BLOCK_BUTTON = BetterEnd.makeID("patterns/block/pattern_button.json");
|
||||
public final static Identifier BLOCK_BUTTON_PRESSED = BetterEnd.makeID("patterns/block/pattern_button_pressed.json");
|
||||
public final static Identifier BLOCK_PILLAR = BetterEnd.makeID("patterns/block/pattern_pillar.json");
|
||||
public final static Identifier BLOCK_PLATE_UP = BetterEnd.makeID("patterns/block/pattern_pressure_plate_up.json");
|
||||
public final static Identifier BLOCK_PLATE_DOWN = BetterEnd.makeID("patterns/block/pattern_pressure_plate_down.json");
|
||||
public final static Identifier BLOCK_DOOR_TOP = BetterEnd.makeID("patterns/block/pattern_door_top.json");
|
||||
public final static Identifier BLOCK_DOOR_TOP_HINGE = BetterEnd.makeID("patterns/block/pattern_door_top_hinge.json");
|
||||
public final static Identifier BLOCK_DOOR_BOTTOM = BetterEnd.makeID("patterns/block/pattern_door_bottom.json");
|
||||
public final static Identifier BLOCK_DOOR_BOTTOM_HINGE = BetterEnd.makeID("patterns/block/pattern_door_bottom_hinge.json");
|
||||
public final static Identifier BLOCK_SAPLING = BetterEnd.makeID("patterns/block/pattern_sapling.json");
|
||||
public final static Identifier BLOCK_GATE_CLOSED = BetterEnd.makeID("patterns/block/pattern_fence_gate_closed.json");
|
||||
public final static Identifier BLOCK_GATE_CLOSED_WALL = BetterEnd.makeID("patterns/block/pattern_wall_gate_closed.json");
|
||||
public final static Identifier BLOCK_GATE_OPEN = BetterEnd.makeID("patterns/block/pattern_fence_gate_open.json");
|
||||
public final static Identifier BLOCK_GATE_OPEN_WALL = BetterEnd.makeID("patterns/block/pattern_wall_gate_open.json");
|
||||
public final static Identifier BLOCK_TRAPDOOR = BetterEnd.makeID("patterns/block/pattern_trapdoor.json");
|
||||
public final static Identifier BLOCK_LADDER = BetterEnd.makeID("patterns/block/pattern_ladder.json");
|
||||
public final static Identifier BLOCK_BARREL_OPEN = BetterEnd.makeID("patterns/block/pattern_barrel_open.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_DEFAULT = BetterEnd.makeID("patterns/block/pattern_pedestal_default.json");
|
||||
public final static Identifier BLOKC_PEDESTAL_COLUMN = BetterEnd.makeID("patterns/block/pattern_pedestal_column.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_COLUMN_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_column_top.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_top.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_pedestal_bottom.json");
|
||||
public final static Identifier BLOCK_PEDESTAL_PILLAR = BetterEnd.makeID("patterns/block/pattern_pedestal_pillar.json");
|
||||
public final static Identifier BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
|
||||
public final static Identifier BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
|
||||
public final static Identifier BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
|
||||
|
||||
//Models Item
|
||||
public final static Identifier ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||
public final static Identifier ITEM_FENCE = BetterEnd.makeID("patterns/item/pattern_fence.json");
|
||||
public final static Identifier ITEM_BUTTON = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||
public final static Identifier ITEM_CHEST = BetterEnd.makeID("patterns/item/pattern_chest.json");
|
||||
public final static Identifier ITEM_BLOCK = BetterEnd.makeID("patterns/item/pattern_block_item.json");
|
||||
public final static Identifier ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_item.json");
|
||||
|
||||
public static String createJson(Reader data, String parent, String block) {
|
||||
try (BufferedReader buffer = new BufferedReader(data)) {
|
||||
return buffer.lines().collect(Collectors.joining())
|
||||
.replace("%parent%", parent)
|
||||
.replace("%block%", block);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, String parent, String block) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining())
|
||||
.replace("%parent%", parent)
|
||||
.replace("%block%", block);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, String texture) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining())
|
||||
.replace("%texture%", texture);
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String createJson(Identifier patternId, Map<String, String> textures) {
|
||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||
.lines().collect(Collectors.joining());
|
||||
for (Entry<String, String> texture : textures.entrySet()) {
|
||||
json = json.replace(texture.getKey(), texture.getValue());
|
||||
}
|
||||
return json;
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue