aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <Draknyte1@hotmail.com>2020-06-02 14:33:02 +0100
committerAlkalus <Draknyte1@hotmail.com>2020-06-02 14:33:02 +0100
commitd1a813e829fa4393aeb625ce83c64f079e44cdb0 (patch)
treec4f54e44597a47f69722a361879ab26c534fd6d6 /src
parent96a83ee47f994c922aba625b67645661bc8cb4fe (diff)
downloadGT5-Unofficial-d1a813e829fa4393aeb625ce83c64f079e44cdb0.tar.gz
GT5-Unofficial-d1a813e829fa4393aeb625ce83c64f079e44cdb0.tar.bz2
GT5-Unofficial-d1a813e829fa4393aeb625ce83c64f079e44cdb0.zip
$ Fixed VFC fluid handling.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java30
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java37
2 files changed, 42 insertions, 25 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
index 8853acd4b7..b3b720497e 100644
--- a/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
+++ b/src/Java/gtPlusPlus/core/handler/StopAnnoyingFuckingAchievements.java
@@ -1,8 +1,13 @@
package gtPlusPlus.core.handler;
+import java.lang.reflect.Field;
+
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import net.minecraft.client.Minecraft;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.stats.AchievementList;
import net.minecraftforge.event.entity.player.AchievementEvent;
@@ -14,11 +19,28 @@ public class StopAnnoyingFuckingAchievements {
*/
@SubscribeEvent(priority=EventPriority.HIGHEST)
public void FUCK_OFF(AchievementEvent event) {
+ if (Utils.isClient()) {
+ doClientStuff();
+ }
if (event.achievement.equals(AchievementList.openInventory)) {
event.setCanceled(true);
- if (Minecraft.getMinecraft() != null) {
- if (Minecraft.getMinecraft().gameSettings != null) {
- Minecraft.getMinecraft().gameSettings.showInventoryAchievementHint = false;
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ private final void doClientStuff() {
+ Class aMC = ReflectionUtils.getClass("net.minecraft.client.Minecraft");
+ if (aMC != null) {
+ Field aInstanceMC = ReflectionUtils.getField(aMC, "theMinecraft");
+ Object aMcObj = ReflectionUtils.getFieldValue(null, aInstanceMC);
+ Class aClazz2 = aMcObj.getClass();
+ if (aClazz2 != null) {
+ Field aGameSettings = ReflectionUtils.getField(aClazz2, "gameSettings");
+ Object aGameSettingsObj = ReflectionUtils.getFieldValue(aInstanceMC, aGameSettings);
+ Class aClazz3 = aGameSettingsObj.getClass();
+ if (aClazz2 != null) {
+ Field ainvHint = ReflectionUtils.getField(aClazz3, "showInventoryAchievementHint");
+ ReflectionUtils.setField(aGameSettingsObj, ainvHint, false);
}
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
index e20a538ea7..febe646310 100644
--- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityVolumetricFlaskSetter.java
@@ -117,25 +117,17 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
return false;
}
- boolean aAllowFluid = false;
- boolean aHasFluid = false;
ItemStack[] aInputs = this.getInventory().getInventory().clone();
- for (ItemStack aStack : aInputs) {
- if (VolumetricFlaskHelper.getFlaskFluid(aStack) != null) {
- aHasFluid = true;
- }
- }
-
- if (aHasFluid && !aAllowFluid) {
- return false;
- }
//Check if there is output in slot.
Boolean hasOutput = false;
if (aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT] != null) {
hasOutput = true;
+ if (aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT].stackSize >= 16) {
+ return false;
+ }
}
AutoMap<Integer> aValidSlots = new AutoMap<Integer>();
int aSlotCount = 0;
@@ -152,11 +144,13 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
Logger.INFO("Skipping Custom slot as value <= 0");
continue;
}
+ if (e == Container_VolumetricFlaskSetter.SLOT_OUTPUT) {
+ continue;
+ }
boolean doAdd = false;
ItemStack g = this.getStackInSlot(e);
- //FluidStack aInputFluidStack = VolumetricFlaskHelper.getFlaskFluid(g);
- FluidStack aInputFluidStack = null;
+ FluidStack aInputFluidStack = VolumetricFlaskHelper.getFlaskFluid(g);
int aSize = 0;
ItemStack aInputStack = null;
int aTypeInSlot = getFlaskType(g);
@@ -168,17 +162,18 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
}
// Existing Output
else {
- ItemStack f = this.getStackInSlot(8);
- //FluidStack aFluidInCheckedSlot = VolumetricFlaskHelper.getFlaskFluid(f);
- FluidStack aFluidInCheckedSlot = null;
+ ItemStack f = aInputs[Container_VolumetricFlaskSetter.SLOT_OUTPUT];
+ FluidStack aFluidInCheckedSlot = VolumetricFlaskHelper.getFlaskFluid(f);
int aTypeInCheckedSlot = getFlaskType(f);
// Check that the Circuit in the Output slot is not null and the same type as the circuit input.
if (aTypeInCheckedSlot > 0 && (aTypeInSlot == aTypeInCheckedSlot) && f != null) {
if (g.getItem() == f.getItem() && VolumetricFlaskHelper.getFlaskCapacity(f) == getCapacityForSlot(e) && ((aInputFluidStack == null && aFluidInCheckedSlot == null) || aInputFluidStack.isFluidEqual(aFluidInCheckedSlot))) {
+ Logger.INFO("Input Slot Flask Contains: "+(aInputFluidStack != null ? aInputFluidStack.getLocalizedName() : "Empty"));
+ Logger.INFO("Output Slot Flask Contains: "+(aFluidInCheckedSlot != null ? aFluidInCheckedSlot.getLocalizedName() : "Empty"));
aSize = f.stackSize + g.stackSize;
- if (aSize > 64) {
+ if (aSize > 16) {
aInputStack = g.copy();
- aInputStack.stackSize = (aSize-64);
+ aInputStack.stackSize = (aSize-16);
}
doAdd = true;
}
@@ -188,9 +183,9 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
// Check Circuit Type
ItemStack aOutput;
FluidStack aOutputFluid = null;
- /*if (!VolumetricFlaskHelper.isFlaskEmpty(g)) {
+ if (!VolumetricFlaskHelper.isFlaskEmpty(g)) {
aOutputFluid = aInputFluidStack.copy();
- }*/
+ }
if (aTypeInSlot == 1) {
aOutput = VolumetricFlaskHelper.getVolumetricFlask(1);
}
@@ -211,7 +206,7 @@ public class TileEntityVolumetricFlaskSetter extends TileEntity implements ISide
if (aOutputFluid.amount > aCapacity) {
aOutputFluid.amount = aCapacity;
}
- //VolumetricFlaskHelper.setFluid(aOutput, aOutputFluid);
+ VolumetricFlaskHelper.setFluid(aOutput, aOutputFluid);
}
this.setInventorySlotContents(e, aInputStack);
this.setInventorySlotContents(Container_VolumetricFlaskSetter.SLOT_OUTPUT, aOutput);