pumpjack rendering fix,
flarestacks exhaust and casting jei interface
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.drmangotea.tfmg.base.creative_mode_tabs;
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -17,6 +16,6 @@ public class BuldingCreativeModeTab extends TFMGCreativeModeTab {
|
||||
|
||||
@Override
|
||||
public ItemStack makeIcon() {
|
||||
return TFMGBlocks.CONCRETE_TEST.asStack();
|
||||
return TFMGBlocks.CONCRETE.asStack();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class ConcreteFluid extends ForgeFlowingFluid {
|
||||
int random = randomSource.nextInt(7) ;
|
||||
|
||||
if(random==2) {
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE_TEST.get().defaultBlockState(), 3);
|
||||
level.setBlock(pos, TFMGBlocks.CONCRETE.get().defaultBlockState(), 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.drmangotea.tfmg.blocks.concrete.formwork;
|
||||
import com.drmangotea.tfmg.blocks.machines.TFMGMachineBlockEntity;
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.foundation.fluid.SmartFluidTank;
|
||||
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -64,7 +63,7 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
|
||||
timer--;
|
||||
|
||||
if(timer==0){
|
||||
level.setBlock(getBlockPos(), TFMGBlocks.CONCRETE_TEST.getDefaultState(),1);
|
||||
level.setBlock(getBlockPos(), TFMGBlocks.CONCRETE.getDefaultState(),3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +131,7 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
|
||||
controller = this.getBlockPos();
|
||||
|
||||
} else {
|
||||
|
||||
if(!(((AirIntakeBlockEntity) level.getBlockEntity(controller)).isController))
|
||||
isUsedByController = false;
|
||||
}
|
||||
@@ -139,17 +140,19 @@ public class AirIntakeBlockEntity extends KineticBlockEntity implements IWrencha
|
||||
// controller = this.getBlockPos();
|
||||
|
||||
if(controller!=null) {
|
||||
if(((AirIntakeBlockEntity)level.getBlockEntity(controller)).diameter==2) {
|
||||
int x = Math.abs(this.getBlockPos().getX() - controller.getX());
|
||||
int y = Math.abs(this.getBlockPos().getY() - controller.getY());
|
||||
int z = Math.abs(this.getBlockPos().getZ() - controller.getZ());
|
||||
if(level.getBlockEntity(controller)!=null)
|
||||
if(((AirIntakeBlockEntity)level.getBlockEntity(controller)).diameter==2) {
|
||||
int x = Math.abs(this.getBlockPos().getX() - controller.getX());
|
||||
int y = Math.abs(this.getBlockPos().getY() - controller.getY());
|
||||
int z = Math.abs(this.getBlockPos().getZ() - controller.getZ());
|
||||
|
||||
int distanceFromController = x + y + z;
|
||||
if (x > 1 || y > 1 || z > 1) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
int distanceFromController = x + y + z;
|
||||
if (x > 1 || y > 1 || z > 1) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(level.getBlockEntity(controller)!=null)
|
||||
if(((AirIntakeBlockEntity)level.getBlockEntity(controller)).diameter==1) {
|
||||
isUsedByController = false;
|
||||
controller = this.getBlockPos();
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.drmangotea.tfmg.blocks.machines.exhaust;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.RodBlock;
|
||||
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.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class ExhaustBlock extends RodBlock implements IBE<ExhaustTileEntity>, IWrenchable {
|
||||
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
|
||||
//Direction facing = this.defaultBlockState().getValue(FACING);
|
||||
public ExhaustBlock(Properties p_55926_) {
|
||||
super(p_55926_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(FACING, Direction.UP).setValue(WATERLOGGED, Boolean.valueOf(false)));
|
||||
}
|
||||
|
||||
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_153711_) {
|
||||
FluidState fluidstate = p_153711_.getLevel().getFluidState(p_153711_.getClickedPos());
|
||||
boolean flag = fluidstate.getType() == Fluids.WATER;
|
||||
return this.defaultBlockState().setValue(FACING, p_153711_.getClickedFace()).setValue(WATERLOGGED, Boolean.valueOf(flag));
|
||||
}
|
||||
|
||||
public BlockState updateShape(BlockState p_153739_, Direction p_153740_, BlockState p_153741_, LevelAccessor p_153742_, BlockPos p_153743_, BlockPos p_153744_) {
|
||||
if (p_153739_.getValue(WATERLOGGED)) {
|
||||
p_153742_.scheduleTick(p_153743_, Fluids.WATER, Fluids.WATER.getTickDelay(p_153742_));
|
||||
}
|
||||
|
||||
return super.updateShape(p_153739_, p_153740_, p_153741_, p_153742_, p_153743_, p_153744_);
|
||||
}
|
||||
public FluidState getFluidState(BlockState p_153759_) {
|
||||
return p_153759_.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(p_153759_);
|
||||
}
|
||||
|
||||
public static void makeParticles(Level level,BlockPos pos, int particleRotation) {
|
||||
Random random = Create.RANDOM;
|
||||
int shouldSpawnSmoke = random.nextInt(7);
|
||||
if(shouldSpawnSmoke==0) {
|
||||
|
||||
|
||||
if(particleRotation==0)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0D, 0.08D, 0.0D);
|
||||
if(particleRotation==1)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 0.0D, 0.08D, 0.0D);
|
||||
|
||||
if(particleRotation==2)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ(), 0.0D, 0.08D, 0.0D);
|
||||
if(particleRotation==3)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 1, 0.0D, 0.08D, 0.0D);
|
||||
if(particleRotation==4)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 1, pos.getY() + 0.5, pos.getZ() + 0.5, 0.0D, 0.08D, 0.0D);
|
||||
if(particleRotation==5)
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX(), pos.getY() + 0.5, pos.getZ() + 0.5, 0.0D, 0.08D, 0.0D);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_153746_) {
|
||||
p_153746_.add(FACING, WATERLOGGED);
|
||||
}
|
||||
@Override
|
||||
public Class<ExhaustTileEntity> getBlockEntityClass() {
|
||||
return ExhaustTileEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends ExhaustTileEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.EXHAUST.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
package com.drmangotea.tfmg.blocks.machines.exhaust;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGFluids;
|
||||
import com.simibubi.create.Create;
|
||||
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 java.util.Optional;
|
||||
|
||||
public class ExhaustTileEntity extends SmartBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
public FluidTank tankInventory;
|
||||
|
||||
public boolean spawnsSmoke=false;
|
||||
public int smokeTimer=0;
|
||||
|
||||
private static final int SYNC_RATE = 8;
|
||||
protected int syncCooldown;
|
||||
protected boolean queuedSync;
|
||||
|
||||
|
||||
|
||||
public ExhaustTileEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tankInventory = createInventory();
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
|
||||
/////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
Lang.translate("goggles.pumpjack_fluid_storage")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(500, this::onFluidStackChanged) {
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return stack.getFluid().isSame(TFMGFluids.CARBON_DIOXIDE.getSource());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {
|
||||
sendData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
Direction direction = this.getBlockState().getValue(ExhaustBlock.FACING);
|
||||
|
||||
if(smokeTimer!=0) {
|
||||
spawnsSmoke = true;
|
||||
smokeTimer--;
|
||||
}else spawnsSmoke = false;
|
||||
if (direction == Direction.UP)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 0);
|
||||
if (direction == Direction.DOWN)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 1);
|
||||
if (direction == Direction.NORTH)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 2);
|
||||
if (direction == Direction.SOUTH)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 3);
|
||||
if (direction == Direction.EAST)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 4);
|
||||
if (direction == Direction.WEST)
|
||||
if(spawnsSmoke)
|
||||
ExhaustBlock.makeParticles(level, this.getBlockPos(), 5);
|
||||
if(tankInventory.getFluidAmount()>0) {
|
||||
|
||||
smokeTimer = 100;
|
||||
spawnsSmoke = true;
|
||||
|
||||
int random = Create.RANDOM.nextInt(5);
|
||||
if(random==0)
|
||||
tankInventory.drain(20, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
|
||||
|
||||
}
|
||||
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<IFluidHandler> 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(500);
|
||||
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
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> 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<BlockEntityBehaviour> behaviours) {
|
||||
|
||||
}
|
||||
|
||||
public IFluidTank getTankInventory() {
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.drmangotea.tfmg.blocks.machines.flarestack;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
|
||||
import com.drmangotea.tfmg.registry.TFMGShapes;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.equipment.wrench.IWrenchable;
|
||||
import com.simibubi.create.foundation.block.IBE;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
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.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
||||
import net.minecraft.world.phys.shapes.CollisionContext;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
public class FlarestackBlock extends Block implements IBE<FlarestackBlockEntity>, IWrenchable {
|
||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||
//Direction facing = this.defaultBlockState().getValue(FACING);
|
||||
public FlarestackBlock(Properties p_55926_) {
|
||||
super(p_55926_);
|
||||
this.registerDefaultState(this.stateDefinition.any().setValue(LIT, Boolean.valueOf(false)));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState pState, BlockGetter worldIn, BlockPos pos, CollisionContext context) {
|
||||
|
||||
return TFMGShapes.FLARESTACK;
|
||||
}
|
||||
@Nullable
|
||||
public BlockState getStateForPlacement(BlockPlaceContext p_51240_) {
|
||||
|
||||
return this.defaultBlockState().setValue(LIT, Boolean.valueOf(false));
|
||||
}
|
||||
|
||||
public static void makeParticles(Level level,BlockPos pos) {
|
||||
Random random = Create.RANDOM;
|
||||
int shouldSpawnSmoke = random.nextInt(7);
|
||||
if(shouldSpawnSmoke==0) {
|
||||
|
||||
|
||||
|
||||
level.addParticle(ParticleTypes.CAMPFIRE_SIGNAL_SMOKE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 0.0D, 0.08D, 0.0D);
|
||||
level.addParticle(ParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, Create.RANDOM.nextDouble(0.28)-0.14D, 0.14D, Create.RANDOM.nextDouble(0.28)-0.14D);
|
||||
level.addParticle(ParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, Create.RANDOM.nextDouble(0.28)-0.14D, 0.14D, Create.RANDOM.nextDouble(0.28)-0.14D);
|
||||
level.addParticle(ParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, Create.RANDOM.nextDouble(0.28)-0.14D, 0.14D, Create.RANDOM.nextDouble(0.28)-0.14D);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_51305_) {
|
||||
p_51305_.add(LIT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FlarestackBlockEntity> getBlockEntityClass() {
|
||||
return FlarestackBlockEntity.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockEntityType<? extends FlarestackBlockEntity> getBlockEntityType() {
|
||||
return TFMGBlockEntities.FLARESTACK.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.drmangotea.tfmg.blocks.machines.flarestack;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.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 java.util.Optional;
|
||||
|
||||
public class FlarestackBlockEntity extends SmartBlockEntity implements IHaveGoggleInformation {
|
||||
|
||||
|
||||
|
||||
protected LazyOptional<IFluidHandler> fluidCapability;
|
||||
public FluidTank tankInventory;
|
||||
|
||||
public boolean spawnsSmoke=false;
|
||||
public int smokeTimer=0;
|
||||
|
||||
private static final int SYNC_RATE = 8;
|
||||
protected int syncCooldown;
|
||||
protected boolean queuedSync;
|
||||
|
||||
|
||||
|
||||
public FlarestackBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||
super(type, pos, state);
|
||||
tankInventory = createInventory();
|
||||
fluidCapability = LazyOptional.of(() -> tankInventory);
|
||||
|
||||
refreshCapability();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("removal")
|
||||
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
|
||||
|
||||
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
|
||||
|
||||
/////////
|
||||
LazyOptional<IFluidHandler> handler = this.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY);
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
if (!resolve.isPresent())
|
||||
return false;
|
||||
|
||||
IFluidHandler tank = resolve.get();
|
||||
if (tank.getTanks() == 0)
|
||||
return false;
|
||||
|
||||
Lang.translate("goggles.pumpjack_fluid_storage")
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip);
|
||||
|
||||
|
||||
boolean isEmpty = true;
|
||||
for (int i = 0; i < tank.getTanks(); i++) {
|
||||
FluidStack fluidStack = tank.getFluidInTank(i);
|
||||
if (fluidStack.isEmpty())
|
||||
continue;
|
||||
|
||||
Lang.fluidName(fluidStack)
|
||||
.style(ChatFormatting.GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
Lang.builder()
|
||||
.add(Lang.number(fluidStack.getAmount())
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.text(ChatFormatting.GRAY, " / ")
|
||||
.add(Lang.number(tank.getTankCapacity(i))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.DARK_GRAY))
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
isEmpty = false;
|
||||
}
|
||||
|
||||
if (tank.getTanks() > 1) {
|
||||
if (isEmpty)
|
||||
tooltip.remove(tooltip.size() - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!isEmpty)
|
||||
return true;
|
||||
|
||||
Lang.translate("gui.goggles.fluid_container.capacity")
|
||||
.add(Lang.number(tank.getTankCapacity(0))
|
||||
.add(mb)
|
||||
.style(ChatFormatting.GOLD))
|
||||
.style(ChatFormatting.DARK_GRAY)
|
||||
.forGoggles(tooltip, 1);
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected SmartFluidTank createInventory() {
|
||||
return new SmartFluidTank(1000, this::onFluidStackChanged) {
|
||||
@Override
|
||||
public boolean isFluidValid(FluidStack stack) {
|
||||
return
|
||||
stack.getFluid().isSame(TFMGFluids.BUTANE.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.PROPANE.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.LPG.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.KEROSENE.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.NAPHTHA.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.ETHYLENE.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.PROPYLENE.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.DIESEL.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.LUBRICATION_OIL.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.HEAVY_OIL.getSource())||
|
||||
stack.getFluid().isSame(TFMGFluids.GASOLINE.getSource());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected void onFluidStackChanged(FluidStack newFluidStack) {
|
||||
sendData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
|
||||
if(smokeTimer!=0) {
|
||||
spawnsSmoke = true;
|
||||
smokeTimer--;
|
||||
}else {
|
||||
spawnsSmoke = false;
|
||||
|
||||
}
|
||||
|
||||
if(spawnsSmoke) {
|
||||
level.setBlock(getBlockPos(), this.getBlockState()
|
||||
.setValue(FlarestackBlock.LIT, true), 2);
|
||||
FlarestackBlock.makeParticles(level, this.getBlockPos());
|
||||
|
||||
} else
|
||||
{
|
||||
level.setBlock(getBlockPos(), this.getBlockState()
|
||||
.setValue(FlarestackBlock.LIT, false), 2);
|
||||
}
|
||||
if(tankInventory.getFluidAmount()>0) {
|
||||
|
||||
smokeTimer = 100;
|
||||
spawnsSmoke = true;
|
||||
|
||||
|
||||
tankInventory.drain(30, IFluidHandler.FluidAction.EXECUTE);
|
||||
|
||||
|
||||
|
||||
}
|
||||
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<IFluidHandler> 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(500);
|
||||
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 <T> LazyOptional<T> getCapability(@Nonnull Capability<T> 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<BlockEntityBehaviour> behaviours) {
|
||||
|
||||
}
|
||||
|
||||
public IFluidTank getTankInventory() {
|
||||
return tankInventory;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
@@ -148,5 +149,9 @@ public class CastingSpoutBlockEntity extends TFMGMachineBlockEntity {
|
||||
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(this.getBlockPos()).inflate(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ 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) {
|
||||
@@ -33,8 +35,8 @@ public class PumpjackCrankRenderer extends KineticBlockEntityRenderer {
|
||||
|
||||
|
||||
|
||||
if (Backend.canUseInstancing(te.getLevel()))
|
||||
return;
|
||||
// if (Backend.canUseInstancing(te.getLevel()))
|
||||
// return;
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
PumpjackCrankBlockEntity wte = (PumpjackCrankBlockEntity) te;
|
||||
@@ -59,10 +61,10 @@ public class PumpjackCrankRenderer extends KineticBlockEntityRenderer {
|
||||
//kineticRotationTransform(hammer, te, getRotationAxisOf(te), AngleHelper.rad(angle), light);
|
||||
hammer.renderInto(ms, vb);
|
||||
}
|
||||
private void renderBlock(PumpjackCrankBlockEntity te, PoseStack ms, int light,
|
||||
private void renderBlock(PumpjackCrankBlockEntity be, PoseStack ms, int light,
|
||||
MultiBufferSource buffer) {
|
||||
|
||||
BlockState blockState = te.getBlockState();
|
||||
BlockState blockState = be.getBlockState();
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
ms.pushPose();
|
||||
TransformStack msr = TransformStack.cast(ms);
|
||||
@@ -70,95 +72,111 @@ public class PumpjackCrankRenderer extends KineticBlockEntityRenderer {
|
||||
|
||||
float dialPivot = 5.75f / 16;
|
||||
|
||||
SuperByteBuffer crank = CachedBufferer.partialFacing(TFMGPartialModels.PUMPJACK_CRANK, blockState,blockState.getValue(FACING));
|
||||
|
||||
if (te.direction == Direction.NORTH){
|
||||
|
||||
|
||||
crank
|
||||
.translate(-0.5, -0.75, -0.5)
|
||||
.centre()
|
||||
.rotate(be.direction.getCounterClockWise(), -AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
|
||||
.light(light)
|
||||
.translateY(0.5);
|
||||
|
||||
crank.renderInto(ms,vb);
|
||||
|
||||
|
||||
|
||||
if (be.direction == Direction.NORTH){
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CRANK_BLOCK, blockState)
|
||||
// .rotateY(d.toYRot())
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
if(te.isValid()) {
|
||||
if(be.isValid()) {
|
||||
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState)
|
||||
|
||||
.translate(-0.5, -0.75, -0.5)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.translateY(0.4)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.translateY(0.4)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
}
|
||||
if(te.direction == Direction.EAST) {
|
||||
if(be.direction == Direction.EAST) {
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CRANK_BLOCK, blockState)
|
||||
.rotateY(270)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
if(te.isValid()) {
|
||||
if(be.isValid()) {
|
||||
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState)
|
||||
.rotateY(270)
|
||||
.translate(-0.5, -0.75, -0.5)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.translateY(0.4)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.translateY(0.4)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
}
|
||||
if(te.direction == Direction.SOUTH) {
|
||||
if(be.direction == Direction.SOUTH) {
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CRANK_BLOCK, blockState)
|
||||
.rotateY(180)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
|
||||
if(te.isValid()) {
|
||||
if(be.isValid()) {
|
||||
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState)
|
||||
.rotateY(180)
|
||||
.translate(-0.5, -0.75, -0.5)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.translateY(0.4)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.translateY(0.4)
|
||||
.renderInto(ms, vb);
|
||||
}
|
||||
}
|
||||
if(te.direction == Direction.WEST) {
|
||||
if(be.direction == Direction.WEST) {
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CRANK_BLOCK, blockState)
|
||||
.rotateY(90)
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.renderInto(ms, vb);
|
||||
if(te.isValid()) {
|
||||
if(be.isValid()) {
|
||||
|
||||
CachedBufferer.partial(TFMGPartialModels.PUMPJACK_CONNECTOR, blockState)
|
||||
.rotateY(90)
|
||||
.translate(-0.5, -0.75, -0.5)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, -AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.translateY(0.4)
|
||||
.centre()
|
||||
.rotate(Direction.WEST, AngleHelper.rad(te.angle))
|
||||
.rotate(Direction.WEST, AngleHelper.rad(be.angle))
|
||||
.unCentre()
|
||||
.light(light)
|
||||
.translateY(0.4)
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -36,6 +37,11 @@ public class PumpjackHammerHolderBlockEntity extends KineticBlockEntity implemen
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AABB createRenderBoundingBox() {
|
||||
return new AABB(this.getBlockPos()).inflate(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
|
||||
|
||||
|
||||
@@ -12,8 +12,11 @@ import net.minecraft.client.renderer.LevelRenderer;
|
||||
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 PumpjackHammerHolderRenderer extends KineticBlockEntityRenderer<PumpjackHammerHolderBlockEntity> {
|
||||
|
||||
protected float lastAngle = Float.NaN;
|
||||
@@ -38,8 +41,8 @@ public class PumpjackHammerHolderRenderer extends KineticBlockEntityRenderer<Pum
|
||||
float speed = be.visualSpeed.getValue(partialTicks) * 3 / 10f;
|
||||
float angle = be.angle.getValue() + speed * partialTicks;
|
||||
|
||||
if (Math.abs(angle - lastAngle) < 0.001)
|
||||
return;
|
||||
//if (Math.abs(angle - lastAngle) < 0.001)
|
||||
// return;
|
||||
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
|
||||
renderHammer(be, ms, light, blockState, angle, vb);
|
||||
|
||||
@@ -52,8 +55,19 @@ public class PumpjackHammerHolderRenderer extends KineticBlockEntityRenderer<Pum
|
||||
|
||||
SuperByteBuffer hammer =
|
||||
CachedBufferer.partialFacing(TFMGPartialModels.PUMPJACK_HAMMER, be.getBlockState(), be.direction);
|
||||
int lightInFront = LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos().relative(be.direction));
|
||||
kineticRotationTransform(hammer, be, be.direction2.getAxis(), angle, lightInFront).renderInto(ms, vb);
|
||||
int lightInFront = LevelRenderer.getLightColor(be.getLevel(), be.getBlockPos());
|
||||
|
||||
Direction.Axis axis = blockState.getValue(FACING).getAxis();
|
||||
|
||||
hammer.centre();
|
||||
|
||||
hammer.rotate(be.direction.getClockWise(), (float) Math.toRadians(angle));
|
||||
|
||||
hammer.unCentre();
|
||||
|
||||
|
||||
hammer.renderInto(ms, vb);
|
||||
//kineticRotationTransform(hammer, be, be.direction2.getAxis(), angle, lightInFront).renderInto(ms, vb);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import net.minecraft.world.level.block.state.BlockState;
|
||||
@Override
|
||||
protected SuperByteBuffer getRotatedModel(MachineInputBlockEntity be, BlockState state) {
|
||||
return CachedBufferer.partialFacing(AllPartialModels.SHAFT_HALF, state, state
|
||||
.getValue(MachineInputBlock.FACING)
|
||||
.getOpposite());
|
||||
.getValue(MachineInputBlock.FACING));
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,11 @@ public class CastingRecipe extends ProcessingRecipe<RecipeWrapper> {
|
||||
}
|
||||
|
||||
|
||||
public static int getOutputCount(CastingRecipe recipe){
|
||||
return recipe.results.toArray().length;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean matches(RecipeWrapper pContainer, Level pLevel) {
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.drmangotea.tfmg.recipes.jei;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.recipes.casting.CastingRecipe;
|
||||
import com.drmangotea.tfmg.recipes.jei.machines.CastingSetup;
|
||||
import com.drmangotea.tfmg.registry.TFMGItems;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.simibubi.create.compat.jei.category.CreateRecipeCategory;
|
||||
import com.simibubi.create.foundation.gui.AllGuiTextures;
|
||||
import mezz.jei.api.forge.ForgeTypes;
|
||||
import mezz.jei.api.gui.builder.IRecipeLayoutBuilder;
|
||||
import mezz.jei.api.gui.ingredient.IRecipeSlotsView;
|
||||
import mezz.jei.api.recipe.IFocusGroup;
|
||||
import mezz.jei.api.recipe.RecipeIngredientRole;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public class CastingCategory extends CreateRecipeCategory<CastingRecipe> {
|
||||
|
||||
private final CastingSetup castingSetup = new CastingSetup();
|
||||
|
||||
public CastingCategory(Info<CastingRecipe> info) {
|
||||
super(info);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void setRecipe(IRecipeLayoutBuilder builder, CastingRecipe recipe, IFocusGroup focuses) {
|
||||
|
||||
|
||||
int y = 77;
|
||||
for(int i = 0;i<CastingRecipe.getOutputCount(recipe);i++) {
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.OUTPUT, 130, y)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addItemStack(recipe.getResultItem());
|
||||
|
||||
|
||||
ItemStack mold= TFMGItems.INGOT_MOLD.asStack();
|
||||
if(i==0)
|
||||
mold = TFMGItems.INGOT_MOLD.asStack();
|
||||
if(i==1)
|
||||
mold = TFMGItems.BLOCK_MOLD.asStack();
|
||||
|
||||
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.OUTPUT, 111, y)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addItemStack(mold);
|
||||
y -= 24;
|
||||
|
||||
}
|
||||
|
||||
//fluid
|
||||
|
||||
builder
|
||||
.addSlot(RecipeIngredientRole.INPUT, 2, 33)
|
||||
.setBackground(getRenderedSlot(), -1, -1)
|
||||
.addIngredients(ForgeTypes.FLUID_STACK, withImprovedVisibility(recipe.getInputFluid().getMatchingFluidStacks()))
|
||||
.addTooltipCallback(addFluidTooltip(recipe.getInputFluid().getRequiredAmount()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(CastingRecipe recipe, IRecipeSlotsView iRecipeSlotsView, PoseStack matrixStack, double mouseX, double mouseY) {
|
||||
castingSetup
|
||||
.draw(matrixStack, 65, 50);
|
||||
|
||||
|
||||
|
||||
AllGuiTextures.JEI_ARROW.render(matrixStack, 20, 36);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.drmangotea.tfmg.recipes.jei;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.recipes.casting.CastingRecipe;
|
||||
import com.drmangotea.tfmg.recipes.coking.CokingRecipe;
|
||||
import com.drmangotea.tfmg.recipes.distillation.DistillationRecipe;
|
||||
import com.drmangotea.tfmg.recipes.distillation.AdvancedDistillationRecipe;
|
||||
@@ -86,7 +87,16 @@ public class TFMGJei implements IModPlugin {
|
||||
.catalyst(TFMGBlocks.FIREPROOF_BRICKS::get)
|
||||
.itemIcon(TFMGBlocks.BLAST_FURNACE_OUTPUT.get())
|
||||
.emptyBackground(177, 150)
|
||||
.build("industrial_blasting", IndustrialBlastingCategory::new)
|
||||
.build("industrial_blasting", IndustrialBlastingCategory::new),
|
||||
|
||||
|
||||
casting = builder(CastingRecipe.class)
|
||||
.addTypedRecipes(TFMGRecipeTypes.CASTING)
|
||||
.catalyst(TFMGBlocks.CASTING_SPOUT::get)
|
||||
.catalyst(TFMGBlocks.CASTING_BASIN::get)
|
||||
.itemIcon(TFMGBlocks.STEEL_BLOCK.get())
|
||||
.emptyBackground(177, 140)
|
||||
.build("casting", CastingCategory::new)
|
||||
|
||||
|
||||
;
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.drmangotea.tfmg.recipes.jei.machines;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPartialModels;
|
||||
import com.jozufozu.flywheel.core.PartialModel;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllPartialModels;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.compat.jei.category.animations.AnimatedKinetics;
|
||||
import com.simibubi.create.content.processing.burner.BlazeBurnerBlock;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShiftEntry;
|
||||
import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
public class CastingSetup extends AnimatedKinetics {
|
||||
|
||||
|
||||
|
||||
public CastingSetup() {}
|
||||
|
||||
@Override
|
||||
public void draw(PoseStack matrixStack, int xOffset, int yOffset) {
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(xOffset, yOffset, 200);
|
||||
matrixStack.mulPose(Vector3f.XP.rotationDegrees(-15.5f));
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(22.5f));
|
||||
int scale = 23;
|
||||
|
||||
|
||||
|
||||
blockElement(TFMGBlocks.CASTING_SPOUT.getDefaultState())
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
blockElement(TFMGBlocks.CASTING_BASIN.getDefaultState())
|
||||
.atLocal(0,2,0)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
blockElement(TFMGPartialModels.CASTING_SPOUT_BOTTOM)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
blockElement(TFMGPartialModels.CASTING_SPOUT_CONNECTOR)
|
||||
.scale(scale)
|
||||
.render(matrixStack);
|
||||
|
||||
matrixStack.scale(scale, -scale, scale);
|
||||
matrixStack.translate(0, -1.8, 0);
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -19,6 +19,8 @@ import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBackTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBackTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.exhaust.ExhaustTileEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.flarestack.FlarestackBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.BlastFurnaceOutputBlockEntity;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.BlastFurnaceRenderer;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.blast_furnace.MoltenMetalBlockEntity;
|
||||
@@ -165,7 +167,7 @@ public class TFMGBlockEntities {
|
||||
|
||||
public static final BlockEntityEntry<PumpjackCrankBlockEntity> PUMPJACK_CRANK = REGISTRATE
|
||||
.blockEntity("pumpjack_crank", PumpjackCrankBlockEntity::new)
|
||||
.instance(() -> PumpjackCrankInstance::new, true)
|
||||
//.instance(() -> PumpjackCrankInstance::new, true)
|
||||
.validBlocks(TFMGBlocks.PUMPJACK_CRANK)
|
||||
.renderer(() -> PumpjackCrankRenderer::new)
|
||||
.register();
|
||||
@@ -258,6 +260,16 @@ public class TFMGBlockEntities {
|
||||
.validBlocks(TFMGBlocks.TURBINE_ENGINE_BACK)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<ExhaustTileEntity> EXHAUST = REGISTRATE
|
||||
.blockEntity("exhaust", ExhaustTileEntity::new)
|
||||
.validBlocks(TFMGBlocks.EXHAUST)
|
||||
.register();
|
||||
|
||||
public static final BlockEntityEntry<FlarestackBlockEntity> FLARESTACK = REGISTRATE
|
||||
.blockEntity("flarestack", FlarestackBlockEntity::new)
|
||||
.validBlocks(TFMGBlocks.FLARESTACK)
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBackBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.lpg.LPGEngineBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBackBlock;
|
||||
import com.drmangotea.tfmg.blocks.engines.small.turbine.TurbineEngineBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.exhaust.ExhaustBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.flarestack.FlarestackBlock;
|
||||
import com.drmangotea.tfmg.items.gadgets.explosives.napalm.NapalmBombBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlock;
|
||||
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout.CastingSpoutBlock;
|
||||
@@ -47,7 +49,6 @@ import com.drmangotea.tfmg.blocks.tanks.SteelTankBlock;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelTankGenerator;
|
||||
import com.drmangotea.tfmg.blocks.tanks.SteelTankItem;
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllSpriteShifts;
|
||||
import com.simibubi.create.AllTags;
|
||||
import com.simibubi.create.content.decoration.encasing.CasingBlock;
|
||||
@@ -151,6 +152,28 @@ public class TFMGBlocks {
|
||||
.build()
|
||||
.register();
|
||||
|
||||
|
||||
public static final BlockEntry<ExhaustBlock> EXHAUST =
|
||||
REGISTRATE.block("exhaust", ExhaustBlock::new)
|
||||
.initialProperties(SharedProperties::copperMetal)
|
||||
.blockstate((c, p) -> p.horizontalFaceBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
public static final BlockEntry<FlarestackBlock> FLARESTACK =
|
||||
REGISTRATE.block("flarestack", FlarestackBlock::new)
|
||||
.initialProperties(SharedProperties::copperMetal)
|
||||
.properties(p -> p.color(MaterialColor.TERRACOTTA_CYAN)
|
||||
.lightLevel(s -> s.getValue(FlarestackBlock.LIT) ? 15 : 0)
|
||||
.noOcclusion())
|
||||
.item()
|
||||
.transform(customItemModel())
|
||||
.register();
|
||||
|
||||
|
||||
|
||||
public static final BlockEntry<SurfaceScannerBlock> SURFACE_SCANNER =
|
||||
REGISTRATE.block("surface_scanner", SurfaceScannerBlock::new)
|
||||
// .properties(p -> p.color(MaterialColor.COLOR_GRAY))
|
||||
@@ -680,7 +703,7 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
|
||||
// .register();
|
||||
|
||||
|
||||
public static final BlockEntry<Block> CONCRETE_TEST = generateConcrete();
|
||||
public static final BlockEntry<Block> CONCRETE = generateConcrete();
|
||||
|
||||
|
||||
public static BlockEntry<Block> generateConcrete(){
|
||||
@@ -750,7 +773,7 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
|
||||
.lang(upperCaseColor + " Concrete Wall")
|
||||
.register();
|
||||
|
||||
REGISTRATE.block(color + "_concrete_stairs", p -> new StairBlock(()-> TFMGBlocks.CONCRETE_TEST.get().defaultBlockState(),p))
|
||||
REGISTRATE.block(color + "_concrete_stairs", p -> new StairBlock(()-> TFMGBlocks.CONCRETE.get().defaultBlockState(),p))
|
||||
.initialProperties(() -> Blocks.STONE)
|
||||
.properties(p -> p.color(MaterialColor.COLOR_LIGHT_GRAY))
|
||||
.properties(p -> p.requiresCorrectToolForDrops())
|
||||
|
||||
@@ -36,6 +36,7 @@ public class TFMGPartialModels {
|
||||
PUMPJACK_FRONT_ROPE = block("pumpjack/pumpjack_front_rope"),
|
||||
PUMPJACK_CONNECTOR = block("pumpjack/pumpjack_connector"),
|
||||
PUMPJACK_CRANK_BLOCK = block("pumpjack/pumpjack_crank_block"),
|
||||
PUMPJACK_CRANK = block("pumpjack/pumpjack_crank"),
|
||||
TOWER_GAUGE = block("distillation_tower/gauge"),
|
||||
STEEL_FLUID_PIPE_CASING = block("steel_pipe/casing"),
|
||||
SURFACE_SCANNER_DIAL = block("surface_scanner/dial"),
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.drmangotea.tfmg.worldgen;
|
||||
|
||||
|
||||
import com.drmangotea.tfmg.registry.TFMGBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPaletteBlocks;
|
||||
import com.drmangotea.tfmg.registry.TFMGPaletteStoneTypes;
|
||||
import com.simibubi.create.content.decoration.palettes.AllPaletteStoneTypes;
|
||||
import com.simibubi.create.infrastructure.worldgen.LayerPattern;
|
||||
@@ -35,7 +34,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.SMOOTH_BASALT)
|
||||
@@ -53,7 +52,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(1)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 3))
|
||||
.layer(l -> l.weight(1)
|
||||
.block(Blocks.TUFF)
|
||||
@@ -73,7 +72,7 @@ public class TFMGLayeredPatterns {
|
||||
.layer(l -> l.weight(2)
|
||||
.passiveBlock())
|
||||
.layer(l -> l.weight(2)
|
||||
.block(TFMGBlocks.CONCRETE_TEST.get())
|
||||
.block(TFMGBlocks.CONCRETE.get())
|
||||
.size(1, 2))
|
||||
.layer(l -> l.weight(3)
|
||||
.block(AllPaletteStoneTypes.SCORCHIA.getBaseBlock())
|
||||
|
||||
Reference in New Issue
Block a user