aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
authorConnor-Colenso <52056774+Connor-Colenso@users.noreply.github.com>2023-02-05 19:01:37 +0000
committerGitHub <noreply@github.com>2023-02-05 19:01:37 +0000
commit4e53f4462feae7b64d5f5f378c48bad7c10cee4f (patch)
treeb44e457aa460a0024d1767e354d6bf431e997b66 /src/main/java/gregtech/api
parent80fa02e61233286de5ae486682ecd3f93dd5c20c (diff)
downloadGT5-Unofficial-4e53f4462feae7b64d5f5f378c48bad7c10cee4f.tar.gz
GT5-Unofficial-4e53f4462feae7b64d5f5f378c48bad7c10cee4f.tar.bz2
GT5-Unofficial-4e53f4462feae7b64d5f5f378c48bad7c10cee4f.zip
Add TPM Multiblock (#1718)
* Remove warning suppression * New helper default method * Initial work on TPM * Bump dep for structure lib and modular UI * Structure works + recipe map * Working * Tooltip and NEI work * Change controller texture * spotlessApply (#1719) * Fix wrong order * Add override * Spotless * Big opps lol * Comment * Spotless --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java3
-rw-r--r--src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java24
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java4
-rw-r--r--src/main/java/gregtech/api/util/GT_Recipe.java65
5 files changed, 87 insertions, 11 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index 90252d1426..ebd20d48c0 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -2013,7 +2013,8 @@ public enum ItemList implements IItemContainer {
BasicPhotolithographicFrameworkCasing,
ReinforcedPhotolithographicFrameworkCasing,
RadiationProofPhotolithographicFrameworkCasing,
- InfinityCooledCasing;
+ InfinityCooledCasing,
+ Machine_Multi_TranscendentPlasmaMixer;
public static final ItemList[] DYE_ONLY_ITEMS = { Color_00, Color_01, Color_02, Color_03, Color_04, Color_05,
Color_06, Color_07, Color_08, Color_09, Color_10, Color_11, Color_12, Color_13, Color_14, Color_15 },
diff --git a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java
index 29b32b5d3b..8bb0ed87aa 100644
--- a/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java
+++ b/src/main/java/gregtech/api/interfaces/IGlobalWirelessEnergy.java
@@ -7,12 +7,12 @@ import java.util.UUID;
import net.minecraft.entity.player.EntityPlayer;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.common.misc.GlobalEnergyWorldSavedData;
// If you are adding very late-game content feel free to tap into this interface.
// The eventual goal is to bypass laser/dynamo stuff and have energy deposited directly from ultra-endgame
// multi-blocks directly into the users network.
-@SuppressWarnings("unused")
public interface IGlobalWirelessEnergy {
// User 0 will join user 1 by calling this function. They will share the same energy network.
@@ -57,7 +57,7 @@ public interface IGlobalWirelessEnergy {
// If the value goes below 0 it will return false and not perform the operation.
// BigIntegers have much slower operations than longs/ints. You should call these methods
// as infrequently as possible and bulk store values to add to the global map.
- default boolean addEUToGlobalEnergyMap(String user_uuid, BigInteger EU) {
+ default boolean addEUToGlobalEnergyMap(String userUUID, BigInteger EU) {
// Mark the data as dirty and in need of saving.
try {
@@ -68,15 +68,15 @@ public interface IGlobalWirelessEnergy {
}
// Get the team UUID. Users are by default in a team with a UUID equal to their player UUID.
- String team_uuid = GlobalEnergyTeam.getOrDefault(user_uuid, user_uuid);
+ String teamUUID = GlobalEnergyTeam.getOrDefault(userUUID, userUUID);
// Get the teams total energy stored. If they are not in the map, return 0 EU.
- BigInteger total_eu = GlobalEnergy.getOrDefault(team_uuid, BigInteger.ZERO);
- total_eu = total_eu.add(EU);
+ BigInteger totalEU = GlobalEnergy.getOrDefault(teamUUID, BigInteger.ZERO);
+ totalEU = totalEU.add(EU);
// If there is sufficient EU then complete the operation and return true.
- if (total_eu.signum() >= 0) {
- GlobalEnergy.put(team_uuid, total_eu);
+ if (totalEU.signum() >= 0) {
+ GlobalEnergy.put(teamUUID, totalEU);
return true;
}
@@ -137,4 +137,14 @@ public interface IGlobalWirelessEnergy {
GlobalEnergyName.clear();
GlobalEnergyTeam.clear();
}
+
+ default String processInitialSettings(final IGregTechTileEntity machine) {
+
+ // UUID and username of the owner.
+ final String UUID = machine.getOwnerUuid().toString();
+ final String name = machine.getOwnerName();
+
+ strongCheckOrAddUser(UUID, name);
+ return UUID;
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 7408701f16..d8a512c954 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -599,7 +599,7 @@ public class BaseMetaTileEntity extends CommonMetaTileEntity implements IGregTec
tTime = System.nanoTime() - tTime;
if (mTimeStatistics.length > 0) mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1)
% mTimeStatistics.length] = (int) tTime;
- if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1000000L)
+ if (tTime > 0 && tTime > (GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING * 1_000_000L)
&& mTickTimer > 1000
&& getMetaTileEntity().doTickProfilingMessageDuringThisTick()
&& mLagWarningCount++ < 10)
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index e6ea51c59d..80b6723d81 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -465,7 +465,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
}
protected long getActualEnergyUsage() {
- return ((long) -mEUt * 10000) / Math.max(1000, mEfficiency);
+ return ((long) -mEUt * 10_000) / Math.max(1000, mEfficiency);
}
/**
@@ -693,7 +693,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity
/**
* Calcualtes the overclockedness using long integers
- *
+ *
* @param aEUt - recipe EUt
* @param aDuration - recipe Duration
* @param mAmperage - should be 1 ?
diff --git a/src/main/java/gregtech/api/util/GT_Recipe.java b/src/main/java/gregtech/api/util/GT_Recipe.java
index 32d841dfa8..59fd3da31d 100644
--- a/src/main/java/gregtech/api/util/GT_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Recipe.java
@@ -1,6 +1,7 @@
package gregtech.api.util;
import static gregtech.api.enums.GT_Values.*;
+import static gregtech.api.util.GT_Utility.formatNumbers;
import static net.minecraft.util.EnumChatFormatting.GRAY;
import java.awt.*;
@@ -1728,6 +1729,70 @@ public class GT_Recipe implements Comparable<GT_Recipe> {
true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT)
.setUsualFluidInputCount(9).setUsualFluidOutputCount(9)
.setNEISpecialInfoFormatter(HeatingCoilSpecialValueFormatter.INSTANCE);
+
+ public static final GT_Recipe_Map sTranscendentPlasmaMixerRecipes = new TranscendentPlasmaMixerRecipeMap(
+ new HashSet<>(20),
+ "gt.recipe.transcendentplasmamixerrecipes",
+ "Transcendent Plasma Mixer",
+ null,
+ RES_PATH_GUI + "basicmachines/PlasmaForge",
+ 1,
+ 0,
+ 0,
+ 0,
+ 1,
+ "",
+ 0,
+ "",
+ false,
+ true).setProgressBar(GT_UITextures.PROGRESSBAR_ARROW, ProgressBar.Direction.RIGHT)
+ .setUsualFluidInputCount(18).setUsualFluidOutputCount(1);
+
+ public static class TranscendentPlasmaMixerRecipeMap extends GT_Recipe_Map_LargeNEI {
+
+ public TranscendentPlasmaMixerRecipeMap(Collection<GT_Recipe> aRecipeList, String aUnlocalizedName,
+ String aLocalName, String aNEIName, String aNEIGUIPath, int aUsualInputCount, int aUsualOutputCount,
+ int aMinimalInputItems, int aMinimalInputFluids, int aAmperage, String aNEISpecialValuePre,
+ int aNEISpecialValueMultiplier, String aNEISpecialValuePost, boolean aShowVoltageAmperageInNEI,
+ boolean aNEIAllowed) {
+ super(
+ aRecipeList,
+ aUnlocalizedName,
+ aLocalName,
+ aNEIName,
+ aNEIGUIPath,
+ aUsualInputCount,
+ aUsualOutputCount,
+ aMinimalInputItems,
+ aMinimalInputFluids,
+ aAmperage,
+ aNEISpecialValuePre,
+ aNEISpecialValueMultiplier,
+ aNEISpecialValuePost,
+ aShowVoltageAmperageInNEI,
+ aNEIAllowed);
+ useModularUI(true);
+ setNEISpecialInfoFormatter((recipeInfo, applyPrefixAndSuffix) -> {
+ final GT_Recipe recipe = recipeInfo.recipe;
+ List<String> result = new ArrayList<>();
+
+ result.add("Total: " + formatNumbers(1000L * (long) recipe.mEUt) + " EU");
+
+ result.add("Average: " + formatNumbers((1000L * (long) recipe.mEUt) / recipe.mDuration) + "EU/t");
+
+ result.add("Time: " + formatNumbers((double) recipe.mDuration / 20L) + "s");
+
+ return result;
+ });
+ }
+
+ @Override
+ public void drawNEIDescription(NEIRecipeInfo recipeInfo) {
+ drawNEISpecialInfo(recipeInfo);
+ drawNEIRecipeOwnerInfo(recipeInfo);
+ }
+ }
+
public static final GT_Recipe_Map sPrimitiveBlastRecipes = new GT_Recipe_Map(
new HashSet<>(200),
"gt.recipe.primitiveblastfurnace",