Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Diamantino-Op committed Jan 20, 2025
2 parents 721fa8f + 49336d5 commit 43655c8
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 12 deletions.
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/enums/Materials.java
Original file line number Diff line number Diff line change
Expand Up @@ -2303,13 +2303,15 @@ private static void initSubTags() {
BlackPlutonium,
BlackSteel,
Bronze,
Chrome,
Clay,
Cobalt,
Copper,
CosmicNeutronium,
CrystallinePinkSlime,
DarkSteel,
Duralumin,
DraconiumAwakened,
Europium,
Gold,
HSSG,
Expand All @@ -2321,7 +2323,10 @@ private static void initSubTags() {
Lead,
Magnesium,
MaterialsKevlar.Kevlar,
MaterialsUEVplus.Creon,
MaterialsUEVplus.Eternity,
MaterialsUEVplus.HotProtoHalkonite,
MaterialsUEVplus.Mellion,
MaterialsUEVplus.ProtoHalkonite,
MaterialsUEVplus.SpaceTime,
MaterialsUEVplus.TranscendentMetal,
Expand All @@ -2340,6 +2345,7 @@ private static void initSubTags() {
Palladium,
Paper,
Platinum,
Plutonium,
Polybenzimidazole,
Polycaprolactam,
Polytetrafluoroethylene,
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/gregtech/api/interfaces/IMEConnectable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gregtech.api.interfaces;

/**
* A hatch that has a connection to an ME cable.
* Used by the matter manipulator to copy this setting.
*/
public interface IMEConnectable {

/** If this hatch can accept connects on the side, or just the front. */
boolean connectsToAllSides();

void setConnectsToAllSides(boolean connects);
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -104,7 +105,7 @@

public class MTEHatchCraftingInputME extends MTEHatchInputBus
implements IConfigurationCircuitSupport, IAddGregtechLogo, IAddUIWidgets, IPowerChannelState, ICraftingProvider,
IGridProxyable, IDualInputHatch, ICustomNameObject, IInterfaceViewable {
IGridProxyable, IDualInputHatch, ICustomNameObject, IInterfaceViewable, IMEConnectable {

// Each pattern slot in the crafting input hatch has its own internal inventory
public static class PatternSlot implements IDualInputInventory {
Expand Down Expand Up @@ -477,6 +478,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down Expand Up @@ -948,6 +960,7 @@ public void provideCrafting(ICraftingProviderHelper craftingTracker) {
@Override
public boolean pushPattern(ICraftingPatternDetails patternDetails, InventoryCrafting table) {
if (!isActive()) return false;
if (!getBaseMetaTileEntity().isAllowedToWork()) return false;

if (!supportFluids) {
for (int i = 0; i < table.getSizeInventory(); ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IConfigurationCircuitSupport;
import gregtech.api.interfaces.IDataCopyable;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -79,8 +80,9 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchInputBusME extends MTEHatchInputBus implements IConfigurationCircuitSupport,
IRecipeProcessingAwareHatch, IAddGregtechLogo, IAddUIWidgets, IPowerChannelState, ISmartInputHatch, IDataCopyable {
public class MTEHatchInputBusME extends MTEHatchInputBus
implements IConfigurationCircuitSupport, IRecipeProcessingAwareHatch, IAddGregtechLogo, IAddUIWidgets,
IPowerChannelState, ISmartInputHatch, IDataCopyable, IMEConnectable {

protected static final int SLOT_COUNT = 16;
public static final String COPIED_DATA_IDENTIFIER = "stockingBus";
Expand Down Expand Up @@ -179,6 +181,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUITextures;
import gregtech.api.interfaces.IDataCopyable;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.modularui.IAddGregtechLogo;
import gregtech.api.interfaces.modularui.IAddUIWidgets;
Expand All @@ -83,7 +84,7 @@
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchInputME extends MTEHatchInput implements IPowerChannelState, IAddGregtechLogo, IAddUIWidgets,
IRecipeProcessingAwareHatch, ISmartInputHatch, IDataCopyable {
IRecipeProcessingAwareHatch, ISmartInputHatch, IDataCopyable, IMEConnectable {

private static final int SLOT_COUNT = 16;
public static final String COPIED_DATA_IDENTIFIER = "stockingHatch";
Expand Down Expand Up @@ -333,6 +334,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import gregtech.GTMod;
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -61,7 +62,7 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChannelState {
public class MTEHatchOutputBusME extends MTEHatchOutputBus implements IPowerChannelState, IMEConnectable {

protected static final long DEFAULT_CAPACITY = 1_600;
protected long baseCapacity = DEFAULT_CAPACITY;
Expand Down Expand Up @@ -231,6 +232,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import gregtech.api.enums.GTValues;
import gregtech.api.enums.ItemList;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.IMEConnectable;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
Expand All @@ -71,7 +72,7 @@
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelState {
public class MTEHatchOutputME extends MTEHatchOutput implements IPowerChannelState, IMEConnectable {

private static final long DEFAULT_CAPACITY = 128_000;
private long baseCapacity = DEFAULT_CAPACITY;
Expand Down Expand Up @@ -346,6 +347,17 @@ public boolean onWireCutterRightClick(ForgeDirection side, ForgeDirection wrench
return true;
}

@Override
public boolean connectsToAllSides() {
return additionalConnection;
}

@Override
public void setConnectsToAllSides(boolean connects) {
additionalConnection = connects;
updateValidGridProxySides();
}

@Override
public AENetworkProxy getProxy() {
if (gridProxy == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import gregtech.api.util.GTRecipe;
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.OverclockCalculator;
import gregtech.common.blocks.BlockCasings10;
import gregtech.common.tileentities.render.TileEntityLaser;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
Expand All @@ -76,7 +77,7 @@ public class MTEIndustrialLaserEngraver extends MTEExtendedPowerMultiBlockBase<M
.addElement(
'a',
buildHatchAdder(MTEIndustrialLaserEngraver.class)
.atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy)
.atLeast(InputBus, OutputBus, InputHatch, OutputHatch, Maintenance, Energy, ExoticEnergy)
.casingIndex(((BlockCasings10) GregTechAPI.sBlockCasings10).getTextureIndex(1))
.dot(1)
.buildAndChain(
Expand Down Expand Up @@ -235,10 +236,11 @@ public void onBlockDestroyed() {
protected MultiblockTooltipBuilder createTooltip() {
MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder();
tt.addMachineType("Laser Engraver, HILE")
.addInfo("200% faster than single block machines of the same voltage")
.addInfo("250% faster than single block machines of the same voltage")
.addInfo("Uses 80% of the EU normally required")
.addInfo("Laser source hatch determines maximum recipe tier and parallels")
.addInfo("Can perform recipes up to laser source tier + 1")
.addInfo("Recipe tier and overclocks limited to laser source tier + 1")
.addInfo("With UEV laser source, 1 multi-amp energy hatch is allowed (instead of regular hatches)")
.addInfo("Parallels equal to the cube root of laser source amperage input")
.addInfo("Glass tier determines maximum laser source tier")
.addInfo("UMV glass accepts all laser source hatches")
Expand Down Expand Up @@ -301,6 +303,16 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
if (mCasingAmount < 35) return false;
if (laserSource == null) return false;
if (!findLaserRenderer(base.getWorld(), base.getXCoord(), base.getYCoord(), base.getZCoord())) return false;

// If there are exotic hatches, ensure there is only 1, and it is not laser. Only multiamp allowed
if (!mExoticEnergyHatches.isEmpty()) {
if (laserSource.mTier < VoltageIndex.UEV) return false;
if (!mEnergyHatches.isEmpty()) return false;
if (mExoticEnergyHatches.size() > 1) return false;
return mExoticEnergyHatches.get(0)
.maxWorkingAmperesIn() <= 64;
}

return glassTier >= VoltageIndex.UMV || laserSource.mTier <= glassTier;
}

Expand Down Expand Up @@ -341,12 +353,21 @@ protected CheckRecipeResult onRecipeStart(@NotNull GTRecipe recipe) {
return super.onRecipeStart(recipe);
}

@NotNull
@Override
protected OverclockCalculator createOverclockCalculator(@NotNull GTRecipe recipe) {
// Limit ocs up to hatch tier + 1
int ocs = (laserSource.mTier + 1) - GTUtility.getTier(recipe.mEUt);
if (ocs < 0) ocs = 0;
return super.createOverclockCalculator(recipe).limitOverclockCount(ocs);
}

@Override
public ProcessingLogic clear() {
if (renderer != null) renderer.setShouldRender(false);
return super.clear();
}
}.setSpeedBonus(1F / 3F)
}.setSpeedBonus(1F / 3.5F)
.setEuModifier(0.8F)
.setMaxParallelSupplier(this::getMaxParallelRecipes);
}
Expand Down Expand Up @@ -407,8 +428,10 @@ public boolean supportsSingleRecipeLocking() {

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

@Override
Expand Down

0 comments on commit 43655c8

Please sign in to comment.