Constant rename
This commit is contained in:
parent
dc0027afd9
commit
a288703f08
27 changed files with 670 additions and 670 deletions
|
@ -1,46 +1,46 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
import ru.betterend.blocks.basis.BlockPedestal;
|
import ru.betterend.blocks.basis.BlockPedestal;
|
||||||
import ru.betterend.interfaces.Patterned;
|
import ru.betterend.interfaces.Patterned;
|
||||||
|
|
||||||
public class EndPedestal extends BlockPedestal {
|
public class EndPedestal extends BlockPedestal {
|
||||||
|
|
||||||
public EndPedestal(Block parent) {
|
public EndPedestal(Block parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(parent);
|
Identifier blockId = Registry.BLOCK.getId(parent);
|
||||||
String name = blockId.getPath();
|
String name = blockId.getPath();
|
||||||
Map<String, String> textures = new HashMap<String, String>() {
|
Map<String, String> textures = new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
{
|
{
|
||||||
put("%mod%", BetterEnd.MOD_ID );
|
put("%mod%", BetterEnd.MOD_ID );
|
||||||
put("%top%", name + "_polished");
|
put("%top%", name + "_polished");
|
||||||
put("%base%", name + "_polished");
|
put("%base%", name + "_polished");
|
||||||
put("%pillar%", name + "_pillar_side");
|
put("%pillar%", name + "_pillar_side");
|
||||||
put("%bottom%", name + "_polished");
|
put("%bottom%", name + "_polished");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (block.contains("column_top")) {
|
if (block.contains("column_top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||||
} else if (block.contains("column")) {
|
} else if (block.contains("column")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN, textures);
|
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||||
} else if (block.contains("top")) {
|
} else if (block.contains("top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||||
} else if (block.contains("bottom")) {
|
} else if (block.contains("bottom")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_BOTTOM, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||||
} else if (block.contains("pillar")) {
|
} else if (block.contains("pillar")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_PILLAR, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_DEFAULT, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
package ru.betterend.blocks;
|
package ru.betterend.blocks;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import ru.betterend.blocks.basis.BlockPedestal;
|
import ru.betterend.blocks.basis.BlockPedestal;
|
||||||
import ru.betterend.interfaces.Patterned;
|
import ru.betterend.interfaces.Patterned;
|
||||||
|
|
||||||
public class PedestalVanilla extends BlockPedestal {
|
public class PedestalVanilla extends BlockPedestal {
|
||||||
|
|
||||||
public PedestalVanilla(Block parent) {
|
public PedestalVanilla(Block parent) {
|
||||||
super(parent);
|
super(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(parent);
|
Identifier blockId = Registry.BLOCK.getId(parent);
|
||||||
String name = blockId.getPath().replace("_block", "");
|
String name = blockId.getPath().replace("_block", "");
|
||||||
Map<String, String> textures = new HashMap<String, String>() {
|
Map<String, String> textures = new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
{
|
{
|
||||||
put("%mod%", blockId.getNamespace() );
|
put("%mod%", blockId.getNamespace() );
|
||||||
put("%top%", "polished_" + name);
|
put("%top%", "polished_" + name);
|
||||||
put("%base%", "polished_" + name);
|
put("%base%", "polished_" + name);
|
||||||
put("%pillar%", name + "_pillar");
|
put("%pillar%", name + "_pillar");
|
||||||
put("%bottom%", "polished_" + name);
|
put("%bottom%", "polished_" + name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (block.contains("column_top")) {
|
if (block.contains("column_top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||||
} else if (block.contains("column")) {
|
} else if (block.contains("column")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN, textures);
|
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||||
} else if (block.contains("top")) {
|
} else if (block.contains("top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||||
} else if (block.contains("bottom")) {
|
} else if (block.contains("bottom")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_BOTTOM, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||||
} else if (block.contains("pillar")) {
|
} else if (block.contains("pillar")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_PILLAR, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_DEFAULT, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public class BlockBark extends BlockPillar {
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
String name = getName(blockId);
|
String name = getName(blockId);
|
||||||
return Patterned.createJson(Patterned.BASE_BLOCK_MODEL, BetterEnd.makeID(name), blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BASE, BetterEnd.makeID(name), blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -97,13 +97,13 @@ public class BlockBarrel extends BarrelBlock implements Patterned {
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
if (block.contains("open")) {
|
if (block.contains("open")) {
|
||||||
return Patterned.createJson(Patterned.BARREL_MODEL_OPEN, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BARREL_OPEN, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.BLOCK_BOTTOM_TOP_MODEL, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BOTTOM_TOP, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BARREL_STATES_PATTERN;
|
return Patterned.STATE_BARREL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class BlockBase extends Block implements Patterned {
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
return Patterned.createJson(Patterned.BASE_BLOCK_MODEL, blockId, block);
|
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,14 +37,14 @@ public class BlockBookshelf extends BlockBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
String name = getName(blockId);
|
String name = getName(blockId);
|
||||||
return Patterned.createJson(Patterned.BOOKSHELF, BetterEnd.makeID(name), blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BOOKSHELF, BetterEnd.makeID(name), blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -53,13 +53,13 @@ public class BlockChest extends ChestBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (path.contains("item")) {
|
if (path.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.CHEST_ITEM_MODEL, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_CHEST, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.EMPTY_MODEL, parentId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_EMPTY, parentId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class BlockCraftingTable extends CraftingTableBlock implements Patterned
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
String blockName = blockId.getPath();
|
String blockName = blockId.getPath();
|
||||||
return Patterned.createJson(Patterned.SIDED_BLOCK_MODEL, new HashMap<String, String>() {
|
return Patterned.createJson(Patterned.BLOCK_SIDED, new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
{
|
{
|
||||||
put("%particle%", blockName + "_front");
|
put("%particle%", blockName + "_front");
|
||||||
|
@ -51,6 +51,6 @@ public class BlockCraftingTable extends CraftingTableBlock implements Patterned
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,19 +48,19 @@ public class BlockDoor extends DoorBlock implements IRenderTypeable, Patterned {
|
||||||
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("top_hinge")) {
|
if (block.contains("top_hinge")) {
|
||||||
return Patterned.createJson(Patterned.DOOR_MODEL_TOP_HINGE, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_DOOR_TOP_HINGE, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("bottom_hinge")) {
|
if (block.contains("bottom_hinge")) {
|
||||||
return Patterned.createJson(Patterned.DOOR_MODEL_BOTTOM_HINGE, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_DOOR_BOTTOM_HINGE, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("top")) {
|
if (block.contains("top")) {
|
||||||
return Patterned.createJson(Patterned.DOOR_MODEL_TOP, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_DOOR_TOP, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.DOOR_MODEL_BOTTOM, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_DOOR_BOTTOM, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.DOOR_STATES_PATTERN;
|
return Patterned.STATE_DOOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,13 +107,13 @@ public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fe
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
block = block.split("/")[1];
|
block = block.split("/")[1];
|
||||||
return Patterned.createJson(Patterned.BLOCK_ITEM_MODEL, block);
|
return Patterned.createJson(Patterned.ITEM_BLOCK, block);
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.SAPLING_MODEL, block);
|
return Patterned.createJson(Patterned.BLOCK_SAPLING, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.SAPLING_STATES_PATTERN;
|
return Patterned.STATE_SAPLING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,16 @@ public class BlockFence extends FenceBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.FENCE_ITEM_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_FENCE, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("side")) {
|
if (block.contains("side")) {
|
||||||
return Patterned.createJson(Patterned.FENCE_SIDE_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_FENCE_SIDE, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.FENCE_POST_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_FENCE_POST, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.FENCE_STATES_PATTERN;
|
return Patterned.STATE_FENCE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,19 +41,19 @@ public class BlockGate extends FenceGateBlock implements Patterned {
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("wall")) {
|
if (block.contains("wall")) {
|
||||||
if (block.contains("open")) {
|
if (block.contains("open")) {
|
||||||
return Patterned.createJson(Patterned.GATE_MODEL_WALL_OPEN, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_GATE_OPEN_WALL, parentId, blockId.getPath());
|
||||||
} else {
|
} else {
|
||||||
return Patterned.createJson(Patterned.GATE_MODEL_WALL_CLOSED, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_GATE_CLOSED_WALL, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (block.contains("open")) {
|
if (block.contains("open")) {
|
||||||
return Patterned.createJson(Patterned.GATE_MODEL_OPEN, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_GATE_OPEN, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.GATE_MODEL_CLOSED, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_GATE_CLOSED, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.GATE_STATES_PATTERN;
|
return Patterned.STATE_GATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -146,13 +146,13 @@ public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable, Pa
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.BLOCK_ITEM_MODEL, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_BLOCK, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.LADDER_MODEL, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_LADDER, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.LADDER_STATES_PATTERN;
|
return Patterned.STATE_LADDER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,12 @@ public class BlockLeaves extends LeavesBlock implements Patterned, IRenderTypeab
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
return Patterned.createJson(Patterned.BASE_BLOCK_MODEL, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,364 +1,364 @@
|
||||||
package ru.betterend.blocks.basis;
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockEntityProvider;
|
import net.minecraft.block.BlockEntityProvider;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.ShapeContext;
|
import net.minecraft.block.ShapeContext;
|
||||||
import net.minecraft.block.entity.BlockEntity;
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemPlacementContext;
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.loot.context.LootContext;
|
import net.minecraft.loot.context.LootContext;
|
||||||
import net.minecraft.loot.context.LootContextParameters;
|
import net.minecraft.loot.context.LootContextParameters;
|
||||||
import net.minecraft.state.StateManager;
|
import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.BooleanProperty;
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.EnumProperty;
|
import net.minecraft.state.property.EnumProperty;
|
||||||
import net.minecraft.tag.BlockTags;
|
import net.minecraft.tag.BlockTags;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
import net.minecraft.util.shape.VoxelShapes;
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
import ru.betterend.blocks.BlockProperties;
|
import ru.betterend.blocks.BlockProperties;
|
||||||
import ru.betterend.blocks.BlockProperties.PedestalState;
|
import ru.betterend.blocks.BlockProperties.PedestalState;
|
||||||
import ru.betterend.blocks.entities.PedestalBlockEntity;
|
import ru.betterend.blocks.entities.PedestalBlockEntity;
|
||||||
import ru.betterend.interfaces.Patterned;
|
import ru.betterend.interfaces.Patterned;
|
||||||
import ru.betterend.registry.EndBlocks;
|
import ru.betterend.registry.EndBlocks;
|
||||||
import ru.betterend.util.BlocksHelper;
|
import ru.betterend.util.BlocksHelper;
|
||||||
|
|
||||||
public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvider {
|
public class BlockPedestal extends BlockBaseNotFull implements BlockEntityProvider {
|
||||||
public final static EnumProperty<PedestalState> STATE = BlockProperties.PEDESTAL_STATE;
|
public final static EnumProperty<PedestalState> STATE = BlockProperties.PEDESTAL_STATE;
|
||||||
public static final BooleanProperty HAS_ITEM = BlockProperties.HAS_ITEM;
|
public static final BooleanProperty HAS_ITEM = BlockProperties.HAS_ITEM;
|
||||||
|
|
||||||
private static final VoxelShape SHAPE_DEFAULT;
|
private static final VoxelShape SHAPE_DEFAULT;
|
||||||
private static final VoxelShape SHAPE_COLUMN;
|
private static final VoxelShape SHAPE_COLUMN;
|
||||||
private static final VoxelShape SHAPE_PILLAR;
|
private static final VoxelShape SHAPE_PILLAR;
|
||||||
private static final VoxelShape SHAPE_PEDESTAL_TOP;
|
private static final VoxelShape SHAPE_PEDESTAL_TOP;
|
||||||
private static final VoxelShape SHAPE_COLUMN_TOP;
|
private static final VoxelShape SHAPE_COLUMN_TOP;
|
||||||
private static final VoxelShape SHAPE_BOTTOM;
|
private static final VoxelShape SHAPE_BOTTOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Register new Pedestal block with Better End mod id.
|
* Register new Pedestal block with Better End mod id.
|
||||||
*
|
*
|
||||||
* @param name
|
* @param name
|
||||||
* @param source
|
* @param source
|
||||||
* @return new Pedestal block with Better End id.
|
* @return new Pedestal block with Better End id.
|
||||||
*/
|
*/
|
||||||
public static Block registerPedestal(String name, Block source) {
|
public static Block registerPedestal(String name, Block source) {
|
||||||
return EndBlocks.registerBlock(name, new BlockPedestal(source));
|
return EndBlocks.registerBlock(name, new BlockPedestal(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Register new Pedestal block with specified mod id.
|
* Register new Pedestal block with specified mod id.
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @param source
|
* @param source
|
||||||
* @return new Pedestal block with specified id.
|
* @return new Pedestal block with specified id.
|
||||||
*/
|
*/
|
||||||
public static Block registerPedestal(Identifier id, Block source) {
|
public static Block registerPedestal(Identifier id, Block source) {
|
||||||
return EndBlocks.registerBlock(id, new BlockPedestal(source));
|
return EndBlocks.registerBlock(id, new BlockPedestal(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final Block parent;
|
protected final Block parent;
|
||||||
protected float height = 1.0F;
|
protected float height = 1.0F;
|
||||||
|
|
||||||
public BlockPedestal(Block parent) {
|
public BlockPedestal(Block parent) {
|
||||||
super(FabricBlockSettings.copyOf(parent));
|
super(FabricBlockSettings.copyOf(parent));
|
||||||
this.setDefaultState(stateManager.getDefaultState().with(STATE, PedestalState.DEFAULT).with(HAS_ITEM, false));
|
this.setDefaultState(stateManager.getDefaultState().with(STATE, PedestalState.DEFAULT).with(HAS_ITEM, false));
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHeight(BlockState state) {
|
public float getHeight(BlockState state) {
|
||||||
if (state.getBlock() instanceof BlockPedestal && state.get(STATE) == PedestalState.PEDESTAL_TOP) {
|
if (state.getBlock() instanceof BlockPedestal && state.get(STATE) == PedestalState.PEDESTAL_TOP) {
|
||||||
return this.height - 0.2F;
|
return this.height - 0.2F;
|
||||||
}
|
}
|
||||||
return this.height;
|
return this.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||||
if (world.isClient || !state.isOf(this)) return ActionResult.CONSUME;
|
if (world.isClient || !state.isOf(this)) return ActionResult.CONSUME;
|
||||||
if (!this.isPlaceable(state)) {
|
if (!this.isPlaceable(state)) {
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof PedestalBlockEntity) {
|
if (blockEntity instanceof PedestalBlockEntity) {
|
||||||
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
||||||
if (pedestal.isEmpty()) {
|
if (pedestal.isEmpty()) {
|
||||||
ItemStack itemStack = player.getStackInHand(hand);
|
ItemStack itemStack = player.getStackInHand(hand);
|
||||||
if (itemStack.isEmpty()) return ActionResult.CONSUME;
|
if (itemStack.isEmpty()) return ActionResult.CONSUME;
|
||||||
world.setBlockState(pos, state.with(HAS_ITEM, true));
|
world.setBlockState(pos, state.with(HAS_ITEM, true));
|
||||||
pedestal.setStack(0, itemStack.split(1));
|
pedestal.setStack(0, itemStack.split(1));
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
ItemStack itemStack = pedestal.getStack(0);
|
ItemStack itemStack = pedestal.getStack(0);
|
||||||
if (player.giveItemStack(itemStack)) {
|
if (player.giveItemStack(itemStack)) {
|
||||||
world.setBlockState(pos, state.with(HAS_ITEM, false));
|
world.setBlockState(pos, state.with(HAS_ITEM, false));
|
||||||
pedestal.removeStack(0);
|
pedestal.removeStack(0);
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
return ActionResult.FAIL;
|
return ActionResult.FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ActionResult.PASS;
|
return ActionResult.PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public BlockState getPlacementState(ItemPlacementContext context) {
|
public BlockState getPlacementState(ItemPlacementContext context) {
|
||||||
World world = context.getWorld();
|
World world = context.getWorld();
|
||||||
BlockPos pos = context.getBlockPos();
|
BlockPos pos = context.getBlockPos();
|
||||||
BlockState upState = world.getBlockState(pos.up());
|
BlockState upState = world.getBlockState(pos.up());
|
||||||
BlockState downState = world.getBlockState(pos.down());
|
BlockState downState = world.getBlockState(pos.down());
|
||||||
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
||||||
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
||||||
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
||||||
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
||||||
return this.getDefaultState().with(STATE, PedestalState.COLUMN_TOP);
|
return this.getDefaultState().with(STATE, PedestalState.COLUMN_TOP);
|
||||||
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
||||||
return this.getDefaultState().with(STATE, PedestalState.COLUMN);
|
return this.getDefaultState().with(STATE, PedestalState.COLUMN);
|
||||||
} else if (hasPedestalUnder && hasPedestalOver) {
|
} else if (hasPedestalUnder && hasPedestalOver) {
|
||||||
return this.getDefaultState().with(STATE, PedestalState.PILLAR);
|
return this.getDefaultState().with(STATE, PedestalState.PILLAR);
|
||||||
} else if (hasPedestalUnder) {
|
} else if (hasPedestalUnder) {
|
||||||
return this.getDefaultState().with(STATE, PedestalState.PEDESTAL_TOP);
|
return this.getDefaultState().with(STATE, PedestalState.PEDESTAL_TOP);
|
||||||
} else if (hasPedestalOver) {
|
} else if (hasPedestalOver) {
|
||||||
return this.getDefaultState().with(STATE, PedestalState.BOTTOM);
|
return this.getDefaultState().with(STATE, PedestalState.BOTTOM);
|
||||||
}
|
}
|
||||||
return this.getDefaultState();
|
return this.getDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||||
BlockState updated = this.getUpdatedState(state, direction, newState, world, pos, posFrom);
|
BlockState updated = this.getUpdatedState(state, direction, newState, world, pos, posFrom);
|
||||||
if (!updated.isOf(this)) return updated;
|
if (!updated.isOf(this)) return updated;
|
||||||
if (!this.isPlaceable(updated)) {
|
if (!this.isPlaceable(updated)) {
|
||||||
this.moveStoredStack(world, updated, pos);
|
this.moveStoredStack(world, updated, pos);
|
||||||
}
|
}
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockState getUpdatedState(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
private BlockState getUpdatedState(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
|
||||||
if (!state.isOf(this)) return state.getStateForNeighborUpdate(direction, newState, world, pos, posFrom);
|
if (!state.isOf(this)) return state.getStateForNeighborUpdate(direction, newState, world, pos, posFrom);
|
||||||
if (direction != Direction.UP && direction != Direction.DOWN) return state;
|
if (direction != Direction.UP && direction != Direction.DOWN) return state;
|
||||||
BlockState upState = world.getBlockState(pos.up());
|
BlockState upState = world.getBlockState(pos.up());
|
||||||
BlockState downState = world.getBlockState(pos.down());
|
BlockState downState = world.getBlockState(pos.down());
|
||||||
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
boolean upSideSolid = upState.isSideSolidFullSquare(world, pos.up(), Direction.DOWN) || upState.isIn(BlockTags.WALLS);
|
||||||
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalOver = upState.getBlock() instanceof BlockPedestal;
|
||||||
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
boolean hasPedestalUnder = downState.getBlock() instanceof BlockPedestal;
|
||||||
if (direction == Direction.UP) {
|
if (direction == Direction.UP) {
|
||||||
upSideSolid = newState.isSideSolidFullSquare(world, posFrom, Direction.DOWN) || newState.isIn(BlockTags.WALLS);
|
upSideSolid = newState.isSideSolidFullSquare(world, posFrom, Direction.DOWN) || newState.isIn(BlockTags.WALLS);
|
||||||
hasPedestalOver = newState.getBlock() instanceof BlockPedestal;
|
hasPedestalOver = newState.getBlock() instanceof BlockPedestal;
|
||||||
} else if (direction == Direction.DOWN) {
|
} else if (direction == Direction.DOWN) {
|
||||||
hasPedestalUnder = newState.getBlock() instanceof BlockPedestal;
|
hasPedestalUnder = newState.getBlock() instanceof BlockPedestal;
|
||||||
}
|
}
|
||||||
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
if (!hasPedestalOver && hasPedestalUnder && upSideSolid) {
|
||||||
return state.with(STATE, PedestalState.COLUMN_TOP);
|
return state.with(STATE, PedestalState.COLUMN_TOP);
|
||||||
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
} else if (!hasPedestalOver && !hasPedestalUnder && upSideSolid) {
|
||||||
return state.with(STATE, PedestalState.COLUMN);
|
return state.with(STATE, PedestalState.COLUMN);
|
||||||
} else if (hasPedestalUnder && hasPedestalOver) {
|
} else if (hasPedestalUnder && hasPedestalOver) {
|
||||||
return state.with(STATE, PedestalState.PILLAR);
|
return state.with(STATE, PedestalState.PILLAR);
|
||||||
} else if (hasPedestalUnder) {
|
} else if (hasPedestalUnder) {
|
||||||
return state.with(STATE, PedestalState.PEDESTAL_TOP);
|
return state.with(STATE, PedestalState.PEDESTAL_TOP);
|
||||||
} else if (hasPedestalOver) {
|
} else if (hasPedestalOver) {
|
||||||
return state.with(STATE, PedestalState.BOTTOM);
|
return state.with(STATE, PedestalState.BOTTOM);
|
||||||
}
|
}
|
||||||
return state.with(STATE, PedestalState.DEFAULT);
|
return state.with(STATE, PedestalState.DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
List<ItemStack> drop = Lists.newArrayList(super.getDroppedStacks(state, builder));
|
List<ItemStack> drop = Lists.newArrayList(super.getDroppedStacks(state, builder));
|
||||||
if (state.isOf(this)) {
|
if (state.isOf(this)) {
|
||||||
if (isPlaceable(state)) {
|
if (isPlaceable(state)) {
|
||||||
BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY);
|
BlockEntity blockEntity = builder.getNullable(LootContextParameters.BLOCK_ENTITY);
|
||||||
if (blockEntity != null && blockEntity instanceof PedestalBlockEntity) {
|
if (blockEntity != null && blockEntity instanceof PedestalBlockEntity) {
|
||||||
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
||||||
if (!pedestal.isEmpty()) {
|
if (!pedestal.isEmpty()) {
|
||||||
drop.add(pedestal.getStack(0));
|
drop.add(pedestal.getStack(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return drop;
|
return drop;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveStoredStack(WorldAccess world, BlockState state, BlockPos pos) {
|
private void moveStoredStack(WorldAccess world, BlockState state, BlockPos pos) {
|
||||||
ItemStack stack = ItemStack.EMPTY;
|
ItemStack stack = ItemStack.EMPTY;
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof PedestalBlockEntity && state.isOf(this)) {
|
if (blockEntity instanceof PedestalBlockEntity && state.isOf(this)) {
|
||||||
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
||||||
stack = pedestal.getStack(0);
|
stack = pedestal.getStack(0);
|
||||||
pedestal.clear();
|
pedestal.clear();
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, state.with(HAS_ITEM, false));
|
BlocksHelper.setWithoutUpdate(world, pos, state.with(HAS_ITEM, false));
|
||||||
}
|
}
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
BlockPos upPos = pos.up();
|
BlockPos upPos = pos.up();
|
||||||
this.moveStoredStack(world, stack, world.getBlockState(upPos), upPos);
|
this.moveStoredStack(world, stack, world.getBlockState(upPos), upPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveStoredStack(WorldAccess world, ItemStack stack, BlockState state, BlockPos pos) {
|
private void moveStoredStack(WorldAccess world, ItemStack stack, BlockState state, BlockPos pos) {
|
||||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
if (!state.isOf(this)) {
|
if (!state.isOf(this)) {
|
||||||
this.dropStoredStack(world, stack, pos);
|
this.dropStoredStack(world, stack, pos);
|
||||||
} else if (state.get(STATE).equals(PedestalState.PILLAR)) {
|
} else if (state.get(STATE).equals(PedestalState.PILLAR)) {
|
||||||
BlockPos upPos = pos.up();
|
BlockPos upPos = pos.up();
|
||||||
this.moveStoredStack(world, stack, world.getBlockState(upPos), upPos);
|
this.moveStoredStack(world, stack, world.getBlockState(upPos), upPos);
|
||||||
} else if (!this.isPlaceable(state)) {
|
} else if (!this.isPlaceable(state)) {
|
||||||
this.dropStoredStack(world, stack, pos);
|
this.dropStoredStack(world, stack, pos);
|
||||||
} else if (blockEntity instanceof PedestalBlockEntity) {
|
} else if (blockEntity instanceof PedestalBlockEntity) {
|
||||||
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
PedestalBlockEntity pedestal = (PedestalBlockEntity) blockEntity;
|
||||||
if (pedestal.isEmpty()) {
|
if (pedestal.isEmpty()) {
|
||||||
pedestal.setStack(0, stack);
|
pedestal.setStack(0, stack);
|
||||||
BlocksHelper.setWithoutUpdate(world, pos, state.with(HAS_ITEM, true));
|
BlocksHelper.setWithoutUpdate(world, pos, state.with(HAS_ITEM, true));
|
||||||
} else {
|
} else {
|
||||||
this.dropStoredStack(world, stack, pos);
|
this.dropStoredStack(world, stack, pos);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.dropStoredStack(world, stack, pos);
|
this.dropStoredStack(world, stack, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropStoredStack(WorldAccess world, ItemStack stack, BlockPos pos) {
|
private void dropStoredStack(WorldAccess world, ItemStack stack, BlockPos pos) {
|
||||||
Block.dropStack((World) world, this.getDropPos(world, pos), stack);
|
Block.dropStack((World) world, this.getDropPos(world, pos), stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockPos getDropPos(WorldAccess world, BlockPos pos) {
|
private BlockPos getDropPos(WorldAccess world, BlockPos pos) {
|
||||||
BlockPos dropPos;
|
BlockPos dropPos;
|
||||||
for(int i = 2; i < Direction.values().length; i++) {
|
for(int i = 2; i < Direction.values().length; i++) {
|
||||||
dropPos = pos.offset(Direction.byId(i));
|
dropPos = pos.offset(Direction.byId(i));
|
||||||
if (world.getBlockState(dropPos).isAir()) {
|
if (world.getBlockState(dropPos).isAir()) {
|
||||||
return dropPos.toImmutable();
|
return dropPos.toImmutable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (world.getBlockState(pos.up()).isAir()) {
|
if (world.getBlockState(pos.up()).isAir()) {
|
||||||
return pos.up();
|
return pos.up();
|
||||||
}
|
}
|
||||||
return this.getDropPos(world, pos.up());
|
return this.getDropPos(world, pos.up());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isPlaceable(BlockState state) {
|
protected boolean isPlaceable(BlockState state) {
|
||||||
if (!state.isOf(this)) return false;
|
if (!state.isOf(this)) return false;
|
||||||
PedestalState currentState = state.get(STATE);
|
PedestalState currentState = state.get(STATE);
|
||||||
return currentState != PedestalState.BOTTOM &&
|
return currentState != PedestalState.BOTTOM &&
|
||||||
currentState != PedestalState.COLUMN &&
|
currentState != PedestalState.COLUMN &&
|
||||||
currentState != PedestalState.PILLAR &&
|
currentState != PedestalState.PILLAR &&
|
||||||
currentState != PedestalState.COLUMN_TOP;
|
currentState != PedestalState.COLUMN_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||||
if (state.isOf(this)) {
|
if (state.isOf(this)) {
|
||||||
switch(state.get(STATE)) {
|
switch(state.get(STATE)) {
|
||||||
case BOTTOM: {
|
case BOTTOM: {
|
||||||
return SHAPE_BOTTOM;
|
return SHAPE_BOTTOM;
|
||||||
}
|
}
|
||||||
case PEDESTAL_TOP: {
|
case PEDESTAL_TOP: {
|
||||||
return SHAPE_PEDESTAL_TOP;
|
return SHAPE_PEDESTAL_TOP;
|
||||||
}
|
}
|
||||||
case COLUMN_TOP: {
|
case COLUMN_TOP: {
|
||||||
return SHAPE_COLUMN_TOP;
|
return SHAPE_COLUMN_TOP;
|
||||||
}
|
}
|
||||||
case PILLAR: {
|
case PILLAR: {
|
||||||
return SHAPE_PILLAR;
|
return SHAPE_PILLAR;
|
||||||
}
|
}
|
||||||
case COLUMN: {
|
case COLUMN: {
|
||||||
return SHAPE_COLUMN;
|
return SHAPE_COLUMN;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return SHAPE_DEFAULT;
|
return SHAPE_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return super.getOutlineShape(state, world, pos, context);
|
return super.getOutlineShape(state, world, pos, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||||
stateManager.add(STATE, HAS_ITEM);
|
stateManager.add(STATE, HAS_ITEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockEntity createBlockEntity(BlockView world) {
|
public BlockEntity createBlockEntity(BlockView world) {
|
||||||
return new PedestalBlockEntity();
|
return new PedestalBlockEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStatesPattern(Reader data) {
|
public String getStatesPattern(Reader data) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
return Patterned.createJson(data, blockId, blockId.getPath());
|
return Patterned.createJson(data, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(parent);
|
Identifier blockId = Registry.BLOCK.getId(parent);
|
||||||
String name = blockId.getPath();
|
String name = blockId.getPath();
|
||||||
Map<String, String> textures = new HashMap<String, String>() {
|
Map<String, String> textures = new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
{
|
{
|
||||||
put("%mod%", blockId.getNamespace() );
|
put("%mod%", blockId.getNamespace() );
|
||||||
put("%top%", name + "_top");
|
put("%top%", name + "_top");
|
||||||
put("%base%", name + "_base");
|
put("%base%", name + "_base");
|
||||||
put("%pillar%", name + "_pillar");
|
put("%pillar%", name + "_pillar");
|
||||||
put("%bottom%", name + "_bottom");
|
put("%bottom%", name + "_bottom");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (block.contains("column_top")) {
|
if (block.contains("column_top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_COLUMN_TOP, textures);
|
||||||
} else if (block.contains("column")) {
|
} else if (block.contains("column")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_COLUMN, textures);
|
return Patterned.createJson(Patterned.BLOKC_PEDESTAL_COLUMN, textures);
|
||||||
} else if (block.contains("top")) {
|
} else if (block.contains("top")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_TOP, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_TOP, textures);
|
||||||
} else if (block.contains("bottom")) {
|
} else if (block.contains("bottom")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_BOTTOM, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_BOTTOM, textures);
|
||||||
} else if (block.contains("pillar")) {
|
} else if (block.contains("pillar")) {
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_PILLAR, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_PILLAR, textures);
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.PEDESTAL_MODEL_DEFAULT, textures);
|
return Patterned.createJson(Patterned.BLOCK_PEDESTAL_DEFAULT, textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.PEDESTAL_STATES_PATTERN;
|
return Patterned.STATE_PEDESTAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
VoxelShape basinUp = Block.createCuboidShape(2, 3, 2, 14, 4, 14);
|
VoxelShape basinUp = Block.createCuboidShape(2, 3, 2, 14, 4, 14);
|
||||||
VoxelShape basinDown = Block.createCuboidShape(0, 0, 0, 16, 3, 16);
|
VoxelShape basinDown = Block.createCuboidShape(0, 0, 0, 16, 3, 16);
|
||||||
VoxelShape columnTopUp = Block.createCuboidShape(1, 14, 1, 15, 16, 15);
|
VoxelShape columnTopUp = Block.createCuboidShape(1, 14, 1, 15, 16, 15);
|
||||||
VoxelShape columnTopDown = Block.createCuboidShape(2, 13, 2, 14, 14, 14);
|
VoxelShape columnTopDown = Block.createCuboidShape(2, 13, 2, 14, 14, 14);
|
||||||
VoxelShape pedestalTop = Block.createCuboidShape(1, 8, 1, 15, 10, 15);
|
VoxelShape pedestalTop = Block.createCuboidShape(1, 8, 1, 15, 10, 15);
|
||||||
VoxelShape pedestalDefault = Block.createCuboidShape(1, 12, 1, 15, 14, 15);
|
VoxelShape pedestalDefault = Block.createCuboidShape(1, 12, 1, 15, 14, 15);
|
||||||
VoxelShape pillar = Block.createCuboidShape(3, 0, 3, 13, 8, 13);
|
VoxelShape pillar = Block.createCuboidShape(3, 0, 3, 13, 8, 13);
|
||||||
VoxelShape pillarDefault = Block.createCuboidShape(3, 0, 3, 13, 12, 13);
|
VoxelShape pillarDefault = Block.createCuboidShape(3, 0, 3, 13, 12, 13);
|
||||||
VoxelShape columnTop = VoxelShapes.union(columnTopDown, columnTopUp);
|
VoxelShape columnTop = VoxelShapes.union(columnTopDown, columnTopUp);
|
||||||
VoxelShape basin = VoxelShapes.union(basinDown, basinUp);
|
VoxelShape basin = VoxelShapes.union(basinDown, basinUp);
|
||||||
SHAPE_PILLAR = Block.createCuboidShape(3, 0, 3, 13, 16, 13);
|
SHAPE_PILLAR = Block.createCuboidShape(3, 0, 3, 13, 16, 13);
|
||||||
SHAPE_DEFAULT = VoxelShapes.union(basin, pillarDefault, pedestalDefault);
|
SHAPE_DEFAULT = VoxelShapes.union(basin, pillarDefault, pedestalDefault);
|
||||||
SHAPE_PEDESTAL_TOP = VoxelShapes.union(pillar, pedestalTop);
|
SHAPE_PEDESTAL_TOP = VoxelShapes.union(pillar, pedestalTop);
|
||||||
SHAPE_COLUMN_TOP = VoxelShapes.union(SHAPE_PILLAR, columnTop);
|
SHAPE_COLUMN_TOP = VoxelShapes.union(SHAPE_PILLAR, columnTop);
|
||||||
SHAPE_COLUMN = VoxelShapes.union(basin, SHAPE_PILLAR, columnTop);
|
SHAPE_COLUMN = VoxelShapes.union(basin, SHAPE_PILLAR, columnTop);
|
||||||
SHAPE_BOTTOM = VoxelShapes.union(basin, SHAPE_PILLAR);
|
SHAPE_BOTTOM = VoxelShapes.union(basin, SHAPE_PILLAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,11 @@ public class BlockPillar extends PillarBlock implements Patterned {
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
return Patterned.createJson(Patterned.PILLAR_BLOCK_MODEL, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_PILLAR, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.PILLAR_STATES_PATTERN;
|
return Patterned.STATE_PILLAR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,13 @@ public class BlockPressurePlate extends PressurePlateBlock implements Patterned
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("down")) {
|
if (block.contains("down")) {
|
||||||
return Patterned.createJson(Patterned.PLATE_MODEL_DOWN, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_PLATE_DOWN, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.PLATE_MODEL_UP, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_PLATE_UP, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.PLATE_STATES_PATTERN;
|
return Patterned.STATE_PLATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,12 +164,12 @@ public class BlockSign extends AbstractSignBlock implements Patterned {
|
||||||
if (path.contains("item")) {
|
if (path.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_MODEL, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.EMPTY_MODEL, parentId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_EMPTY, parentId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,12 +45,12 @@ public class BlockSimpleLeaves extends BlockBaseNotFull implements IRenderTypeab
|
||||||
@Override
|
@Override
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
return Patterned.createJson(Patterned.BASE_BLOCK_MODEL, blockId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BASE, blockId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BLOCK_STATES_PATTERN;
|
return Patterned.STATE_SIMPLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -39,11 +39,11 @@ public class BlockSlab extends SlabBlock implements Patterned {
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
return Patterned.createJson(Patterned.SLAB_BLOCK_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_SLAB, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.SLAB_STATES_PATTERN;
|
return Patterned.STATE_SLAB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,16 @@ public class BlockStairs extends StairsBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("inner")) {
|
if (block.contains("inner")) {
|
||||||
return Patterned.createJson(Patterned.STAIRS_MODEL_INNER, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_STAIR_INNER, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("outer")) {
|
if (block.contains("outer")) {
|
||||||
return Patterned.createJson(Patterned.STAIRS_MODEL_OUTER, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_STAIR_OUTER, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.STAIRS_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_STAIR, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.STAIRS_STATES_PATTERN;
|
return Patterned.STATE_STAIRS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,16 @@ public class BlockStoneButton extends StoneButtonBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.BUTTON_ITEM_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_BUTTON, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("pressed")) {
|
if (block.contains("pressed")) {
|
||||||
return Patterned.createJson(Patterned.BUTTON_PRESSED_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BUTTON_PRESSED, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.BUTTON_BLOCK_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BUTTON, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BUTTON_STATES_PATTERN;
|
return Patterned.STATE_BUTTON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,13 +40,13 @@ public class BlockStonePressurePlate extends PressurePlateBlock implements Patte
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("down")) {
|
if (block.contains("down")) {
|
||||||
return Patterned.createJson(Patterned.PLATE_MODEL_DOWN, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_PLATE_DOWN, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.PLATE_MODEL_UP, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_PLATE_UP, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.PLATE_STATES_PATTERN;
|
return Patterned.STATE_PLATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Pat
|
||||||
public String getModelPattern(String block) {
|
public String getModelPattern(String block) {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
String name = blockId.getPath();
|
String name = blockId.getPath();
|
||||||
return Patterned.createJson(Patterned.TRAPDOOR_MODEL, new HashMap<String, String>() {
|
return Patterned.createJson(Patterned.BLOCK_TRAPDOOR, new HashMap<String, String>() {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
{
|
{
|
||||||
put("%block%", name);
|
put("%block%", name);
|
||||||
|
@ -53,6 +53,6 @@ public class BlockTrapdoor extends TrapdoorBlock implements IRenderTypeable, Pat
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.TRAPDOOR_STATES_PATTERN;
|
return Patterned.STATE_TRAPDOOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,19 +40,19 @@ public class BlockWall extends WallBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.WALL_ITEM_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_WALL, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("side_tall")) {
|
if (block.contains("side_tall")) {
|
||||||
return Patterned.createJson(Patterned.WALL_SIDE_TALL_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_WALL_SIDE_TALL, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("side")) {
|
if (block.contains("side")) {
|
||||||
return Patterned.createJson(Patterned.WALL_SIDE_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_WALL_SIDE, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.WALL_POST_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_WALL_POST, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.WALL_STATES_PATTERN;
|
return Patterned.STATE_WALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,16 @@ public class BlockWoodenButton extends WoodenButtonBlock implements Patterned {
|
||||||
Identifier blockId = Registry.BLOCK.getId(this);
|
Identifier blockId = Registry.BLOCK.getId(this);
|
||||||
Identifier parentId = Registry.BLOCK.getId(parent);
|
Identifier parentId = Registry.BLOCK.getId(parent);
|
||||||
if (block.contains("item")) {
|
if (block.contains("item")) {
|
||||||
return Patterned.createJson(Patterned.BUTTON_ITEM_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.ITEM_BUTTON, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
if (block.contains("pressed")) {
|
if (block.contains("pressed")) {
|
||||||
return Patterned.createJson(Patterned.BUTTON_PRESSED_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BUTTON_PRESSED, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
return Patterned.createJson(Patterned.BUTTON_BLOCK_MODEL, parentId, blockId.getPath());
|
return Patterned.createJson(Patterned.BLOCK_BUTTON, parentId, blockId.getPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier statePatternId() {
|
public Identifier statePatternId() {
|
||||||
return Patterned.BUTTON_STATES_PATTERN;
|
return Patterned.STATE_BUTTON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,147 +1,147 @@
|
||||||
package ru.betterend.interfaces;
|
package ru.betterend.interfaces;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.resource.ResourceManager;
|
import net.minecraft.resource.ResourceManager;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import ru.betterend.BetterEnd;
|
import ru.betterend.BetterEnd;
|
||||||
|
|
||||||
public interface Patterned {
|
public interface Patterned {
|
||||||
//Blockstates
|
//Blockstates
|
||||||
public final static Identifier BLOCK_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_block.json");
|
public final static Identifier STATE_SIMPLE = BetterEnd.makeID("patterns/blockstate/pattern_block.json");
|
||||||
public final static Identifier SLAB_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_slab.json");
|
public final static Identifier STATE_SLAB = BetterEnd.makeID("patterns/blockstate/pattern_slab.json");
|
||||||
public final static Identifier STAIRS_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_stairs.json");
|
public final static Identifier STATE_STAIRS = BetterEnd.makeID("patterns/blockstate/pattern_stairs.json");
|
||||||
public final static Identifier WALL_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_wall.json");
|
public final static Identifier STATE_WALL = BetterEnd.makeID("patterns/blockstate/pattern_wall.json");
|
||||||
public final static Identifier FENCE_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_fence.json");
|
public final static Identifier STATE_FENCE = BetterEnd.makeID("patterns/blockstate/pattern_fence.json");
|
||||||
public final static Identifier BUTTON_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_button.json");
|
public final static Identifier STATE_BUTTON = BetterEnd.makeID("patterns/blockstate/pattern_button.json");
|
||||||
public final static Identifier PILLAR_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_pillar.json");
|
public final static Identifier STATE_PILLAR = BetterEnd.makeID("patterns/blockstate/pattern_pillar.json");
|
||||||
public final static Identifier PLATE_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_pressure_plate.json");
|
public final static Identifier STATE_PLATE = 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 STATE_DOOR = 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 STATE_SAPLING = 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 STATE_GATE = 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 STATE_TRAPDOOR = BetterEnd.makeID("patterns/blockstate/pattern_trapdoor.json");
|
||||||
public final static Identifier LADDER_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_ladder.json");
|
public final static Identifier STATE_LADDER = BetterEnd.makeID("patterns/blockstate/pattern_ladder.json");
|
||||||
public final static Identifier BARREL_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json");
|
public final static Identifier STATE_BARREL = BetterEnd.makeID("patterns/blockstate/pattern_barrel.json");
|
||||||
public final static Identifier PEDESTAL_STATES_PATTERN = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json");
|
public final static Identifier STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pattern_pedestal.json");
|
||||||
public final static Identifier BLOCKSTATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
public final static Identifier STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
||||||
|
|
||||||
//Models Block
|
//Models Block
|
||||||
public final static Identifier EMPTY_MODEL = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
public final static Identifier BLOCK_EMPTY = BetterEnd.makeID("patterns/block/pattern_empty.json");
|
||||||
public final static Identifier BASE_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_block.json");
|
public final static Identifier BLOCK_BASE = BetterEnd.makeID("patterns/block/pattern_block.json");
|
||||||
public final static Identifier SIDED_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_block_sided.json");
|
public final static Identifier BLOCK_SIDED = BetterEnd.makeID("patterns/block/pattern_block_sided.json");
|
||||||
public final static Identifier BLOCK_BOTTOM_TOP_MODEL = BetterEnd.makeID("patterns/block/pattern_block_bottom_top.json");
|
public final static Identifier BLOCK_BOTTOM_TOP = BetterEnd.makeID("patterns/block/pattern_block_bottom_top.json");
|
||||||
public final static Identifier SLAB_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_slab.json");
|
public final static Identifier BLOCK_SLAB = BetterEnd.makeID("patterns/block/pattern_slab.json");
|
||||||
public final static Identifier STAIRS_MODEL = BetterEnd.makeID("patterns/block/pattern_stairs.json");
|
public final static Identifier BLOCK_STAIR = BetterEnd.makeID("patterns/block/pattern_stairs.json");
|
||||||
public final static Identifier STAIRS_MODEL_INNER = BetterEnd.makeID("patterns/block/pattern_inner_stairs.json");
|
public final static Identifier BLOCK_STAIR_INNER = BetterEnd.makeID("patterns/block/pattern_inner_stairs.json");
|
||||||
public final static Identifier STAIRS_MODEL_OUTER = BetterEnd.makeID("patterns/block/pattern_outer_stairs.json");
|
public final static Identifier BLOCK_STAIR_OUTER = BetterEnd.makeID("patterns/block/pattern_outer_stairs.json");
|
||||||
public final static Identifier WALL_POST_MODEL = BetterEnd.makeID("patterns/block/pattern_wall_post.json");
|
public final static Identifier BLOCK_WALL_POST = BetterEnd.makeID("patterns/block/pattern_wall_post.json");
|
||||||
public final static Identifier WALL_SIDE_MODEL = BetterEnd.makeID("patterns/block/pattern_wall_side.json");
|
public final static Identifier BLOCK_WALL_SIDE = BetterEnd.makeID("patterns/block/pattern_wall_side.json");
|
||||||
public final static Identifier WALL_SIDE_TALL_MODEL = BetterEnd.makeID("patterns/block/pattern_wall_side_tall.json");
|
public final static Identifier BLOCK_WALL_SIDE_TALL = BetterEnd.makeID("patterns/block/pattern_wall_side_tall.json");
|
||||||
public final static Identifier FENCE_POST_MODEL = BetterEnd.makeID("patterns/block/pattern_fence_post.json");
|
public final static Identifier BLOCK_FENCE_POST = BetterEnd.makeID("patterns/block/pattern_fence_post.json");
|
||||||
public final static Identifier FENCE_SIDE_MODEL = BetterEnd.makeID("patterns/block/pattern_fence_side.json");
|
public final static Identifier BLOCK_FENCE_SIDE = BetterEnd.makeID("patterns/block/pattern_fence_side.json");
|
||||||
public final static Identifier BUTTON_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_button.json");
|
public final static Identifier BLOCK_BUTTON = BetterEnd.makeID("patterns/block/pattern_button.json");
|
||||||
public final static Identifier BUTTON_PRESSED_MODEL = BetterEnd.makeID("patterns/block/pattern_button_pressed.json");
|
public final static Identifier BLOCK_BUTTON_PRESSED = BetterEnd.makeID("patterns/block/pattern_button_pressed.json");
|
||||||
public final static Identifier PILLAR_BLOCK_MODEL = BetterEnd.makeID("patterns/block/pattern_pillar.json");
|
public final static Identifier BLOCK_PILLAR = BetterEnd.makeID("patterns/block/pattern_pillar.json");
|
||||||
public final static Identifier PLATE_MODEL_UP = BetterEnd.makeID("patterns/block/pattern_pressure_plate_up.json");
|
public final static Identifier BLOCK_PLATE_UP = BetterEnd.makeID("patterns/block/pattern_pressure_plate_up.json");
|
||||||
public final static Identifier PLATE_MODEL_DOWN = BetterEnd.makeID("patterns/block/pattern_pressure_plate_down.json");
|
public final static Identifier BLOCK_PLATE_DOWN = BetterEnd.makeID("patterns/block/pattern_pressure_plate_down.json");
|
||||||
public final static Identifier DOOR_MODEL_TOP = BetterEnd.makeID("patterns/block/pattern_door_top.json");
|
public final static Identifier BLOCK_DOOR_TOP = BetterEnd.makeID("patterns/block/pattern_door_top.json");
|
||||||
public final static Identifier DOOR_MODEL_TOP_HINGE = BetterEnd.makeID("patterns/block/pattern_door_top_hinge.json");
|
public final static Identifier BLOCK_DOOR_TOP_HINGE = BetterEnd.makeID("patterns/block/pattern_door_top_hinge.json");
|
||||||
public final static Identifier DOOR_MODEL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_door_bottom.json");
|
public final static Identifier BLOCK_DOOR_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 BLOCK_DOOR_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 BLOCK_SAPLING = 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 BLOCK_GATE_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 BLOCK_GATE_CLOSED_WALL = 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 BLOCK_GATE_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 BLOCK_GATE_OPEN_WALL = 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 BLOCK_TRAPDOOR = BetterEnd.makeID("patterns/block/pattern_trapdoor.json");
|
||||||
public final static Identifier LADDER_MODEL = BetterEnd.makeID("patterns/block/pattern_ladder.json");
|
public final static Identifier BLOCK_LADDER = BetterEnd.makeID("patterns/block/pattern_ladder.json");
|
||||||
public final static Identifier BARREL_MODEL_OPEN = BetterEnd.makeID("patterns/block/pattern_barrel_open.json");
|
public final static Identifier BLOCK_BARREL_OPEN = BetterEnd.makeID("patterns/block/pattern_barrel_open.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_DEFAULT = BetterEnd.makeID("patterns/block/pattern_pedestal_default.json");
|
public final static Identifier BLOCK_PEDESTAL_DEFAULT = BetterEnd.makeID("patterns/block/pattern_pedestal_default.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_COLUMN = BetterEnd.makeID("patterns/block/pattern_pedestal_column.json");
|
public final static Identifier BLOKC_PEDESTAL_COLUMN = BetterEnd.makeID("patterns/block/pattern_pedestal_column.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_COLUMN_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_column_top.json");
|
public final static Identifier BLOCK_PEDESTAL_COLUMN_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_column_top.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_top.json");
|
public final static Identifier BLOCK_PEDESTAL_TOP = BetterEnd.makeID("patterns/block/pattern_pedestal_top.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_pedestal_bottom.json");
|
public final static Identifier BLOCK_PEDESTAL_BOTTOM = BetterEnd.makeID("patterns/block/pattern_pedestal_bottom.json");
|
||||||
public final static Identifier PEDESTAL_MODEL_PILLAR = BetterEnd.makeID("patterns/block/pattern_pedestal_pillar.json");
|
public final static Identifier BLOCK_PEDESTAL_PILLAR = BetterEnd.makeID("patterns/block/pattern_pedestal_pillar.json");
|
||||||
public final static Identifier BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
|
public final static Identifier BLOCK_BOOKSHELF = BetterEnd.makeID("patterns/block/bookshelf.json");
|
||||||
public final static Identifier STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
|
public final static Identifier BLOCK_STONE_LANTERN_CEIL = BetterEnd.makeID("patterns/block/stone_lantern_ceil.json");
|
||||||
public final static Identifier STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
|
public final static Identifier BLOCK_STONE_LANTERN_FLOOR = BetterEnd.makeID("patterns/block/stone_lantern_floor.json");
|
||||||
|
|
||||||
//Models Item
|
//Models Item
|
||||||
public final static Identifier WALL_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
public final static Identifier ITEM_WALL = 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 ITEM_FENCE = 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 ITEM_BUTTON = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||||
public final static Identifier CHEST_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_chest.json");
|
public final static Identifier ITEM_CHEST = BetterEnd.makeID("patterns/item/pattern_chest.json");
|
||||||
public final static Identifier BLOCK_ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_block_item.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 final static Identifier ITEM_MODEL = BetterEnd.makeID("patterns/item/pattern_item.json");
|
||||||
|
|
||||||
default String getStatesPattern(Reader data) {
|
default String getStatesPattern(Reader data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default String getModelPattern(String name) {
|
default String getModelPattern(String name) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default Identifier statePatternId() {
|
default Identifier statePatternId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default Identifier modelPatternId() {
|
default Identifier modelPatternId() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createJson(Reader data, Identifier parent, String name) {
|
public static String createJson(Reader data, Identifier parent, String name) {
|
||||||
try (BufferedReader buffer = new BufferedReader(data)) {
|
try (BufferedReader buffer = new BufferedReader(data)) {
|
||||||
return buffer.lines().collect(Collectors.joining())
|
return buffer.lines().collect(Collectors.joining())
|
||||||
.replace("%parent%", parent.getPath())
|
.replace("%parent%", parent.getPath())
|
||||||
.replace("%block%", name);
|
.replace("%block%", name);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createJson(Identifier patternId, Identifier parent, String block) {
|
public static String createJson(Identifier patternId, Identifier parent, String block) {
|
||||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||||
.lines().collect(Collectors.joining())
|
.lines().collect(Collectors.joining())
|
||||||
.replace("%parent%", parent.getPath())
|
.replace("%parent%", parent.getPath())
|
||||||
.replace("%block%", block);
|
.replace("%block%", block);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createJson(Identifier patternId, String texture) {
|
public static String createJson(Identifier patternId, String texture) {
|
||||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||||
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
return new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||||
.lines().collect(Collectors.joining())
|
.lines().collect(Collectors.joining())
|
||||||
.replace("%texture%", texture);
|
.replace("%texture%", texture);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createJson(Identifier patternId, Map<String, String> textures) {
|
public static String createJson(Identifier patternId, Map<String, String> textures) {
|
||||||
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
ResourceManager resourceManager = MinecraftClient.getInstance().getResourceManager();
|
||||||
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
try (InputStream input = resourceManager.getResource(patternId).getInputStream()) {
|
||||||
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
String json = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))
|
||||||
.lines().collect(Collectors.joining());
|
.lines().collect(Collectors.joining());
|
||||||
for (Entry<String, String> texture : textures.entrySet()) {
|
for (Entry<String, String> texture : textures.entrySet()) {
|
||||||
json = json.replace(texture.getKey(), texture.getValue());
|
json = json.replace(texture.getKey(), texture.getValue());
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue