Removed blockstates patterns
This commit is contained in:
parent
744fe40a00
commit
5dc76a37f2
47 changed files with 60 additions and 650 deletions
|
@ -1,13 +1,8 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
import ru.betterend.blocks.basis.EndAnvilBlock;
|
||||
import ru.betterend.item.material.EndToolMaterial;
|
||||
import ru.betterend.client.models.Patterns;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
|
||||
public class AeterniumAnvil extends EndAnvilBlock {
|
||||
|
@ -22,8 +17,4 @@ public class AeterniumAnvil extends EndAnvilBlock {
|
|||
return DESTRUCTION_LONG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_ANVIL_LONG;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -53,13 +52,7 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -83,9 +76,5 @@ public class BulbVineLanternBlock extends EndLanternBlock implements IRenderType
|
|||
protected String getGlowTexture() {
|
||||
return "bulb_vine_lantern_bulb";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_BULB_LANTERN;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -39,13 +38,7 @@ public class ChandelierBlock extends AttachedBlock implements IRenderTypeable, B
|
|||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return BOUNDING_SHAPES.get(state.getValue(FACING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -62,12 +55,7 @@ public class ChandelierBlock extends AttachedBlock implements IRenderTypeable, B
|
|||
return Patterns.createJson(Patterns.BLOCK_CHANDELIER_FLOOR, blockId.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_CHANDELIER;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
BOUNDING_SHAPES.put(Direction.UP, Block.box(5, 0, 5, 11, 13, 11));
|
||||
BOUNDING_SHAPES.put(Direction.DOWN, Block.box(5, 3, 5, 11, 16, 11));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -86,21 +85,11 @@ public class EmeraldIceBlock extends HalfTransparentBlock implements IRenderType
|
|||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId.getPath(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.google.common.collect.Maps;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
|
@ -63,9 +62,5 @@ public class EndPathBlock extends BlockBaseNotFull {
|
|||
map.put("%side%", name.replace("_path", "") + "_side");
|
||||
return Patterns.createJson(Patterns.BLOCK_PATH, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_ROTATED_TOP;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
|
@ -100,9 +99,5 @@ public class EndTerrainBlock extends BlockBase {
|
|||
map.put("%bottom%", "minecraft:block/end_stone");
|
||||
return Patterns.createJson(Patterns.BLOCK_TOP_SIDE_BOTTOM, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_ROTATED_TOP;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.client.color.block.BlockColor;
|
||||
import net.minecraft.client.color.item.ItemColor;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ru.betterend.interfaces.IColorProvider;
|
||||
import ru.betterend.client.models.Patterns;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -29,21 +27,11 @@ public class HydraluxPetalColoredBlock extends HydraluxPetalBlock implements ICo
|
|||
return BlocksHelper.getBlockColor(this);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String path = "betterend:block/block_petal_colored";
|
||||
return Patterns.createJson(data, path, path);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
String path = "betterend:block/block_petal_colored";
|
||||
return Patterns.createJson(Patterns.BLOCK_PETAL_COLORED, path, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_DIRECT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -9,9 +8,7 @@ import com.google.common.collect.Lists;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.client.color.block.BlockColor;
|
||||
import net.minecraft.client.color.item.ItemColor;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
|
@ -66,23 +63,12 @@ public class JellyshroomCapBlock extends SlimeBlock implements IRenderTypeable,
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Lists.newArrayList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
return Patterns.createJson(Patterns.BLOCK_COLORED, "jellyshroom_cap");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockColor getProvider() {
|
||||
return (state, world, pos, tintIndex) -> {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -67,23 +66,12 @@ public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderType
|
|||
return MHelper.RANDOM.nextInt(4) == 0 ? Lists.newArrayList(new ItemStack(EndBlocks.UMBRELLA_TREE_SAPLING)) : Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId.getPath(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean propagatesSkylightDown(BlockState state, BlockGetter world, BlockPos pos) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
|
@ -11,12 +10,6 @@ public class BarkBlock extends EndPillarBlock {
|
|||
public BarkBlock(Properties settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Optional<String> createBlockPattern(ResourceLocation blockId) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -25,12 +24,6 @@ public class BlockBase extends Block implements BlockModelProvider {
|
|||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -42,8 +35,4 @@ public class BlockBase extends Block implements BlockModelProvider {
|
|||
return getBlockModel(blockId, defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -58,13 +57,7 @@ public class EndAnvilBlock extends AnvilBlock implements BlockModelProvider {
|
|||
stack.getOrCreateTag().putInt("level", level);
|
||||
return Collections.singletonList(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -81,11 +74,6 @@ public class EndAnvilBlock extends AnvilBlock implements BlockModelProvider {
|
|||
char last = block.charAt(block.length() - 1);
|
||||
return blockId.getPath() + "_top_" + last;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_ANVIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getModel(ResourceLocation blockId) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -93,13 +92,7 @@ public class EndBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
|
@ -114,11 +107,6 @@ public class EndBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
|||
return getBlockModel(blockId, defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_BARREL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
String texture = blockId.getPath();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -35,23 +34,12 @@ public class EndBookshelfBlock extends BlockBase {
|
|||
}
|
||||
return Collections.singletonList(new ItemStack(Items.BOOK, 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_BOOKSHELF, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, getName(blockId), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -35,13 +34,7 @@ public class EndChainBlock extends ChainBlock implements BlockModelProvider, IRe
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -56,11 +49,6 @@ public class EndChainBlock extends ChainBlock implements BlockModelProvider, IRe
|
|||
return ModelProvider.createItemModel(blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_CHAIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
String name = blockId.getPath();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
@ -40,14 +39,7 @@ public class EndChestBlock extends ChestBlock implements BlockModelProvider {
|
|||
drop.add(new ItemStack(this.asItem()));
|
||||
return drop;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String path) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -64,11 +56,6 @@ public class EndChestBlock extends ChestBlock implements BlockModelProvider {
|
|||
return pattern.map(BlockModel::fromString).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -29,13 +28,7 @@ public class EndComposterBlock extends ComposterBlock implements BlockModelProvi
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -48,11 +41,6 @@ public class EndComposterBlock extends ComposterBlock implements BlockModelProvi
|
|||
return getBlockModel(resourceLocation, defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_COMPOSTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
return null;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -27,13 +26,7 @@ public class EndCraftingTableBlock extends CraftingTableBlock implements BlockMo
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -57,11 +50,6 @@ public class EndCraftingTableBlock extends CraftingTableBlock implements BlockMo
|
|||
return getBlockModel(resourceLocation, defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
String blockName = blockId.getPath();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -46,12 +45,6 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
|
@ -143,11 +136,6 @@ public class EndDoorBlock extends DoorBlock implements IRenderTypeable, BlockMod
|
|||
return new MultiVariant(Lists.newArrayList(variant));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_DOOR;
|
||||
}
|
||||
|
||||
protected DoorType getDoorType(BlockState blockState) {
|
||||
boolean isHinge = isHinge(blockState.getValue(HINGE), blockState.getValue(OPEN));
|
||||
switch (blockState.getValue(HALF)) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndFenceBlock extends FenceBlock implements BlockModelProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -48,9 +40,5 @@ public class EndFenceBlock extends FenceBlock implements BlockModelProvider {
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_FENCE_POST, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_FENCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -52,13 +51,7 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockModelProvider,
|
|||
player.awardStat(Stats.INTERACT_WITH_FURNACE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -75,11 +68,6 @@ public class EndFurnaceBlock extends FurnaceBlock implements BlockModelProvider,
|
|||
return Patterns.createJson(Patterns.BLOCK_FURNACE, map);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_FURNACE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndGateBlock extends FenceGateBlock implements BlockModelProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -52,9 +44,5 @@ public class EndGateBlock extends FenceGateBlock implements BlockModelProvider {
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_GATE_CLOSED, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_GATE;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -137,13 +136,7 @@ public class EndLadderBlock extends BlockBaseNotFull implements IRenderTypeable,
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -152,9 +145,5 @@ public class EndLadderBlock extends BlockBaseNotFull implements IRenderTypeable,
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_LADDER, blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_LADDER;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -10,7 +9,6 @@ import com.google.common.collect.Lists;
|
|||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
|
@ -53,24 +51,13 @@ public class EndLeavesBlock extends LeavesBlock implements BlockModelProvider, I
|
|||
.isViewBlocking((state, world, pos) -> false));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, blockId, blockId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
String blockId = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId, blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -30,13 +29,7 @@ public class EndMetalPaneBlock extends IronBarsBlock implements BlockModelProvid
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -58,12 +51,7 @@ public class EndMetalPaneBlock extends IronBarsBlock implements BlockModelProvid
|
|||
}
|
||||
return super.skipRendering(state, stateFrom, direction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_BARS;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndMetalPlateBlock extends WeightedPressurePlateBlock implements Bl
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -45,9 +37,5 @@ public class EndMetalPlateBlock extends WeightedPressurePlateBlock implements Bl
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_UP, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_PLATE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -71,21 +70,11 @@ public class EndOreBlock extends OreBlock implements BlockModelProvider {
|
|||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, blockId.getPath(), block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -39,23 +38,12 @@ public class EndPillarBlock extends RotatedPillarBlock implements BlockModelProv
|
|||
public BlockModel getModel(ResourceLocation blockId) {
|
||||
return getBlockModel(blockId, defaultBlockState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return createBlockPattern(blockId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_PILLAR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndPlateBlock extends PressurePlateBlock implements BlockModelProvi
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -45,9 +37,5 @@ public class EndPlateBlock extends PressurePlateBlock implements BlockModelProvi
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_PLATE_UP, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return this.stateDefinition.getProperty("facing") != null ? Patterns.STATE_PLATE_ROTATED : Patterns.STATE_PLATE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -144,14 +143,7 @@ public class EndSignBlock extends SignBlock implements BlockModelProvider, ISpet
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String path) {
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
|
@ -160,12 +152,7 @@ public class EndSignBlock extends SignBlock implements BlockModelProvider, ISpet
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_EMPTY, parentId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState rotate(BlockState state, Rotation rotation) {
|
||||
return (BlockState) state.setValue(ROTATION, rotation.rotate((Integer) state.getValue(ROTATION), 16));
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,23 +27,12 @@ public class EndSlabBlock extends SlabBlock implements BlockModelProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(Patterns.BLOCK_SLAB, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SLAB;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -29,14 +28,7 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -50,9 +42,5 @@ public class EndStairsBlock extends StairBlock implements BlockModelProvider {
|
|||
}
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_STAIRS;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndStoneButtonBlock extends StoneButtonBlock implements BlockModelP
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -48,9 +40,5 @@ public class EndStoneButtonBlock extends StoneButtonBlock implements BlockModelP
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_BUTTON;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -33,13 +32,7 @@ public class EndTrapdoorBlock extends TrapDoorBlock implements IRenderTypeable,
|
|||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -52,9 +45,5 @@ public class EndTrapdoorBlock extends TrapDoorBlock implements IRenderTypeable,
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_TRAPDOOR;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -29,14 +28,7 @@ public class EndWallBlock extends WallBlock implements BlockModelProvider {
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -52,9 +44,5 @@ public class EndWallBlock extends WallBlock implements BlockModelProvider {
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_WALL_POST, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_WALL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -28,14 +27,7 @@ public class EndWoodenButtonBlock extends WoodButtonBlock implements BlockModelP
|
|||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||
return Collections.singletonList(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
ResourceLocation parentId = Registry.BLOCK.getKey(parent);
|
||||
return Patterns.createJson(data, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
|
@ -48,9 +40,5 @@ public class EndWoodenButtonBlock extends WoodButtonBlock implements BlockModelP
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_BUTTON, parentId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_BUTTON;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -10,7 +9,6 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -110,12 +108,6 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
return ERenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(this);
|
||||
return Patterns.createJson(data, blockId.getPath(), blockId.getPath());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
if (block.contains("item")) {
|
||||
|
@ -125,11 +117,6 @@ public abstract class FeatureSaplingBlock extends SaplingBlock implements IRende
|
|||
return Patterns.createJson(Patterns.BLOCK_CROSS, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SAPLING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockModel getModel(ResourceLocation resourceLocation) {
|
||||
return ModelsHelper.createBlockItem(resourceLocation);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.io.Reader;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -338,13 +337,7 @@ public class PedestalBlock extends BlockBaseNotFull implements EntityBlock {
|
|||
public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
|
||||
return state.getValue(HAS_ITEM) ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
Map<String, String> textures = createTexturesMap();
|
||||
|
@ -406,11 +399,6 @@ public class PedestalBlock extends BlockBaseNotFull implements EntityBlock {
|
|||
return ModelsHelper.createBlockSimple(modelId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_PEDESTAL;
|
||||
}
|
||||
|
||||
protected Map<String, String> createTexturesMap() {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(parent);
|
||||
String name = blockId.getPath();
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.SoundType;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
@ -36,23 +34,12 @@ public class SimpleLeavesBlock extends BlockBaseNotFull implements IRenderTypeab
|
|||
.isSuffocating((state, world, pos) -> false)
|
||||
.isViewBlocking((state, world, pos) -> false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, texture, texture);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(Patterns.BLOCK_BASE, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_SIMPLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
|
|
|
@ -201,12 +201,7 @@ public class StalactiteBlock extends BlockBaseNotFull implements SimpleWaterlogg
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_CROSS_SHADED, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_STALACTITE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canPlaceLiquid(BlockGetter world, BlockPos pos, BlockState state, Fluid fluid) {
|
||||
return false;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package ru.betterend.blocks.basis;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
@ -9,7 +8,6 @@ import net.minecraft.client.color.item.ItemColor;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -62,12 +60,7 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
|
|||
public VoxelShape getShape(BlockState state, BlockGetter view, BlockPos pos, CollisionContext ePos) {
|
||||
return state.getValue(IS_FLOOR) ? SHAPE_FLOOR : SHAPE_CEIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_STONE_LANTERN;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getModelString(String block) {
|
||||
String texture = Registry.BLOCK.getKey(this).getPath();
|
||||
|
@ -76,10 +69,5 @@ public class StoneLanternBlock extends EndLanternBlock implements IColorProvider
|
|||
}
|
||||
return Patterns.createJson(Patterns.BLOCK_STONE_LANTERN_FLOOR, texture, texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatesPattern(Reader data) {
|
||||
String block = Registry.BLOCK.getKey(this).getPath();
|
||||
return Patterns.createJson(data, block, block);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.google.common.collect.Maps;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -61,12 +60,7 @@ public class TripleTerrainBlock extends EndTerrainBlock {
|
|||
map.put("%bottom%", "minecraft:block/end_stone");
|
||||
return Patterns.createJson(Patterns.BLOCK_TOP_SIDE_BOTTOM, map);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation statePatternId() {
|
||||
return Patterns.STATE_TRIPLE_ROTATED_TOP;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
||||
TripleShape shape = state.getValue(SHAPE);
|
||||
|
|
|
@ -15,9 +15,6 @@ import ru.betterend.BetterEnd;
|
|||
import static net.minecraft.client.resources.model.ModelBakery.MISSING_MODEL_LOCATION;
|
||||
|
||||
public interface BlockModelProvider extends ModelProvider {
|
||||
String getStatesPattern(Reader data);
|
||||
ResourceLocation statePatternId();
|
||||
|
||||
@Nullable
|
||||
default BlockModel getBlockModel(ResourceLocation resourceLocation, BlockState blockState) {
|
||||
Optional<String> pattern = Patterns.createBlockSimple(resourceLocation.getPath());
|
||||
|
|
|
@ -18,39 +18,7 @@ import net.minecraft.server.packs.resources.ResourceManager;
|
|||
import ru.betterend.BetterEnd;
|
||||
|
||||
public class Patterns {
|
||||
|
||||
//Blockstates
|
||||
public final static ResourceLocation STATE_SIMPLE = BetterEnd.makeID("patterns/blockstate/block.json");
|
||||
public final static ResourceLocation STATE_SLAB = BetterEnd.makeID("patterns/blockstate/slab.json");
|
||||
public final static ResourceLocation STATE_STAIRS = BetterEnd.makeID("patterns/blockstate/stairs.json");
|
||||
public final static ResourceLocation STATE_WALL = BetterEnd.makeID("patterns/blockstate/wall.json");
|
||||
public final static ResourceLocation STATE_FENCE = BetterEnd.makeID("patterns/blockstate/fence.json");
|
||||
public final static ResourceLocation STATE_BUTTON = BetterEnd.makeID("patterns/blockstate/button.json");
|
||||
public final static ResourceLocation STATE_PILLAR = BetterEnd.makeID("patterns/blockstate/pillar.json");
|
||||
public final static ResourceLocation STATE_PLATE = BetterEnd.makeID("patterns/blockstate/pressure_plate.json");
|
||||
public final static ResourceLocation STATE_PLATE_ROTATED = BetterEnd.makeID("patterns/blockstate/pressure_plate_rotated.json");
|
||||
public final static ResourceLocation STATE_DOOR = BetterEnd.makeID("patterns/blockstate/door.json");
|
||||
public final static ResourceLocation STATE_SAPLING = BetterEnd.makeID("patterns/blockstate/sapling.json");
|
||||
public final static ResourceLocation STATE_GATE = BetterEnd.makeID("patterns/blockstate/fence_gate.json");
|
||||
public final static ResourceLocation STATE_TRAPDOOR = BetterEnd.makeID("patterns/blockstate/trapdoor.json");
|
||||
public final static ResourceLocation STATE_LADDER = BetterEnd.makeID("patterns/blockstate/ladder.json");
|
||||
public final static ResourceLocation STATE_BARREL = BetterEnd.makeID("patterns/blockstate/barrel.json");
|
||||
public final static ResourceLocation STATE_PEDESTAL = BetterEnd.makeID("patterns/blockstate/pedestal.json");
|
||||
public final static ResourceLocation STATE_STONE_LANTERN = BetterEnd.makeID("patterns/blockstate/stone_lantern.json");
|
||||
public final static ResourceLocation STATE_DIRECT = BetterEnd.makeID("patterns/blockstate/direct.json");
|
||||
public final static ResourceLocation STATE_BULB_LANTERN = BetterEnd.makeID("patterns/blockstate/bulb_lantern.json");
|
||||
public final static ResourceLocation STATE_COMPOSTER = BetterEnd.makeID("patterns/blockstate/composter.json");
|
||||
public final static ResourceLocation STATE_BARS = BetterEnd.makeID("patterns/blockstate/bars.json");
|
||||
public final static ResourceLocation STATE_ANVIL = BetterEnd.makeID("patterns/blockstate/anvil.json");
|
||||
public final static ResourceLocation STATE_ANVIL_LONG = BetterEnd.makeID("patterns/blockstate/anvil_long.json");
|
||||
public final static ResourceLocation STATE_CHAIN = BetterEnd.makeID("patterns/blockstate/chain.json");
|
||||
public final static ResourceLocation STATE_CHANDELIER = BetterEnd.makeID("patterns/blockstate/chandelier.json");
|
||||
public final static ResourceLocation STATE_FURNACE = BetterEnd.makeID("patterns/blockstate/furnace.json");
|
||||
public final static ResourceLocation STATE_ROTATED_TOP = BetterEnd.makeID("patterns/blockstate/rotated_top.json");
|
||||
public final static ResourceLocation STATE_TRIPLE_ROTATED_TOP = BetterEnd.makeID("patterns/blockstate/triple_rotated_top.json");
|
||||
public final static ResourceLocation STATE_STALACTITE = BetterEnd.makeID("patterns/blockstate/stalactite.json");
|
||||
|
||||
//Models Block
|
||||
//Block Models
|
||||
public final static ResourceLocation BLOCK_EMPTY = BetterEnd.makeID("patterns/block/empty.json");
|
||||
public final static ResourceLocation BLOCK_BASE = BetterEnd.makeID("patterns/block/block.json");
|
||||
public final static ResourceLocation BLOCK_SIDED = BetterEnd.makeID("patterns/block/block_sided.json");
|
||||
|
@ -108,7 +76,7 @@ public class Patterns {
|
|||
public final static ResourceLocation BLOCK_TOP_SIDE_BOTTOM = BetterEnd.makeID("patterns/block/top_side_bottom.json");
|
||||
public final static ResourceLocation BLOCK_PATH = BetterEnd.makeID("patterns/block/path.json");
|
||||
|
||||
//Models Item
|
||||
//Item Models
|
||||
public final static ResourceLocation ITEM_WALL = BetterEnd.makeID("patterns/item/pattern_wall.json");
|
||||
public final static ResourceLocation ITEM_FENCE = BetterEnd.makeID("patterns/item/pattern_fence.json");
|
||||
public final static ResourceLocation ITEM_BUTTON = BetterEnd.makeID("patterns/item/pattern_button.json");
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
package ru.betterend.mixin.client;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BlockModelDefinition;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import ru.betterend.client.models.BlockModelProvider;
|
||||
|
||||
@Mixin(BlockModelDefinition.class)
|
||||
public abstract class ModelVariantMapMixin {
|
||||
|
||||
@Inject(method = "fromStream", at = @At("HEAD"), cancellable = true)
|
||||
private static void be_deserializeBlockState(BlockModelDefinition.Context context, Reader reader, CallbackInfoReturnable<BlockModelDefinition> info) {
|
||||
Block block = context.getDefinition().any().getBlock();
|
||||
if (block instanceof BlockModelProvider) {
|
||||
String pattern = ((BlockModelProvider) block).getStatesPattern(reader);
|
||||
Gson gson = ContextGsonAccessor.class.cast(context).getGson();
|
||||
BlockModelDefinition map = GsonHelper.fromJson(gson, new StringReader(pattern), BlockModelDefinition.class);
|
||||
info.setReturnValue(map);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package ru.betterend.mixin.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.FallbackResourceManager;
|
||||
import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.client.models.BlockModelProvider;
|
||||
|
||||
@Mixin(FallbackResourceManager.class)
|
||||
public abstract class NamespaceResourceManagerMixin {
|
||||
|
||||
@Shadow
|
||||
public abstract Resource getResource(ResourceLocation id);
|
||||
|
||||
@Inject(method = "getResources", cancellable = true, at = @At(
|
||||
value = "NEW",
|
||||
target = "java/io/FileNotFoundException",
|
||||
shift = Shift.BEFORE))
|
||||
public void be_getStatesPattern(ResourceLocation id, CallbackInfoReturnable<List<Resource>> info) {
|
||||
if (id.getNamespace().equals(BetterEnd.MOD_ID)) {
|
||||
String[] data = id.getPath().split("/");
|
||||
if (data.length > 1) {
|
||||
ResourceLocation blockId = BetterEnd.makeID(data[1].replace(".json", ""));
|
||||
Block block = Registry.BLOCK.get(blockId);
|
||||
if (block instanceof BlockModelProvider) {
|
||||
ResourceLocation stateId = ((BlockModelProvider) block).statePatternId();
|
||||
try {
|
||||
List<Resource> resources = Lists.newArrayList();
|
||||
Resource stateRes = this.getResource(stateId);
|
||||
resources.add(stateRes);
|
||||
info.setReturnValue(resources);
|
||||
} catch (Exception ex) {
|
||||
BetterEnd.LOGGER.catching(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue