diff --git a/trash_bin/old/base/PumpjackBaseBlock.java b/trash_bin/old/base/PumpjackBaseBlock.java new file mode 100644 index 00000000..cb9e872f --- /dev/null +++ b/trash_bin/old/base/PumpjackBaseBlock.java @@ -0,0 +1,72 @@ +package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.base; + + +import com.drmangotea.createindustry.registry.TFMGBlockEntities; +import com.drmangotea.createindustry.registry.TFMGShapes; +import com.simibubi.create.content.equipment.wrench.IWrenchable; +import com.simibubi.create.foundation.block.IBE; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.Mirror; +import net.minecraft.world.level.block.Rotation; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class PumpjackBaseBlock extends HorizontalDirectionalBlock implements IWrenchable, IBE { + + + + + public PumpjackBaseBlock(Properties p_i48440_1_) { + super(p_i48440_1_); + + } + @Override + public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) { + + return TFMGShapes.PUMPJACK_BASE; + } + public BlockState rotate(BlockState p_54540_, Rotation p_54541_) { + return p_54540_.setValue(HorizontalDirectionalBlock.FACING, p_54541_.rotate(p_54540_.getValue(HorizontalDirectionalBlock.FACING))); + } + + public BlockState mirror(BlockState p_54537_, Mirror p_54538_) { + return p_54537_.rotate(p_54538_.getRotation(p_54537_.getValue(HorizontalDirectionalBlock.FACING))); + } + + protected void createBlockStateDefinition(StateDefinition.Builder p_54543_) { + p_54543_.add(HorizontalDirectionalBlock.FACING); + } + + + @Override + public BlockState getStateForPlacement(BlockPlaceContext context) { + return this.defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, context.getHorizontalDirection().getOpposite()); + } + + @Override + public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean isMoving) { + + + world.removeBlockEntity(pos); + } + + + @Override + public Class getBlockEntityClass() { + return PumpjackBaseBlockEntity.class; + } + + @Override + public BlockEntityType getBlockEntityType() { + return TFMGBlockEntities.PUMPJACK_BASE.get(); + } + +} diff --git a/trash_bin/old/base/PumpjackBaseBlockEntity.java b/trash_bin/old/base/PumpjackBaseBlockEntity.java new file mode 100644 index 00000000..d882b200 --- /dev/null +++ b/trash_bin/old/base/PumpjackBaseBlockEntity.java @@ -0,0 +1,375 @@ +package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.base; + + +import com.drmangotea.createindustry.blocks.deposits.FluidDepositBlockEntity; +import com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.crank.PumpjackCrankBlockEntity; +import com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.hammer_holder.PumpjackHammerHolderBlockEntity; +import com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.machine_input.MachineInputBlockEntity; +import com.drmangotea.createindustry.registry.TFMGBlocks; +import com.drmangotea.createindustry.registry.TFMGFluids; +import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation; +import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; +import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour; +import com.simibubi.create.foundation.fluid.SmartFluidTank; +import com.simibubi.create.foundation.utility.Lang; +import com.simibubi.create.foundation.utility.LangBuilder; +import net.minecraft.ChatFormatting; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidTank; +import net.minecraftforge.fluids.capability.CapabilityFluidHandler; +import net.minecraftforge.fluids.capability.IFluidHandler; +import net.minecraftforge.fluids.capability.templates.FluidTank; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; + +public class PumpjackBaseBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation { + + public BlockPos crankPos = this.getBlockPos(); + + protected LazyOptional fluidCapability; + public FluidTank tankInventory; + public FluidDepositBlockEntity deposit; + public Direction direction = this.getBlockState().getValue(HorizontalDirectionalBlock.FACING).getOpposite(); + int debugCounter = 0; + public int miningRate = 0; + int depositCheckTimer = 0; + + private static final int SYNC_RATE = 8; + protected int syncCooldown; + protected boolean queuedSync; + + + public PumpjackBaseBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + tankInventory = createInventory(); + fluidCapability = LazyOptional.of(() -> tankInventory); + + refreshCapability(); + } + + + @Override + public boolean addToGoggleTooltip(List tooltip, boolean isPlayerSneaking) { + Lang.translate("goggles.pumpjack_info") + .forGoggles(tooltip); + if (!isComplete()) { + Lang.translate("goggles.pumpjack.part_missing") + .style(ChatFormatting.DARK_RED) + .forGoggles(tooltip); + if(isWronglyRotated()){ + Lang.translate("goggles.pumpjack.wrong_rotation1") + .style(ChatFormatting.GOLD) + .forGoggles(tooltip); + Lang.translate("goggles.pumpjack.wrong_rotation2") + .style(ChatFormatting.GOLD) + .forGoggles(tooltip); + } + return true; + } + + + LangBuilder mb = Lang.translate("generic.unit.millibuckets"); + + + Lang.translate("goggles.pumpjack.deposit_info") + .style(ChatFormatting.GRAY) + .forGoggles(tooltip); + + + if (!(deposit == null || deposit.fluidAmount == 0)) { + Lang.translate("goggles.pumpjack.fluid_amount") + .style(ChatFormatting.DARK_GRAY) + .add( + Lang.translate("pumpjack_deposit_amount", this.deposit.baseFluidAmount) + .style(ChatFormatting.BLUE) + // .add(mb)) + ).forGoggles(tooltip, 1); + + + } else { + + Lang.translate("goggles.zero") + .style(ChatFormatting.DARK_RED) + .forGoggles(tooltip, 1); + } + + + return true; + + + } + + + public void process() { + if (deposit == null || deposit.fluidAmount == 0) + return; + + if (tankInventory.getFluidAmount() + miningRate > 1000) + return; + + deposit.fluidAmount -= miningRate; + tankInventory.setFluid(new FluidStack(deposit.getDepositFluid(), tankInventory.getFluidAmount() + miningRate)); + } + + public boolean hasPipe() { + + for (int i = -62; i != getBlockPos().getY(); i++) { + BlockPos pos = new BlockPos(getBlockPos().getX(), i, getBlockPos().getZ()); + if (!(level.getBlockState(pos).is(TFMGBlocks.INDUSTRIAL_PIPE.get()))) + return false; + } + + return true; + + } + + public void findDeposit() { + for (int i = 0; i < this.getBlockPos().getY() + 64; i++) { + debugCounter = this.getBlockPos().getY() - i; + BlockPos checkedPos = new BlockPos(this.getBlockPos().getX(), (this.getBlockPos().getY() - 1) - i, this.getBlockPos().getZ()); + + if (level.getBlockState(new BlockPos(checkedPos)).is(TFMGBlocks.OIL_DEPOSIT.get())) { + deposit = (FluidDepositBlockEntity) level.getBlockEntity(checkedPos); + return; + } + + if (!(level.getBlockState(new BlockPos(checkedPos)).is(TFMGBlocks.INDUSTRIAL_PIPE.get()))) { + deposit = null; + return; + } + + + } + debugCounter = 0; + deposit = null; + return; + + /* + if(!hasPipe()) { + deposit = null; + return; + } + + if(level.getBlockEntity(new BlockPos(getBlockPos().getX(),-63,getBlockPos().getZ())) instanceof FluidDepositTileEntity) { + deposit = (FluidDepositTileEntity) (level.getBlockEntity(new BlockPos(getBlockPos().getX(),-64,getBlockPos().getZ()))); + }else { + deposit=null; + } + + */ + } + + protected SmartFluidTank createInventory() { + return new SmartFluidTank(1000, this::onFluidStackChanged) { + @Override + public boolean isFluidValid(FluidStack stack) { + return stack.getFluid().isSame(TFMGFluids.CRUDE_OIL.getSource()); + } + }; + } + + protected void onFluidStackChanged(FluidStack newFluidStack) { + } + + @Override + public void tick() { + super.tick(); + if (!isComplete()) + return; + + + MachineInputBlockEntity input = null; + if (level.getBlockEntity(crankPos.below()) instanceof MachineInputBlockEntity) + input = (MachineInputBlockEntity) level.getBlockEntity(crankPos.below()); + if (input == null) + return; + miningRate = input.powerLevel * 12; + + + depositCheckTimer++; + if (depositCheckTimer > 50) { + depositCheckTimer = 0; + findDeposit(); + + } + + + direction = this.getBlockState().getValue(HorizontalDirectionalBlock.FACING).getOpposite(); + + process(); + if (syncCooldown > 0) { + syncCooldown--; + if (syncCooldown == 0 && queuedSync) + sendData(); + } + + + } + + + @Override + public void initialize() { + super.initialize(); + sendData(); + if (level.isClientSide) + invalidateRenderBoundingBox(); + } + + + @Override + public void sendData() { + if (syncCooldown > 0) { + queuedSync = true; + return; + } + super.sendData(); + queuedSync = false; + syncCooldown = SYNC_RATE; + } + + + private void refreshCapability() { + LazyOptional oldCap = fluidCapability; + fluidCapability = LazyOptional.of(() -> handlerForCapability()); + oldCap.invalidate(); + } + + private IFluidHandler handlerForCapability() { + + return tankInventory; + } + + + @Override + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); + + tankInventory.setCapacity(1000); + tankInventory.readFromNBT(compound.getCompound("TankContent")); + } + + + @Override + public void write(CompoundTag compound, boolean clientPacket) { + + compound.put("TankContent", tankInventory.writeToNBT(new CompoundTag())); + super.write(compound, clientPacket); + + + } + + @Nonnull + @Override + @SuppressWarnings("removal") + public LazyOptional getCapability(@Nonnull Capability cap, @Nullable Direction side) { + if (!fluidCapability.isPresent()) + refreshCapability(); + if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) + return fluidCapability.cast(); + return super.getCapability(cap, side); + } + + + @Override + public void addBehaviours(List behaviours) { + + } + + public IFluidTank getTankInventory() { + return tankInventory; + } + + public boolean isComplete() { + BlockPos hammerPos = this.getBlockPos(); + crankPos = this.getBlockPos(); + if (direction == Direction.WEST) { + hammerPos = new BlockPos(this.getBlockPos().west(2).above(2)); + crankPos = new BlockPos(this.getBlockPos().west(4).above(1)); + } + if (direction == Direction.EAST) { + hammerPos = new BlockPos(this.getBlockPos().east(2).above(2)); + crankPos = new BlockPos(this.getBlockPos().east(4).above(1)); + } + if (direction == Direction.NORTH) { + hammerPos = new BlockPos(this.getBlockPos().north(2).above(2)); + crankPos = new BlockPos(this.getBlockPos().north(4).above(1)); + } + if (direction == Direction.SOUTH) { + hammerPos = new BlockPos(this.getBlockPos().south(2).above(2)); + crankPos = new BlockPos(this.getBlockPos().south(4).above(1)); + } + + + if (!(level.getBlockEntity(hammerPos) instanceof PumpjackHammerHolderBlockEntity && + level.getBlockEntity(crankPos) instanceof PumpjackCrankBlockEntity)) { + return false; + } + //MachineInputTileEntity input = (MachineInputTileEntity) level.getBlockEntity(crankPos.below()); + // if(input.powerLevel==0) + // return false; + + + if (level.getBlockEntity(hammerPos).getBlockState().getValue(HorizontalDirectionalBlock.FACING).getOpposite() == direction + && level.getBlockEntity(crankPos).getBlockState().getValue(HorizontalDirectionalBlock.FACING).getOpposite() == direction + ) + return true; + + return false; + + } + + public boolean isWronglyRotated() { + if (isComplete()) + return false; + + + BlockPos hammerPos1 = this.getBlockPos(); + BlockPos hammerPos2 = this.getBlockPos(); + BlockPos hammerPos3 = this.getBlockPos(); + crankPos = this.getBlockPos(); + if (direction == Direction.WEST) { + hammerPos1 = new BlockPos(this.getBlockPos().east(2).above(2)); + hammerPos2 = new BlockPos(this.getBlockPos().north(2).above(2)); + hammerPos3 = new BlockPos(this.getBlockPos().south(2).above(2)); + } + if (direction == Direction.EAST) { + hammerPos1 = new BlockPos(this.getBlockPos().west(2).above(2)); + hammerPos2 = new BlockPos(this.getBlockPos().north(2).above(2)); + hammerPos3 = new BlockPos(this.getBlockPos().south(2).above(2)); + } + if (direction == Direction.NORTH) { + hammerPos1 = new BlockPos(this.getBlockPos().south(2).above(2)); + hammerPos2 = new BlockPos(this.getBlockPos().west(2).above(2)); + hammerPos3 = new BlockPos(this.getBlockPos().east(2).above(2)); + } + if (direction == Direction.SOUTH) { + hammerPos1 = new BlockPos(this.getBlockPos().north(2).above(2)); + hammerPos2 = new BlockPos(this.getBlockPos().east(2).above(2)); + hammerPos3 = new BlockPos(this.getBlockPos().west(2).above(2)); + } + + + BlockState hammer1 = level.getBlockState(hammerPos1); + BlockState hammer2 = level.getBlockState(hammerPos2); + BlockState hammer3 = level.getBlockState(hammerPos3); + + + return hammer1.is(TFMGBlocks.PUMPJACK_HAMMER_HOLDER.get())|| + hammer2.is(TFMGBlocks.PUMPJACK_HAMMER_HOLDER.get())|| + hammer3.is(TFMGBlocks.PUMPJACK_HAMMER_HOLDER.get()); + + + } +} diff --git a/trash_bin/old/crank/PumpjackCrankBlock.java b/trash_bin/old/crank/PumpjackCrankBlock.java new file mode 100644 index 00000000..410b9fa1 --- /dev/null +++ b/trash_bin/old/crank/PumpjackCrankBlock.java @@ -0,0 +1,48 @@ +package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.crank; + + +import com.drmangotea.createindustry.registry.TFMGBlockEntities; +import com.drmangotea.createindustry.registry.TFMGShapes; +import com.simibubi.create.content.equipment.wrench.IWrenchable; +import com.simibubi.create.foundation.block.IBE; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.context.BlockPlaceContext; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.HorizontalDirectionalBlock; +import net.minecraft.world.level.block.RenderShape; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class PumpjackCrankBlock extends HorizontalDirectionalBlock implements IBE, IWrenchable { + public PumpjackCrankBlock(Properties p_54120_) { + super(p_54120_); + } + + public BlockState getStateForPlacement(BlockPlaceContext p_54779_) { + return this.defaultBlockState().setValue(HorizontalDirectionalBlock.FACING, p_54779_.getHorizontalDirection()); + } + @Override + public VoxelShape getShape(BlockState state, BlockGetter p_220053_2_, BlockPos p_220053_3_, + CollisionContext p_220053_4_) { + return TFMGShapes.PUMPJACK_CRANK; + } + @Override + public Class getBlockEntityClass() { + return PumpjackCrankBlockEntity.class; + } + @Override + public RenderShape getRenderShape(BlockState pState) { + return RenderShape.MODEL; + } + @Override + public BlockEntityType getBlockEntityType() { + return TFMGBlockEntities.PUMPJACK_CRANK.get(); + } + protected void createBlockStateDefinition(StateDefinition.Builder p_54794_) { + p_54794_.add(HorizontalDirectionalBlock.FACING); + } +} diff --git a/trash_bin/old/crank/PumpjackCrankBlockEntity.java b/trash_bin/old/crank/PumpjackCrankBlockEntity.java new file mode 100644 index 00000000..3fa3d13e --- /dev/null +++ b/trash_bin/old/crank/PumpjackCrankBlockEntity.java @@ -0,0 +1,122 @@ +package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.crank; + + +import com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.hammer_holder.PumpjackHammerHolderBlockEntity; +import com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.machine_input.MachineInputBlockEntity; +import com.simibubi.create.content.kinetics.base.KineticBlockEntity; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; + +public class PumpjackCrankBlockEntity extends KineticBlockEntity { + float targetSpeed; + + + public float angle=0; + public Direction direction; + public BlockPos hammerPos; + + + public PumpjackCrankBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { + super(type, pos, state); + angle=177; + if(direction==Direction.NORTH) + hammerPos =this.getBlockPos().north(2).above(); + if(direction==Direction.SOUTH) + hammerPos =this.getBlockPos().south(2).above(); + if(direction==Direction.WEST) + hammerPos =this.getBlockPos().west(2).above(); + if(direction==Direction.EAST) + hammerPos =this.getBlockPos().east(2).above(); + } + + + @Override + public void write(CompoundTag compound, boolean clientPacket) { + super.write(compound, clientPacket); + if (clientPacket) { + compound.putFloat("Angle", angle); + } + } + + @Override + protected void read(CompoundTag compound, boolean clientPacket) { + super.read(compound, clientPacket); + if (clientPacket) { + + angle = compound.getFloat("Angle"); + } + } + + @Override + public void tick() { + super.tick(); + + + direction = this.getBlockState().getValue(HorizontalDirectionalBlock.FACING); + + if (!level.isClientSide) + return; + + + if(direction==Direction.NORTH) + hammerPos =this.getBlockPos().north(2).above(); + if(direction==Direction.SOUTH) + hammerPos =this.getBlockPos().south(2).above(); + if(direction==Direction.WEST) + hammerPos =this.getBlockPos().west(2).above(); + if(direction==Direction.EAST) + hammerPos =this.getBlockPos().east(2).above(); + + + if(!isValid()) { + angle = 177; + return; + } + + if(level.getBlockEntity(this.getBlockPos().below())instanceof MachineInputBlockEntity) { + if(((MachineInputBlockEntity)level.getBlockEntity(this.getBlockPos().below())).powerLevel!=0) { + angle += 3; + }else angle=177; + }else + angle=177; + + + + targetSpeed= 10; + + + + angle%=360; + + } + + public boolean isValid(){ + if(hammerPos==null) + return false; + + if(!(level.getBlockEntity(hammerPos) instanceof PumpjackHammerHolderBlockEntity)) + return false; + if(!(direction==level.getBlockEntity(hammerPos).getBlockState().getValue(HorizontalDirectionalBlock.FACING))) + return false; + + return true; + } +/* + private void moveConnectionPos() { + connectionPos = new BlockPos(this.getBlockPos().getX()+0.5f,this.getBlockPos().getY()+0.25f,this.getBlockPos().getZ()+0.5f); + + float y=0.8f; + float x=0.8f; + // connectionPos. + + + + } + + */ +} diff --git a/trash_bin/old/crank/PumpjackCrankRenderer.java b/trash_bin/old/crank/PumpjackCrankRenderer.java new file mode 100644 index 00000000..24fe2e92 --- /dev/null +++ b/trash_bin/old/crank/PumpjackCrankRenderer.java @@ -0,0 +1,180 @@ +package com.drmangotea.createindustry.blocks.machines.oil_processing.pumpjack.old.crank; + + + +import com.drmangotea.createindustry.registry.TFMGPartialModels; +import com.jozufozu.flywheel.util.transform.TransformStack; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.simibubi.create.content.kinetics.base.KineticBlockEntity; +import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer; +import com.simibubi.create.foundation.render.CachedBufferer; +import com.simibubi.create.foundation.render.SuperByteBuffer; +import com.simibubi.create.foundation.utility.AngleHelper; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; +import net.minecraft.core.Direction; +import net.minecraft.world.level.block.state.BlockState; + +import static net.minecraft.world.level.block.HorizontalDirectionalBlock.FACING; + +public class PumpjackCrankRenderer extends KineticBlockEntityRenderer { + + public PumpjackCrankRenderer(BlockEntityRendererProvider.Context context) { + super(context); + } + + @Override + protected void renderSafe(KineticBlockEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, + int light, int overlay) { + renderBlock((PumpjackCrankBlockEntity) te, ms, light,buffer); + + + + + + // if (Backend.canUseInstancing(te.getLevel())) + // return; + + BlockState blockState = te.getBlockState(); + PumpjackCrankBlockEntity wte = (PumpjackCrankBlockEntity) te; + + + + float angle = wte.angle * partialTicks; + + VertexConsumer vb = buffer.getBuffer(RenderType.solid()); + + renderCrank(te, ms, light, blockState, angle, vb); + } + + private void renderCrank(KineticBlockEntity te, PoseStack ms, int light, BlockState blockState, float angle, + VertexConsumer vb) { + + + SuperByteBuffer hammer = CachedBufferer.block(blockState); + //kineticRotationTransform(hammer, te, getRotationAxisOf(te), AngleHelper.rad(angle), light); + hammer.renderInto(ms, vb); + } + private void renderBlock(PumpjackCrankBlockEntity be, PoseStack ms, int light, + MultiBufferSource buffer) { + + BlockState blockState = be.getBlockState(); + VertexConsumer vb = buffer.getBuffer(RenderType.solid()); + ms.pushPose(); + TransformStack msr = TransformStack.cast(ms); + msr.translate(1 / 2f, 0.5, 1 / 2f); + + float dialPivot = 5.75f / 16; + + SuperByteBuffer crank = CachedBufferer.partialFacing(TFMGPartialModels.PUMPJACK_CRANK, blockState,blockState.getValue(HorizontalDirectionalBlock.FACING)); + CachedBufferer.partialFacing(TFMGPartialModels.PUMPJACK_CRANK_BLOCK, blockState,blockState.getValue(HorizontalDirectionalBlock.FACING)) + .translate(-0.5, -0.5, -0.5) + .light(light) + .renderInto(ms,vb); + + + crank + .translate(-0.5, -0.5, -0.5) + .centre() + .translate(0, -.25, 0) + .rotate(be.getBlockState().getValue(HorizontalDirectionalBlock.FACING).getCounterClockWise(), -AngleHelper.rad(be.angle)) + .translate(0, .25, 0) + .unCentre() + + .light(light); + + crank.renderInto(ms,vb); + + + + if (be.direction == Direction.NORTH){ + + + if(be.isValid()) { + + CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState) + + .translate(-0.5, -0.75, -0.5) + .centre() + .rotate(Direction.WEST, -AngleHelper.rad(be.angle)) + .unCentre() + .translateY(0.4) + .centre() + .rotate(Direction.WEST, AngleHelper.rad(be.angle)) + .unCentre() + .light(light) + .translateY(0.4) + .renderInto(ms, vb); + } + } + if(be.direction == Direction.EAST) { + + if(be.isValid()) { + + CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState) + .rotateY(270) + .translate(-0.5, -0.75, -0.5) + .centre() + .rotate(Direction.WEST, -AngleHelper.rad(be.angle)) + .unCentre() + .translateY(0.4) + .centre() + .rotate(Direction.WEST, AngleHelper.rad(be.angle)) + .unCentre() + .light(light) + .translateY(0.4) + .renderInto(ms, vb); + } + } + if(be.direction == Direction.SOUTH) { + + + if(be.isValid()) { + + CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState) + .rotateY(180) + .translate(-0.5, -0.75, -0.5) + .centre() + .rotate(Direction.WEST, -AngleHelper.rad(be.angle)) + .unCentre() + .translateY(0.4) + .centre() + .rotate(Direction.WEST, AngleHelper.rad(be.angle)) + .unCentre() + .light(light) + .translateY(0.4) + .renderInto(ms, vb); + } + } + if(be.direction == Direction.WEST) { + + if(be.isValid()) { + + CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState) + .rotateY(90) + .translate(-0.5, -0.75, -0.5) + .centre() + .rotate(Direction.WEST, -AngleHelper.rad(be.angle)) + .unCentre() + .translateY(0.4) + .centre() + .rotate(Direction.WEST, AngleHelper.rad(be.angle)) + .unCentre() + .light(light) + .translateY(0.4) + .renderInto(ms, vb); + } + } + + + ms.popPose(); + } + + @Override + protected BlockState getRenderedBlockState(KineticBlockEntity te) { + return KineticBlockEntityRenderer.shaft(KineticBlockEntityRenderer.getRotationAxisOf(te)); + } + +}