Skip to content

Commit

Permalink
Add Brewery Multi (GTNewHorizons#3257)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
  • Loading branch information
FourIsTheNumber and Dream-Master authored Sep 22, 2024
1 parent e14fd93 commit 22a702d
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/main/java/gregtech/api/enums/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ public enum ItemList implements IItemContainer {
Casing_Fluid_Solidifier,
Radiator_Fluid_Solidifier,

Casing_Reinforced_Wood,

Machine_Multi_IndustrialCompressor,
Machine_Multi_HIPCompressor,
Machine_Multi_NeutroniumCompressor,
Expand All @@ -1506,6 +1508,8 @@ public enum ItemList implements IItemContainer {
Black_Hole_Opener,
Black_Hole_Closer,

Machine_Multi_IndustrialBrewery,

Machine_Multi_IndustrialLaserEngraver,
Laser_Plate,
Casing_Laser,
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/enums/MetaTileEntityIDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ public enum MetaTileEntityIDs {
BLACKHOLE_COMPRESSOR_CONTROLLER(3008),
HEAT_DETECTOR_HATCH(3009),
INDUSTRIAL_EXTRACTOR_CONTROLLER(3010),
INDUSTRIAL_BREWERY_CONTROLLER(3011),
DraconicEvolutionFusionCrafterController(5001),
CHEST_BUFFER_ULV(9230),
CHEST_BUFFER_LV(9231),
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/gregtech/api/enums/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ public enum BlockIcons implements IIconContainer, Runnable {
MACHINE_CASING_MS160,
RADIATOR_MS160,

CASING_REINFORCED_WOOD,
CASING_REINFORCED_WOOD_TOP,

OVERLAY_FRONT_MULTI_CANNER,
OVERLAY_FRONT_MULTI_CANNER_ACTIVE,
OVERLAY_FRONT_MULTI_CANNER_ACTIVE_GLOW,
Expand Down Expand Up @@ -368,6 +371,11 @@ public enum BlockIcons implements IIconContainer, Runnable {
OVERLAY_FRONT_INDUSTRIAL_EXTRACTOR_ACTIVE_GLOW,
OVERLAY_FRONT_INDUSTRIAL_EXTRACTOR_GLOW,

OVERLAY_FRONT_MULTI_BREWERY,
OVERLAY_FRONT_MULTI_BREWERY_ACTIVE,
OVERLAY_FRONT_MULTI_BREWERY_ACTIVE_GLOW,
OVERLAY_FRONT_MULTI_BREWERY_GLOW,

LASER_PLATE,
MACHINE_CASING_LASER,
OVERLAY_FRONT_ENGRAVER,
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/gregtech/common/blocks/BlockCasings10.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public BlockCasings10() {
.addStringLocalization(getUnlocalizedName() + ".11.name", "Extreme Density Space-Bending Casing");
GTLanguageManager
.addStringLocalization(getUnlocalizedName() + ".12.name", "Background Radiation Absorbent Casing");

GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".13.name", "Solidifier Casing");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".14.name", "Solidifier Radiator");
GTLanguageManager.addStringLocalization(getUnlocalizedName() + ".15.name", "Reinforced Wooden Casing");

ItemList.Casing_Electromagnetic_Separator.set(new ItemStack(this, 1, 0));
ItemList.Casing_Laser.set(new ItemStack(this, 1, 1));
Expand All @@ -51,6 +51,7 @@ public BlockCasings10() {
ItemList.Background_Radiation_Casing.set(new ItemStack(this, 1, 12));
ItemList.Casing_Fluid_Solidifier.set(new ItemStack(this, 1, 13));
ItemList.Radiator_Fluid_Solidifier.set(new ItemStack(this, 1, 14));
ItemList.Casing_Reinforced_Wood.set(new ItemStack(this, 1, 15));
}

@Override
Expand All @@ -77,6 +78,8 @@ public IIcon getIcon(int ordinalSide, int aMeta) {
case 12 -> Textures.BlockIcons.RADIATION_ABSORBENT_CASING.getIcon();
case 13 -> Textures.BlockIcons.MACHINE_CASING_MS160.getIcon();
case 14 -> Textures.BlockIcons.RADIATOR_MS160.getIcon();
case 15 -> ordinalSide > 1 ? Textures.BlockIcons.CASING_REINFORCED_WOOD.getIcon()
: Textures.BlockIcons.CASING_REINFORCED_WOOD_TOP.getIcon();
default -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
package gregtech.common.tileentities.machines.multi;

import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static gregtech.api.enums.GTValues.AuthorFourIsTheNumber;
import static gregtech.api.enums.HatchElement.Energy;
import static gregtech.api.enums.HatchElement.InputBus;
import static gregtech.api.enums.HatchElement.InputHatch;
import static gregtech.api.enums.HatchElement.Maintenance;
import static gregtech.api.enums.HatchElement.OutputBus;
import static gregtech.api.enums.HatchElement.OutputHatch;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_BREWERY;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_BREWERY_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_BREWERY_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_BREWERY_GLOW;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.ofFrame;

import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;

import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import gregtech.api.GregTechAPI;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEExtendedPowerMultiBlockBase;
import gregtech.api.multitileentity.multiblock.casing.Glasses;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMaps;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.common.blocks.BlockCasings10;

public class MTEIndustrialBrewery extends MTEExtendedPowerMultiBlockBase<MTEIndustrialBrewery>
implements ISurvivalConstructable {

private static final String STRUCTURE_PIECE_MAIN = "main";
private static final IStructureDefinition<MTEIndustrialBrewery> STRUCTURE_DEFINITION = StructureDefinition
.<MTEIndustrialBrewery>builder()
.addShape(
STRUCTURE_PIECE_MAIN,
// spotless:off
new String[][]{{
"BBB",
"BBB",
"B~B",
"BBB",
"C C"
},{
"BBB",
"A A",
"A A",
"BBB",
" "
},{
"BBB",
"BAB",
"BAB",
"BBB",
"C C"
}})
//spotless:on
.addElement(
'B',
buildHatchAdder(MTEIndustrialBrewery.class)
.atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy)
.casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(15))
.dot(1)
.buildAndChain(
onElementPass(MTEIndustrialBrewery::onCasingAdded, ofBlock(GregTechAPI.sBlockCasings10, 15))))
.addElement('A', Glasses.chainAllGlasses())
.addElement('C', ofFrame(Materials.Steel))
.build();

public MTEIndustrialBrewery(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
}

public MTEIndustrialBrewery(String aName) {
super(aName);
}

@Override
public IStructureDefinition<MTEIndustrialBrewery> getStructureDefinition() {
return STRUCTURE_DEFINITION;
}

@Override
public boolean isCorrectMachinePart(ItemStack aStack) {
return true;
}

@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEIndustrialBrewery(this.mName);
}

@Override
public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing,
int colorIndex, boolean aActive, boolean redstoneLevel) {
ITexture[] rTexture;
if (side == aFacing) {
if (aActive) {
rTexture = new ITexture[] {
Textures.BlockIcons
.getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 15)),
TextureFactory.builder()
.addIcon(OVERLAY_FRONT_MULTI_BREWERY_ACTIVE)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(OVERLAY_FRONT_MULTI_BREWERY_ACTIVE_GLOW)
.extFacing()
.glow()
.build() };
} else {
rTexture = new ITexture[] {
Textures.BlockIcons
.getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 15)),
TextureFactory.builder()
.addIcon(OVERLAY_FRONT_MULTI_BREWERY)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(OVERLAY_FRONT_MULTI_BREWERY_GLOW)
.extFacing()
.glow()
.build() };
}
} else {
rTexture = new ITexture[] { Textures.BlockIcons
.getCasingTextureForId(GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings10, 15)) };
}
return rTexture;
}

@Override
protected MultiblockTooltipBuilder createTooltip() {
MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
tt.addMachineType("Brewery")
.addInfo("Controller Block for the Big Barrel Brewery")
.addInfo("50% faster than singleblock machines of the same voltage")
.addInfo("Gains 4 parallels per voltage tier")
.addInfo(AuthorFourIsTheNumber)
.addSeparator()
.beginStructureBlock(3, 5, 3, true)
.addController("Front Center")
.addCasingInfoMin("Reinforced Wooden Casing", 14, false)
.addCasingInfoExactly("Any Glass", 6, false)
.addCasingInfoExactly("Steel Frame Box", 4, false)
.addInputBus("Any Wooden Casing", 1)
.addOutputBus("Any Wooden Casing", 1)
.addInputHatch("Any Wooden Casing", 1)
.addOutputHatch("Any Wooden Casing", 1)
.addEnergyHatch("Any Wooden Casing", 1)
.addMaintenanceHatch("Any Wooden Casing", 1)
.toolTipFinisher("GregTech");
return tt;
}

@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 1, 2, 0);
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 1, 2, 0, elementBudget, env, false, true);
}

private int mCasingAmount;

private void onCasingAdded() {
mCasingAmount++;
}

@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasingAmount = 0;
return checkPiece(STRUCTURE_PIECE_MAIN, 1, 2, 0) && mCasingAmount >= 14;
}

@Override
protected void setProcessingLogicPower(ProcessingLogic logic) {
logic.setAvailableVoltage(GTUtility.roundUpVoltage(this.getMaxInputVoltage()));
logic.setAvailableAmperage(1L);
}

@Override
protected ProcessingLogic createProcessingLogic() {
return new ProcessingLogic().setSpeedBonus(1F / 1.5F)
.setMaxParallelSupplier(this::getMaxParallelRecipes);
}

public int getMaxParallelRecipes() {
return (4 * GTUtility.getTier(this.getMaxInputVoltage()));
}

@Override
public RecipeMap<?> getRecipeMap() {
return RecipeMaps.brewingRecipes;
}

@Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}

@Override
public int getDamageToComponent(ItemStack aStack) {
return 0;
}

@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}

@Override
public boolean supportsVoidProtection() {
return true;
}

@Override
public boolean supportsBatchMode() {
return true;
}

@Override
public boolean supportsInputSeparation() {
return true;
}

@Override
public boolean supportsSingleRecipeLocking() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@
import gregtech.common.tileentities.machines.multi.MTEFusionComputer3;
import gregtech.common.tileentities.machines.multi.MTEHeatExchanger;
import gregtech.common.tileentities.machines.multi.MTEImplosionCompressor;
import gregtech.common.tileentities.machines.multi.MTEIndustrialBrewery;
import gregtech.common.tileentities.machines.multi.MTEIndustrialElectromagneticSeparator;
import gregtech.common.tileentities.machines.multi.MTEIndustrialExtractor;
import gregtech.common.tileentities.machines.multi.MTEIndustrialLaserEngraver;
Expand Down Expand Up @@ -1622,6 +1623,10 @@ private static void registerMultiblockControllers() {
"multimachine.blackholecompressor",
"Pseudostable Black Hole Containment Field").getStackForm(1));

ItemList.Machine_Multi_IndustrialBrewery.set(
new MTEIndustrialBrewery(INDUSTRIAL_BREWERY_CONTROLLER.ID, "multimachine.brewery", "Big Barrel Brewery")
.getStackForm(1));

ItemList.Machine_Multi_Autoclave.set(
new MTEMultiAutoclave(MULTI_AUTOCLAVE_CONTROLLER.ID, "multimachine.autoclave", "Industrial Autoclave")
.getStackForm(1));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 22a702d

Please sign in to comment.