Skip to content

Commit

Permalink
Merge branch 'main' into 2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
planetme committed Jan 22, 2024
2 parents b8c981e + a2cae34 commit 6fdbe19
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 78 deletions.
8 changes: 6 additions & 2 deletions src/main/java/supersymmetry/api/recipes/SuSyRecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,12 @@ public class SuSyRecipeMaps {
.setSound(GTSoundEvents.CHEMICAL_REACTOR)
.setSmallRecipeMap(MIXER_RECIPES);

public static final RecipeMap<FuelRecipeBuilder> LARGE_STEAM_TURBINE = new RecipeMap<>("large_steam_turbine", 1, 0, 2, 1, new FuelRecipeBuilder(), false)
.setSlotOverlay(false, true, GuiTextures.CENTRIFUGE_OVERLAY)
.setProgressBar(GuiTextures.PROGRESS_BAR_GAS_COLLECTOR, ProgressWidget.MoveType.HORIZONTAL)
.setSound(GTSoundEvents.TURBINE)
.allowEmptyOutput();

public static void init(){
RecipeMaps.SIFTER_RECIPES.setMaxFluidInputs(1);
RecipeMaps.SIFTER_RECIPES.setMaxFluidOutputs(1);
Expand All @@ -348,8 +354,6 @@ public static void init(){
RecipeMaps.GAS_TURBINE_FUELS.setMaxFluidInputs(3);
RecipeMaps.GAS_TURBINE_FUELS.setMaxFluidOutputs(1);
RecipeMaps.GAS_TURBINE_FUELS.setMaxInputs(1);
RecipeMaps.STEAM_TURBINE_FUELS.setMaxFluidInputs(2);
RecipeMaps.STEAM_TURBINE_FUELS.setMaxInputs(1);
RecipeMaps.AUTOCLAVE_RECIPES.setMaxFluidInputs(2);
RecipeMaps.AUTOCLAVE_RECIPES.setMaxFluidOutputs(2);
RecipeMaps.CHEMICAL_BATH_RECIPES.setMaxFluidInputs(3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public static void init() {
NEW_ENERGY_OUTPUT_HATCH_16A[2] = registerMetaTileEntity(16005, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.hv"), 3, 16, true));
NEW_ENERGY_OUTPUT_HATCH_16A[3] = registerMetaTileEntity(16006, new SusyMetaTileEntityEnergyHatch(susyId("energy_hatch.output_16a.ev"), 4, 16, true));

BASIC_STEAM_TURBINE = registerMetaTileEntity(17000, new MetaTileEntitySUSYLargeTurbine(susyId("basic_steam_turbine"), RecipeMaps.STEAM_TURBINE_FUELS, 1, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_STEAM_TURBINE_OVERLAY));
BASIC_STEAM_TURBINE = registerMetaTileEntity(17000, new MetaTileEntitySUSYLargeTurbine(susyId("basic_steam_turbine"), SuSyRecipeMaps.LARGE_STEAM_TURBINE, 1, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_STEAM_TURBINE_OVERLAY));
BASIC_GAS_TURBINE = registerMetaTileEntity(17001, new MetaTileEntitySUSYLargeTurbine(susyId("basic_gas_turbine"), RecipeMaps.GAS_TURBINE_FUELS, 2, MetaBlocks.TURBINE_CASING.getState(BlockTurbineCasing.TurbineCasingType.STEEL_TURBINE_CASING), Textures.SOLID_STEEL_CASING, SusyTextures.LARGE_GAS_TURBINE_OVERLAY));

ADVANCED_ARC_FURNACE = registerMetaTileEntity(17003, new MetaTileEntityAdvancedArcFurnace(susyId("advanced_arc_furnace")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.pipeline.IVertexOperation;
import codechicken.lib.vec.Matrix4;
import gregtech.api.capability.IMultipleTankHandler;
import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.capability.impl.ItemHandlerList;
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.ModularUI;
import gregtech.api.gui.widgets.*;
import gregtech.api.gui.widgets.ProgressWidget;
import gregtech.api.gui.widgets.RecipeProgressWidget;
import gregtech.api.gui.widgets.SlotWidget;
import gregtech.api.gui.widgets.TankWidget;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.IMultiblockPart;
Expand All @@ -27,17 +28,14 @@
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.items.IItemHandlerModifiable;
import supersymmetry.common.blocks.BlockCoagulationTankWall;
import supersymmetry.api.recipes.SuSyRecipeMaps;
import supersymmetry.client.renderer.textures.SusyTextures;
import supersymmetry.common.blocks.BlockCoagulationTankWall;
import supersymmetry.common.blocks.SuSyBlocks;

import javax.annotation.Nonnull;

public class MetaTileEntityCoagulationTank extends RecipeMapPrimitiveMultiblockController {
protected IItemHandlerModifiable outputInventory;
protected IMultipleTankHandler inputFluidInventory;
public MetaTileEntityCoagulationTank(ResourceLocation metaTileEntityId) {
super(metaTileEntityId, SuSyRecipeMaps.COAGULATION_RECIPES);
}
Expand All @@ -50,15 +48,16 @@ protected BlockPattern createStructurePattern() {
return FactoryBlockPattern.start()
.aisle(new String[]{"XXX", "XXX", "XXX"})
.aisle(new String[]{"XXX", "X#X", "X#X"}).setRepeatable(1, 4)
.aisle(new String[]{"XXX", "XYX", "XXX"})
.where('X', states(new IBlockState[]{SuSyBlocks.COAGULATION_TANK_WALL.getState(BlockCoagulationTankWall.CoagulationTankWallType.WOODEN_COAGULATION_TANK_WALL)}).or(abilities(new MultiblockAbility[]{MultiblockAbility.EXPORT_ITEMS}).setMinGlobalLimited(0).setMaxGlobalLimited(1)).or(abilities(new MultiblockAbility[]{MultiblockAbility.IMPORT_FLUIDS}).setMinGlobalLimited(0).setMaxGlobalLimited(1)))
.aisle(new String[]{"XXX", "XSX", "XXX"})
.where('X',
states(new IBlockState[]{SuSyBlocks.COAGULATION_TANK_WALL
.getState(BlockCoagulationTankWall.CoagulationTankWallType.WOODEN_COAGULATION_TANK_WALL)})
.or(abilities(MultiblockAbility.EXPORT_ITEMS)
.setMaxGlobalLimited(1))
.or(abilities(MultiblockAbility.IMPORT_FLUIDS)
.setMaxGlobalLimited(1)))
.where('#', air())
.where('Y', this.selfPredicate()).build();
}

@Override
public void checkStructurePattern() {
super.checkStructurePattern();
.where('S', this.selfPredicate()).build();
}

public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
Expand All @@ -68,41 +67,51 @@ public ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) {
ModularUI.Builder builder = ModularUI.builder(GuiTextures.PRIMITIVE_BACKGROUND, 176,166);
builder.label(6, 6, this.getMetaFullName());
builder.widget(new RecipeProgressWidget(this.recipeMapWorkable::getProgressPercent, 76, 41, 20, 15, GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, SuSyRecipeMaps.COAGULATION_RECIPES));

builder.widget((new SlotWidget(this.importItems, 0, 30, 30, true, true).setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));
builder.widget((new SlotWidget(this.importItems, 1, 48, 30, true, true).setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));
builder.widget((new TankWidget(this.importFluids.getTankAt(1), 30, 48, 18, 18)).setAlwaysShowFull(true).setBackgroundTexture(GuiTextures.FLUID_SLOT).setContainerClicking(true, true));
builder.widget((new TankWidget(this.importFluids.getTankAt(0), 48, 48, 18, 18)).setAlwaysShowFull(true).setBackgroundTexture(GuiTextures.FLUID_SLOT).setContainerClicking(true, true));
builder.widget((new SlotWidget(this.exportItems, 0, 106, 39, true, false).setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));
builder.widget(new RecipeProgressWidget(this.recipeMapWorkable::getProgressPercent, 76, 41, 20, 15,
GuiTextures.PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR, ProgressWidget.MoveType.HORIZONTAL, SuSyRecipeMaps.COAGULATION_RECIPES));

builder.widget((new SlotWidget(this.importItems, 0, 30, 30, true, true)
.setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));
builder.widget((new SlotWidget(this.importItems, 1, 48, 30, true, true)
.setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));
builder.widget((new TankWidget(this.importFluids.getTankAt(1), 30, 48, 18, 18))
.setAlwaysShowFull(true)
.setBackgroundTexture(GuiTextures.FLUID_SLOT)
.setContainerClicking(true, true));
builder.widget((new TankWidget(this.importFluids.getTankAt(0), 48, 48, 18, 18))
.setAlwaysShowFull(true).setBackgroundTexture(GuiTextures.FLUID_SLOT)
.setContainerClicking(true, true));
builder.widget((new SlotWidget(this.exportItems, 0, 106, 39, true, false)
.setBackgroundTexture(GuiTextures.PRIMITIVE_SLOT)));


return builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.PRIMITIVE_SLOT, 0);
}

public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, this.getFrontFacing(), this.recipeMapWorkable.isActive(), this.recipeMapWorkable.isWorkingEnabled());
this.getFrontOverlay().renderOrientedState(renderState, translation, pipeline, this.getFrontFacing(),
this.recipeMapWorkable.isActive(), this.recipeMapWorkable.isWorkingEnabled());
}

public void update() {
super.update();
if (this.getOffsetTimer() % 5 == 0){
for (IFluidTank iFluidTank : this.inputFluidInventory.getFluidTanks()) {
if(iFluidTank.getFluid() != null){
if (this.getOffsetTimer() % 5 == 0 && this.isStructureFormed()){
for (IFluidTank tank : getAbilities(MultiblockAbility.IMPORT_FLUIDS)) {
if(tank.getFluid() != null){
NonNullList<FluidStack> fluidStacks = NonNullList.create();
int toFill = (this.importFluids.getTankAt(0).getCapacity() - this.importFluids.getTankAt(0).getFluidAmount());
int amount = Math.min(iFluidTank.getFluidAmount(), toFill);
fluidStacks.add(new FluidStack(iFluidTank.getFluid().getFluid(),amount));
int amount = Math.min(tank.getFluidAmount(), toFill);
fluidStacks.add(new FluidStack(tank.getFluid().getFluid(),amount));
if(GTTransferUtils.addFluidsToFluidHandler(this.importFluids,true, fluidStacks)) {
GTTransferUtils.addFluidsToFluidHandler(this.importFluids,false, fluidStacks);
iFluidTank.drain(amount, true);
tank.drain(amount, true);
}
}
}
for (int i = 0; i < this.exportItems.getSlots(); i++) {
ItemStack stack = this.exportItems.getStackInSlot(i);
this.exportItems.setStackInSlot(i,GTTransferUtils.insertItem(this.outputInventory, stack,false));
this.exportItems.setStackInSlot(i,GTTransferUtils.insertItem(new ItemHandlerList(this.getAbilities(MultiblockAbility.EXPORT_ITEMS)), stack,false));
}
this.fillInternalTankFromFluidContainer();
}
Expand All @@ -111,18 +120,11 @@ public void update() {
@Override
protected void formStructure(PatternMatchContext context) {
super.formStructure(context);
this.reinitializeAbilities();
}

@Override
protected void initializeAbilities() {
super.initializeAbilities();
this.reinitializeAbilities();
}

private void reinitializeAbilities() {
this.outputInventory = new ItemHandlerList(this.getAbilities(MultiblockAbility.EXPORT_ITEMS));
this.inputFluidInventory = new FluidTankList(false, this.getAbilities(MultiblockAbility.IMPORT_FLUIDS));
}

@Nonnull
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/assets/susy/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -650,9 +650,10 @@ recipemap.blender.name=Blender
recipemap.phase_separator.name=Phase Separation
recipemap.bath_condenser.name=Bath Condenser
recipemap.drone_pad.name=Drone Pad
recipemap.polishing_machine=Polishing
recipemap.polishing_machine.name=Polishing
recipemap.gravity_separator=Gravity Separation
recipemap.spinning.name=Textile Spinning
recipemap.large_steam_turbine.name=Large Steam Turbine

gregtech.multiblock.primitive_mud_pump.description=The Primitive Mud Pump is a Steam Era multiblock that collects mud once per second, but only if it is in a river biome, and when the controller is between Y = 64 and Y = 80 (Inclusive). It can use a Pump, ULV, or LV Output Hatch.
gregtech.multiblock.ocean_pumper.description=The Ocean Pumper is an electrically powered multiblock that collects a base amount of 8,000 L Seawater per second (at MV), but only if it is in an ocean biome, and when the controller is between Y = 70 and Y = 75 (Inclusive). It needs an output hatch, a maintenance hatch, and an energy input hatch.
Expand Down
Loading

0 comments on commit 6fdbe19

Please sign in to comment.