This commit is contained in:
DrMangoTea
2023-10-10 14:08:55 +02:00
parent 549b09f635
commit 1dbe3a7868
38 changed files with 1224 additions and 50 deletions

View File

@@ -1,7 +1,9 @@
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;
@@ -22,6 +24,8 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
public boolean south = true;
public boolean bottom = true;
public int timer = -1;
protected FluidTank tankInventory;
@@ -49,6 +53,26 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
@Override
public void tick() {
if(tankInventory.getFluidAmount()==tankInventory.getCapacity()){
if(timer==-1) {
timer = 180 * 24;
}else {
timer--;
if(timer==0){
level.setBlock(getBlockPos(), TFMGBlocks.CONCRETE.getDefaultState(),1);
}
}
} else
timer = -1;
super.tick();
fluidLevel.chase(tankInventory.getFluidAmount(), 0.3f, LerpedFloat.Chaser.EXP);
fluidLevel.tickChaser();
@@ -171,6 +195,8 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
timer = compound.getInt("Timer");
bottom = compound.getBoolean("Bottom");
east = compound.getBoolean("East");
@@ -188,6 +214,8 @@ public class FormWorkBlockEntity extends TFMGMachineBlockEntity {
super.write(compound, clientPacket);
compound.putInt("Timer", timer);
compound.putBoolean("Bottom", bottom);
compound.putBoolean("East", east);

View File

@@ -491,6 +491,7 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
super.read(compound, clientPacket);
inputInventory.deserializeNBT(compound.getCompound("InputItems"));
fuelInventory.deserializeNBT(compound.getCompound("Fuel"));
timer = compound.getInt("Timer");
}
@Override
@@ -499,6 +500,7 @@ public class BlastFurnaceOutputBlockEntity extends TFMGMachineBlockEntity implem
compound.put("InputItems", inputInventory.serializeNBT());
compound.put("Fuel", fuelInventory.serializeNBT());
compound.putInt("Timer", timer);
}
@Override

View File

@@ -0,0 +1,83 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin;
import com.drmangotea.tfmg.blocks.machines.metal_processing.coke_oven.CokeOvenBlock;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.drmangotea.tfmg.registry.TFMGItems;
import com.simibubi.create.content.equipment.wrench.IWrenchable;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
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.EnumProperty;
import net.minecraft.world.phys.BlockHitResult;
public class CastingBasinBlock extends Block implements IBE<CastingBasinBlockEntity>, IWrenchable {
public static final EnumProperty<CastingBasinBlockEntity.MoldType> MOLD_TYPE = EnumProperty.create("mold_type", CastingBasinBlockEntity.MoldType.class);
public CastingBasinBlock(Properties p_49795_) {
super(p_49795_);
registerDefaultState(defaultBlockState().setValue(MOLD_TYPE, CastingBasinBlockEntity.MoldType.NONE));
}
@Override
public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand interactionHand, BlockHitResult blockHitResult) {
CastingBasinBlockEntity be;
if(level.getBlockEntity(pos) instanceof CastingBasinBlockEntity) {
be = (CastingBasinBlockEntity) level.getBlockEntity(pos);
}else return InteractionResult.PASS;
if(be ==null)
return InteractionResult.PASS;
///
if(!be.tank1.isEmpty())
return InteractionResult.PASS;
if(player.getItemInHand(interactionHand).is(Items.AIR)&&!(((CastingBasinBlockEntity) level.getBlockEntity(pos)).moldInventory.isEmpty())){
player.setItemInHand(interactionHand,new ItemStack(be.moldInventory.getStackInSlot(0).getItem(),1));
((CastingBasinBlockEntity) level.getBlockEntity(pos)).moldInventory.getStackInSlot(0).shrink(1);
return InteractionResult.SUCCESS;
}
///
if(player.getItemInHand(interactionHand).getItem() instanceof CastingMoldItem&&((CastingBasinBlockEntity) level.getBlockEntity(pos)).moldInventory.isEmpty()){
((CastingBasinBlockEntity) level.getBlockEntity(pos)).moldInventory.setStackInSlot(0, new ItemStack(player.getItemInHand(interactionHand).getItem(),1));
player.getItemInHand(interactionHand).shrink(1);
return InteractionResult.SUCCESS;
}
return InteractionResult.PASS;
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
pBuilder.add(MOLD_TYPE);
super.createBlockStateDefinition(pBuilder);
}
@Override
public Class<CastingBasinBlockEntity> getBlockEntityClass() {
return CastingBasinBlockEntity.class;
}
@Override
public BlockEntityType<? extends CastingBasinBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.CASTING_BASIN.get();
}
}

View File

@@ -0,0 +1,317 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin;
import com.drmangotea.tfmg.CreateTFMG;
import com.drmangotea.tfmg.blocks.machines.TFMGMachineBlockEntity;
import com.drmangotea.tfmg.recipes.casting.CastingRecipe;
import com.simibubi.create.content.equipment.goggles.IHaveGoggleInformation;
import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour;
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.recipe.RecipeFinder;
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.util.StringRepresentable;
import net.minecraft.world.Container;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Recipe;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluids;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Optional;
import static com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlock.MOLD_TYPE;
public class CastingBasinBlockEntity extends TFMGMachineBlockEntity implements IHaveGoggleInformation {
public MoldType type;
private CastingRecipe recipe;
public int timer = -1;
public SmartInventory outputInventory;
public SmartInventory moldInventory;
public LazyOptional<IItemHandlerModifiable> itemCapability;
private static final Object CastingRecipesKey = new Object();
public CastingBasinBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
outputInventory = new SmartInventory(1, this)
.withMaxStackSize(64);
moldInventory = new SmartInventory(1, this)
.withMaxStackSize(1);
itemCapability = LazyOptional.of(() -> new CombinedInvWrapper(outputInventory,moldInventory));
tank1.getPrimaryHandler().setCapacity(4000);
tank2.forbidExtraction();
tank2.forbidInsertion();
moldInventory.forbidExtraction();
moldInventory.forbidInsertion();
outputInventory.forbidInsertion();
}
public void tick(){
super.tick();
type = getBlockState().getValue(MOLD_TYPE);
findRecipe();
//
setMold();
if(tank1.isEmpty()){
setCapacity();
}
if(type==MoldType.NONE)
return;
if(recipe==null)
return;
if(outputInventory.getStackInSlot(0).getCount()!=0)
return;
if(tank1.getPrimaryHandler().getCapacity()==tank1.getPrimaryHandler().getFluidAmount()){
if(timer ==-1) {
//if(type==MoldType.BLOCK)
timer = recipe.getProcessingDuration();
//if(type==MoldType.INGOT)
// timer = recipe.getProcessingDuration()/9;
}
if (timer >0)
timer--;
if(timer == 0){
if(type==MoldType.INGOT)
outputInventory.setStackInSlot(0,recipe.getIngotResult());
if(type==MoldType.BLOCK)
outputInventory.setStackInSlot(0,recipe.getBlockResult());
tank1.getPrimaryHandler().setFluid(new FluidStack(Fluids.EMPTY,0));
timer = -1;
}
}
}
public void setMold(){
if(moldInventory.isEmpty())
return;
MoldType moldType = ((CastingMoldItem)moldInventory.getStackInSlot(0).getItem()).getType();
MoldType oldMoldType = this.getBlockState().getValue(MOLD_TYPE);
if(moldType==oldMoldType)
return;
level.setBlock(getBlockPos(),this.getBlockState().setValue(MOLD_TYPE,moldType),2);
type = getBlockState().getValue(MOLD_TYPE);
}
public void findRecipe(){
CombinedTankWrapper tankIn = new CombinedTankWrapper(tank1.getPrimaryHandler(),tank2.getPrimaryHandler());
if (recipe == null || !recipe.matches(tankIn, level)) {
CastingRecipe recipe = getMatchingRecipes();
if (recipe!=null) {
this.recipe = recipe;
sendData();
}
}
}
public void setCapacity(){
if(type == null){
if(tank1.getPrimaryHandler().getCapacity()<4000)
tank1.getPrimaryHandler().setCapacity(4000);
}else {
if(tank1.getPrimaryHandler().getCapacity()!=type.getRequiredFluidAmount())
tank1.getPrimaryHandler().setCapacity(type.getRequiredFluidAmount());
}
}
protected CastingRecipe getMatchingRecipes() {
List<Recipe<?>> list = RecipeFinder.get(getRecipeCacheKey(), level, this::matchStaticFilters);
for(int i = 0; i < list.toArray().length;i++){
CastingRecipe recipe = (CastingRecipe) list.get(i);
for(int y = 0; y < recipe.getFluidIngredients().get(0).getMatchingFluidStacks().toArray().length;y++)
if(tank1.getPrimaryHandler().getFluid().getFluid()==recipe.getFluidIngredients().get(0).getMatchingFluidStacks().get(y).getFluid())
if(tank1.getPrimaryHandler().getFluidAmount()>=recipe.getFluidIngredients().get(0).getRequiredAmount())
return recipe;
}
return null;
}
@Override
@SuppressWarnings("removal")
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
//--Fluid Info--//
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;
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
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.DARK_GREEN))
.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.DARK_GREEN))
.style(ChatFormatting.DARK_GRAY)
.forGoggles(tooltip, 1);
return true;
}
protected <C extends Container> boolean matchStaticFilters(Recipe<C> r) {
return r instanceof CastingRecipe;
}
@Override
protected void read(CompoundTag compound, boolean clientPacket) {
super.read(compound, clientPacket);
outputInventory.deserializeNBT(compound.getCompound("OutputItems"));
moldInventory.deserializeNBT(compound.getCompound("CurrentMold"));
timer = compound.getInt("Timer");
}
@Override
public void write(CompoundTag compound, boolean clientPacket) {
super.write(compound, clientPacket);
compound.put("OutputItems", outputInventory.serializeNBT());
compound.put("CurrentMold", moldInventory.serializeNBT());
compound.putInt("Timer", timer);
}
@Override
public void invalidate() {
super.invalidate();
itemCapability.invalidate();
}
@Nonnull
@Override
@SuppressWarnings("removal")
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, Direction side) {
if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return itemCapability.cast();
if (cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
return fluidCapability.cast();
return super.getCapability(cap, side);
}
protected Object getRecipeCacheKey() {
return CastingRecipesKey;
}
@Override
public void addBehaviours(List<BlockEntityBehaviour> behaviours) {
super.addBehaviours(behaviours);
}
public enum MoldType implements StringRepresentable {
INGOT("ingot",112),
BLOCK("block",1000),
NONE("none", 4000);
private final String name;
private final int fluidAmountNeeded;
MoldType(String name, int amountNeeded) {
this.name = name;
this.fluidAmountNeeded = amountNeeded;
}
public int getRequiredFluidAmount(){return this.fluidAmountNeeded;}
@Override
public String getSerializedName() {
return this.name;
}
}
}

View File

@@ -0,0 +1,4 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin;
public class CastingBasinRenderer {
}

View File

@@ -0,0 +1,19 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin;
import net.minecraft.world.item.Item;
public class CastingMoldItem extends Item {
private final CastingBasinBlockEntity.MoldType type;
public CastingMoldItem(Properties p_41383_, CastingBasinBlockEntity.MoldType type) {
super(p_41383_);
this.type = type;
}
public CastingBasinBlockEntity.MoldType getType(){
return this.type;
}
}

View File

@@ -0,0 +1,23 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout;
import com.drmangotea.tfmg.registry.TFMGBlockEntities;
import com.simibubi.create.foundation.block.IBE;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntityType;
public class CastingSpoutBlock extends Block implements IBE<CastingSpoutBlockEntity> {
public CastingSpoutBlock(Properties p_49795_) {
super(p_49795_);
}
@Override
public Class<CastingSpoutBlockEntity> getBlockEntityClass() {
return CastingSpoutBlockEntity.class;
}
@Override
public BlockEntityType<? extends CastingSpoutBlockEntity> getBlockEntityType() {
return TFMGBlockEntities.CASTING_SPOUT.get();
}
}

View File

@@ -0,0 +1,152 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout;
import com.drmangotea.tfmg.CreateTFMG;
import com.drmangotea.tfmg.blocks.machines.TFMGMachineBlockEntity;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlockEntity;
import com.simibubi.create.content.fluids.tank.FluidTankBlockEntity;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.LangBuilder;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.ChatFormatting;
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.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import java.util.List;
import java.util.Optional;
public class CastingSpoutBlockEntity extends TFMGMachineBlockEntity {
CastingBasinBlockEntity basin;
public boolean isRunning=false;
public LerpedFloat movement = LerpedFloat.linear();
public CastingSpoutBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
super(type, pos, state);
tank2.forbidInsertion();
tank2.forbidExtraction();
tank1.forbidExtraction();
}
public void tick(){
super.tick();
if(isRunning) {
movement.chase(0.03, 0.1f, LerpedFloat.Chaser.EXP);
}else
movement.chase(0, 0.1f, LerpedFloat.Chaser.EXP);
movement.tickChaser();
if(tank1.isEmpty())
{
isRunning = false;
return;
}
if(level.getBlockEntity(getBlockPos().below(2)) instanceof CastingBasinBlockEntity){
basin = (CastingBasinBlockEntity) level.getBlockEntity(getBlockPos().below(2));
}else {
isRunning = false;
return;
}
if(basin.moldInventory.isEmpty())
{
isRunning = false;
return;
}
if(basin.tank1.getPrimaryHandler().getFluidAmount()==basin.tank1.getPrimaryHandler().getCapacity())
{
isRunning = false;
return;
}
if(basin.outputInventory.getStackInSlot(0).getCount()!=0)
{
isRunning = false;
return;
}
if(basin.tank1.getPrimaryHandler().getCapacity()==4000)
{
isRunning = false;
return;
}
basin.tank1.getPrimaryHandler().setFluid(new FluidStack(tank1.getPrimaryHandler().getFluid().getFluid(),basin.tank1.getPrimaryHandler().getFluidAmount()+1));
tank1.getPrimaryHandler().drain(1, IFluidHandler.FluidAction.EXECUTE);
isRunning = true;
}
@Override
@SuppressWarnings("removal")
public boolean addToGoggleTooltip(List<Component> tooltip, boolean isPlayerSneaking) {
//--Fluid Info--//
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;
LangBuilder mb = Lang.translate("generic.unit.millibuckets");
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.DARK_GREEN))
.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.DARK_GREEN))
.style(ChatFormatting.DARK_GRAY)
.forGoggles(tooltip, 1);
return true;
}
}

View File

@@ -0,0 +1,102 @@
package com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout;
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.simibubi.create.AllPartialModels;
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
import com.simibubi.create.foundation.blockEntity.renderer.SafeBlockEntityRenderer;
import com.simibubi.create.foundation.fluid.FluidRenderer;
import com.simibubi.create.foundation.render.CachedBufferer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraftforge.fluids.FluidStack;
public class CastingSpoutRenderer extends SafeBlockEntityRenderer<CastingSpoutBlockEntity> {
public CastingSpoutRenderer(BlockEntityRendererProvider.Context context) {
}
static final PartialModel[] BITS =
{TFMGPartialModels.CASTING_SPOUT_CONNECTOR, TFMGPartialModels.CASTING_SPOUT_BOTTOM };
@Override
protected void renderSafe(CastingSpoutBlockEntity be, float partialTicks, PoseStack ms, MultiBufferSource buffer,
int light, int overlay) {
SmartFluidTankBehaviour tank = be.tank1;
if (tank == null)
return;
TankSegment primaryTank = be.tank1.getPrimaryTank();
FluidStack fluidStack = primaryTank.getRenderedFluid();
float level = primaryTank.getFluidLevel()
.getValue(partialTicks);
if (!fluidStack.isEmpty() && level != 0) {
boolean top = fluidStack.getFluid()
.getFluidType()
.isLighterThanAir();
level = Math.max(level, 0.175f);
float min = 2.5f / 16f;
float max = min + (11 / 16f);
float yOffset = (11 / 16f) * level;
ms.pushPose();
if (!top) ms.translate(0, yOffset, 0);
else ms.translate(0, max - min, 0);
FluidRenderer.renderFluidBox(fluidStack,
min, min - yOffset, min,
max, min, max,
buffer, ms, light, false);
ms.popPose();
}
int processingTicks;
if(be.basin==null){
processingTicks = 0;
}else
processingTicks = be.basin.timer;
float processingPT = processingTicks - partialTicks;
float processingProgress = 1 - (processingPT - 5) / 10;
processingProgress = Mth.clamp(processingProgress, 0, 1);
float radius = 0;
if (be.isRunning) {
radius = (float) (Math.pow(((0.3) - 1), 2) - 1);
AABB bb = new AABB(0.5, .5, 0.5, 0.5, -1.2, 0.5).inflate(radius / 32f);
FluidRenderer.renderFluidBox(fluidStack, (float) bb.minX, (float) bb.minY, (float) bb.minZ,
(float) bb.maxX, (float) bb.maxY, (float) bb.maxZ, buffer, ms, light, true);
}
ms.pushPose();
BlockState blockState = be.getBlockState();
VertexConsumer vb = buffer.getBuffer(RenderType.solid());
CachedBufferer.partial(TFMGPartialModels.CASTING_SPOUT_BOTTOM, blockState)
.translateY(be.movement.getValue(partialTicks)*2)
.light(light)
.renderInto(ms, vb);
CachedBufferer.partial(TFMGPartialModels.CASTING_SPOUT_CONNECTOR, blockState)
.translateY(be.movement.getValue(partialTicks))
.light(light)
.renderInto(ms, vb);
ms.popPose();
}
}

View File

@@ -0,0 +1,56 @@
package com.drmangotea.tfmg.recipes.casting;
import com.drmangotea.tfmg.registry.TFMGRecipeTypes;
import com.simibubi.create.content.processing.recipe.ProcessingRecipe;
import com.simibubi.create.content.processing.recipe.ProcessingRecipeBuilder.ProcessingRecipeParams;
import com.simibubi.create.foundation.fluid.CombinedTankWrapper;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.items.wrapper.RecipeWrapper;
public class CastingRecipe extends ProcessingRecipe<RecipeWrapper> {
public CastingRecipe(ProcessingRecipeParams params) {
super(TFMGRecipeTypes.CASTING, params);
}
@Override
protected int getMaxInputCount() {
return 0;
}
@Override
protected int getMaxOutputCount() {
return 3;
}
@Override
protected int getMaxFluidOutputCount() {
return 1;
}
public boolean matches(CombinedTankWrapper inv, Level worldIn) {
if (inv.getFluidInTank(0).getAmount()==0)
return false;
return fluidIngredients.get(0)
.test(inv.getFluidInTank(0));
}
public FluidIngredient getInputFluid(){
return getFluidIngredients().get(0);
}
public ItemStack getIngotResult(){
return results.get(0).getStack();
}
public ItemStack getBlockResult(){
return results.get(1).getStack();
}
@Override
public boolean matches(RecipeWrapper pContainer, Level pLevel) {
return false;
}
}

View File

@@ -10,6 +10,9 @@ import com.drmangotea.tfmg.blocks.deposits.surface_scanner.SurfaceScannerRendere
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;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlockEntity;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout.CastingSpoutBlockEntity;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_spout.CastingSpoutRenderer;
import com.drmangotea.tfmg.blocks.machines.metal_processing.coke_oven.CokeOvenBlockEntity;
import com.drmangotea.tfmg.blocks.machines.metal_processing.coke_oven.CokeOvenRenderer;
import com.drmangotea.tfmg.blocks.machines.oil_processing.distillation.distillation_tower.DistillationControllerBlockEntity;
@@ -184,6 +187,17 @@ public class TFMGBlockEntities {
.validBlocks(TFMGBlocks.MOLTEN_METAL)
.register();
public static final BlockEntityEntry<CastingBasinBlockEntity> CASTING_BASIN = REGISTRATE
.blockEntity("casting_basin", CastingBasinBlockEntity::new)
.validBlocks(TFMGBlocks.CASTING_BASIN)
.register();
public static final BlockEntityEntry<CastingSpoutBlockEntity> CASTING_SPOUT = REGISTRATE
.blockEntity("casting_spout", CastingSpoutBlockEntity::new)
.renderer(()->CastingSpoutRenderer::new)
.validBlocks(TFMGBlocks.CASTING_SPOUT)
.register();
public static void register() {}
}

View File

@@ -8,6 +8,8 @@ import com.drmangotea.tfmg.blocks.concrete.formwork.FormWorkGenerator;
import com.drmangotea.tfmg.blocks.decoration.doors.TFMGSlidingDoorBlock;
import com.drmangotea.tfmg.blocks.deposits.FluidDepositBlock;
import com.drmangotea.tfmg.blocks.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;
import com.drmangotea.tfmg.items.CoalCokeBlockItem;
import com.drmangotea.tfmg.items.FossilstoneItem;
import com.drmangotea.tfmg.blocks.deposits.surface_scanner.SurfaceScannerBlock;
@@ -68,7 +70,7 @@ import static com.simibubi.create.foundation.data.CreateRegistrate.connectedText
import static com.simibubi.create.foundation.data.ModelGen.customItemModel;
import static com.simibubi.create.foundation.data.TagGen.*;
@SuppressWarnings("removal")
public class TFMGBlocks {
@@ -376,6 +378,32 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
.forAllStatesExcept(BlockStateGen.mapToAir(p)))
.register();
//--Casting Basin
public static final BlockEntry<CastingBasinBlock> CASTING_BASIN = REGISTRATE.block("casting_basin", CastingBasinBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.color(MaterialColor.TERRACOTTA_BLACK))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.addLayer(() -> RenderType::cutoutMipped)
.item()
.build()
.lang("Casting Basin")
.register();
public static final BlockEntry<CastingSpoutBlock> CASTING_SPOUT = REGISTRATE.block("casting_spout", CastingSpoutBlock::new)
.initialProperties(() -> Blocks.IRON_BLOCK)
.properties(p -> p.color(MaterialColor.TERRACOTTA_BLACK))
.properties(p -> p.requiresCorrectToolForDrops())
.transform(pickaxeOnly())
.blockstate((ctx, prov) -> prov.simpleBlock(ctx.getEntry(), AssetLookup.partialBaseModel(ctx, prov)))
.addLayer(() -> RenderType::cutoutMipped)
.item()
.build()
.lang("Casting Spout")
.register();
//////////
public static final BlockEntry<CokeOvenBlock> COKE_OVEN = REGISTRATE.block("coke_oven", CokeOvenBlock::new)
.initialProperties(() -> Blocks.BRICKS)
@@ -387,6 +415,8 @@ public static final BlockEntry<DistillationOutputBlock> STEEL_DISTILLATION_OUTPU
.transform(customItemModel())
.lang("Coke Oven")
.register();
///////

View File

@@ -3,6 +3,8 @@ package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ChemicalColor;
import com.drmangotea.tfmg.blocks.gadgets.explosives.thermite_grenades.ThermiteGrenadeItem;
import com.drmangotea.tfmg.blocks.gadgets.quad_potato_cannon.QuadPotatoCannonItem;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingBasinBlockEntity;
import com.drmangotea.tfmg.blocks.machines.metal_processing.casting_basin.CastingMoldItem;
import com.drmangotea.tfmg.items.CoalCokeItem;
import com.drmangotea.tfmg.items.ScrewdriverItem;
import com.simibubi.create.foundation.data.AssetLookup;
@@ -38,7 +40,9 @@ public class TFMGItems {
REGISTRATE.item("quad_potato_cannon", QuadPotatoCannonItem::new)
.model(AssetLookup.itemModelWithPartials())
.register();
public static final ItemEntry<CastingMoldItem>
BLOCK_MOLD = REGISTRATE.item("block_mold", p -> new CastingMoldItem(p, CastingBasinBlockEntity.MoldType.BLOCK)).properties(p -> p.stacksTo(1)).register(),
INGOT_MOLD = REGISTRATE.item("ingot_mold", p -> new CastingMoldItem(p, CastingBasinBlockEntity.MoldType.INGOT)).properties(p -> p.stacksTo(1)).register();
public static final ItemEntry<CoalCokeItem> COAL_COKE = REGISTRATE.item("coal_coke", CoalCokeItem::new)
.register();

View File

@@ -19,6 +19,8 @@ public class TFMGPartialModels {
public static final PartialModel
CASTING_SPOUT_CONNECTOR = block("casting_spout/connector"),
CASTING_SPOUT_BOTTOM = block("casting_spout/bottom"),
COKE_OVEN_DOOR_LEFT = block("coke_oven/door_left"),
COKE_OVEN_DOOR_RIGHT = block("coke_oven/door_right"),
COKE_OVEN_DOOR_LEFT_TOP = block("coke_oven/door_left_top"),

View File

@@ -2,6 +2,7 @@ package com.drmangotea.tfmg.registry;
import com.drmangotea.tfmg.CreateTFMG;
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;
@@ -31,6 +32,7 @@ import java.util.function.Supplier;
public enum TFMGRecipeTypes implements IRecipeTypeInfo {
CASTING(CastingRecipe::new),
INDUSTRIAL_BLASTING(IndustrialBlastingRecipe::new),
COKING(CokingRecipe::new),
DISTILLATION(DistillationRecipe::new),

View File

@@ -0,0 +1,58 @@
{
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"12": "create:block/basin",
"particle": "create:block/industrial_iron_block"
},
"elements": [
{
"name": "Basin",
"from": [0, 2, 0],
"to": [16, 16, 16],
"faces": {
"north": {"uv": [0, 0, 8, 7], "texture": "#12"},
"east": {"uv": [0, 0, 8, 7], "texture": "#12"},
"south": {"uv": [0, 0, 8, 7], "texture": "#12"},
"west": {"uv": [0, 0, 8, 7], "texture": "#12"},
"up": {"uv": [0, 8, 8, 16], "texture": "#12"},
"down": {"uv": [0, 8, 8, 16], "texture": "#12"}
}
},
{
"name": "Basin Interior",
"from": [1.95, 16, 1.95],
"to": [14.05, 2, 14.05],
"faces": {
"north": {"uv": [9, 0, 15, 7], "rotation": 180, "texture": "#12"},
"east": {"uv": [9, 0, 15, 7], "rotation": 180, "texture": "#12"},
"south": {"uv": [9, 0, 15, 7], "rotation": 180, "texture": "#12"},
"west": {"uv": [9, 0, 15, 7], "rotation": 180, "texture": "#12"},
"up": {"uv": [9, 9, 15, 15], "rotation": 90, "texture": "#12"}
}
},
{
"name": "Basin Base",
"from": [2, 0, 2],
"to": [14, 2, 14],
"faces": {
"north": {"uv": [1, 7, 7, 8], "texture": "#12"},
"east": {"uv": [1, 7, 7, 8], "texture": "#12"},
"south": {"uv": [1, 7, 7, 8], "texture": "#12"},
"west": {"uv": [1, 7, 7, 8], "texture": "#12"},
"down": {"uv": [9, 9, 15, 15], "texture": "#12"}
}
}
],
"groups": [
{
"name": "Basin",
"origin": [8, 8, 8],
"color": 0,
"children": []
},
0,
1,
2
]
}

View File

@@ -0,0 +1,44 @@
{
"credit": "Made with Blockbench",
"elements": [
{
"from": [1, 2, 1],
"to": [15, 14, 15],
"color": 2,
"faces": {
"north": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"east": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"south": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"west": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"up": {"uv": [0, 0, 14, 14], "texture": "#missing"},
"down": {"uv": [0, 0, 14, 14], "texture": "#missing"}
}
},
{
"from": [2, 0, 2],
"to": [14, 2, 14],
"color": 7,
"faces": {
"north": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 12, 12], "texture": "#missing"},
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
}
},
{
"from": [2, 14, 2],
"to": [14, 16, 14],
"color": 7,
"faces": {
"north": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 12, 12], "texture": "#missing"},
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
}
}
]
}

View File

@@ -0,0 +1,31 @@
{
"credit": "Made with Blockbench",
"elements": [
{
"from": [6, -5, 6],
"to": [10, -2, 10],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"east": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"south": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"west": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"up": {"uv": [0, 0, 4, 4], "texture": "#missing"},
"down": {"uv": [0, 0, 4, 4], "texture": "#missing"}
}
},
{
"from": [5, -7, 5],
"to": [11, -5, 11],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 6, 6], "texture": "#missing"},
"down": {"uv": [0, 0, 6, 6], "texture": "#missing"}
}
}
]
}

View File

@@ -0,0 +1,18 @@
{
"credit": "Made with Blockbench",
"elements": [
{
"from": [4, -2, 4],
"to": [12, 0, 12],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 8, 8], "texture": "#missing"},
"down": {"uv": [0, 0, 8, 8], "texture": "#missing"}
}
}
]
}

View File

@@ -0,0 +1,83 @@
{
"credit": "Made with Blockbench",
"elements": [
{
"from": [1, 2, 1],
"to": [15, 14, 15],
"color": 2,
"faces": {
"north": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"east": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"south": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"west": {"uv": [0, 0, 14, 12], "texture": "#missing"},
"up": {"uv": [0, 0, 14, 14], "texture": "#missing"},
"down": {"uv": [0, 0, 14, 14], "texture": "#missing"}
}
},
{
"from": [2, 0, 2],
"to": [14, 2, 14],
"color": 7,
"faces": {
"north": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 12, 12], "texture": "#missing"},
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
}
},
{
"from": [2, 14, 2],
"to": [14, 16, 14],
"color": 7,
"faces": {
"north": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 12, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 12, 12], "texture": "#missing"},
"down": {"uv": [0, 0, 12, 12], "texture": "#missing"}
}
},
{
"from": [4, -2, 4],
"to": [12, 0, 12],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 8, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 8, 8], "texture": "#missing"},
"down": {"uv": [0, 0, 8, 8], "texture": "#missing"}
}
},
{
"from": [5, -7, 5],
"to": [11, -5, 11],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"east": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"south": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"west": {"uv": [0, 0, 6, 2], "texture": "#missing"},
"up": {"uv": [0, 0, 6, 6], "texture": "#missing"},
"down": {"uv": [0, 0, 6, 6], "texture": "#missing"}
}
},
{
"from": [6, -5, 6],
"to": [10, -2, 10],
"color": 5,
"faces": {
"north": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"east": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"south": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"west": {"uv": [0, 0, 4, 3], "texture": "#missing"},
"up": {"uv": [0, 0, 4, 4], "texture": "#missing"},
"down": {"uv": [0, 0, 4, 4], "texture": "#missing"}
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@@ -0,0 +1,22 @@
{
"type": "tfmg:casting",
"ingredients": [
{
"fluid": "tfmg:heavy_oil",
"amount": 1
}
],
"processingTime": 300,
"results": [
{
"count": 1,
"item": "tfmg:steel_ingot"
}
,
{
"count": 1,
"item": "tfmg:steel_block"
}
]
}

View File

@@ -0,0 +1,22 @@
{
"type": "tfmg:casting",
"ingredients": [
{
"fluid": "tfmg:gasoline",
"amount": 1
}
],
"processingTime": 200,
"results": [
{
"count": 1,
"item": "tfmg:aluminum_ingot"
}
,
{
"count": 1,
"item": "tfmg:aluminum_block"
}
]
}