More wooden materials, gui, mixins, registries
This commit is contained in:
parent
6ec2b53edd
commit
720103bd45
97 changed files with 2414 additions and 14 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -27,3 +27,4 @@ bin/
|
||||||
# fabric
|
# fabric
|
||||||
|
|
||||||
run/
|
run/
|
||||||
|
output/
|
|
@ -4,6 +4,7 @@ import net.fabricmc.api.ModInitializer;
|
||||||
import ru.betterend.config.MainConfig;
|
import ru.betterend.config.MainConfig;
|
||||||
import ru.betterend.recipe.CraftingRecipes;
|
import ru.betterend.recipe.CraftingRecipes;
|
||||||
import ru.betterend.registry.BiomeRegistry;
|
import ru.betterend.registry.BiomeRegistry;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
import ru.betterend.registry.BlockRegistry;
|
import ru.betterend.registry.BlockRegistry;
|
||||||
import ru.betterend.registry.FeatureRegistry;
|
import ru.betterend.registry.FeatureRegistry;
|
||||||
import ru.betterend.registry.ItemRegistry;
|
import ru.betterend.registry.ItemRegistry;
|
||||||
|
@ -21,6 +22,7 @@ public class BetterEnd implements ModInitializer {
|
||||||
DoubleBlockSurfaceBuilder.register();
|
DoubleBlockSurfaceBuilder.register();
|
||||||
ItemRegistry.register();
|
ItemRegistry.register();
|
||||||
BlockRegistry.register();
|
BlockRegistry.register();
|
||||||
|
BlockEntityRegistry.register();
|
||||||
FeatureRegistry.register();
|
FeatureRegistry.register();
|
||||||
BiomeRegistry.register();
|
BiomeRegistry.register();
|
||||||
BetterEndBiomeSource.register();
|
BetterEndBiomeSource.register();
|
||||||
|
|
85
src/main/java/ru/betterend/blocks/basis/BlockBarrel.java
Normal file
85
src/main/java/ru/betterend/blocks/basis/BlockBarrel.java
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.BarrelBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockRenderType;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.mob.PiglinBrain;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.stat.Stats;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import ru.betterend.blocks.entities.EBarrelBlockEntity;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
|
|
||||||
|
public class BlockBarrel extends BarrelBlock {
|
||||||
|
public BlockBarrel(Block source) {
|
||||||
|
super(FabricBlockSettings.copyOf(source).nonOpaque());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockView world) {
|
||||||
|
return BlockEntityRegistry.BARREL.instantiate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
|
List<ItemStack> drop = super.getDroppedStacks(state, builder);
|
||||||
|
drop.add(new ItemStack(this.asItem()));
|
||||||
|
return drop;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
|
||||||
|
BlockHitResult hit) {
|
||||||
|
if (world.isClient) {
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
} else {
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if (blockEntity instanceof EBarrelBlockEntity) {
|
||||||
|
player.openHandledScreen((EBarrelBlockEntity) blockEntity);
|
||||||
|
player.incrementStat(Stats.OPEN_BARREL);
|
||||||
|
PiglinBrain.onGuardedBlockInteracted(player, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ActionResult.CONSUME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if (blockEntity instanceof EBarrelBlockEntity) {
|
||||||
|
((EBarrelBlockEntity) blockEntity).tick();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockRenderType getRenderType(BlockState state) {
|
||||||
|
return BlockRenderType.MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer,
|
||||||
|
ItemStack itemStack) {
|
||||||
|
if (itemStack.hasCustomName()) {
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if (blockEntity instanceof EBarrelBlockEntity) {
|
||||||
|
((EBarrelBlockEntity) blockEntity).setCustomName(itemStack.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
|
||||||
|
public class BlockBaseNotFull extends BlockBase {
|
||||||
|
|
||||||
|
public BlockBaseNotFull(Settings settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canSuffocate(BlockState state, BlockView view, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSimpleFullBlock(BlockState state, BlockView view, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean allowsSpawning(BlockState state, BlockView view, BlockPos pos, EntityType<?> type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
36
src/main/java/ru/betterend/blocks/basis/BlockChest.java
Normal file
36
src/main/java/ru/betterend/blocks/basis/BlockChest.java
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.ChestBlock;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
|
|
||||||
|
public class BlockChest extends ChestBlock
|
||||||
|
{
|
||||||
|
public BlockChest(Block source) {
|
||||||
|
super(FabricBlockSettings.copyOf(source).nonOpaque(), () -> {
|
||||||
|
return BlockEntityRegistry.CHEST;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockView world)
|
||||||
|
{
|
||||||
|
return BlockEntityRegistry.CHEST.instantiate();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder)
|
||||||
|
{
|
||||||
|
List<ItemStack> drop = super.getDroppedStacks(state, builder);
|
||||||
|
drop.add(new ItemStack(this.asItem()));
|
||||||
|
return drop;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.CraftingTableBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.loot.context.LootContext;
|
||||||
|
|
||||||
|
public class BlockCraftingTable extends CraftingTableBlock
|
||||||
|
{
|
||||||
|
public BlockCraftingTable(Block source) {
|
||||||
|
super(FabricBlockSettings.copyOf(source));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
|
||||||
|
return Collections.singletonList(new ItemStack(this.asItem()));
|
||||||
|
}
|
||||||
|
}
|
134
src/main/java/ru/betterend/blocks/basis/BlockLadder.java
Normal file
134
src/main/java/ru/betterend/blocks/basis/BlockLadder.java
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.HorizontalFacingBlock;
|
||||||
|
import net.minecraft.block.ShapeContext;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.BlockMirror;
|
||||||
|
import net.minecraft.util.BlockRotation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
import ru.betterend.client.ERenderLayer;
|
||||||
|
import ru.betterend.client.IRenderTypeable;
|
||||||
|
import ru.betterend.util.BlocksHelper;
|
||||||
|
|
||||||
|
public class BlockLadder extends BlockBaseNotFull implements IRenderTypeable {
|
||||||
|
public static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
|
||||||
|
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;
|
||||||
|
protected static final VoxelShape EAST_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D);
|
||||||
|
protected static final VoxelShape WEST_SHAPE = Block.createCuboidShape(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D);
|
||||||
|
protected static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D);
|
||||||
|
protected static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D);
|
||||||
|
|
||||||
|
public BlockLadder(Block block) {
|
||||||
|
super(FabricBlockSettings.copyOf(block).nonOpaque());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||||
|
stateManager.add(FACING);
|
||||||
|
stateManager.add(WATERLOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||||
|
switch (state.get(FACING)) {
|
||||||
|
case NORTH:
|
||||||
|
return NORTH_SHAPE;
|
||||||
|
case SOUTH:
|
||||||
|
return SOUTH_SHAPE;
|
||||||
|
case WEST:
|
||||||
|
return WEST_SHAPE;
|
||||||
|
case EAST:
|
||||||
|
default:
|
||||||
|
return EAST_SHAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean canPlaceOn(BlockView world, BlockPos pos, Direction side) {
|
||||||
|
BlockState blockState = world.getBlockState(pos);
|
||||||
|
return !blockState.emitsRedstonePower() && blockState.isSideSolidFullSquare(world, pos, side);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
|
||||||
|
Direction direction = (Direction) state.get(FACING);
|
||||||
|
return this.canPlaceOn(world, pos.offset(direction.getOpposite()), direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState,
|
||||||
|
WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||||
|
if (facing.getOpposite() == state.get(FACING) && !state.canPlaceAt(world, pos)) {
|
||||||
|
return Blocks.AIR.getDefaultState();
|
||||||
|
} else {
|
||||||
|
if ((Boolean) state.get(WATERLOGGED)) {
|
||||||
|
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getStateForNeighborUpdate(state, facing, neighborState, world, pos, neighborPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
|
BlockState blockState2;
|
||||||
|
if (!ctx.canReplaceExisting()) {
|
||||||
|
blockState2 = ctx.getWorld().getBlockState(ctx.getBlockPos().offset(ctx.getSide().getOpposite()));
|
||||||
|
if (blockState2.getBlock() == this && blockState2.get(FACING) == ctx.getSide()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blockState2 = this.getDefaultState();
|
||||||
|
WorldView worldView = ctx.getWorld();
|
||||||
|
BlockPos blockPos = ctx.getBlockPos();
|
||||||
|
FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos());
|
||||||
|
Direction[] var6 = ctx.getPlacementDirections();
|
||||||
|
int var7 = var6.length;
|
||||||
|
|
||||||
|
for (int var8 = 0; var8 < var7; ++var8) {
|
||||||
|
Direction direction = var6[var8];
|
||||||
|
if (direction.getAxis().isHorizontal()) {
|
||||||
|
blockState2 = (BlockState) blockState2.with(FACING, direction.getOpposite());
|
||||||
|
if (blockState2.canPlaceAt(worldView, blockPos)) {
|
||||||
|
return (BlockState) blockState2.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState rotate(BlockState state, BlockRotation rotation) {
|
||||||
|
return BlocksHelper.rotateHorizontal(state, rotation, FACING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState mirror(BlockState state, BlockMirror mirror) {
|
||||||
|
return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state) {
|
||||||
|
return (Boolean) state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ERenderLayer getRenderLayer() {
|
||||||
|
return ERenderLayer.CUTOUT;
|
||||||
|
}
|
||||||
|
}
|
143
src/main/java/ru/betterend/blocks/basis/BlockSign.java
Normal file
143
src/main/java/ru/betterend/blocks/basis/BlockSign.java
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
package ru.betterend.blocks.basis;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.minecraft.block.AbstractSignBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.ShapeContext;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.DyeItem;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.packet.s2c.play.SignEditorOpenS2CPacket;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.IntProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.SignType;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
|
||||||
|
public class BlockSign extends AbstractSignBlock {
|
||||||
|
public static final IntProperty ROTATION = Properties.ROTATION;
|
||||||
|
public static final BooleanProperty FLOOR = BooleanProperty.of("floor");
|
||||||
|
private static final VoxelShape[] WALL_SHAPES = new VoxelShape[] {
|
||||||
|
Block.createCuboidShape(0.0D, 4.5D, 14.0D, 16.0D, 12.5D, 16.0D),
|
||||||
|
Block.createCuboidShape(0.0D, 4.5D, 0.0D, 2.0D, 12.5D, 16.0D),
|
||||||
|
Block.createCuboidShape(0.0D, 4.5D, 0.0D, 16.0D, 12.5D, 2.0D),
|
||||||
|
Block.createCuboidShape(14.0D, 4.5D, 0.0D, 16.0D, 12.5D, 16.0D) };
|
||||||
|
|
||||||
|
public BlockSign(Block source) {
|
||||||
|
super(FabricBlockSettings.copyOf(source).noCollision().nonOpaque(), SignType.OAK);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState().with(ROTATION, 0).with(FLOOR, true).with(WATERLOGGED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder) {
|
||||||
|
builder.add(ROTATION, FLOOR, WATERLOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||||
|
return state.get(FLOOR) ? SHAPE : WALL_SHAPES[state.get(ROTATION) >> 2];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity createBlockEntity(BlockView world) {
|
||||||
|
return new ESignBlockEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||||
|
ItemStack itemStack = player.getStackInHand(hand);
|
||||||
|
boolean bl = itemStack.getItem() instanceof DyeItem && player.abilities.allowModifyWorld;
|
||||||
|
if (world.isClient) {
|
||||||
|
return bl ? ActionResult.SUCCESS : ActionResult.CONSUME;
|
||||||
|
} else {
|
||||||
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||||
|
if (blockEntity instanceof ESignBlockEntity) {
|
||||||
|
ESignBlockEntity signBlockEntity = (ESignBlockEntity) blockEntity;
|
||||||
|
if (bl) {
|
||||||
|
boolean bl2 = signBlockEntity.setTextColor(((DyeItem) itemStack.getItem()).getColor());
|
||||||
|
if (bl2 && !player.isCreative()) {
|
||||||
|
itemStack.decrement(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return signBlockEntity.onActivate(player) ? ActionResult.SUCCESS : ActionResult.PASS;
|
||||||
|
} else {
|
||||||
|
return ActionResult.PASS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlaced(World world, BlockPos pos, BlockState state, LivingEntity placer,
|
||||||
|
ItemStack itemStack) {
|
||||||
|
if (placer != null && placer instanceof PlayerEntity) {
|
||||||
|
ESignBlockEntity sign = (ESignBlockEntity) world.getBlockEntity(pos);
|
||||||
|
if (!world.isClient) {
|
||||||
|
sign.setEditor((PlayerEntity) placer);
|
||||||
|
((ServerPlayerEntity) placer).networkHandler.sendPacket(new SignEditorOpenS2CPacket(pos));
|
||||||
|
} else
|
||||||
|
sign.setEditable(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState,
|
||||||
|
WorldAccess world, BlockPos pos, BlockPos neighborPos) {
|
||||||
|
if ((Boolean) state.get(WATERLOGGED)) {
|
||||||
|
world.getFluidTickScheduler().schedule(pos, Fluids.WATER, Fluids.WATER.getTickRate(world));
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getStateForNeighborUpdate(state, facing, neighborState, world, pos, neighborPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||||
|
if (ctx.getSide() == Direction.UP) {
|
||||||
|
FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos());
|
||||||
|
return this.getDefaultState().with(FLOOR, true)
|
||||||
|
.with(ROTATION, MathHelper.floor((180.0 + ctx.getPlayerYaw() * 16.0 / 360.0) + 0.5 - 12) & 15)
|
||||||
|
.with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||||
|
} else if (ctx.getSide() != Direction.DOWN) {
|
||||||
|
BlockState blockState = this.getDefaultState();
|
||||||
|
FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos());
|
||||||
|
WorldView worldView = ctx.getWorld();
|
||||||
|
BlockPos blockPos = ctx.getBlockPos();
|
||||||
|
Direction[] directions = ctx.getPlacementDirections();
|
||||||
|
Direction[] var7 = directions;
|
||||||
|
int var8 = directions.length;
|
||||||
|
|
||||||
|
for (int var9 = 0; var9 < var8; ++var9) {
|
||||||
|
Direction direction = var7[var9];
|
||||||
|
if (direction.getAxis().isHorizontal()) {
|
||||||
|
Direction direction2 = direction.getOpposite();
|
||||||
|
int rot = MathHelper.floor((180.0 + direction2.asRotation() * 16.0 / 360.0) + 0.5 + 4) & 15;
|
||||||
|
blockState = blockState.with(ROTATION, rot);
|
||||||
|
if (blockState.canPlaceAt(worldView, blockPos)) {
|
||||||
|
return blockState.with(FLOOR, false).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,13 +5,18 @@ import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.Material;
|
import net.minecraft.block.Material;
|
||||||
import net.minecraft.block.MaterialColor;
|
import net.minecraft.block.MaterialColor;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
|
import ru.betterend.blocks.basis.BlockBarrel;
|
||||||
import ru.betterend.blocks.basis.BlockBase;
|
import ru.betterend.blocks.basis.BlockBase;
|
||||||
|
import ru.betterend.blocks.basis.BlockChest;
|
||||||
|
import ru.betterend.blocks.basis.BlockCraftingTable;
|
||||||
import ru.betterend.blocks.basis.BlockDoor;
|
import ru.betterend.blocks.basis.BlockDoor;
|
||||||
import ru.betterend.blocks.basis.BlockFence;
|
import ru.betterend.blocks.basis.BlockFence;
|
||||||
import ru.betterend.blocks.basis.BlockGate;
|
import ru.betterend.blocks.basis.BlockGate;
|
||||||
|
import ru.betterend.blocks.basis.BlockLadder;
|
||||||
import ru.betterend.blocks.basis.BlockLogStripable;
|
import ru.betterend.blocks.basis.BlockLogStripable;
|
||||||
import ru.betterend.blocks.basis.BlockPillar;
|
import ru.betterend.blocks.basis.BlockPillar;
|
||||||
import ru.betterend.blocks.basis.BlockPressurePlate;
|
import ru.betterend.blocks.basis.BlockPressurePlate;
|
||||||
|
import ru.betterend.blocks.basis.BlockSign;
|
||||||
import ru.betterend.blocks.basis.BlockSlab;
|
import ru.betterend.blocks.basis.BlockSlab;
|
||||||
import ru.betterend.blocks.basis.BlockStairs;
|
import ru.betterend.blocks.basis.BlockStairs;
|
||||||
import ru.betterend.blocks.basis.BlockTrapdoor;
|
import ru.betterend.blocks.basis.BlockTrapdoor;
|
||||||
|
@ -38,12 +43,12 @@ public class WoodenMaterial
|
||||||
public final Block trapdoor;
|
public final Block trapdoor;
|
||||||
public final Block door;
|
public final Block door;
|
||||||
|
|
||||||
//public final Block crafting_table;
|
public final Block crafting_table;
|
||||||
//public final Block ladder;
|
public final Block ladder;
|
||||||
//public final Block sign;
|
public final Block sign;
|
||||||
|
|
||||||
//public final Block chest;
|
public final Block chest;
|
||||||
//public final Block barrel;
|
public final Block barrel;
|
||||||
|
|
||||||
public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor)
|
public WoodenMaterial(String name, MaterialColor woodColor, MaterialColor planksColor)
|
||||||
{
|
{
|
||||||
|
@ -65,14 +70,14 @@ public class WoodenMaterial
|
||||||
trapdoor = BlockRegistry.registerBlock(name + "_trapdoor", new BlockTrapdoor(planks));
|
trapdoor = BlockRegistry.registerBlock(name + "_trapdoor", new BlockTrapdoor(planks));
|
||||||
door = BlockRegistry.registerBlock(name + "_door", new BlockDoor(planks));
|
door = BlockRegistry.registerBlock(name + "_door", new BlockDoor(planks));
|
||||||
|
|
||||||
//crafting_table = BlockRegistry.registerBlock("crafting_table_" + name, planks);
|
crafting_table = BlockRegistry.registerBlock(name + "_crafting_table", new BlockCraftingTable(planks));
|
||||||
//ladder = BlockRegistry.registerBlock(name + "_ladder", planks);
|
ladder = BlockRegistry.registerBlock(name + "_ladder", new BlockLadder(planks));
|
||||||
//sign = BlockRegistry.registerBlock("sign_" + name, planks);
|
sign = BlockRegistry.registerBlock(name + "_sign", new BlockSign(planks));
|
||||||
|
|
||||||
//chest = BlockRegistry.registerBlock("chest_" + name, planks);
|
chest = BlockRegistry.registerBlock(name + "_chest", new BlockChest(planks));
|
||||||
//barrel = BlockRegistry.registerBlock("barrel_" + name, planks, planks_slab);
|
barrel = BlockRegistry.registerBlock(name + "_barrel", new BlockBarrel(planks));
|
||||||
|
|
||||||
RecipeBuilder.make(name + "_planks", planks).setOutputCount(4).setList("#").addMaterial('#', log, bark).setGroup("end_planks").build();
|
RecipeBuilder.make(name + "_planks", planks).setOutputCount(4).setList("#").addMaterial('#', log, bark, log_striped, bark_striped).setGroup("end_planks").build();
|
||||||
RecipeBuilder.make(name + "_stairs", stairs).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', planks).setGroup("end_planks_stairs").build();
|
RecipeBuilder.make(name + "_stairs", stairs).setOutputCount(4).setShape("# ", "## ", "###").addMaterial('#', planks).setGroup("end_planks_stairs").build();
|
||||||
RecipeBuilder.make(name + "_slab", slab).setOutputCount(6).setShape("###").addMaterial('#', planks).setGroup("end_planks_slabs").build();
|
RecipeBuilder.make(name + "_slab", slab).setOutputCount(6).setShape("###").addMaterial('#', planks).setGroup("end_planks_slabs").build();
|
||||||
RecipeBuilder.make(name + "_fence", fence).setOutputCount(3).setShape("#I#", "#I#").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_planks_fences").build();
|
RecipeBuilder.make(name + "_fence", fence).setOutputCount(3).setShape("#I#", "#I#").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_planks_fences").build();
|
||||||
|
@ -81,6 +86,11 @@ public class WoodenMaterial
|
||||||
RecipeBuilder.make(name + "_pressure_plate", pressure_plate).setList("##").addMaterial('#', planks).setGroup("end_planks_plates").build();
|
RecipeBuilder.make(name + "_pressure_plate", pressure_plate).setList("##").addMaterial('#', planks).setGroup("end_planks_plates").build();
|
||||||
RecipeBuilder.make(name + "_trapdoor", trapdoor).setOutputCount(2).setShape("###", "###").addMaterial('#', planks).setGroup("end_trapdoors").build();
|
RecipeBuilder.make(name + "_trapdoor", trapdoor).setOutputCount(2).setShape("###", "###").addMaterial('#', planks).setGroup("end_trapdoors").build();
|
||||||
RecipeBuilder.make(name + "_door", door).setOutputCount(3).setShape("##", "##", "##").addMaterial('#', planks).setGroup("end_doors").build();
|
RecipeBuilder.make(name + "_door", door).setOutputCount(3).setShape("##", "##", "##").addMaterial('#', planks).setGroup("end_doors").build();
|
||||||
|
RecipeBuilder.make(name + "_crafting_table", crafting_table).setShape("##", "##").addMaterial('#', planks).setGroup("end_tables").build();
|
||||||
|
RecipeBuilder.make(name + "_ladder", ladder).setOutputCount(3).setShape("I I", "I#I", "I I").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_ladders").build();
|
||||||
|
RecipeBuilder.make(name + "_sign", sign).setOutputCount(3).setShape("###", "###", " I ").addMaterial('#', planks).addMaterial('I', Items.STICK).setGroup("end_signs").build();
|
||||||
|
RecipeBuilder.make(name + "_chest", chest).setShape("###", "# #", "###").addMaterial('#', planks).setGroup("end_chests").build();
|
||||||
|
RecipeBuilder.make(name + "_barrel", barrel).setShape("#S#", "# #", "#S#").addMaterial('#', planks).addMaterial('S', slab).setGroup("end_barrels").build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTreeLog(Block block)
|
public boolean isTreeLog(Block block)
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
|
import net.minecraft.block.BarrelBlock;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
import net.minecraft.block.entity.ChestBlockEntity;
|
||||||
|
import net.minecraft.block.entity.LootableContainerBlockEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
|
import net.minecraft.inventory.Inventories;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.screen.GenericContainerScreenHandler;
|
||||||
|
import net.minecraft.screen.ScreenHandler;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvent;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.text.TranslatableText;
|
||||||
|
import net.minecraft.util.collection.DefaultedList;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3i;
|
||||||
|
import ru.betterend.blocks.basis.BlockBarrel;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
|
|
||||||
|
public class EBarrelBlockEntity extends LootableContainerBlockEntity {
|
||||||
|
private DefaultedList<ItemStack> inventory;
|
||||||
|
private int viewerCount;
|
||||||
|
|
||||||
|
private EBarrelBlockEntity(BlockEntityType<?> type) {
|
||||||
|
super(type);
|
||||||
|
this.inventory = DefaultedList.ofSize(27, ItemStack.EMPTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EBarrelBlockEntity() {
|
||||||
|
this(BlockEntityRegistry.BARREL);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
super.toTag(tag);
|
||||||
|
if (!this.serializeLootTable(tag)) {
|
||||||
|
Inventories.toTag(tag, this.inventory);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fromTag(BlockState state, CompoundTag tag) {
|
||||||
|
super.fromTag(state, tag);
|
||||||
|
this.inventory = DefaultedList.ofSize(this.size(), ItemStack.EMPTY);
|
||||||
|
if (!this.deserializeLootTable(tag)) {
|
||||||
|
Inventories.fromTag(tag, this.inventory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return 27;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected DefaultedList<ItemStack> getInvStackList() {
|
||||||
|
return this.inventory;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setInvStackList(DefaultedList<ItemStack> list) {
|
||||||
|
this.inventory = list;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Text getContainerName() {
|
||||||
|
return new TranslatableText("container.barrel");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) {
|
||||||
|
return GenericContainerScreenHandler.createGeneric9x3(syncId, playerInventory, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onOpen(PlayerEntity player) {
|
||||||
|
if (!player.isSpectator()) {
|
||||||
|
if (this.viewerCount < 0) {
|
||||||
|
this.viewerCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
++this.viewerCount;
|
||||||
|
BlockState blockState = this.getCachedState();
|
||||||
|
boolean bl = (Boolean) blockState.get(BarrelBlock.OPEN);
|
||||||
|
if (!bl) {
|
||||||
|
this.playSound(blockState, SoundEvents.BLOCK_BARREL_OPEN);
|
||||||
|
this.setOpen(blockState, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.scheduleUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void scheduleUpdate() {
|
||||||
|
this.world.getBlockTickScheduler().schedule(this.getPos(), this.getCachedState().getBlock(), 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
int i = this.pos.getX();
|
||||||
|
int j = this.pos.getY();
|
||||||
|
int k = this.pos.getZ();
|
||||||
|
this.viewerCount = ChestBlockEntity.countViewers(this.world, this, i, j, k);
|
||||||
|
if (this.viewerCount > 0) {
|
||||||
|
this.scheduleUpdate();
|
||||||
|
} else {
|
||||||
|
BlockState blockState = this.getCachedState();
|
||||||
|
if (!(blockState.getBlock() instanceof BlockBarrel)) {
|
||||||
|
this.markRemoved();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean bl = (Boolean) blockState.get(BarrelBlock.OPEN);
|
||||||
|
if (bl) {
|
||||||
|
this.playSound(blockState, SoundEvents.BLOCK_BARREL_CLOSE);
|
||||||
|
this.setOpen(blockState, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClose(PlayerEntity player) {
|
||||||
|
if (!player.isSpectator()) {
|
||||||
|
--this.viewerCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setOpen(BlockState state, boolean open) {
|
||||||
|
this.world.setBlockState(this.getPos(), (BlockState) state.with(BarrelBlock.OPEN, open), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playSound(BlockState blockState, SoundEvent soundEvent) {
|
||||||
|
Vec3i vec3i = ((Direction) blockState.get(BarrelBlock.FACING)).getVector();
|
||||||
|
double d = (double) this.pos.getX() + 0.5D + (double) vec3i.getX() / 2.0D;
|
||||||
|
double e = (double) this.pos.getY() + 0.5D + (double) vec3i.getY() / 2.0D;
|
||||||
|
double f = (double) this.pos.getZ() + 0.5D + (double) vec3i.getZ() / 2.0D;
|
||||||
|
this.world.playSound((PlayerEntity) null, d, e, f, soundEvent, SoundCategory.BLOCKS, 0.5F,
|
||||||
|
this.world.random.nextFloat() * 0.1F + 0.9F);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.ChestBlockEntity;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
|
|
||||||
|
public class EChestBlockEntity extends ChestBlockEntity {
|
||||||
|
public EChestBlockEntity() {
|
||||||
|
super(BlockEntityRegistry.CHEST);
|
||||||
|
}
|
||||||
|
}
|
168
src/main/java/ru/betterend/blocks/entities/ESignBlockEntity.java
Normal file
168
src/main/java/ru/betterend/blocks/entities/ESignBlockEntity.java
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
package ru.betterend.blocks.entities;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||||
|
import net.minecraft.server.command.CommandOutput;
|
||||||
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.text.ClickEvent;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
|
import net.minecraft.text.OrderedText;
|
||||||
|
import net.minecraft.text.Style;
|
||||||
|
import net.minecraft.text.Text;
|
||||||
|
import net.minecraft.text.Texts;
|
||||||
|
import net.minecraft.util.DyeColor;
|
||||||
|
import net.minecraft.util.math.Vec2f;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import ru.betterend.registry.BlockEntityRegistry;
|
||||||
|
|
||||||
|
public class ESignBlockEntity extends BlockEntity {
|
||||||
|
private final Text[] text;
|
||||||
|
private boolean editable;
|
||||||
|
private PlayerEntity editor;
|
||||||
|
private final OrderedText[] textBeingEdited;
|
||||||
|
private DyeColor textColor;
|
||||||
|
|
||||||
|
public ESignBlockEntity() {
|
||||||
|
super(BlockEntityRegistry.SIGN);
|
||||||
|
this.text = new Text[] { LiteralText.EMPTY, LiteralText.EMPTY, LiteralText.EMPTY, LiteralText.EMPTY };
|
||||||
|
this.editable = true;
|
||||||
|
this.textBeingEdited = new OrderedText[4];
|
||||||
|
this.textColor = DyeColor.BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag toTag(CompoundTag tag) {
|
||||||
|
super.toTag(tag);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
String string = Text.Serializer.toJson(this.text[i]);
|
||||||
|
tag.putString("Text" + (i + 1), string);
|
||||||
|
}
|
||||||
|
|
||||||
|
tag.putString("Color", this.textColor.getName());
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fromTag(BlockState state, CompoundTag tag) {
|
||||||
|
this.editable = false;
|
||||||
|
super.fromTag(state, tag);
|
||||||
|
this.textColor = DyeColor.byName(tag.getString("Color"), DyeColor.BLACK);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
String string = tag.getString("Text" + (i + 1));
|
||||||
|
Text text = Text.Serializer.fromJson(string.isEmpty() ? "\"\"" : string);
|
||||||
|
if (this.world instanceof ServerWorld) {
|
||||||
|
try {
|
||||||
|
this.text[i] = Texts.parse(this.getCommandSource((ServerPlayerEntity) null), text, (Entity) null,
|
||||||
|
0);
|
||||||
|
} catch (CommandSyntaxException var7) {
|
||||||
|
this.text[i] = text;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.text[i] = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.textBeingEdited[i] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextOnRow(int row, Text text) {
|
||||||
|
this.text[row] = text;
|
||||||
|
this.textBeingEdited[row] = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public OrderedText getTextBeingEditedOnRow(int row, Function<Text, OrderedText> function) {
|
||||||
|
if (this.textBeingEdited[row] == null && this.text[row] != null) {
|
||||||
|
this.textBeingEdited[row] = (OrderedText) function.apply(this.text[row]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.textBeingEdited[row];
|
||||||
|
}
|
||||||
|
|
||||||
|
public BlockEntityUpdateS2CPacket toUpdatePacket() {
|
||||||
|
return new BlockEntityUpdateS2CPacket(this.pos, 9, this.toInitialChunkDataTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag toInitialChunkDataTag() {
|
||||||
|
return this.toTag(new CompoundTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean copyItemDataRequiresOperator() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEditable() {
|
||||||
|
return this.editable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public void setEditable(boolean bl) {
|
||||||
|
this.editable = bl;
|
||||||
|
if (!bl) {
|
||||||
|
this.editor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEditor(PlayerEntity player) {
|
||||||
|
this.editor = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerEntity getEditor() {
|
||||||
|
return this.editor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onActivate(PlayerEntity player) {
|
||||||
|
Text[] var2 = this.text;
|
||||||
|
int var3 = var2.length;
|
||||||
|
|
||||||
|
for (int var4 = 0; var4 < var3; ++var4) {
|
||||||
|
Text text = var2[var4];
|
||||||
|
Style style = text == null ? null : text.getStyle();
|
||||||
|
if (style != null && style.getClickEvent() != null) {
|
||||||
|
ClickEvent clickEvent = style.getClickEvent();
|
||||||
|
if (clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {
|
||||||
|
player.getServer().getCommandManager().execute(this.getCommandSource((ServerPlayerEntity) player),
|
||||||
|
clickEvent.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ServerCommandSource getCommandSource(ServerPlayerEntity player) {
|
||||||
|
String string = player == null ? "Sign" : player.getName().getString();
|
||||||
|
Text text = player == null ? new LiteralText("Sign") : player.getDisplayName();
|
||||||
|
return new ServerCommandSource(CommandOutput.DUMMY, Vec3d.ofCenter(this.pos), Vec2f.ZERO,
|
||||||
|
(ServerWorld) this.world, 2, string, (Text) text, this.world.getServer(), player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DyeColor getTextColor() {
|
||||||
|
return this.textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean setTextColor(DyeColor value) {
|
||||||
|
if (value != this.getTextColor()) {
|
||||||
|
this.textColor = value;
|
||||||
|
this.markDirty();
|
||||||
|
this.world.updateListeners(this.getPos(), this.getCachedState(), this.getCachedState(), 3);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,187 @@
|
||||||
|
package ru.betterend.blocks.entities.render;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||||
|
import net.minecraft.block.AbstractChestBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.block.ChestBlock;
|
||||||
|
import net.minecraft.block.DoubleBlockProperties;
|
||||||
|
import net.minecraft.block.DoubleBlockProperties.PropertySource;
|
||||||
|
import net.minecraft.block.entity.ChestBlockEntity;
|
||||||
|
import net.minecraft.block.enums.ChestType;
|
||||||
|
import net.minecraft.client.block.ChestAnimationProgress;
|
||||||
|
import net.minecraft.client.model.ModelPart;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||||
|
import net.minecraft.client.render.block.entity.LightmapCoordinatesRetriever;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.client.util.math.Vector3f;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.blocks.basis.BlockChest;
|
||||||
|
import ru.betterend.blocks.entities.EChestBlockEntity;
|
||||||
|
import ru.betterend.registry.ItemRegistry;
|
||||||
|
|
||||||
|
public class EChestBlockEntityRenderer extends BlockEntityRenderer<EChestBlockEntity> {
|
||||||
|
private static final HashMap<Integer, RenderLayer[]> LAYERS = Maps.newHashMap();
|
||||||
|
private static RenderLayer[] defaultLayer;
|
||||||
|
|
||||||
|
private static final int ID_NORMAL = 0;
|
||||||
|
private static final int ID_LEFT = 1;
|
||||||
|
private static final int ID_RIGHT = 2;
|
||||||
|
|
||||||
|
private final ModelPart partA;
|
||||||
|
private final ModelPart partC;
|
||||||
|
private final ModelPart partB;
|
||||||
|
private final ModelPart partRightA;
|
||||||
|
private final ModelPart partRightC;
|
||||||
|
private final ModelPart partRightB;
|
||||||
|
private final ModelPart partLeftA;
|
||||||
|
private final ModelPart partLeftC;
|
||||||
|
private final ModelPart partLeftB;
|
||||||
|
|
||||||
|
public EChestBlockEntityRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher) {
|
||||||
|
super(blockEntityRenderDispatcher);
|
||||||
|
|
||||||
|
this.partC = new ModelPart(64, 64, 0, 19);
|
||||||
|
this.partC.addCuboid(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F, 0.0F);
|
||||||
|
this.partA = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partA.addCuboid(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F, 0.0F);
|
||||||
|
this.partA.pivotY = 9.0F;
|
||||||
|
this.partA.pivotZ = 1.0F;
|
||||||
|
this.partB = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partB.addCuboid(7.0F, -1.0F, 15.0F, 2.0F, 4.0F, 1.0F, 0.0F);
|
||||||
|
this.partB.pivotY = 8.0F;
|
||||||
|
this.partRightC = new ModelPart(64, 64, 0, 19);
|
||||||
|
this.partRightC.addCuboid(1.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F, 0.0F);
|
||||||
|
this.partRightA = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partRightA.addCuboid(1.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, 0.0F);
|
||||||
|
this.partRightA.pivotY = 9.0F;
|
||||||
|
this.partRightA.pivotZ = 1.0F;
|
||||||
|
this.partRightB = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partRightB.addCuboid(15.0F, -1.0F, 15.0F, 1.0F, 4.0F, 1.0F, 0.0F);
|
||||||
|
this.partRightB.pivotY = 8.0F;
|
||||||
|
this.partLeftC = new ModelPart(64, 64, 0, 19);
|
||||||
|
this.partLeftC.addCuboid(0.0F, 0.0F, 1.0F, 15.0F, 10.0F, 14.0F, 0.0F);
|
||||||
|
this.partLeftA = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partLeftA.addCuboid(0.0F, 0.0F, 0.0F, 15.0F, 5.0F, 14.0F, 0.0F);
|
||||||
|
this.partLeftA.pivotY = 9.0F;
|
||||||
|
this.partLeftA.pivotZ = 1.0F;
|
||||||
|
this.partLeftB = new ModelPart(64, 64, 0, 0);
|
||||||
|
this.partLeftB.addCuboid(0.0F, -1.0F, 15.0F, 1.0F, 4.0F, 1.0F, 0.0F);
|
||||||
|
this.partLeftB.pivotY = 8.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(EChestBlockEntity entity, float tickDelta, MatrixStack matrices,
|
||||||
|
VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||||
|
World world = entity.getWorld();
|
||||||
|
boolean worldExists = world != null;
|
||||||
|
BlockState blockState = worldExists ? entity.getCachedState()
|
||||||
|
: (BlockState) Blocks.CHEST.getDefaultState().with(ChestBlock.FACING, Direction.SOUTH);
|
||||||
|
ChestType chestType = blockState.contains(ChestBlock.CHEST_TYPE)
|
||||||
|
? (ChestType) blockState.get(ChestBlock.CHEST_TYPE) : ChestType.SINGLE;
|
||||||
|
Block block = blockState.getBlock();
|
||||||
|
if (block instanceof AbstractChestBlock) {
|
||||||
|
AbstractChestBlock<?> abstractChestBlock = (AbstractChestBlock<?>) block;
|
||||||
|
boolean isDouble = chestType != ChestType.SINGLE;
|
||||||
|
float f = ((Direction) blockState.get(ChestBlock.FACING)).asRotation();
|
||||||
|
PropertySource<? extends ChestBlockEntity> propertySource;
|
||||||
|
|
||||||
|
matrices.push();
|
||||||
|
matrices.translate(0.5D, 0.5D, 0.5D);
|
||||||
|
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-f));
|
||||||
|
matrices.translate(-0.5D, -0.5D, -0.5D);
|
||||||
|
|
||||||
|
if (worldExists) {
|
||||||
|
propertySource = abstractChestBlock.getBlockEntitySource(blockState, world, entity.getPos(), true);
|
||||||
|
} else {
|
||||||
|
propertySource = DoubleBlockProperties.PropertyRetriever::getFallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
float pitch = ((Float2FloatFunction) propertySource
|
||||||
|
.apply(ChestBlock.getAnimationProgressRetriever((ChestAnimationProgress) entity))).get(tickDelta);
|
||||||
|
pitch = 1.0F - pitch;
|
||||||
|
pitch = 1.0F - pitch * pitch * pitch;
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
int blockLight = ((Int2IntFunction) propertySource.apply(new LightmapCoordinatesRetriever()))
|
||||||
|
.applyAsInt(light);
|
||||||
|
|
||||||
|
VertexConsumer vertexConsumer = getConsumer(vertexConsumers, block, chestType);
|
||||||
|
|
||||||
|
if (isDouble) {
|
||||||
|
if (chestType == ChestType.LEFT) {
|
||||||
|
renderParts(matrices, vertexConsumer, this.partLeftA, this.partLeftB, this.partLeftC, pitch,
|
||||||
|
blockLight, overlay);
|
||||||
|
} else {
|
||||||
|
renderParts(matrices, vertexConsumer, this.partRightA, this.partRightB, this.partRightC, pitch,
|
||||||
|
blockLight, overlay);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
renderParts(matrices, vertexConsumer, this.partA, this.partB, this.partC, pitch, blockLight, overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
matrices.pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderParts(MatrixStack matrices, VertexConsumer vertices, ModelPart modelPart, ModelPart modelPart2,
|
||||||
|
ModelPart modelPart3, float pitch, int light, int overlay) {
|
||||||
|
modelPart.pitch = -(pitch * 1.5707964F);
|
||||||
|
modelPart2.pitch = modelPart.pitch;
|
||||||
|
modelPart.render(matrices, vertices, light, overlay);
|
||||||
|
modelPart2.render(matrices, vertices, light, overlay);
|
||||||
|
modelPart3.render(matrices, vertices, light, overlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RenderLayer getChestTexture(ChestType type, RenderLayer[] layers) {
|
||||||
|
switch (type) {
|
||||||
|
case LEFT:
|
||||||
|
return layers[ID_LEFT];
|
||||||
|
case RIGHT:
|
||||||
|
return layers[ID_RIGHT];
|
||||||
|
case SINGLE:
|
||||||
|
default:
|
||||||
|
return layers[ID_NORMAL];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VertexConsumer getConsumer(VertexConsumerProvider provider, Block block, ChestType chestType) {
|
||||||
|
RenderLayer[] layers = LAYERS.getOrDefault(Block.getRawIdFromState(block.getDefaultState()), defaultLayer);
|
||||||
|
return provider.getBuffer(getChestTexture(chestType, layers));
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
defaultLayer = new RenderLayer[] {
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "entity/chest/normal.png")),
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "entity/chest/normal_left.png")),
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "entity/chest/normal_right.png"))
|
||||||
|
};
|
||||||
|
|
||||||
|
ItemRegistry.getModBlocks().forEach((item) -> {
|
||||||
|
if (item instanceof BlockItem) {
|
||||||
|
Block block = ((BlockItem) item).getBlock();
|
||||||
|
if (block instanceof BlockChest) {
|
||||||
|
String name = Registry.BLOCK.getId(block).getPath();
|
||||||
|
LAYERS.put(Block.getRawIdFromState(block.getDefaultState()), new RenderLayer[] {
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "textures/entity/chest/" + name + ".png")),
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "textures/entity/chest/" + name + "_left.png")),
|
||||||
|
RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "textures/entity/chest/" + name + "_right.png"))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package ru.betterend.blocks.entities.render;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractSignBlock;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.SignBlock;
|
||||||
|
import net.minecraft.client.font.TextRenderer;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.client.render.TexturedRenderLayers;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||||
|
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||||
|
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
|
||||||
|
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer.SignModel;
|
||||||
|
import net.minecraft.client.texture.NativeImage;
|
||||||
|
import net.minecraft.client.util.SpriteIdentifier;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.client.util.math.Vector3f;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.text.OrderedText;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.SignType;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.blocks.basis.BlockSign;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
import ru.betterend.registry.ItemRegistry;
|
||||||
|
|
||||||
|
public class ESignBlockEntityRenderer extends BlockEntityRenderer<ESignBlockEntity> {
|
||||||
|
private static final HashMap<Integer, RenderLayer> LAYERS = Maps.newHashMap();
|
||||||
|
private static RenderLayer defaultLayer;
|
||||||
|
private final SignModel model = new SignBlockEntityRenderer.SignModel();
|
||||||
|
|
||||||
|
public ESignBlockEntityRenderer(BlockEntityRenderDispatcher dispatcher) {
|
||||||
|
super(dispatcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(ESignBlockEntity signBlockEntity, float tickDelta, MatrixStack matrixStack,
|
||||||
|
VertexConsumerProvider provider, int light, int overlay) {
|
||||||
|
BlockState state = signBlockEntity.getCachedState();
|
||||||
|
matrixStack.push();
|
||||||
|
|
||||||
|
matrixStack.translate(0.5D, 0.5D, 0.5D);
|
||||||
|
float angle = -((float) ((Integer) state.get(SignBlock.ROTATION) * 360) / 16.0F);
|
||||||
|
|
||||||
|
BlockState blockState = signBlockEntity.getCachedState();
|
||||||
|
if (blockState.get(BlockSign.FLOOR)) {
|
||||||
|
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle));
|
||||||
|
this.model.foot.visible = true;
|
||||||
|
} else {
|
||||||
|
matrixStack.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(angle + 180));
|
||||||
|
matrixStack.translate(0.0D, -0.3125D, -0.4375D);
|
||||||
|
this.model.foot.visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
matrixStack.push();
|
||||||
|
matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);
|
||||||
|
VertexConsumer vertexConsumer = getConsumer(provider, state.getBlock());
|
||||||
|
model.field.render(matrixStack, vertexConsumer, light, overlay);
|
||||||
|
model.foot.render(matrixStack, vertexConsumer, light, overlay);
|
||||||
|
matrixStack.pop();
|
||||||
|
TextRenderer textRenderer = dispatcher.getTextRenderer();
|
||||||
|
matrixStack.translate(0.0D, 0.3333333432674408D, 0.046666666865348816D);
|
||||||
|
matrixStack.scale(0.010416667F, -0.010416667F, 0.010416667F);
|
||||||
|
int m = signBlockEntity.getTextColor().getSignColor();
|
||||||
|
int n = (int) (NativeImage.getRed(m) * 0.4D);
|
||||||
|
int o = (int) (NativeImage.getGreen(m) * 0.4D);
|
||||||
|
int p = (int) (NativeImage.getBlue(m) * 0.4D);
|
||||||
|
int q = NativeImage.getAbgrColor(0, p, o, n);
|
||||||
|
|
||||||
|
for (int s = 0; s < 4; ++s) {
|
||||||
|
OrderedText orderedText = signBlockEntity.getTextBeingEditedOnRow(s, (text) -> {
|
||||||
|
List<OrderedText> list = textRenderer.wrapLines(text, 90);
|
||||||
|
return list.isEmpty() ? OrderedText.EMPTY : (OrderedText) list.get(0);
|
||||||
|
});
|
||||||
|
if (orderedText != null) {
|
||||||
|
float t = (float) (-textRenderer.getWidth(orderedText) / 2);
|
||||||
|
textRenderer.draw((OrderedText) orderedText, t, (float) (s * 10 - 20), q, false,
|
||||||
|
matrixStack.peek().getModel(), provider, false, 0, light);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrixStack.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SpriteIdentifier getModelTexture(Block block) {
|
||||||
|
SignType signType2;
|
||||||
|
if (block instanceof AbstractSignBlock) {
|
||||||
|
signType2 = ((AbstractSignBlock) block).getSignType();
|
||||||
|
} else {
|
||||||
|
signType2 = SignType.OAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TexturedRenderLayers.getSignTextureId(signType2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VertexConsumer getConsumer(VertexConsumerProvider provider, Block block) {
|
||||||
|
return provider.getBuffer(LAYERS.getOrDefault(Block.getRawIdFromState(block.getDefaultState()), defaultLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
defaultLayer = RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "entity/chest/normal.png"));
|
||||||
|
|
||||||
|
ItemRegistry.getModBlocks().forEach((item) -> {
|
||||||
|
if (item instanceof BlockItem) {
|
||||||
|
Block block = ((BlockItem) item).getBlock();
|
||||||
|
if (block instanceof BlockSign) {
|
||||||
|
String name = Registry.BLOCK.getId(block).getPath();
|
||||||
|
RenderLayer layer = RenderLayer.getEntitySolid(new Identifier(BetterEnd.MOD_ID, "textures/entity/sign/" + name + ".png"));
|
||||||
|
LAYERS.put(Block.getRawIdFromState(block.getDefaultState()), layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,12 +4,14 @@ import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import ru.betterend.registry.BlockEntityRenderRegistry;
|
||||||
|
|
||||||
public class BetterEndClient implements ClientModInitializer
|
public class BetterEndClient implements ClientModInitializer
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
registerRenderLayers();
|
registerRenderLayers();
|
||||||
|
BlockEntityRenderRegistry.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerRenderLayers() {
|
private void registerRenderLayers() {
|
||||||
|
|
232
src/main/java/ru/betterend/client/gui/BlockSignEditScreen.java
Normal file
232
src/main/java/ru/betterend/client/gui/BlockSignEditScreen.java
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
package ru.betterend.client.gui;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.client.gui.DrawableHelper;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.screen.ScreenTexts;
|
||||||
|
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||||
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
|
import net.minecraft.client.render.BufferBuilder;
|
||||||
|
import net.minecraft.client.render.BufferRenderer;
|
||||||
|
import net.minecraft.client.render.DiffuseLighting;
|
||||||
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
|
import net.minecraft.client.render.Tessellator;
|
||||||
|
import net.minecraft.client.render.VertexConsumer;
|
||||||
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
|
import net.minecraft.client.render.VertexFormats;
|
||||||
|
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer.SignModel;
|
||||||
|
import net.minecraft.client.util.SelectionManager;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
|
import net.minecraft.text.TranslatableText;
|
||||||
|
import net.minecraft.util.Util;
|
||||||
|
import net.minecraft.util.math.Matrix4f;
|
||||||
|
import ru.betterend.blocks.basis.BlockSign;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
import ru.betterend.blocks.entities.render.ESignBlockEntityRenderer;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class BlockSignEditScreen extends Screen {
|
||||||
|
private final SignModel model = new SignModel();
|
||||||
|
private final ESignBlockEntity sign;
|
||||||
|
private int ticksSinceOpened;
|
||||||
|
private int currentRow;
|
||||||
|
private SelectionManager selectionManager;
|
||||||
|
private final String[] text = (String[]) Util.make(new String[4], (strings) -> {
|
||||||
|
Arrays.fill(strings, "");
|
||||||
|
});
|
||||||
|
|
||||||
|
public BlockSignEditScreen(ESignBlockEntity sign) {
|
||||||
|
super(new TranslatableText("sign.edit"));
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void init() {
|
||||||
|
this.client.keyboard.setRepeatEvents(true);
|
||||||
|
this.addButton(new ButtonWidget(this.width / 2 - 100, this.height / 4 + 120, 200, 20, ScreenTexts.DONE,
|
||||||
|
(buttonWidget) -> {
|
||||||
|
this.finishEditing();
|
||||||
|
}));
|
||||||
|
this.sign.setEditable(false);
|
||||||
|
this.selectionManager = new SelectionManager(() -> {
|
||||||
|
return this.text[this.currentRow];
|
||||||
|
}, (string) -> {
|
||||||
|
this.text[this.currentRow] = string;
|
||||||
|
this.sign.setTextOnRow(this.currentRow, new LiteralText(string));
|
||||||
|
}, SelectionManager.makeClipboardGetter(this.client), SelectionManager.makeClipboardSetter(this.client),
|
||||||
|
(string) -> {
|
||||||
|
return this.client.textRenderer.getWidth(string) <= 90;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removed() {
|
||||||
|
this.client.keyboard.setRepeatEvents(false);
|
||||||
|
ClientPlayNetworkHandler clientPlayNetworkHandler = this.client.getNetworkHandler();
|
||||||
|
if (clientPlayNetworkHandler != null) {
|
||||||
|
clientPlayNetworkHandler.sendPacket(new UpdateSignC2SPacket(this.sign.getPos(), this.text[0], this.text[1],
|
||||||
|
this.text[2], this.text[3]));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sign.setEditable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void tick() {
|
||||||
|
++this.ticksSinceOpened;
|
||||||
|
if (!this.sign.getType().supports(this.sign.getCachedState().getBlock())) {
|
||||||
|
this.finishEditing();
|
||||||
|
System.out.println(this.sign.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void finishEditing() {
|
||||||
|
this.sign.markDirty();
|
||||||
|
this.client.openScreen((Screen) null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean charTyped(char chr, int keyCode) {
|
||||||
|
this.selectionManager.insert(chr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClose() {
|
||||||
|
this.finishEditing();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||||
|
if (keyCode == 265) {
|
||||||
|
this.currentRow = this.currentRow - 1 & 3;
|
||||||
|
this.selectionManager.moveCaretToEnd();
|
||||||
|
return true;
|
||||||
|
} else if (keyCode != 264 && keyCode != 257 && keyCode != 335) {
|
||||||
|
return this.selectionManager.handleSpecialKey(keyCode) ? true
|
||||||
|
: super.keyPressed(keyCode, scanCode, modifiers);
|
||||||
|
} else {
|
||||||
|
this.currentRow = this.currentRow + 1 & 3;
|
||||||
|
this.selectionManager.moveCaretToEnd();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
|
DiffuseLighting.disableGuiDepthLighting();
|
||||||
|
this.renderBackground(matrices);
|
||||||
|
DrawableHelper.drawCenteredText(matrices, this.textRenderer, this.title, this.width / 2, 40, 16777215);
|
||||||
|
matrices.push();
|
||||||
|
matrices.translate((double) (this.width / 2), 0.0D, 50.0D);
|
||||||
|
|
||||||
|
matrices.scale(93.75F, -93.75F, 93.75F);
|
||||||
|
matrices.translate(0.0D, -1.3125D, 0.0D);
|
||||||
|
BlockState blockState = this.sign.getCachedState();
|
||||||
|
boolean bl = blockState.get(BlockSign.FLOOR);
|
||||||
|
|
||||||
|
if (!bl) {
|
||||||
|
matrices.translate(0.0D, -0.3125D, 0.0D);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean bl2 = this.ticksSinceOpened / 6 % 2 == 0;
|
||||||
|
|
||||||
|
matrices.push();
|
||||||
|
matrices.scale(0.6666667F, -0.6666667F, -0.6666667F);
|
||||||
|
VertexConsumerProvider.Immediate immediate = this.client.getBufferBuilders().getEntityVertexConsumers();
|
||||||
|
VertexConsumer vertexConsumer = ESignBlockEntityRenderer.getConsumer(immediate, blockState.getBlock());
|
||||||
|
this.model.field.render(matrices, vertexConsumer, 15728880, OverlayTexture.DEFAULT_UV);
|
||||||
|
|
||||||
|
if (bl) {
|
||||||
|
this.model.foot.render(matrices, vertexConsumer, 15728880, OverlayTexture.DEFAULT_UV);
|
||||||
|
}
|
||||||
|
|
||||||
|
matrices.pop();
|
||||||
|
|
||||||
|
matrices.translate(0.0D, 0.3333333432674408D, 0.046666666865348816D);
|
||||||
|
matrices.scale(0.010416667F, -0.010416667F, 0.010416667F);
|
||||||
|
int i = this.sign.getTextColor().getSignColor();
|
||||||
|
int j = this.selectionManager.getSelectionStart();
|
||||||
|
int k = this.selectionManager.getSelectionEnd();
|
||||||
|
int l = this.currentRow * 10 - this.text.length * 5;
|
||||||
|
Matrix4f matrix4f = matrices.peek().getModel();
|
||||||
|
|
||||||
|
int m;
|
||||||
|
String string2;
|
||||||
|
int s;
|
||||||
|
int t;
|
||||||
|
for (m = 0; m < this.text.length; ++m) {
|
||||||
|
string2 = this.text[m];
|
||||||
|
if (string2 != null) {
|
||||||
|
if (this.textRenderer.isRightToLeft()) {
|
||||||
|
string2 = this.textRenderer.mirror(string2);
|
||||||
|
}
|
||||||
|
|
||||||
|
float n = (float) (-this.client.textRenderer.getWidth(string2) / 2);
|
||||||
|
this.client.textRenderer.draw(string2, n, (float) (m * 10 - this.text.length * 5), i, false, matrix4f,
|
||||||
|
immediate, false, 0, 15728880, false);
|
||||||
|
if (m == this.currentRow && j >= 0 && bl2) {
|
||||||
|
s = this.client.textRenderer
|
||||||
|
.getWidth(string2.substring(0, Math.max(Math.min(j, string2.length()), 0)));
|
||||||
|
t = s - this.client.textRenderer.getWidth(string2) / 2;
|
||||||
|
if (j >= string2.length()) {
|
||||||
|
this.client.textRenderer.draw("_", (float) t, (float) l, i, false, matrix4f, immediate, false,
|
||||||
|
0, 15728880, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
immediate.draw();
|
||||||
|
|
||||||
|
for (m = 0; m < this.text.length; ++m) {
|
||||||
|
string2 = this.text[m];
|
||||||
|
if (string2 != null && m == this.currentRow && j >= 0) {
|
||||||
|
int r = this.client.textRenderer
|
||||||
|
.getWidth(string2.substring(0, Math.max(Math.min(j, string2.length()), 0)));
|
||||||
|
s = r - this.client.textRenderer.getWidth(string2) / 2;
|
||||||
|
if (bl2 && j < string2.length()) {
|
||||||
|
int var31 = l - 1;
|
||||||
|
int var10003 = s + 1;
|
||||||
|
this.client.textRenderer.getClass();
|
||||||
|
fill(matrices, s, var31, var10003, l + 9, -16777216 | i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k != j) {
|
||||||
|
t = Math.min(j, k);
|
||||||
|
int u = Math.max(j, k);
|
||||||
|
int v = this.client.textRenderer.getWidth(string2.substring(0, t))
|
||||||
|
- this.client.textRenderer.getWidth(string2) / 2;
|
||||||
|
int w = this.client.textRenderer.getWidth(string2.substring(0, u))
|
||||||
|
- this.client.textRenderer.getWidth(string2) / 2;
|
||||||
|
int x = Math.min(v, w);
|
||||||
|
int y = Math.max(v, w);
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||||
|
RenderSystem.disableTexture();
|
||||||
|
RenderSystem.enableColorLogicOp();
|
||||||
|
RenderSystem.logicOp(GlStateManager.LogicOp.OR_REVERSE);
|
||||||
|
bufferBuilder.begin(7, VertexFormats.POSITION_COLOR);
|
||||||
|
float var32 = (float) x;
|
||||||
|
this.client.textRenderer.getClass();
|
||||||
|
bufferBuilder.vertex(matrix4f, var32, (float) (l + 9), 0.0F).color(0, 0, 255, 255).next();
|
||||||
|
var32 = (float) y;
|
||||||
|
this.client.textRenderer.getClass();
|
||||||
|
bufferBuilder.vertex(matrix4f, var32, (float) (l + 9), 0.0F).color(0, 0, 255, 255).next();
|
||||||
|
bufferBuilder.vertex(matrix4f, (float) y, (float) l, 0.0F).color(0, 0, 255, 255).next();
|
||||||
|
bufferBuilder.vertex(matrix4f, (float) x, (float) l, 0.0F).color(0, 0, 255, 255).next();
|
||||||
|
bufferBuilder.end();
|
||||||
|
BufferRenderer.draw(bufferBuilder);
|
||||||
|
RenderSystem.disableColorLogicOp();
|
||||||
|
RenderSystem.enableTexture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrices.pop();
|
||||||
|
DiffuseLighting.enableGuiDepthLighting();
|
||||||
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package ru.betterend.mixin.client;
|
||||||
|
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.network.NetworkThreadUtils;
|
||||||
|
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||||
|
import net.minecraft.network.packet.s2c.play.SignEditorOpenS2CPacket;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.thread.ThreadExecutor;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
import ru.betterend.client.gui.BlockSignEditScreen;
|
||||||
|
|
||||||
|
@Mixin(ClientPlayNetworkHandler.class)
|
||||||
|
public class ClientPlayNetworkHandlerMixin
|
||||||
|
{
|
||||||
|
@Shadow
|
||||||
|
private MinecraftClient client;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private ClientWorld world;
|
||||||
|
|
||||||
|
@Inject(method = "onSignEditorOpen", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
public void openSignEditor(SignEditorOpenS2CPacket packet, CallbackInfo info) {
|
||||||
|
NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this,
|
||||||
|
(ThreadExecutor<?>) client);
|
||||||
|
BlockEntity blockEntity = this.world.getBlockEntity(packet.getPos());
|
||||||
|
if (blockEntity instanceof ESignBlockEntity) {
|
||||||
|
ESignBlockEntity sign = (ESignBlockEntity) blockEntity;
|
||||||
|
client.openScreen(new BlockSignEditScreen(sign));
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "onBlockEntityUpdate", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
public void onEntityUpdate(BlockEntityUpdateS2CPacket packet, CallbackInfo info) {
|
||||||
|
NetworkThreadUtils.forceMainThread(packet, (ClientPlayNetworkHandler) (Object) this,
|
||||||
|
(ThreadExecutor<?>) client);
|
||||||
|
BlockPos blockPos = packet.getPos();
|
||||||
|
BlockEntity blockEntity = this.client.world.getBlockEntity(blockPos);
|
||||||
|
if (blockEntity instanceof ESignBlockEntity) {
|
||||||
|
blockEntity.fromTag(this.client.world.getBlockState(blockPos), packet.getCompoundTag());
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package ru.betterend.mixin.common;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.network.NetworkThreadUtils;
|
||||||
|
import net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket;
|
||||||
|
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
|
import net.minecraft.util.Formatting;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
|
||||||
|
@Mixin(ServerPlayNetworkHandler.class)
|
||||||
|
public class ServerPlayNetworkHandlerMixin {
|
||||||
|
@Shadow
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
public ServerPlayerEntity player;
|
||||||
|
|
||||||
|
@Inject(method = "onSignUpdate", at = @At(value = "HEAD"), cancellable = true)
|
||||||
|
private void signUpdate(UpdateSignC2SPacket packet, CallbackInfo info) {
|
||||||
|
NetworkThreadUtils.forceMainThread(packet, (ServerPlayNetworkHandler) (Object) this, (ServerWorld) this.player.getServerWorld());
|
||||||
|
this.player.updateLastActionTime();
|
||||||
|
ServerWorld serverWorld = this.player.getServerWorld();
|
||||||
|
BlockPos blockPos = packet.getPos();
|
||||||
|
if (serverWorld.isChunkLoaded(blockPos)) {
|
||||||
|
BlockState blockState = serverWorld.getBlockState(blockPos);
|
||||||
|
BlockEntity blockEntity = serverWorld.getBlockEntity(blockPos);
|
||||||
|
if (blockEntity instanceof ESignBlockEntity) {
|
||||||
|
ESignBlockEntity signBlockEntity = (ESignBlockEntity) blockEntity;
|
||||||
|
if (!signBlockEntity.isEditable() || signBlockEntity.getEditor() != this.player) {
|
||||||
|
LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] strings = packet.getText();
|
||||||
|
|
||||||
|
for (int i = 0; i < strings.length; ++i) {
|
||||||
|
signBlockEntity.setTextOnRow(i, new LiteralText(Formatting.strip(strings[i])));
|
||||||
|
}
|
||||||
|
|
||||||
|
signBlockEntity.markDirty();
|
||||||
|
serverWorld.updateListeners(blockPos, blockState, blockState, 3);
|
||||||
|
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
src/main/java/ru/betterend/registry/BlockEntityRegistry.java
Normal file
77
src/main/java/ru/betterend/registry/BlockEntityRegistry.java
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
package ru.betterend.registry;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.entity.BlockEntity;
|
||||||
|
import net.minecraft.block.entity.BlockEntityType;
|
||||||
|
import net.minecraft.item.BlockItem;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import ru.betterend.BetterEnd;
|
||||||
|
import ru.betterend.blocks.basis.BlockBarrel;
|
||||||
|
import ru.betterend.blocks.basis.BlockChest;
|
||||||
|
import ru.betterend.blocks.basis.BlockSign;
|
||||||
|
import ru.betterend.blocks.entities.EBarrelBlockEntity;
|
||||||
|
import ru.betterend.blocks.entities.EChestBlockEntity;
|
||||||
|
import ru.betterend.blocks.entities.ESignBlockEntity;
|
||||||
|
|
||||||
|
public class BlockEntityRegistry
|
||||||
|
{
|
||||||
|
public static final BlockEntityType<EChestBlockEntity> CHEST = BlockEntityType.Builder.create(EChestBlockEntity::new, getChests()).build(null);
|
||||||
|
public static final BlockEntityType<EBarrelBlockEntity> BARREL = BlockEntityType.Builder.create(EBarrelBlockEntity::new, getBarrels()).build(null);
|
||||||
|
public static final BlockEntityType<ESignBlockEntity> SIGN = BlockEntityType.Builder.create(ESignBlockEntity::new, getSigns()).build(null);
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
RegisterBlockEntity("chest", CHEST);
|
||||||
|
RegisterBlockEntity("barrel", BARREL);
|
||||||
|
RegisterBlockEntity("sign", SIGN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RegisterBlockEntity(String name, BlockEntityType<? extends BlockEntity> type) {
|
||||||
|
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(BetterEnd.MOD_ID, name), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Block[] getChests() {
|
||||||
|
List<Block> result = Lists.newArrayList();
|
||||||
|
ItemRegistry.getModBlocks().forEach((item) -> {
|
||||||
|
if (item instanceof BlockItem) {
|
||||||
|
Block block = ((BlockItem) item).getBlock();
|
||||||
|
if (block instanceof BlockChest) {
|
||||||
|
result.add(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result.toArray(new Block[] {});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Block[] getBarrels()
|
||||||
|
{
|
||||||
|
List<Block> result = Lists.newArrayList();
|
||||||
|
ItemRegistry.getModBlocks().forEach((item) -> {
|
||||||
|
if (item instanceof BlockItem) {
|
||||||
|
Block block = ((BlockItem) item).getBlock();
|
||||||
|
if (block instanceof BlockBarrel) {
|
||||||
|
result.add(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result.toArray(new Block[] {});
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Block[] getSigns()
|
||||||
|
{
|
||||||
|
List<Block> result = Lists.newArrayList();
|
||||||
|
ItemRegistry.getModBlocks().forEach((item) -> {
|
||||||
|
if (item instanceof BlockItem) {
|
||||||
|
Block block = ((BlockItem) item).getBlock();
|
||||||
|
if (block instanceof BlockSign) {
|
||||||
|
result.add(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result.toArray(new Block[] {});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package ru.betterend.registry;
|
||||||
|
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||||
|
import ru.betterend.blocks.entities.render.EChestBlockEntityRenderer;
|
||||||
|
import ru.betterend.blocks.entities.render.ESignBlockEntityRenderer;
|
||||||
|
|
||||||
|
public class BlockEntityRenderRegistry {
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public static void register() {
|
||||||
|
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityRegistry.CHEST, EChestBlockEntityRenderer::new);
|
||||||
|
BlockEntityRendererRegistry.INSTANCE.register(BlockEntityRegistry.SIGN, ESignBlockEntityRenderer::new);
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import ru.betterend.blocks.BlockTerrain;
|
||||||
import ru.betterend.blocks.EndStoneSmelter;
|
import ru.betterend.blocks.EndStoneSmelter;
|
||||||
import ru.betterend.blocks.EnderBlock;
|
import ru.betterend.blocks.EnderBlock;
|
||||||
import ru.betterend.blocks.TerminiteBlock;
|
import ru.betterend.blocks.TerminiteBlock;
|
||||||
|
import ru.betterend.blocks.complex.WoodenMaterial;
|
||||||
import ru.betterend.tab.CreativeTab;
|
import ru.betterend.tab.CreativeTab;
|
||||||
|
|
||||||
public class BlockRegistry {
|
public class BlockRegistry {
|
||||||
|
@ -22,6 +23,9 @@ public class BlockRegistry {
|
||||||
public static final Block END_MYCELIUM = registerBlock("end_mycelium", new BlockTerrain(MaterialColor.LIGHT_BLUE));
|
public static final Block END_MYCELIUM = registerBlock("end_mycelium", new BlockTerrain(MaterialColor.LIGHT_BLUE));
|
||||||
public static final Block END_MOSS = registerBlock("end_moss", new BlockTerrain(MaterialColor.CYAN));
|
public static final Block END_MOSS = registerBlock("end_moss", new BlockTerrain(MaterialColor.CYAN));
|
||||||
|
|
||||||
|
// Wooden Materials //
|
||||||
|
public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD);
|
||||||
|
|
||||||
// Ores //
|
// Ores //
|
||||||
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));
|
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));
|
||||||
|
|
||||||
|
@ -30,7 +34,7 @@ public class BlockRegistry {
|
||||||
public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock());
|
public static final Block AETERNIUM_BLOCK = registerBlock("aeternium_block", new AeterniumBlock());
|
||||||
public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock());
|
public static final Block ENDER_BLOCK = registerBlock("ender_block", new EnderBlock());
|
||||||
|
|
||||||
// BlockEntities //
|
// Block With Entities //
|
||||||
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());
|
public static final Block END_STONE_SMELTER = registerBlock("end_stone_smelter", new EndStoneSmelter());
|
||||||
|
|
||||||
public static void register() {}
|
public static void register() {}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"client": [
|
"client": [
|
||||||
"WorldRendererMixin",
|
"WorldRendererMixin",
|
||||||
"BackgroundRendererMixin"
|
"BackgroundRendererMixin",
|
||||||
|
"ClientPlayNetworkHandlerMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"DimensionTypeMixin",
|
"DimensionTypeMixin",
|
||||||
"RecipeManagerMixin"
|
"RecipeManagerMixin",
|
||||||
|
"ServerPlayNetworkHandlerMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|
92
utilities/paulevs/wooden/Helper.java
Normal file
92
utilities/paulevs/wooden/Helper.java
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
package paulevs.wooden;
|
||||||
|
|
||||||
|
public class Helper
|
||||||
|
{
|
||||||
|
public static final String MASK = "%name%";
|
||||||
|
|
||||||
|
public static final String[] BLOCKSTATES = new String[] {
|
||||||
|
"%name%_bark.json",
|
||||||
|
"%name%_button.json",
|
||||||
|
"%name%_door.json",
|
||||||
|
"%name%_fence.json",
|
||||||
|
"%name%_gate.json",
|
||||||
|
"%name%_ladder.json",
|
||||||
|
"%name%_log.json",
|
||||||
|
"%name%_planks.json",
|
||||||
|
"%name%_plate.json",
|
||||||
|
"%name%_slab.json",
|
||||||
|
"%name%_stairs.json",
|
||||||
|
"%name%_trapdoor.json",
|
||||||
|
"barrel_%name%.json",
|
||||||
|
"bar_stool_%name%.json",
|
||||||
|
"chair_%name%.json",
|
||||||
|
"chest_%name%.json",
|
||||||
|
"crafting_table_%name%.json",
|
||||||
|
"sign_%name%.json",
|
||||||
|
"striped_bark_%name%.json",
|
||||||
|
"striped_log_%name%.json",
|
||||||
|
"taburet_%name%.json"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final String[] BLOCKS = new String[] {
|
||||||
|
"%name%_bark.json",
|
||||||
|
"%name%_button.json",
|
||||||
|
"%name%_button_inventory.json",
|
||||||
|
"%name%_button_pressed.json",
|
||||||
|
"%name%_door_bottom.json",
|
||||||
|
"%name%_door_bottom_hinge.json",
|
||||||
|
"%name%_door_top.json",
|
||||||
|
"%name%_door_top_hinge.json",
|
||||||
|
"%name%_fence_gate_closed.json",
|
||||||
|
"%name%_fence_gate_open.json",
|
||||||
|
"%name%_fence_inventory.json",
|
||||||
|
"%name%_fence_post.json",
|
||||||
|
"%name%_fence_side.json",
|
||||||
|
"%name%_half_slab.json",
|
||||||
|
"%name%_inner_stairs.json",
|
||||||
|
"%name%_ladder.json",
|
||||||
|
"%name%_log.json",
|
||||||
|
"%name%_outer_stairs.json",
|
||||||
|
"%name%_planks.json",
|
||||||
|
"%name%_pressure_plate_down.json",
|
||||||
|
"%name%_pressure_plate_up.json",
|
||||||
|
"%name%_stairs.json",
|
||||||
|
"%name%_trapdoor.json",
|
||||||
|
"%name%_wall_gate_closed.json",
|
||||||
|
"%name%_wall_gate_open.json",
|
||||||
|
"barrel_%name%.json",
|
||||||
|
"barrel_%name%_open.json",
|
||||||
|
"bar_stool_%name%.json",
|
||||||
|
"chair_%name%.json",
|
||||||
|
"chair_%name%_top.json",
|
||||||
|
"crafting_table_%name%.json",
|
||||||
|
"empty_%name%.json",
|
||||||
|
"striped_bark_%name%.json",
|
||||||
|
"striped_log_%name%.json",
|
||||||
|
"taburet_%name%.json"
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final String[] ITEMS = new String[] {
|
||||||
|
"%name%_bark.json",
|
||||||
|
"%name%_button.json",
|
||||||
|
"%name%_door.json",
|
||||||
|
"%name%_fence.json",
|
||||||
|
"%name%_gate.json",
|
||||||
|
"%name%_ladder.json",
|
||||||
|
"%name%_log.json",
|
||||||
|
"%name%_planks.json",
|
||||||
|
"%name%_plate.json",
|
||||||
|
"%name%_slab.json",
|
||||||
|
"%name%_stairs.json",
|
||||||
|
"%name%_trapdoor.json",
|
||||||
|
"barrel_%name%.json",
|
||||||
|
"bar_stool_%name%.json",
|
||||||
|
"chair_%name%.json",
|
||||||
|
"chest_%name%.json",
|
||||||
|
"crafting_table_%name%.json",
|
||||||
|
"sign_%name%.json",
|
||||||
|
"striped_bark_%name%.json",
|
||||||
|
"striped_log_%name%.json",
|
||||||
|
"taburet_%name%.json"
|
||||||
|
};
|
||||||
|
}
|
93
utilities/paulevs/wooden/ModelHelper.java
Normal file
93
utilities/paulevs/wooden/ModelHelper.java
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
package paulevs.wooden;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
|
public class ModelHelper {
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
new ModelHelper("nether_sakura");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModelHelper(String name) throws IOException {
|
||||||
|
clearOutput();
|
||||||
|
editBlockstates(name);
|
||||||
|
editBlocks(name);
|
||||||
|
editItems(name);
|
||||||
|
printStates(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void clearOutput() {
|
||||||
|
for (File file: new File("./output/blockstates").listFiles())
|
||||||
|
file.delete();
|
||||||
|
for (File file: new File("./output/models/block").listFiles())
|
||||||
|
file.delete();
|
||||||
|
for (File file: new File("./output/models/item").listFiles())
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editBlockstates(String name) throws IOException {
|
||||||
|
String string;
|
||||||
|
new File("./output/blockstates").mkdirs();
|
||||||
|
for (String state: Helper.BLOCKSTATES) {
|
||||||
|
InputStream stream = Helper.class.getResourceAsStream("/blockstates/" + state);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
BufferedWriter wr = new BufferedWriter(new FileWriter(new File("./output/blockstates/" + state.replace(Helper.MASK, name))));
|
||||||
|
while ((string = br.readLine()) != null) wr.write(string.replace(Helper.MASK, name) + "\n");
|
||||||
|
wr.close();
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editBlocks(String name) throws IOException {
|
||||||
|
String string;
|
||||||
|
new File("./output/models/block").mkdirs();
|
||||||
|
for (String block: Helper.BLOCKS) {
|
||||||
|
InputStream stream = Helper.class.getResourceAsStream("/block/" + block);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
BufferedWriter wr = new BufferedWriter(new FileWriter(new File("./output/models/block/" + block.replace(Helper.MASK, name))));
|
||||||
|
while ((string = br.readLine()) != null) wr.write(string.replace(Helper.MASK, name) + "\n");
|
||||||
|
wr.close();
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void editItems(String name) throws IOException {
|
||||||
|
String string;
|
||||||
|
new File("./output/models/item").mkdirs();
|
||||||
|
for (String item: Helper.ITEMS) {
|
||||||
|
InputStream stream = Helper.class.getResourceAsStream("/item/" + item);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(stream));
|
||||||
|
BufferedWriter wr = new BufferedWriter(new FileWriter(new File("./output/models/item/" + item.replace(Helper.MASK, name))));
|
||||||
|
while ((string = br.readLine()) != null) wr.write(string.replace(Helper.MASK, name) + "\n");
|
||||||
|
wr.close();
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String capitalize(String str) {
|
||||||
|
String out = "";
|
||||||
|
for (int i = 0; i < str.length(); i++)
|
||||||
|
{
|
||||||
|
if (i == 0 || str.charAt(i - 1) == ' ')
|
||||||
|
out += Character.toUpperCase(str.charAt(i));
|
||||||
|
else
|
||||||
|
out += str.charAt(i);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void printStates(String name) {
|
||||||
|
for (String state: Helper.BLOCKSTATES)
|
||||||
|
{
|
||||||
|
String rname = state.replace(Helper.MASK, name);
|
||||||
|
String onlyName = rname.substring(0, rname.indexOf('.'));
|
||||||
|
String finName = name.replace('_', ' ') + " " + state.substring(0, state.indexOf('.')).replace(Helper.MASK, "").replace('_', ' ').trim();
|
||||||
|
System.out.println("\"block.betternether." + onlyName + "\": \"" + capitalize(finName) + "\",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_bark.json
Normal file
6
utility_res/block/%name%_bark.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "betternether:block/%name%_log_side"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_button.json
Normal file
6
utility_res/block/%name%_button.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/button",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_button_inventory.json
Normal file
6
utility_res/block/%name%_button_inventory.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/button_inventory",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_button_pressed.json
Normal file
6
utility_res/block/%name%_button_pressed.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/button_pressed",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/block/%name%_door_bottom.json
Normal file
7
utility_res/block/%name%_door_bottom.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "block/door_bottom",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_door_bottom",
|
||||||
|
"top": "betternether:block/%name%_door_bottom"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/block/%name%_door_bottom_hinge.json
Normal file
7
utility_res/block/%name%_door_bottom_hinge.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "block/door_bottom_rh",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_door_bottom",
|
||||||
|
"top": "betternether:block/%name%_door_bottom"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/block/%name%_door_top.json
Normal file
7
utility_res/block/%name%_door_top.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "block/door_top",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_door_top",
|
||||||
|
"top": "betternether:block/%name%_door_top"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/block/%name%_door_top_hinge.json
Normal file
7
utility_res/block/%name%_door_top_hinge.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "block/door_top_rh",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_door_top",
|
||||||
|
"top": "betternether:block/%name%_door_top"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_fence_gate_closed.json
Normal file
6
utility_res/block/%name%_fence_gate_closed.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/template_fence_gate",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_fence_gate_open.json
Normal file
6
utility_res/block/%name%_fence_gate_open.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/template_fence_gate_open",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_fence_inventory.json
Normal file
6
utility_res/block/%name%_fence_inventory.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/fence_inventory",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_fence_post.json
Normal file
6
utility_res/block/%name%_fence_post.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/fence_post",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_fence_side.json
Normal file
6
utility_res/block/%name%_fence_side.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/fence_side",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/%name%_half_slab.json
Normal file
8
utility_res/block/%name%_half_slab.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "block/slab",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_planks",
|
||||||
|
"top": "betternether:block/%name%_planks",
|
||||||
|
"side": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/%name%_inner_stairs.json
Normal file
8
utility_res/block/%name%_inner_stairs.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "block/inner_stairs",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_planks",
|
||||||
|
"top": "betternether:block/%name%_planks",
|
||||||
|
"side": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/block/%name%_ladder.json
Normal file
7
utility_res/block/%name%_ladder.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/reeds_ladder",
|
||||||
|
"textures": {
|
||||||
|
"particle": "betternether:block/%name%_ladder",
|
||||||
|
"texture": "betternether:block/%name%_ladder"
|
||||||
|
}
|
||||||
|
}
|
12
utility_res/block/%name%_log.json
Normal file
12
utility_res/block/%name%_log.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "betternether:block/%name%_log_side",
|
||||||
|
"down": "betternether:block/%name%_log_top",
|
||||||
|
"up": "betternether:block/%name%_log_top",
|
||||||
|
"north": "betternether:block/%name%_log_side",
|
||||||
|
"east": "betternether:block/%name%_log_side",
|
||||||
|
"south": "betternether:block/%name%_log_side",
|
||||||
|
"west": "betternether:block/%name%_log_side"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/%name%_outer_stairs.json
Normal file
8
utility_res/block/%name%_outer_stairs.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "block/outer_stairs",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_planks",
|
||||||
|
"top": "betternether:block/%name%_planks",
|
||||||
|
"side": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_planks.json
Normal file
6
utility_res/block/%name%_planks.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_pressure_plate_down.json
Normal file
6
utility_res/block/%name%_pressure_plate_down.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/pressure_plate_down",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_pressure_plate_up.json
Normal file
6
utility_res/block/%name%_pressure_plate_up.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/pressure_plate_up",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/%name%_stairs.json
Normal file
8
utility_res/block/%name%_stairs.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "block/stairs",
|
||||||
|
"textures": {
|
||||||
|
"bottom": "betternether:block/%name%_planks",
|
||||||
|
"top": "betternether:block/%name%_planks",
|
||||||
|
"side": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
68
utility_res/block/%name%_trapdoor.json
Normal file
68
utility_res/block/%name%_trapdoor.json
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
|
||||||
|
"parent": "block/block",
|
||||||
|
"textures": {
|
||||||
|
"particle": "betternether:block/%name%_trapdoor",
|
||||||
|
"texture": "betternether:block/%name%_trapdoor",
|
||||||
|
"side": "betternether:block/%name%_planks"
|
||||||
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"__comment": "Box1",
|
||||||
|
"from": [ 0, 0, 0 ],
|
||||||
|
"to": [ 2, 3, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 0, 0, 2, 16 ], "texture": "#texture", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 0, 0, 2, 16 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 14, 12, 16, 15 ], "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 0, 12, 2, 15 ], "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 12, 16, 15 ], "texture": "#side", "cullface": "west" },
|
||||||
|
"east": { "uv": [ 0, 12, 16, 15 ], "texture": "#side" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Box1",
|
||||||
|
"from": [ 14, 0, 0 ],
|
||||||
|
"to": [ 16, 3, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 14, 0, 16, 16 ], "texture": "#texture", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 14, 0, 16, 16 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 0, 12, 2, 15 ], "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 14, 12, 16, 15 ], "texture": "#side", "cullface": "south" },
|
||||||
|
"west": { "uv": [ 0, 12, 16, 15 ], "texture": "#side" },
|
||||||
|
"east": { "uv": [ 0, 12, 16, 15 ], "texture": "#side", "cullface": "east" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Box1",
|
||||||
|
"from": [ 2, 0, 0 ],
|
||||||
|
"to": [ 14, 3, 2 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 2, 12, 14, 15 ], "texture": "#side", "cullface": "north" },
|
||||||
|
"south": { "uv": [ 2, 12, 14, 15 ], "texture": "#side" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Box1",
|
||||||
|
"from": [ 2, 0, 14 ],
|
||||||
|
"to": [ 14, 3, 16 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 2, 0, 14, 2 ], "texture": "#texture", "cullface": "down" },
|
||||||
|
"up": { "uv": [ 2, 14, 14, 16 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 2, 12, 14, 15 ], "texture": "#side" },
|
||||||
|
"south": { "uv": [ 2, 12, 14, 15 ], "texture": "#side", "cullface": "south" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__comment": "Box1",
|
||||||
|
"from": [ 2, 1, 2 ],
|
||||||
|
"to": [ 14, 2, 14 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 2, 2, 14, 14 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
6
utility_res/block/%name%_wall_gate_closed.json
Normal file
6
utility_res/block/%name%_wall_gate_closed.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/template_fence_gate_wall",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/%name%_wall_gate_open.json
Normal file
6
utility_res/block/%name%_wall_gate_open.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/template_fence_gate_wall_open",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:block/%name%_planks"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/barrel_%name%.json
Normal file
8
utility_res/block/barrel_%name%.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube_bottom_top",
|
||||||
|
"textures": {
|
||||||
|
"top": "betternether:block/barrel_%name%_top",
|
||||||
|
"bottom": "betternether:block/barrel_%name%_bottom",
|
||||||
|
"side": "betternether:block/barrel_%name%_side"
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/block/barrel_%name%_open.json
Normal file
8
utility_res/block/barrel_%name%_open.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube_bottom_top",
|
||||||
|
"textures": {
|
||||||
|
"top": "betternether:block/barrel_%name%_top_open",
|
||||||
|
"bottom": "betternether:block/barrel_%name%_bottom",
|
||||||
|
"side": "betternether:block/barrel_%name%_side"
|
||||||
|
}
|
||||||
|
}
|
12
utility_res/block/crafting_table_%name%.json
Normal file
12
utility_res/block/crafting_table_%name%.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "betternether:block/crafting_table_%name%_front",
|
||||||
|
"north": "betternether:block/crafting_table_%name%_front",
|
||||||
|
"south": "betternether:block/crafting_table_%name%_side",
|
||||||
|
"east": "betternether:block/crafting_table_%name%_side",
|
||||||
|
"west": "betternether:block/crafting_table_%name%_front",
|
||||||
|
"up": "betternether:block/crafting_table_%name%_top",
|
||||||
|
"down": "betternether:block/crafting_table_%name%_bottom"
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/block/striped_bark_%name%.json
Normal file
6
utility_res/block/striped_bark_%name%.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube_all",
|
||||||
|
"textures": {
|
||||||
|
"all": "betternether:block/striped_log_%name%_side"
|
||||||
|
}
|
||||||
|
}
|
12
utility_res/block/striped_log_%name%.json
Normal file
12
utility_res/block/striped_log_%name%.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cube",
|
||||||
|
"textures": {
|
||||||
|
"particle": "betternether:block/striped_log_%name%_side",
|
||||||
|
"down": "betternether:block/striped_log_%name%_top",
|
||||||
|
"up": "betternether:block/striped_log_%name%_top",
|
||||||
|
"north": "betternether:block/striped_log_%name%_side",
|
||||||
|
"east": "betternether:block/striped_log_%name%_side",
|
||||||
|
"south": "betternether:block/striped_log_%name%_side",
|
||||||
|
"west": "betternether:block/striped_log_%name%_side"
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/%name%_bark.json
Normal file
7
utility_res/blockstates/%name%_bark.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"axis=y": { "model": "betternether:block/%name%_bark" },
|
||||||
|
"axis=z": { "model": "betternether:block/%name%_bark", "x": 90 },
|
||||||
|
"axis=x": { "model": "betternether:block/%name%_bark", "x": 90, "y": 90 }
|
||||||
|
}
|
||||||
|
}
|
28
utility_res/blockstates/%name%_button.json
Normal file
28
utility_res/blockstates/%name%_button.json
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"face=floor,facing=east,powered=false": { "model": "betternether:block/%name%_button", "y": 90 },
|
||||||
|
"face=floor,facing=west,powered=false": { "model": "betternether:block/%name%_button", "y": 270 },
|
||||||
|
"face=floor,facing=south,powered=false": { "model": "betternether:block/%name%_button", "y": 180 },
|
||||||
|
"face=floor,facing=north,powered=false": { "model": "betternether:block/%name%_button" },
|
||||||
|
"face=wall,facing=east,powered=false": { "model": "betternether:block/%name%_button", "uvlock": true, "x": 90, "y": 90 },
|
||||||
|
"face=wall,facing=west,powered=false": { "model": "betternether:block/%name%_button", "uvlock": true, "x": 90, "y": 270 },
|
||||||
|
"face=wall,facing=south,powered=false": { "model": "betternether:block/%name%_button", "uvlock": true, "x": 90, "y": 180 },
|
||||||
|
"face=wall,facing=north,powered=false": { "model": "betternether:block/%name%_button", "uvlock": true, "x": 90 },
|
||||||
|
"face=ceiling,facing=east,powered=false": { "model": "betternether:block/%name%_button", "x": 180, "y": 270 },
|
||||||
|
"face=ceiling,facing=west,powered=false": { "model": "betternether:block/%name%_button", "x": 180, "y": 90 },
|
||||||
|
"face=ceiling,facing=south,powered=false": { "model": "betternether:block/%name%_button", "x": 180 },
|
||||||
|
"face=ceiling,facing=north,powered=false": { "model": "betternether:block/%name%_button", "x": 180, "y": 180 },
|
||||||
|
"face=floor,facing=east,powered=true": { "model": "betternether:block/%name%_button_pressed", "y": 90 },
|
||||||
|
"face=floor,facing=west,powered=true": { "model": "betternether:block/%name%_button_pressed", "y": 270 },
|
||||||
|
"face=floor,facing=south,powered=true": { "model": "betternether:block/%name%_button_pressed", "y": 180 },
|
||||||
|
"face=floor,facing=north,powered=true": { "model": "betternether:block/%name%_button_pressed" },
|
||||||
|
"face=wall,facing=east,powered=true": { "model": "betternether:block/%name%_button_pressed", "uvlock": true, "x": 90, "y": 90 },
|
||||||
|
"face=wall,facing=west,powered=true": { "model": "betternether:block/%name%_button_pressed", "uvlock": true, "x": 90, "y": 270 },
|
||||||
|
"face=wall,facing=south,powered=true": { "model": "betternether:block/%name%_button_pressed", "uvlock": true, "x": 90, "y": 180 },
|
||||||
|
"face=wall,facing=north,powered=true": { "model": "betternether:block/%name%_button_pressed", "uvlock": true, "x": 90 },
|
||||||
|
"face=ceiling,facing=east,powered=true": { "model": "betternether:block/%name%_button_pressed", "x": 180, "y": 270 },
|
||||||
|
"face=ceiling,facing=west,powered=true": { "model": "betternether:block/%name%_button_pressed", "x": 180, "y": 90 },
|
||||||
|
"face=ceiling,facing=south,powered=true": { "model": "betternether:block/%name%_button_pressed", "x": 180 },
|
||||||
|
"face=ceiling,facing=north,powered=true": { "model": "betternether:block/%name%_button_pressed", "x": 180, "y": 180 }
|
||||||
|
}
|
||||||
|
}
|
36
utility_res/blockstates/%name%_door.json
Normal file
36
utility_res/blockstates/%name%_door.json
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east,half=lower,hinge=left,open=false": { "model": "betternether:block/%name%_door_bottom" },
|
||||||
|
"facing=south,half=lower,hinge=left,open=false": { "model": "betternether:block/%name%_door_bottom", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=false": { "model": "betternether:block/%name%_door_bottom", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=false": { "model": "betternether:block/%name%_door_bottom", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=right,open=false": { "model": "betternether:block/%name%_door_bottom_hinge" },
|
||||||
|
"facing=south,half=lower,hinge=right,open=false": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 90 },
|
||||||
|
"facing=west,half=lower,hinge=right,open=false": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 180 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=false": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 270 },
|
||||||
|
"facing=east,half=lower,hinge=left,open=true": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 90 },
|
||||||
|
"facing=south,half=lower,hinge=left,open=true": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 180 },
|
||||||
|
"facing=west,half=lower,hinge=left,open=true": { "model": "betternether:block/%name%_door_bottom_hinge", "y": 270 },
|
||||||
|
"facing=north,half=lower,hinge=left,open=true": { "model": "betternether:block/%name%_door_bottom_hinge" },
|
||||||
|
"facing=east,half=lower,hinge=right,open=true": { "model": "betternether:block/%name%_door_bottom", "y": 270 },
|
||||||
|
"facing=south,half=lower,hinge=right,open=true": { "model": "betternether:block/%name%_door_bottom" },
|
||||||
|
"facing=west,half=lower,hinge=right,open=true": { "model": "betternether:block/%name%_door_bottom", "y": 90 },
|
||||||
|
"facing=north,half=lower,hinge=right,open=true": { "model": "betternether:block/%name%_door_bottom", "y": 180 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=false": { "model": "betternether:block/%name%_door_top" },
|
||||||
|
"facing=south,half=upper,hinge=left,open=false": { "model": "betternether:block/%name%_door_top", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=false": { "model": "betternether:block/%name%_door_top", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=false": { "model": "betternether:block/%name%_door_top", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=right,open=false": { "model": "betternether:block/%name%_door_top_hinge" },
|
||||||
|
"facing=south,half=upper,hinge=right,open=false": { "model": "betternether:block/%name%_door_top_hinge", "y": 90 },
|
||||||
|
"facing=west,half=upper,hinge=right,open=false": { "model": "betternether:block/%name%_door_top_hinge", "y": 180 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=false": { "model": "betternether:block/%name%_door_top_hinge", "y": 270 },
|
||||||
|
"facing=east,half=upper,hinge=left,open=true": { "model": "betternether:block/%name%_door_top_hinge", "y": 90 },
|
||||||
|
"facing=south,half=upper,hinge=left,open=true": { "model": "betternether:block/%name%_door_top_hinge", "y": 180 },
|
||||||
|
"facing=west,half=upper,hinge=left,open=true": { "model": "betternether:block/%name%_door_top_hinge", "y": 270 },
|
||||||
|
"facing=north,half=upper,hinge=left,open=true": { "model": "betternether:block/%name%_door_top_hinge" },
|
||||||
|
"facing=east,half=upper,hinge=right,open=true": { "model": "betternether:block/%name%_door_top", "y": 270 },
|
||||||
|
"facing=south,half=upper,hinge=right,open=true": { "model": "betternether:block/%name%_door_top" },
|
||||||
|
"facing=west,half=upper,hinge=right,open=true": { "model": "betternether:block/%name%_door_top", "y": 90 },
|
||||||
|
"facing=north,half=upper,hinge=right,open=true": { "model": "betternether:block/%name%_door_top", "y": 180 }
|
||||||
|
}
|
||||||
|
}
|
17
utility_res/blockstates/%name%_fence.json
Normal file
17
utility_res/blockstates/%name%_fence.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"multipart": [
|
||||||
|
{ "apply": { "model": "betternether:block/%name%_fence_post" }},
|
||||||
|
{ "when": { "north": true },
|
||||||
|
"apply": { "model": "betternether:block/%name%_fence_side", "uvlock": true }
|
||||||
|
},
|
||||||
|
{ "when": { "east": true },
|
||||||
|
"apply": { "model": "betternether:block/%name%_fence_side", "y": 90, "uvlock": true }
|
||||||
|
},
|
||||||
|
{ "when": { "south": true },
|
||||||
|
"apply": { "model": "betternether:block/%name%_fence_side", "y": 180, "uvlock": true }
|
||||||
|
},
|
||||||
|
{ "when": { "west": true },
|
||||||
|
"apply": { "model": "betternether:block/%name%_fence_side", "y": 270, "uvlock": true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
20
utility_res/blockstates/%name%_gate.json
Normal file
20
utility_res/blockstates/%name%_gate.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=south,in_wall=false,open=false": { "model": "betternether:block/%name%_fence_gate_closed", "uvlock": true },
|
||||||
|
"facing=west,in_wall=false,open=false": { "model": "betternether:block/%name%_fence_gate_closed", "uvlock": true, "y": 90 },
|
||||||
|
"facing=north,in_wall=false,open=false": { "model": "betternether:block/%name%_fence_gate_closed", "uvlock": true, "y": 180 },
|
||||||
|
"facing=east,in_wall=false,open=false": { "model": "betternether:block/%name%_fence_gate_closed", "uvlock": true, "y": 270 },
|
||||||
|
"facing=south,in_wall=false,open=true": { "model": "betternether:block/%name%_fence_gate_open", "uvlock": true },
|
||||||
|
"facing=west,in_wall=false,open=true": { "model": "betternether:block/%name%_fence_gate_open", "uvlock": true, "y": 90 },
|
||||||
|
"facing=north,in_wall=false,open=true": { "model": "betternether:block/%name%_fence_gate_open", "uvlock": true, "y": 180 },
|
||||||
|
"facing=east,in_wall=false,open=true": { "model": "betternether:block/%name%_fence_gate_open", "uvlock": true, "y": 270 },
|
||||||
|
"facing=south,in_wall=true,open=false": { "model": "betternether:block/%name%_wall_gate_closed", "uvlock": true },
|
||||||
|
"facing=west,in_wall=true,open=false": { "model": "betternether:block/%name%_wall_gate_closed", "uvlock": true, "y": 90 },
|
||||||
|
"facing=north,in_wall=true,open=false": { "model": "betternether:block/%name%_wall_gate_closed", "uvlock": true, "y": 180 },
|
||||||
|
"facing=east,in_wall=true,open=false": { "model": "betternether:block/%name%_wall_gate_closed", "uvlock": true, "y": 270 },
|
||||||
|
"facing=south,in_wall=true,open=true": { "model": "betternether:block/%name%_wall_gate_open", "uvlock": true },
|
||||||
|
"facing=west,in_wall=true,open=true": { "model": "betternether:block/%name%_wall_gate_open", "uvlock": true, "y": 90 },
|
||||||
|
"facing=north,in_wall=true,open=true": { "model": "betternether:block/%name%_wall_gate_open", "uvlock": true, "y": 180 },
|
||||||
|
"facing=east,in_wall=true,open=true": { "model": "betternether:block/%name%_wall_gate_open", "uvlock": true, "y": 270 }
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/blockstates/%name%_ladder.json
Normal file
8
utility_res/blockstates/%name%_ladder.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=north": { "model": "betternether:block/%name%_ladder" },
|
||||||
|
"facing=east": { "model": "betternether:block/%name%_ladder", "y": 90 },
|
||||||
|
"facing=south": { "model": "betternether:block/%name%_ladder", "y": 180 },
|
||||||
|
"facing=west": { "model": "betternether:block/%name%_ladder", "y": 270 }
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/%name%_log.json
Normal file
7
utility_res/blockstates/%name%_log.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"axis=y": { "model": "betternether:block/%name%_log" },
|
||||||
|
"axis=z": { "model": "betternether:block/%name%_log", "x": 90 },
|
||||||
|
"axis=x": { "model": "betternether:block/%name%_log", "x": 90, "y": 90 }
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/blockstates/%name%_planks.json
Normal file
6
utility_res/blockstates/%name%_planks.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"variants":
|
||||||
|
{
|
||||||
|
"": { "model": "betternether:block/%name%_planks" }
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/blockstates/%name%_plate.json
Normal file
6
utility_res/blockstates/%name%_plate.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"powered=false": { "model": "betternether:block/%name%_pressure_plate_up" },
|
||||||
|
"powered=true": { "model": "betternether:block/%name%_pressure_plate_down" }
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/blockstates/%name%_slab.json
Normal file
8
utility_res/blockstates/%name%_slab.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"variants":
|
||||||
|
{
|
||||||
|
"type=bottom": { "model": "betternether:block/%name%_half_slab" },
|
||||||
|
"type=top": { "model": "betternether:block/%name%_half_slab", "x": 180, "uvlock": true },
|
||||||
|
"type=double": { "model": "betternether:block/%name%_planks" }
|
||||||
|
}
|
||||||
|
}
|
44
utility_res/blockstates/%name%_stairs.json
Normal file
44
utility_res/blockstates/%name%_stairs.json
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east,half=bottom,shape=straight": { "model": "betternether:block/%name%_stairs" },
|
||||||
|
"facing=west,half=bottom,shape=straight": { "model": "betternether:block/%name%_stairs", "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=bottom,shape=straight": { "model": "betternether:block/%name%_stairs", "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=bottom,shape=straight": { "model": "betternether:block/%name%_stairs", "y": 270, "uvlock": true },
|
||||||
|
"facing=east,half=bottom,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs" },
|
||||||
|
"facing=west,half=bottom,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=bottom,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=bottom,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "y": 270, "uvlock": true },
|
||||||
|
"facing=east,half=bottom,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "y": 270, "uvlock": true },
|
||||||
|
"facing=west,half=bottom,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "y": 90, "uvlock": true },
|
||||||
|
"facing=south,half=bottom,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs" },
|
||||||
|
"facing=north,half=bottom,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "y": 180, "uvlock": true },
|
||||||
|
"facing=east,half=bottom,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs" },
|
||||||
|
"facing=west,half=bottom,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=bottom,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=bottom,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "y": 270, "uvlock": true },
|
||||||
|
"facing=east,half=bottom,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "y": 270, "uvlock": true },
|
||||||
|
"facing=west,half=bottom,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "y": 90, "uvlock": true },
|
||||||
|
"facing=south,half=bottom,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs" },
|
||||||
|
"facing=north,half=bottom,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "y": 180, "uvlock": true },
|
||||||
|
"facing=east,half=top,shape=straight": { "model": "betternether:block/%name%_stairs", "x": 180, "uvlock": true },
|
||||||
|
"facing=west,half=top,shape=straight": { "model": "betternether:block/%name%_stairs", "x": 180, "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=top,shape=straight": { "model": "betternether:block/%name%_stairs", "x": 180, "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=top,shape=straight": { "model": "betternether:block/%name%_stairs", "x": 180, "y": 270, "uvlock": true },
|
||||||
|
"facing=east,half=top,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 90, "uvlock": true },
|
||||||
|
"facing=west,half=top,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 270, "uvlock": true },
|
||||||
|
"facing=south,half=top,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 180, "uvlock": true },
|
||||||
|
"facing=north,half=top,shape=outer_right": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "uvlock": true },
|
||||||
|
"facing=east,half=top,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "uvlock": true },
|
||||||
|
"facing=west,half=top,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=top,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=top,shape=outer_left": { "model": "betternether:block/%name%_outer_stairs", "x": 180, "y": 270, "uvlock": true },
|
||||||
|
"facing=east,half=top,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 90, "uvlock": true },
|
||||||
|
"facing=west,half=top,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 270, "uvlock": true },
|
||||||
|
"facing=south,half=top,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 180, "uvlock": true },
|
||||||
|
"facing=north,half=top,shape=inner_right": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "uvlock": true },
|
||||||
|
"facing=east,half=top,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "uvlock": true },
|
||||||
|
"facing=west,half=top,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 180, "uvlock": true },
|
||||||
|
"facing=south,half=top,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 90, "uvlock": true },
|
||||||
|
"facing=north,half=top,shape=inner_left": { "model": "betternether:block/%name%_inner_stairs", "x": 180, "y": 270, "uvlock": true }
|
||||||
|
}
|
||||||
|
}
|
20
utility_res/blockstates/%name%_trapdoor.json
Normal file
20
utility_res/blockstates/%name%_trapdoor.json
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=north,half=bottom,open=false": { "model": "betternether:block/%name%_trapdoor" },
|
||||||
|
"facing=south,half=bottom,open=false": { "model": "betternether:block/%name%_trapdoor", "y": 180 },
|
||||||
|
"facing=east,half=bottom,open=false": { "model": "betternether:block/%name%_trapdoor", "y": 90 },
|
||||||
|
"facing=west,half=bottom,open=false": { "model": "betternether:block/%name%_trapdoor", "y": 270 },
|
||||||
|
"facing=north,half=top,open=false": { "model": "betternether:block/%name%_trapdoor", "x": 180 },
|
||||||
|
"facing=south,half=top,open=false": { "model": "betternether:block/%name%_trapdoor", "x": 180, "y": 180 },
|
||||||
|
"facing=east,half=top,open=false": { "model": "betternether:block/%name%_trapdoor", "x": 180, "y": 90 },
|
||||||
|
"facing=west,half=top,open=false": { "model": "betternether:block/%name%_trapdoor", "x": 180, "y": 270 },
|
||||||
|
"facing=north,half=bottom,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 90 },
|
||||||
|
"facing=south,half=bottom,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 90, "y": 180 },
|
||||||
|
"facing=east,half=bottom,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 90, "y": 90 },
|
||||||
|
"facing=west,half=bottom,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 90, "y": 270 },
|
||||||
|
"facing=north,half=top,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 270, "y": 180 },
|
||||||
|
"facing=south,half=top,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 270, "y": 0 },
|
||||||
|
"facing=east,half=top,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 270, "y": 270 },
|
||||||
|
"facing=west,half=top,open=true": { "model": "betternether:block/%name%_trapdoor", "x": 270, "y": 90 }
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/blockstates/bar_stool_%name%.json
Normal file
8
utility_res/blockstates/bar_stool_%name%.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east": { "model": "betternether:block/bar_stool_%name%" },
|
||||||
|
"facing=west": { "model": "betternether:block/bar_stool_%name%", "y": 180 },
|
||||||
|
"facing=south": { "model": "betternether:block/bar_stool_%name%", "y": 90 },
|
||||||
|
"facing=north": { "model": "betternether:block/bar_stool_%name%", "y": 270 }
|
||||||
|
}
|
||||||
|
}
|
56
utility_res/blockstates/barrel_%name%.json
Normal file
56
utility_res/blockstates/barrel_%name%.json
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=down,open=false": {
|
||||||
|
"x": 180,
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=down,open=true": {
|
||||||
|
"x": 180,
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
},
|
||||||
|
"facing=east,open=false": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 90,
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=east,open=true": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 90,
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
},
|
||||||
|
"facing=north,open=false": {
|
||||||
|
"x": 90,
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=north,open=true": {
|
||||||
|
"x": 90,
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
},
|
||||||
|
"facing=south,open=false": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 180,
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=south,open=true": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 180,
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
},
|
||||||
|
"facing=up,open=false": {
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=up,open=true": {
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
},
|
||||||
|
"facing=west,open=false": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 270,
|
||||||
|
"model": "betternether:block/barrel_%name%"
|
||||||
|
},
|
||||||
|
"facing=west,open=true": {
|
||||||
|
"x": 90,
|
||||||
|
"y": 270,
|
||||||
|
"model": "betternether:block/barrel_%name%_open"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
utility_res/blockstates/chair_%name%.json
Normal file
9
utility_res/blockstates/chair_%name%.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east,top=false": { "model": "betternether:block/chair_%name%", "y": 90 },
|
||||||
|
"facing=west,top=false": { "model": "betternether:block/chair_%name%", "y": 270 },
|
||||||
|
"facing=south,top=false": { "model": "betternether:block/chair_%name%", "y": 180 },
|
||||||
|
"facing=north,top=false": { "model": "betternether:block/chair_%name%" },
|
||||||
|
"top=true": { "model": "betternether:block/chair_%name%_top" }
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/chest_%name%.json
Normal file
7
utility_res/blockstates/chest_%name%.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "betternether:block/empty_%name%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/crafting_table_%name%.json
Normal file
7
utility_res/blockstates/crafting_table_%name%.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "betternether:block/crafting_table_%name%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
5
utility_res/blockstates/sign_%name%.json
Normal file
5
utility_res/blockstates/sign_%name%.json
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": { "model": "betternether:block/empty_%name%" }
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/striped_bark_%name%.json
Normal file
7
utility_res/blockstates/striped_bark_%name%.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"axis=y": { "model": "betternether:block/striped_bark_%name%" },
|
||||||
|
"axis=z": { "model": "betternether:block/striped_bark_%name%", "x": 90 },
|
||||||
|
"axis=x": { "model": "betternether:block/striped_bark_%name%", "x": 90, "y": 90 }
|
||||||
|
}
|
||||||
|
}
|
7
utility_res/blockstates/striped_log_%name%.json
Normal file
7
utility_res/blockstates/striped_log_%name%.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"axis=y": { "model": "betternether:block/striped_log_%name%" },
|
||||||
|
"axis=z": { "model": "betternether:block/striped_log_%name%", "x": 90 },
|
||||||
|
"axis=x": { "model": "betternether:block/striped_log_%name%", "x": 90, "y": 90 }
|
||||||
|
}
|
||||||
|
}
|
8
utility_res/blockstates/taburet_%name%.json
Normal file
8
utility_res/blockstates/taburet_%name%.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"facing=east": { "model": "betternether:block/taburet_%name%" },
|
||||||
|
"facing=west": { "model": "betternether:block/taburet_%name%", "y": 180 },
|
||||||
|
"facing=south": { "model": "betternether:block/taburet_%name%", "y": 90 },
|
||||||
|
"facing=north": { "model": "betternether:block/taburet_%name%", "y": 270 }
|
||||||
|
}
|
||||||
|
}
|
3
utility_res/item/%name%_bark.json
Normal file
3
utility_res/item/%name%_bark.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_bark"
|
||||||
|
}
|
3
utility_res/item/%name%_button.json
Normal file
3
utility_res/item/%name%_button.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_button_inventory"
|
||||||
|
}
|
6
utility_res/item/%name%_door.json
Normal file
6
utility_res/item/%name%_door.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "betternether:item/%name%_door"
|
||||||
|
}
|
||||||
|
}
|
3
utility_res/item/%name%_fence.json
Normal file
3
utility_res/item/%name%_fence.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_fence_inventory"
|
||||||
|
}
|
3
utility_res/item/%name%_gate.json
Normal file
3
utility_res/item/%name%_gate.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_fence_gate_closed"
|
||||||
|
}
|
6
utility_res/item/%name%_ladder.json
Normal file
6
utility_res/item/%name%_ladder.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "betternether:block/%name%_ladder"
|
||||||
|
}
|
||||||
|
}
|
3
utility_res/item/%name%_log.json
Normal file
3
utility_res/item/%name%_log.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_log"
|
||||||
|
}
|
3
utility_res/item/%name%_planks.json
Normal file
3
utility_res/item/%name%_planks.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_planks"
|
||||||
|
}
|
3
utility_res/item/%name%_plate.json
Normal file
3
utility_res/item/%name%_plate.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_pressure_plate_up"
|
||||||
|
}
|
3
utility_res/item/%name%_slab.json
Normal file
3
utility_res/item/%name%_slab.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_half_slab"
|
||||||
|
}
|
3
utility_res/item/%name%_stairs.json
Normal file
3
utility_res/item/%name%_stairs.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_stairs"
|
||||||
|
}
|
3
utility_res/item/%name%_trapdoor.json
Normal file
3
utility_res/item/%name%_trapdoor.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/%name%_trapdoor"
|
||||||
|
}
|
3
utility_res/item/bar_stool_%name%.json
Normal file
3
utility_res/item/bar_stool_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/bar_stool_%name%"
|
||||||
|
}
|
3
utility_res/item/barrel_%name%.json
Normal file
3
utility_res/item/barrel_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/barrel_%name%"
|
||||||
|
}
|
15
utility_res/item/chair_%name%.json
Normal file
15
utility_res/item/chair_%name%.json
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/chair_%name%",
|
||||||
|
"display": {
|
||||||
|
"gui": {
|
||||||
|
"rotation": [ 30, 45, 0 ],
|
||||||
|
"translation": [ 0, -1.4, 0],
|
||||||
|
"scale":[ 0.625, 0.625, 0.625 ]
|
||||||
|
},
|
||||||
|
"fixed": {
|
||||||
|
"rotation": [ 0, 0, 0 ],
|
||||||
|
"translation": [ 0, 0, 0 ],
|
||||||
|
"scale": [ 0.5, 0.5, 0.5 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
6
utility_res/item/chest_%name%.json
Normal file
6
utility_res/item/chest_%name%.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/chest_item",
|
||||||
|
"textures": {
|
||||||
|
"texture": "betternether:entity/chest/chest_%name%"
|
||||||
|
}
|
||||||
|
}
|
3
utility_res/item/crafting_table_%name%.json
Normal file
3
utility_res/item/crafting_table_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/crafting_table_%name%"
|
||||||
|
}
|
6
utility_res/item/sign_%name%.json
Normal file
6
utility_res/item/sign_%name%.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "betternether:item/sign_%name%"
|
||||||
|
}
|
||||||
|
}
|
3
utility_res/item/striped_bark_%name%.json
Normal file
3
utility_res/item/striped_bark_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/striped_bark_%name%"
|
||||||
|
}
|
3
utility_res/item/striped_log_%name%.json
Normal file
3
utility_res/item/striped_log_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/striped_log_%name%"
|
||||||
|
}
|
3
utility_res/item/taburet_%name%.json
Normal file
3
utility_res/item/taburet_%name%.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "betternether:block/taburet_%name%"
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue