aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-11-24 16:14:12 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-11-24 16:14:12 +0000
commitf3a698a3af1826ef6f5ac719d31334b930e0005e (patch)
tree5964a9e90c6c3bd3fd71a3e65a48d3ff3f9277e9 /src
parent9ba6d563d1b69bc8aa88d48754c273dae77aa713 (diff)
downloadGT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.gz
GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.tar.bz2
GT5-Unofficial-f3a698a3af1826ef6f5ac719d31334b930e0005e.zip
+ Added Concurrent Set objects to the API.
+ Added Flexible Pair objects to the API. + Added logging to ICO formation code. % Adjusted position of GUI elements in NEI for Chemical Plant recipes. % Adjusted the recipe for the Lava Filter. % Adjusted which fluids are returned when requesting tiered fluids from CI. This will inevitably adjust many recipes as a result. % Adjusted handling of the creative energy buffer. % Adjusted Achievement handler for Dev Mode. % Adjusted Tank Capacity on my Chemical Plants. $ Fixed Output buffer checks on multiblocks, Closes #574. $ Fixed LuV Super Bus recipes, Closes #575. (ULV super bus recipe is still broken for the time being) $ Attempted once more to fix Hot Water localization.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/AutoMap.java14
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java18
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java53
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java39
-rw-r--r--src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java13
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java77
-rw-r--r--src/Java/gtPlusPlus/core/recipe/common/CI.java16
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java9
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java51
-rw-r--r--src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java22
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java464
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java101
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java74
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java26
16 files changed, 789 insertions, 210 deletions
diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
index 9e7f702200..02517097cf 100644
--- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
+++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java
@@ -70,6 +70,20 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect
}
}
}
+
+ /**
+ * Generates an AutoMap from a Array.
+ * @param aArray - Data to be inserted into the AutoMap.
+ */
+ public AutoMap(V[] aArray) {
+ mInternalMap = new LinkedHashMap<Integer, V>();
+ mInternalNameMap = new LinkedHashMap<String, Integer>();
+ if (aArray != null && aArray.length > 0) {
+ for (V obj : aArray) {
+ add(obj);
+ }
+ }
+ }
@Override
public Iterator<V> iterator() {
diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java
new file mode 100644
index 0000000000..991908e402
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentHashSet.java
@@ -0,0 +1,18 @@
+package gtPlusPlus.api.objects.data;
+
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+public class ConcurrentHashSet<V> extends ConcurrentSet<V> {
+
+ private static final long serialVersionUID = -1293478938482781728L;
+
+ public ConcurrentHashSet() {
+ this(new ConcurrentHashMap<Integer, V>());
+ }
+
+ public ConcurrentHashSet(ConcurrentMap<Integer, V> defaultMapType) {
+ super(defaultMapType);
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
new file mode 100644
index 0000000000..1d3ffc1c01
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/ConcurrentSet.java
@@ -0,0 +1,53 @@
+package gtPlusPlus.api.objects.data;
+
+import java.io.Serializable;
+import java.util.AbstractSet;
+import java.util.Iterator;
+import java.util.concurrent.ConcurrentMap;
+
+public abstract class ConcurrentSet<E> extends AbstractSet<E> implements Serializable {
+
+ private static final long serialVersionUID = -6761513279741915432L;
+
+ private final ConcurrentMap<Integer, E> mInternalMap;
+
+ private int mInternalID = 0;
+
+ /**
+ * Creates a new instance which wraps the specified {@code map}.
+ */
+ public ConcurrentSet(ConcurrentMap<Integer, E> aMap) {
+ mInternalMap = aMap;
+ }
+
+ @Override
+ public int size() {
+ return mInternalMap.size();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return mInternalMap.containsKey(o);
+ }
+
+ @Override
+ public boolean add(E o) {
+ return mInternalMap.putIfAbsent(mInternalID++, o) == null;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return mInternalMap.remove(o) != null;
+ }
+
+ @Override
+ public void clear() {
+ this.mInternalID = 0;
+ mInternalMap.clear();
+ }
+
+ @Override
+ public Iterator<E> iterator() {
+ return mInternalMap.values().iterator();
+ }
+}
diff --git a/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java
new file mode 100644
index 0000000000..64f57b4e5a
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/data/FlexiblePair.java
@@ -0,0 +1,39 @@
+package gtPlusPlus.api.objects.data;
+
+import java.io.Serializable;
+
+import com.google.common.base.Objects;
+
+public class FlexiblePair<K,V> implements Serializable {
+
+ /**
+ * SVUID
+ */
+ private static final long serialVersionUID = 1250550491092812443L;
+ private final K key;
+ private V value;
+
+ public FlexiblePair(final K key, final V value){
+ this.key = key;
+ this.value = value;
+ }
+
+ final public K getKey(){
+ return this.key;
+ }
+
+ final public V getValue(){
+ return this.value;
+ }
+
+ final public void setValue(V aObj) {
+ value = aObj;
+ }
+
+ @Override
+ public int hashCode() {
+ Integer aCode = Objects.hashCode(getKey(), getValue());
+ return aCode != null ? aCode : super.hashCode();
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
index b10e67aeaf..8853acd4b7 100644
--- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
+++ b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
@@ -1,8 +1,8 @@
package gtPlusPlus.core.handler;
+import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import gtPlusPlus.core.util.math.MathUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import net.minecraft.client.Minecraft;
import net.minecraft.stats.AchievementList;
import net.minecraftforge.event.entity.player.AchievementEvent;
@@ -12,12 +12,15 @@ public class StopAnnoyingFuckingAchievements {
* Stops me getting fireworks every fucking time I open my inventory upon first loading a dev client.
* @param event
*/
- @SubscribeEvent
+ @SubscribeEvent(priority=EventPriority.HIGHEST)
public void FUCK_OFF(AchievementEvent event) {
if (event.achievement.equals(AchievementList.openInventory)) {
- if (MathUtils.randInt(0, 10) >= 9)
- PlayerUtils.messagePlayer(event.entityPlayer, "Bang! Nah, Just joking, there's no fireworks. :)");
event.setCanceled(true);
+ if (Minecraft.getMinecraft() != null) {
+ if (Minecraft.getMinecraft().gameSettings != null) {
+ Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
+ }
+ }
}
}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index bc1c7fc398..c0a4a998e8 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -1063,7 +1063,20 @@ public class RECIPES_Machines {
RECIPE_ThermalBoilerCasing);
//Lava Filter Recipe
- GT_Values.RA.addAssemblerRecipe(ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 16), CI.getNumberedCircuit(18), ItemUtils.getSimpleStack(ModItems.itemLavaFilter), 80*20, 16);
+ CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
+ CI.getNumberedCircuit(18),
+ ItemUtils.getItemStackOfAmountFromOreDict("dustCarbon", GTNH ? 64 : 32),
+ ItemUtils.getItemStackOfAmountFromOreDict("wireFineSteel", GTNH ? 64 : 32),
+ ItemUtils.getItemStackOfAmountFromOreDict("ringTumbaga", GTNH ? 32 : 16),
+ ItemUtils.getItemStackOfAmountFromOreDict("foilCopper", GTNH ? 8 : 4),
+ ItemUtils.getItemStackWithMeta(LoadedMods.IndustrialCraft2, "IC2:itemPartCarbonMesh", "RawCarbonMesh", 0, 64),
+
+ },
+ CI.getTieredFluid(3, 144),
+ ItemUtils.getSimpleStack(ModItems.itemLavaFilter, GTNH ? 8 : 16),
+ 1600,
+ 240
+ );
}
if (CORE.ConfigSwitches.enableMultiblock_LiquidFluorideThoriumReactor){
@@ -2201,10 +2214,10 @@ public class RECIPES_Machines {
ItemList.Hatch_Input_Bus_ZPM.get(1),
ItemList.Hatch_Input_Bus_UV.get(1),
ItemList.Hatch_Input_Bus_MAX.get(1),
- GregtechItemList.Hatch_SuperBus_Input_ULV.get(1),
GregtechItemList.Hatch_SuperBus_Input_LV.get(1),
GregtechItemList.Hatch_SuperBus_Input_MV.get(1),
GregtechItemList.Hatch_SuperBus_Input_HV.get(1),
+ GregtechItemList.Hatch_SuperBus_Input_EV.get(1),
};
ItemStack[] mOutputHatch = new ItemStack[] {
@@ -2214,20 +2227,66 @@ public class RECIPES_Machines {
ItemList.Hatch_Output_Bus_ZPM.get(1),
ItemList.Hatch_Output_Bus_UV.get(1),
ItemList.Hatch_Output_Bus_MAX.get(1),
- GregtechItemList.Hatch_SuperBus_Output_ULV.get(1),
GregtechItemList.Hatch_SuperBus_Output_LV.get(1),
GregtechItemList.Hatch_SuperBus_Output_MV.get(1),
GregtechItemList.Hatch_SuperBus_Output_HV.get(1),
+ GregtechItemList.Hatch_SuperBus_Output_EV.get(1),
};
+ // Special Case recipes for ULV buses
+ {
+
+ int i = 0;
+ ItemStack[] aInputs1 = new ItemStack[] {
+ CI.getNumberedCircuit(17),
+ mInputHatch[i],
+ CI.getElectricMotor(i, GTNH ? 8 : 2),
+ CI.getConveyor(i, GTNH ? 10 : 5),
+ CI.getBolt(i, GTNH ? 32 : 16),
+ CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2)
+ };
+ Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aInputs1));
+ ItemStack[] aOutputs1 = new ItemStack[] {
+ CI.getNumberedCircuit(18),
+ mOutputHatch[i],
+ CI.getElectricPiston(i, GTNH ? 8 : 2),
+ CI.getConveyor(i, GTNH ? 10 : 5),
+ CI.getGear(i, GTNH ? 6 : 3),
+ CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2)
+ };
+ Logger.INFO("[FIND] "+ItemUtils.getArrayStackNames(aOutputs1));
+
+ FluidStack a1 = CI.getAlternativeTieredFluid(i, 144 * 8);
+ FluidStack a2 = CI.getTertiaryTieredFluid(i, 144 * 8);
+
+
+ Logger.INFO("[FIND] Input Bus Fluid: "+ItemUtils.getFluidName(a1));
+ Logger.INFO("[FIND] Output Bus Fluid: "+ItemUtils.getFluidName(a2));
+
+
+ CORE.RA.addSixSlotAssemblingRecipe(aInputs1,
+ a1,
+ mSuperBusesInput[i].get(1),
+ 20 * 30 * 2 * i,
+ (int) GT_Values.V[i]);
+
+ CORE.RA.addSixSlotAssemblingRecipe(aOutputs1,
+ a2,
+ mSuperBusesOutput[i].get(1),
+ 20 * 30 * 2 * i,
+ (int) GT_Values.V[i]);
+
+
+ }
+
//Input Buses
- for (int i = 0; i < 10; i++) {
+ for (int i = 1; i < 10; i++) {
CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
- CI.getNumberedCircuit(16),
+ CI.getNumberedCircuit(17),
mInputHatch[i],
CI.getElectricMotor(i, GTNH ? 8 : 2),
CI.getConveyor(i, GTNH ? 10 : 5),
- CI.getGear(i, GTNH ? 6 : 3),
+ CI.getBolt(i, GTNH ? 32 : 16),
CI.getTieredComponent(OrePrefixes.circuit, i, GTNH ? 4 : 2)
},
CI.getAlternativeTieredFluid(i, 144 * 8),
@@ -2235,7 +2294,7 @@ public class RECIPES_Machines {
(int) GT_Values.V[i]);
}
//Output Buses
- for (int i = 0; i < 10; i++) {
+ for (int i = 1; i < 10; i++) {
CORE.RA.addSixSlotAssemblingRecipe(new ItemStack[] {
CI.getNumberedCircuit(18),
mOutputHatch[i],
@@ -2259,7 +2318,7 @@ public class RECIPES_Machines {
CI.craftingToolWrench, CI.machineCasing_ULV, CI.craftingToolScrewdriver,
ItemUtils.getSimpleStack(Blocks.hopper), "circuitPrimitive", ItemUtils.getSimpleStack(Blocks.hopper),
ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1));
-
+
ItemStack[] aRobinators = new ItemStack[] {
ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 0, 1),
ItemUtils.simpleMetaStack(ModBlocks.blockRoundRobinator, 1, 1),
@@ -2283,7 +2342,7 @@ public class RECIPES_Machines {
CI.getTieredComponent(OrePrefixes.plate, aTier, 4 * aCostMultiplier),
CI.getTieredComponent(OrePrefixes.circuit, i, 2 * aCostMultiplier),
};
-
+
CORE.RA.addSixSlotAssemblingRecipe(
aInputs,
CI.getAlternativeTieredFluid(aTier, (144 * 2 * i)), //Input Fluid
diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java
index 63477cda19..968a96135e 100644
--- a/src/Java/gtPlusPlus/core/recipe/common/CI.java
+++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java
@@ -634,12 +634,22 @@ public class CI {
}
public static FluidStack getTieredFluid(int aTier, int aAmount, int aType) {
- ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1);
+ // Weird Legacy handling
+ /*ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1);
FluidStack a = GT_Utility.getFluidForFilledItem(aCell, true);
if (a == null) {
a = aMaster[aType][aTier].getFluid(aAmount);
- }
- a.amount = aAmount;
+ }*/
+
+ // Modern Handling
+ FluidStack a = aMaster[aType][aTier].getFluid(aAmount);
+ if (a == null) {
+ ItemStack aCell = getTieredComponent(OrePrefixes.liquid, aTier, 1);
+ if (aCell != null) {
+ a = GT_Utility.getFluidForFilledItem(aCell, true);
+ a.amount = aAmount;
+ }
+ }
return a;
}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index 88fdda555c..cb490203df 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -47,6 +47,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
+import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
@@ -1083,6 +1084,14 @@ public class ItemUtils {
}
+
+ public static String getFluidName(FluidStack aFluid) {
+ return aFluid != null ? aFluid.getFluid().getLocalizedName(aFluid) : "NULL";
+ }
+
+ public static String getFluidName(Fluid aFluid) {
+ return aFluid != null ? aFluid.getLocalizedName() : "NULL";
+ }
public static String getItemName(ItemStack aStack) {
if (aStack == null) {
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java
new file mode 100644
index 0000000000..1de4209bf9
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/util/minecraft/LangUtils.java
@@ -0,0 +1,51 @@
+package gtPlusPlus.core.util.minecraft;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+
+public class LangUtils {
+
+
+ public static boolean rewriteEntryForLanguageRegistry(String aKey, String aNewValue){
+ return rewriteEntryForLanguageRegistry("en_US", aKey, aNewValue);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static boolean rewriteEntryForLanguageRegistry(String aLang, String aKey, String aNewValue){
+ LanguageRegistry aInstance = LanguageRegistry.instance();
+ Field aModLanguageData = ReflectionUtils.getField(LanguageRegistry.class, "modLanguageData");
+ if (aModLanguageData != null){
+ Map<String,Properties> aProps = new HashMap<String, Properties>();
+ Object aInstanceProps;
+ try {
+ aInstanceProps = aModLanguageData.get(aInstance);
+ if (aInstanceProps != null){
+ aProps = (Map<String, Properties>) aInstanceProps;
+ Properties aLangProps = aProps.get(aLang);
+ if (aLangProps != null){
+ if (aLangProps.containsKey(aKey)) {
+ aLangProps.remove(aKey);
+ aLangProps.put(aKey, aNewValue);
+ }
+ else {
+ aLangProps.put(aKey, aNewValue);
+ }
+ aProps.remove(aLang);
+ aProps.put(aLang, aLangProps);
+ ReflectionUtils.setField(aInstance, aModLanguageData, aProps);
+ }
+ }
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {
+
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
index 5c5d1169aa..e4279cf489 100644
--- a/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
+++ b/src/Java/gtPlusPlus/nei/GT_NEI_FluidReactor.java
@@ -65,7 +65,7 @@ extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(final String outputId, final Object... results) {
- if (outputId.equals(this.getOverlayIdentifier())) {
+ if (outputId.equals(this.mRecipeMap.mNEIName)) {
for (final GT_Recipe tRecipe : this.mRecipeMap.mRecipeList) {
if (!tRecipe.mHidden) {
this.arecipes.add(new CachedDefaultRecipe(tRecipe));
@@ -146,7 +146,8 @@ extends TemplateRecipeHandler {
@Override
public String getOverlayIdentifier() {
- return this.mRecipeMap.mNEIName;
+ //return this.mRecipeMap.mNEIName;
+ return "Penis";
}
@Override
@@ -163,7 +164,8 @@ extends TemplateRecipeHandler {
@Override
public String getRecipeName() {
- return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
+ //return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName);
+ return " Chem Plant";
}
@Override
@@ -201,24 +203,24 @@ extends TemplateRecipeHandler {
@Override
public void drawExtras(final int aRecipeIndex) {
- final int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
+ final long tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt;
final int tDuration = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration;
if (tEUt != 0) {
- drawText(10, 73, "Total: " + (tDuration * tEUt) + " EU", -16777216);
- drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216);
+ drawText(10, 73, "Total: " + (long) (tDuration * tEUt) + " EU", -16777216);
+ //drawText(10, 83, "Usage: " + tEUt + " EU/t", -16777216);
if (this.mRecipeMap.mShowVoltageAmperageInNEI) {
- drawText(10, 93, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU", -16777216);
- drawText(10, 103, "Amperage: " + this.mRecipeMap.mAmperage, -16777216);
+ drawText(10, 83, "Voltage: " + (tEUt / this.mRecipeMap.mAmperage) + " EU/t", -16777216);
+ drawText(10, 93, "Amperage: " + this.mRecipeMap.mAmperage, -16777216);
} else {
drawText(10, 93, "Voltage: unspecified", -16777216);
drawText(10, 103, "Amperage: unspecified", -16777216);
}
}
if (tDuration > 0) {
- drawText(10, 113, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216);
+ drawText(10, 103, "Time: " + (tDuration < 20 ? "< 1" : Integer.valueOf(tDuration / 20)) + " secs", -16777216);
}
if ((GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePre)) || (GT_Utility.isStringValid(this.mRecipeMap.mNEISpecialValuePost))) {
- drawText(10, 123, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216);
+ drawText(10, 113, this.mRecipeMap.mNEISpecialValuePre + (((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue * this.mRecipeMap.mNEISpecialValueMultiplier) + this.mRecipeMap.mNEISpecialValuePost, -16777216);
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
index d3e22875ae..88b9661c95 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MultiMachine.java
@@ -101,32 +101,32 @@ public class CONTAINER_MultiMachine extends GT_ContainerMetaTile_Machine {
//crafters = ReflectionUtils.getField(getClass(), "crafters");
}
if (timer != null && crafters != null && mControllerSet) {
- Logger.INFO("Trying to update clientside GUI data");
+ //Logger.INFO("Trying to update clientside GUI data");
try {
- Logger.INFO("0");
+ //Logger.INFO("0");
int aTimer = (int) ReflectionUtils.getFieldValue(timer, this);
//List crafters1List = (List) crafters1;
List<ICrafting> crafters2 = new ArrayList<ICrafting>();
- Logger.INFO("1");
+ //Logger.INFO("1");
for (Object o : crafters) {
if (o instanceof ICrafting) {
crafters2.add((ICrafting) o);
}
}
- Logger.INFO("2");
+ //Logger.INFO("2");
if (!crafters2.isEmpty()) {
- Logger.INFO("3");
+ //Logger.INFO("3");
handleInitialFieldSetting();
try {
- Logger.INFO("4");
+ //Logger.INFO("4");
for (final ICrafting var3 : crafters2) {
handleCraftingEvent(aTimer, var3);
}
- Logger.INFO("5");
+ //Logger.INFO("5");
handleInternalFieldSetting();
- Logger.INFO("6");
+ //Logger.INFO("6");
} catch (Throwable t) {
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 68b81182fc..2e50d12aca 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -42,6 +42,11 @@ import gtPlusPlus.GTplusplus;
import gtPlusPlus.GTplusplus.INIT_PHASE;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.api.objects.data.ConcurrentHashSet;
+import gtPlusPlus.api.objects.data.ConcurrentSet;
+import gtPlusPlus.api.objects.data.FlexiblePair;
+import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.api.objects.data.Triplet;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
@@ -49,6 +54,7 @@ import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.preloader.asm.AsmConfig;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine;
import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MultiMachine_NoPlayerInventory;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MultiMachine;
@@ -59,6 +65,7 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements;
+
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -92,12 +99,12 @@ GT_MetaTileEntity_MultiBlockBase {
else {
aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class);
}
-
+
try {
calculatePollutionReduction = GT_MetaTileEntity_Hatch_Muffler.class.getDeclaredMethod("calculatePollutionReduction", int.class);
} catch (NoSuchMethodException | SecurityException e) {}
-
-
+
+
//gregtech.api.util.GT_Recipe.GT_Recipe_Map.findRecipe(IHasWorldObjectAndCoords, GT_Recipe, boolean, long, FluidStack[], ItemStack, ItemStack...)
}
@@ -135,7 +142,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
public abstract boolean hasSlotInGUI();
-
+
public long getTotalRuntimeInTicks() {
return this.mTotalRunTime;
}
@@ -276,7 +283,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
-
+
public int getPollutionReductionForAllMufflers() {
int mPollutionReduction=0;
for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
@@ -286,7 +293,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
return mPollutionReduction;
}
-
+
public long getStoredEnergyInAllEnergyHatches() {
long storedEnergy=0;
for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
@@ -296,7 +303,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
return storedEnergy;
}
-
+
public long getMaxEnergyStorageOfAllEnergyHatches() {
long maxEnergy=0;
for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
@@ -408,7 +415,7 @@ GT_MetaTileEntity_MultiBlockBase {
String[] aToolTip = new String[(a2 + a3)];
aToolTip = ArrayUtils.addAll(aToolTip, x);
aToolTip = ArrayUtils.addAll(aToolTip, z);
-
+
if (aCachedToolTip == null || aCachedToolTip.length <= 0) {
aCachedToolTip = aToolTip;
}
@@ -465,66 +472,300 @@ GT_MetaTileEntity_MultiBlockBase {
public String getSound() { return ""; }
public boolean canBufferOutputs(final GT_Recipe aRecipe, int aParallelRecipes) {
- if (aRecipe.mOutputs.length > 16) {
- // Gendustry custom comb with a billion centrifuge outputs? Do it anyway.
- return true;
- }
- // Count slots available in output buses
- ArrayList<ItemStack> tBusStacks = new ArrayList<>();
+ Logger.INFO("Determining if we have space to buffer outputs.");
+
+ // Null recipe or a recipe with lots of outputs?
+ // E.G. Gendustry custom comb with a billion centrifuge outputs?
+ // Do it anyway.
+ if (aRecipe == null || aRecipe.mOutputs.length > 16) {
+ return aRecipe == null ? false : true;
+ }
- int tEmptySlots = 0;
- for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) {
- if (!isValidMetaTileEntity(tBus)) {
- continue;
+ // Do we even need to check for item outputs?
+ boolean aDoesOutputItems = aRecipe.mOutputs.length > 0;
+ // Do we even need to check for fluid outputs?
+ boolean aDoesOutputFluids = aRecipe.mFluidOutputs.length > 0;
+
+
+
+ /* ========================================
+ * Item Management
+ * ========================================
+ */
+
+ if (aDoesOutputItems) {
+ Logger.INFO("We have items to output.");
+
+ // How many slots are free across all the output buses?
+ int aInputBusSlotsFree = 0;
+
+ /*
+ * Create Variables for Item Output
+ */
+
+ AutoMap<FlexiblePair<ItemStack, Integer>> aItemMap = new AutoMap<FlexiblePair<ItemStack, Integer>>();
+ AutoMap<ItemStack> aOutputs = new AutoMap<ItemStack>(aRecipe.mOutputs);
+
+ for (final GT_MetaTileEntity_Hatch_OutputBus tBus : this.mOutputBusses) {
+ if (!isValidMetaTileEntity(tBus)) {
+ continue;
+ }
+ final IInventory tBusInv = tBus.getBaseMetaTileEntity();
+ for (int i = 0; i < tBusInv.getSizeInventory(); i++) {
+ if (tBus.getStackInSlot(i) == null) {
+ aInputBusSlotsFree++;
+ }
+ else {
+ ItemStack aT = tBus.getStackInSlot(i);
+ int aSize = aT.stackSize;
+ aT = aT.copy();
+ aT.stackSize = 0;
+ aItemMap.put(new FlexiblePair<ItemStack, Integer>(aT, aSize));
+ }
+ }
}
- final IInventory tBusInv = tBus.getBaseMetaTileEntity();
- for (int i = 0; i < tBusInv.getSizeInventory(); i++) {
- if (tBus.getStackInSlot(i) == null) {
- tEmptySlots++;
+
+ // Count the slots we need, later we can check if any are able to merge with existing stacks
+ int aRecipeSlotsRequired = 0;
+
+ // A map to hold the items we will be 'inputting' into the output buses. These itemstacks are actually the recipe outputs.
+ ConcurrentSet<FlexiblePair<ItemStack, Integer>> aInputMap = new ConcurrentHashSet<FlexiblePair<ItemStack, Integer>>();
+
+ // Iterate over the outputs, calculating require stack spacing they will require.
+ for (int i=0;i<aOutputs.size();i++) {
+ ItemStack aY = aOutputs.get(i);
+ if (aY == null) {
+ continue;
}
else {
- tBusStacks.add(tBus.getStackInSlot(i));
- }
+ int aStackSize = aY.stackSize * aParallelRecipes;
+ if (aStackSize > 64) {
+ int aSlotsNeedsForThisStack = (int) Math.ceil((double) ((float) aStackSize / 64f));
+ // Sould round up and add as many stacks as required nicely.
+ aRecipeSlotsRequired += aSlotsNeedsForThisStack;
+ for (int o=0;o<aRecipeSlotsRequired;o++) {
+ int aStackToRemove = (aStackSize -= 64) > 64 ? 64 : aStackSize;
+ aY = aY.copy();
+ aY.stackSize = 0;
+ aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackToRemove));
+ }
+ }
+ else {
+ // Only requires one slot
+ aRecipeSlotsRequired++;
+ aY = aY.copy();
+ aY.stackSize = 0;
+ aInputMap.add(new FlexiblePair<ItemStack, Integer>(aY, aStackSize));
+ }
+ }
+ }
+
+ // We have items to add to the output buses. See if any are not full stacks and see if we can make them full.
+ if (aInputMap.size() > 0) {
+ // Iterate over the current stored items in the Output busses, if any match and are not full, we can try account for merging.
+ busItems: for (FlexiblePair<ItemStack, Integer> y : aItemMap) {
+ // Iterate over the 'inputs', we can safely remove these as we go.
+ outputItems: for (FlexiblePair<ItemStack, Integer> u : aInputMap) {
+ // Create local vars for readability.
+ ItemStack aOutputBusStack = y.getKey();
+ ItemStack aOutputStack = u.getKey();
+ // Stacks match, including NBT.
+ if (GT_Utility.areStacksEqual(aOutputBusStack, aOutputStack, false)) {
+ // Stack Matches, but it's full, continue.
+ if (aOutputBusStack.stackSize >= 64) {
+ // This stack is full, no point checking it.
+ continue busItems;
+ }
+ else {
+ // We can merge these two stacks without any hassle.
+ if ((aOutputBusStack.stackSize + aOutputStack.stackSize) <= 64) {
+ // Update the stack size in the bus storage map.
+ y.setValue(aOutputBusStack.stackSize + aOutputStack.stackSize);
+ // Remove the 'input' stack from the recipe outputs, so we don't try count it again.
+ aInputMap.remove(u);
+ continue outputItems;
+ }
+ // Stack merging is too much, so we fill this stack, leave the remainder.
+ else {
+ int aRemainder = (aOutputBusStack.stackSize + aOutputStack.stackSize) - 64;
+ // Update the stack size in the bus storage map.
+ y.setValue(64);
+ // Create a new object to iterate over later, with the remainder data;
+ FlexiblePair<ItemStack, Integer> t = new FlexiblePair<ItemStack, Integer>(u.getKey(), aRemainder);
+ // Remove the 'input' stack from the recipe outputs, so we don't try count it again.
+ aInputMap.remove(u);
+ // Add the remainder stack.
+ aInputMap.add(t);
+ continue outputItems;
+ }
+ }
+ }
+ else {
+ continue outputItems;
+ }
+ }
+ }
}
+
+ // We have stacks that did not merge, do we have space for them?
+ if (aInputMap.size() > 0) {
+ if (aInputMap.size() > aInputBusSlotsFree) {
+ // We do not have enough free slots in total to accommodate the remaining managed stacks.
+ Logger.INFO("Failed to find enough space for all item outputs.");
+ return false;
+ }
+ }
+
+ /*
+ * End Item Management
+ */
+
}
- int slotsNeeded = aRecipe.mOutputs.length;
- for (final ItemStack tRecipeOutput: aRecipe.mOutputs) {
- if (tRecipeOutput == null) continue;
- int amount = tRecipeOutput.stackSize * aParallelRecipes;
- for (final ItemStack tBusStack : tBusStacks) {
- if (GT_Utility.areStacksEqual(tBusStack, tRecipeOutput)) {
- if (tBusStack.stackSize + amount <= tBusStack.getMaxStackSize()) {
- slotsNeeded--;
- break;
- }
+
+
+
+
+ /* ========================================
+ * Fluid Management
+ * ========================================
+ */
+
+
+
+ if (aDoesOutputFluids) {
+ Logger.INFO("We have Fluids to output.");
+ // How many slots are free across all the output buses?
+ int aFluidHatches = 0;
+ int aEmptyFluidHatches = 0;
+ int aFullFluidHatches = 0;
+ // Create Map for Fluid Output
+ ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>> aOutputHatches = new ConcurrentHashSet<Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>>();
+ for (final GT_MetaTileEntity_Hatch_Output tBus : this.mOutputHatches) {
+ if (!isValidMetaTileEntity(tBus)) {
+ continue;
+ }
+ aFluidHatches++;
+ // Map the Hatch with the space left for easy checking later.
+ if (tBus.getFluid() == null) {
+ aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, null, tBus.getCapacity()));
+ }
+ else {
+ int aSpaceLeft = tBus.getCapacity() - tBus.getFluidAmount();
+ aOutputHatches.add(new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(tBus, tBus.getFluid(), aSpaceLeft));
}
}
- }
- // Enough open slots?
- if (tEmptySlots < slotsNeeded) return false;
-
- // For each output fluid, make sure an output hatch can accept it.
- for (FluidStack tRecipeFluid: aRecipe.mFluidOutputs) {
- if (tRecipeFluid == null) continue;
- boolean tCanBufferFluid = false;
- int tRecipeAmount = tRecipeFluid.amount;
- for (final GT_MetaTileEntity_Hatch_Output tHatch : this.mOutputHatches) {
- FluidStack tHatchFluid = tHatch.getFluid();
- if (tHatchFluid == null) {
- if(tHatch.getCapacity() > tRecipeAmount) {
- tCanBufferFluid = true;
- break;
- }
+ // Create a map of all the fluids we would like to output, we can iterate over this and see how many we can merge into existing hatch stacks.
+ ConcurrentHashSet<FluidStack> aOutputFluids = new ConcurrentHashSet<FluidStack>();
+ // Ugly ass boxing
+ aOutputFluids.addAll(new AutoMap<FluidStack>(aRecipe.mFluidOutputs));
+ // Iterate the Hatches, updating their 'stored' data.
+ aHatchIterator: for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aHatchData : aOutputHatches) {
+ // The Hatch Itself
+ GT_MetaTileEntity_Hatch_Output aHatch = aHatchData.getValue_1();
+ // Fluid in the Hatch
+ FluidStack aHatchStack = aHatchData.getValue_2();
+ // Space left in Hatch
+ int aSpaceLeftInHatch = aHatch.getCapacity() - aHatch.getFluidAmount();
+ // Hatch is full,
+ if (aSpaceLeftInHatch <= 0) {
+ aFullFluidHatches++;
+ aOutputHatches.remove(aHatchData);
+ continue aHatchIterator;
}
- else if (tHatchFluid.isFluidEqual(tRecipeFluid) && tHatch.getCapacity() - tHatchFluid.amount > tRecipeAmount) {
- tCanBufferFluid = true;
- break;
+ // Hatch has space
+ else {
+ // Check if any fluids match
+ aFluidMatch: for (FluidStack aOutputStack : aOutputFluids) {
+ if (GT_Utility.areFluidsEqual(aHatchStack, aOutputStack)) {
+ int aFluidToPutIntoHatch = aOutputStack.amount;
+ // Not Enough space to insert all of the fluid.
+ // We fill this hatch and add a smaller Fluidstack back to the iterator.
+ if (aSpaceLeftInHatch < aFluidToPutIntoHatch) {
+ // Copy existing Hatch Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ aNewHatchStack.amount = 0;
+ // Copy existing Hatch Stack again
+ FluidStack aNewOutputStack = aHatchStack.copy();
+ aNewOutputStack.amount = 0;
+ // How much fluid do we have left after we fill the hatch?
+ int aFluidLeftAfterInsert = aFluidToPutIntoHatch - aSpaceLeftInHatch;
+ // Set new stacks to appropriate values
+ aNewHatchStack.amount = aHatch.getCapacity();
+ aNewOutputStack.amount = aFluidLeftAfterInsert;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Add remaining Fluid to Output list
+ aOutputFluids.add(aNewOutputStack);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ continue aHatchIterator;
+ }
+ // We can fill this hatch perfectly (rare case), may as well add it directly to the full list.
+ else if (aSpaceLeftInHatch == aFluidToPutIntoHatch) {
+ // Copy Old Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ // Add in amount from output stack
+ aNewHatchStack.amount += aOutputStack.amount;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ continue aHatchIterator;
+ }
+ // We have more space than we need to merge, so we remove the stack from the output list and update the hatch list.
+ else {
+ // Copy Old Stack
+ FluidStack aNewHatchStack = aHatchStack.copy();
+ // Add in amount from output stack
+ aNewHatchStack.amount += aOutputStack.amount;
+ // Remove fluid from output list, merge success
+ aOutputFluids.remove(aOutputStack);
+ // Remove hatch from hatch list, data is now invalid.
+ aOutputHatches.remove(aHatchData);
+ // Re-add hatch to hatch list, with new data.
+ Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aNewHatchData = new Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer>(aHatch, aNewHatchStack, aNewHatchStack.amount);
+ aOutputHatches.add(aNewHatchData);
+ // Check next fluid
+ continue aFluidMatch;
+ }
+
+ }
+ else {
+ continue aFluidMatch;
+ }
+ }
+ }
+ }
+
+ for (Triplet<GT_MetaTileEntity_Hatch_Output, FluidStack, Integer> aFreeHatchCheck : aOutputHatches) {
+ // Free Hatch
+ if (aFreeHatchCheck.getValue_2() == null || aFreeHatchCheck.getValue_3() == 0 || aFreeHatchCheck.getValue_1().getFluid() == null) {
+ aEmptyFluidHatches++;
}
}
- if (!tCanBufferFluid) return false;
+
+ // We have Fluid Stacks we did not merge. Do we have space?
+ if (aOutputFluids.size() > 0) {
+ // Not enough space to add fluids.
+ if (aOutputFluids.size() < aEmptyFluidHatches) {
+ Logger.INFO("Failed to find enough space for all fluid outputs.");
+ return false;
+ }
+ }
+
+ /*
+ * End Fluid Management
+ */
}
+
return true;
}
@@ -534,20 +775,17 @@ GT_MetaTileEntity_MultiBlockBase {
public static Method aLogger = null;
public void log(String s) {
-
- boolean isDebugLogging = CORE.DEBUG;
- boolean reset = false;
-
- if (reset) {
- if (isDebugLogging) {
+ boolean reset = true;
+ if (reset || aLogger == null) {
+ if (!AsmConfig.disableAllLogging) {
aLogger = ReflectionUtils.getMethod(
Logger.class, "INFO", String.class
- );
+ );
}
else {
aLogger = ReflectionUtils.getMethod(
Logger.class, "MACHINE_INFO", String.class
- );
+ );
}
}
try {
@@ -555,6 +793,7 @@ GT_MetaTileEntity_MultiBlockBase {
}
catch (IllegalAccessException | IllegalArgumentException
| InvocationTargetException e) {
+ e.printStackTrace();
}
}
@@ -741,21 +980,39 @@ GT_MetaTileEntity_MultiBlockBase {
int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) {
// Based on the Processing Array. A bit overkill, but very flexible.
+
// Reset outputs and progress stats
this.mEUt = 0;
this.mMaxProgresstime = 0;
this.mOutputItems = new ItemStack[]{};
this.mOutputFluids = new FluidStack[]{};
-
+
+
+
+ // Get input Voltage
long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+
+ // Get total Amps available to this multiblock
+ long tAmpsIn = 0;
+ for (GT_MetaTileEntity_Hatch_Energy aHatch : this.mEnergyHatches) {
+ tAmpsIn += aHatch.maxAmperesIn();
+ }
+
+ // How much voltage can actually go in
+ long tEffectiveVoltage = tVoltage * tAmpsIn;
+
+ byte tTierInputVoltage = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tEffectiveVoltage));
log("Running checkRecipeGeneric(0)");
+ log("Amps: "+tAmpsIn);
+ log("Input Voltage: "+tVoltage+", Tier: "+tTierInputVoltage);
+ log("Effective Voltage: "+tEffectiveVoltage+", Effective Tier: "+tTier);
GT_Recipe tRecipe = findRecipe(
getBaseMetaTileEntity(), mLastRecipe, false,
- gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+ gregtech.api.enums.GT_Values.V[tTierInputVoltage], aFluidInputs, aItemInputs);
log("Running checkRecipeGeneric(1)");
// Remember last recipe - an optimization for findRecipe()
@@ -767,7 +1024,8 @@ GT_MetaTileEntity_MultiBlockBase {
}
if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) {
- log("BAD RETURN - 2");
+ log("BAD RETURN - 2"); // TODO
+ Logger.INFO("No Output Space.");
return false;
}
@@ -783,12 +1041,12 @@ GT_MetaTileEntity_MultiBlockBase {
log("tVoltage: "+tVoltage);
log("tRecipeEUt: "+tRecipeEUt);
// Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) {
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEffectiveVoltage - tRecipeEUt); parallelRecipes++) {
if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
log("Broke at "+parallelRecipes+".");
break;
}
- log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+". Can use "+tEffectiveVoltage);
tTotalEUt += tRecipeEUt;
}
@@ -813,10 +1071,10 @@ GT_MetaTileEntity_MultiBlockBase {
// Overclock
if (this.mEUt <= 16) {
- this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
- this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ this.mEUt = (this.mEUt * (1 << tTierInputVoltage - 1) * (1 << tTierInputVoltage - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTierInputVoltage - 1));
} else {
- while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTierInputVoltage - 1)]) {
this.mEUt *= 4;
this.mMaxProgresstime /= 2;
}
@@ -1383,36 +1641,36 @@ GT_MetaTileEntity_MultiBlockBase {
public boolean causeMaintenanceIssue() {
boolean b = false;
switch (this.getBaseMetaTileEntity().getRandomNumber(6)) {
- case 0 : {
- this.mWrench = false;
- b = true;
- break;
- }
- case 1 : {
- this.mScrewdriver = false;
- b = true;
- break;
- }
- case 2 : {
- this.mSoftHammer = false;
- b = true;
- break;
- }
- case 3 : {
- this.mHardHammer = false;
- b = true;
- break;
- }
- case 4 : {
- this.mSolderingTool = false;
- b = true;
- break;
- }
- case 5 : {
- this.mCrowbar = false;
- b = true;
- break;
- }
+ case 0 : {
+ this.mWrench = false;
+ b = true;
+ break;
+ }
+ case 1 : {
+ this.mScrewdriver = false;
+ b = true;
+ break;
+ }
+ case 2 : {
+ this.mSoftHammer = false;
+ b = true;
+ break;
+ }
+ case 3 : {
+ this.mHardHammer = false;
+ b = true;
+ break;
+ }
+ case 4 : {
+ this.mSolderingTool = false;
+ b = true;
+ break;
+ }
+ case 5 : {
+ this.mCrowbar = false;
+ b = true;
+ break;
+ }
}
return b;
}
@@ -1849,7 +2107,7 @@ GT_MetaTileEntity_MultiBlockBase {
@SuppressWarnings("rawtypes")
public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){
- Class mDynamoClass;
+ Class<?> mDynamoClass;
mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti");
if (mDynamoClass != null){
if (mDynamoClass.isInstance(aMetaTileEntity)){
@@ -1894,7 +2152,7 @@ GT_MetaTileEntity_MultiBlockBase {
try {
return (int) calculatePollutionReduction.invoke(i, g);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
-
+
}
}
return 0;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index d507b3c814..aad05f1730 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -36,6 +36,7 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.util.minecraft.FluidUtils;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.minecraft.LangUtils;
import gtPlusPlus.core.util.minecraft.MaterialUtils;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
@@ -131,32 +132,84 @@ public class Meta_GT_Proxy {
public static void fixIC2FluidNames() {
//Fix IC2 Hot Water name
try {
- String aNewHeatedWaterName = "Heated Water";
- Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water");
- LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName);
- LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
- GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName);
- GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
-
- Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater);
- if (b != null) {
- LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName);
- LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
- GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
- }
- Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater);
- if (f != null) {
- LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
- GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
- int aDam = FluidRegistry.getFluidID(f);
- ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam);
- if (s != null) {
- LanguageRegistry.addName(s, aNewHeatedWaterName);
- }
- }
+ String aNewHeatedWaterName = "Heated Water";
+ Logger.INFO("Renaming [IC2 Hotspring Water] --> ["+aNewHeatedWaterName+"].");LanguageRegistry.instance().addStringLocalization("fluidHotWater", "Heated Water");
+ LanguageRegistry.instance().addStringLocalization("fluidHotWater", aNewHeatedWaterName);
+ LanguageRegistry.instance().addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization("fluidHotWater", aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization("ic2.fluidHotWater", aNewHeatedWaterName);
+
+ Block b = BlocksItems.getFluidBlock(InternalName.fluidHotWater);
+ if (b != null) {
+ LanguageRegistry.addName(ItemUtils.getSimpleStack(b), aNewHeatedWaterName);
+ LanguageRegistry.instance().addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization(b.getUnlocalizedName(), aNewHeatedWaterName);
+ }
+ Fluid f = BlocksItems.getFluid(InternalName.fluidHotWater);
+ if (f != null) {
+ LanguageRegistry.instance().addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
+ GT_LanguageManager.addStringLocalization(f.getUnlocalizedName(), aNewHeatedWaterName);
+ int aDam = FluidRegistry.getFluidID(f);
+ ItemStack s = ItemList.Display_Fluid.getWithDamage(1, aDam);
+ if (s != null) {
+ LanguageRegistry.addName(s, aNewHeatedWaterName);
+ }
+ }
+
+ String[] aLangs = new String[] {
+ "de_DE",
+ "en_US",
+ "en_GB",
+ "en_IC",
+ "es_AR",
+ "es_ES",
+ "es_MX",
+ "es_UY",
+ "es_VE",
+ "fr_CA",
+ "fr_FR",
+ "it_IT",
+ "ko_KR",
+ "pt_BR",
+ "pt_PT",
+ "ru_RU",
+ "sv_SE",
+ "tr_TR",
+ "zh_CN",
+ "zh_TW",
+ };
+ String[] aLangValues = new String[] {
+ "Erhitztes Wasser",
+ "Heated Water",
+ "Heated Water",
+ "Heated Water",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Agua caliente",
+ "Eau chauffée",
+ "Eau chauffée",
+ "Acqua riscaldata",
+ "온수",
+ "Água aquecida",
+ "Água aquecida",
+ "Вода с подогревом",
+ "Uppvärmt vatten",
+ "Isıtılmış Su",
+ "热水",
+ "热水",
+
+ };
+ for (int i=0;i<aLangs.length;i++) {
+ Logger.REFLECTION("Trying to inject new lang data for "+aLangs[i]+", using value: "+aLangValues[i]);
+ LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "fluidHotWater", aLangValues[i]);
+ LangUtils.rewriteEntryForLanguageRegistry(aLangs[i], "ic2.fluidHotWater", aLangValues[i]);
+ }
}
+
catch (Throwable t) {
-
+
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
index 1ee27afbf0..2f00600af6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -22,6 +22,7 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.core.util.sys.KeyboardUtils;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon;
import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
@@ -48,7 +49,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public String[] getDescription() {
- return new String[] {this.mDescription, "Use Screwdriver to change voltage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"};
+ return new String[] {this.mDescription, "Use Screwdriver to change voltage", "Hold Shift while using Screwdriver to change amperage", EnumChatFormatting.GREEN+"CREATIVE MACHINE"};
}
/*
@@ -177,43 +178,48 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
}
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (this.mTier < 9) {
- this.mTier++;
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (KeyboardUtils.isShiftKeyDown()) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
}
else {
- this.mTier = 0;
- }
- this.markDirty();
- try {
- Field field = ReflectionUtils.getField(this.getClass(), "mTextures");
- field.setAccessible(true);
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
- ITexture[][][] V = getTextureSet(null);
- if (V != null) {
- Logger.REFLECTION("Got Valid Textures.");
- if (this.getBaseMetaTileEntity().isClientSide()) {
- Logger.REFLECTION("Clientside Call.");
- Logger.REFLECTION("Refreshing Textures on buffer.");
- field.set(this, V);
- Logger.REFLECTION("Refreshed Textures on buffer.");
+ if (this.mTier < (CORE.GTNH ? GT_Values.V.length : 9)) {
+ this.mTier++;
+ }
+ else {
+ this.mTier = 0;
+ }
+ this.markDirty();
+ try {
+ Field field = ReflectionUtils.getField(this.getClass(), "mTextures");
+ field.setAccessible(true);
+ Field modifiersField = Field.class.getDeclaredField("modifiers");
+ modifiersField.setAccessible(true);
+ modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
+ ITexture[][][] V = getTextureSet(null);
+ if (V != null) {
+ Logger.REFLECTION("Got Valid Textures.");
+ if (this.getBaseMetaTileEntity().isClientSide()) {
+ Logger.REFLECTION("Clientside Call.");
+ Logger.REFLECTION("Refreshing Textures on buffer.");
+ field.set(this, V);
+ Logger.REFLECTION("Refreshed Textures on buffer.");
+ }
+ else {
+ Logger.REFLECTION("Serverside Call.");
+ }
}
else {
- Logger.REFLECTION("Serverside Call.");
- }
+ Logger.REFLECTION("Bad mTextures setter.");
+ }
}
- else {
- Logger.REFLECTION("Bad mTextures setter.");
- }
- }
- catch (Throwable t) {
- //Bad refresh.
- t.printStackTrace();
- Logger.REFLECTION("Bad mTextures setter.");
- }
- PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+". ["+MathUtils.isNumberEven(this.mTier)+"]");
- super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ catch (Throwable t) {
+ //Bad refresh.
+ t.printStackTrace();
+ Logger.REFLECTION("Bad mTextures setter.");
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Now running at "+GT_Values.VOLTAGE_NAMES[this.mTier]+".");
+ }
+
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
index ed312b704d..7717bf6379 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_ChemicalReactor.java
@@ -5,6 +5,7 @@ import static gregtech.api.enums.GT_Values.E;
import java.util.HashSet;
import java.util.List;
+import cpw.mods.fml.common.registry.LanguageRegistry;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
@@ -22,6 +23,7 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.slots.SlotChemicalPlantInput;
import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.Container_FluidReactor;
import gtPlusPlus.xmod.gregtech.api.gui.fluidreactor.GUI_FluidReactor;
+import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -142,7 +144,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba
@Override
public int getCapacity() {
- return 8000 * Math.max(1, this.mTier);
+ return 32000 * Math.max(1, this.mTier) / 4;
}
@Override
@@ -255,7 +257,7 @@ public class GregtechMetaTileEntity_ChemicalReactor extends GT_MetaTileEntity_Ba
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- // Re-implement basic machine logic from the ground up.
+ // Re-implement basic machine logic from the ground up.=
if (aBaseMetaTileEntity.isServerSide()) {
this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L;
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
index 611cb4da71..b8517533e6 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCokeOven.java
@@ -55,7 +55,7 @@ extends GregtechMeta_MultiBlockBase {
"1x Input Bus",
"1x Output Bus",
"1x Energy Hatch"
- };
+ };
}
@Override
@@ -101,7 +101,7 @@ extends GregtechMeta_MultiBlockBase {
public boolean checkRecipe(final ItemStack aStack) {
return checkRecipeGeneric(getMaxParallelRecipes(), getEuDiscountForParallelism(), 0);
}
-
+
@Override
public int getMaxParallelRecipes() {
return this.mLevel * 12;
@@ -118,19 +118,21 @@ extends GregtechMeta_MultiBlockBase {
final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
this.mLevel = 0;
if (!aBaseMetaTileEntity.getAirOffset(xDir, 1, zDir)) {
+ Logger.INFO("No air? "+xDir+", 1, "+zDir);
return false;
}
final byte tUsedMeta = aBaseMetaTileEntity.getMetaIDOffset(xDir + 1, 1, zDir);
switch (tUsedMeta) {
- case 2:
- this.mLevel = 1;
- break;
- case 3:
- this.mLevel = 2;
- break;
- default:
- return false;
+ case 2:
+ this.mLevel = 1;
+ break;
+ case 3:
+ this.mLevel = 2;
+ break;
+ default:
+ Logger.INFO("Bad Heating Coils.");
+ return false;
}
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
@@ -140,7 +142,7 @@ extends GregtechMeta_MultiBlockBase {
Logger.INFO("Heating Coils missing.");
return false;
}
-
+
if (!isValidBlockForStructure(tTileEntity2, TAE.GTPP_INDEX(1), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j), ModBlocks.blockCasingsMisc, 1)) {
Logger.INFO("Casings missing from top layer of coke oven.");
return false;
@@ -158,7 +160,7 @@ extends GregtechMeta_MultiBlockBase {
}
}
}
- }
+ }
return true;
}