diff options
| author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-14 20:22:34 +0000 |
|---|---|---|
| committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-14 20:22:34 +0000 |
| commit | f6599e799922840f2e5c94d2c0b638357e75e5cd (patch) | |
| tree | 7627ab7fd0267cc26a8e36e74bf92f9493f933e8 | |
| parent | 87b3fdb080ad0409d9593e09f4206e5d70c78756 (diff) | |
| download | GT5-Unofficial-f6599e799922840f2e5c94d2c0b638357e75e5cd.tar.gz GT5-Unofficial-f6599e799922840f2e5c94d2c0b638357e75e5cd.tar.bz2 GT5-Unofficial-f6599e799922840f2e5c94d2c0b638357e75e5cd.zip | |
Fix Computer Cube GUI.
Fix Glod's shitty implementation of perfect OC which broke some multis.
12 files changed, 320 insertions, 396 deletions
diff --git a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java index 7573e0d51c..5c7a5bac6d 100644 --- a/src/main/java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/main/java/gtPlusPlus/core/util/math/MathUtils.java @@ -16,12 +16,12 @@ public class MathUtils { final static Random rand = CORE.RANDOM; - /** Formats a number with group separator and at most 2 fraction digits. */ - private static final NumberFormat sNumberFormat = NumberFormat.getInstance(); - - static { - sNumberFormat.setMaximumFractionDigits(2); - } + /** Formats a number with group separator and at most 2 fraction digits. */ + private static final NumberFormat sNumberFormat = NumberFormat.getInstance(); + + static { + sNumberFormat.setMaximumFractionDigits(2); + } /** * Returns a psuedo-random number between min and max, inclusive. @@ -554,7 +554,7 @@ public class MathUtils { return 0; } } - + public static <V> V safeCast(Object aNumberType) { long a1; double a2; @@ -573,7 +573,7 @@ public class MathUtils { String s = ""+a1; Short s1 = Short.valueOf(s); return (V) s1; - + } } else if ((aNumberType.getClass() == int.class) || (aNumberType instanceof Integer)){ @@ -581,7 +581,7 @@ public class MathUtils { String s = ""+a1; Integer s1 = Integer.valueOf(s); return (V) s1; - + } } else if ((aNumberType.getClass() == long.class) || (aNumberType instanceof Long)){ @@ -596,7 +596,7 @@ public class MathUtils { String s = ""+a1; Float s1 = Float.valueOf(s); return (V) s1; - + } } else if ((aNumberType.getClass() == double.class) || (aNumberType instanceof Double)){ @@ -604,40 +604,40 @@ public class MathUtils { String s = ""+a1; Double s1 = Double.valueOf(s); return (V) s1; - + } } - + Integer o = 0; return (V) o; - + } - + public static byte getSafeByte(Byte b) { Byte a = safeCast(b); return a.byteValue(); } - + public static short getSafeShort(Short b) { Short a = safeCast(b); return a.shortValue(); } - + public static int getSafeInt(Integer b) { Integer a = safeCast(b); return a.intValue(); } - + public static long getSafeLong(Long b) { Long a = safeCast(b); return a.longValue(); } - + public static float getSafeFloat(Float b) { Float a = safeCast(b); return a.floatValue(); } - + public static double getSafeDouble(Double b) { Double a = safeCast(b); return a.doubleValue(); @@ -699,7 +699,7 @@ public class MathUtils { public static int balance(int aInput, int aMin, int aMax) { return Math.max(Math.min(aInput, aMax), aMin); } - + /** * Balances a number within a range. * @param aInput - The number to balance @@ -710,7 +710,7 @@ public class MathUtils { public static Number balance(Number aInput, Number aMin, Number aMax) { return max(min(aInput, aMax), aMin); } - + /** * Balances a number within a range. * @param aInput - The number to balance @@ -721,7 +721,7 @@ public class MathUtils { public static int balanceInt(Number aInput, Number aMin, Number aMax) { return MathUtils.safeCast_LongToInt((long) balance(max(min(aInput, aMax), aMin), Integer.MIN_VALUE, Integer.MAX_VALUE)); } - + /** * Balances a number within a range. * @param aInput - The number to balance @@ -737,51 +737,62 @@ public class MathUtils { int aAmount = Math.max(Math.min(i, aMax), aMin); return aAmount; } - + public static Pair<Integer, Integer> splitLongIntoIntegers(long aLong){ int aIntMaxInLong = (int) Math.min(Integer.MAX_VALUE, Math.floor(aLong/Integer.MAX_VALUE)); int aRemainder = (int) (aLong - (aIntMaxInLong * Integer.MAX_VALUE)); return new Pair<Integer, Integer>(aIntMaxInLong, aRemainder); } - - - /** - * Returns the smaller of two {@code Number}s. That is, - * the result the argument closer to the value of - * {@link Long#MIN_VALUE}. If the arguments have the same - * value, the result is that same value. - * - * @param a an argument. - * @param b another argument. - * @return the smaller of {@code a} and {@code b}. - */ - public static Number min(Number a, Number b) { - return (a.longValue() <= b.longValue()) ? a : b; - } - - /** - * Returns the greater of two {@code Number}s. That is, the - * result is the argument closer to the value of - * {@link Long#MAX_VALUE}. If the arguments have the same value, - * the result is that same value. - * - * @param a an argument. - * @param b another argument. - * @return the larger of {@code a} and {@code b}. - */ - public static Number max(Number a, Number b) { - return (a.longValue() >= b.longValue()) ? a : b; - } - - public static String formatNumbers(long aNumber) { - return sNumberFormat.format(aNumber); - } - - public static String formatNumbers(double aNumber) { - return sNumberFormat.format(aNumber); - } + + + /** + * Returns the smaller of two {@code Number}s. That is, + * the result the argument closer to the value of + * {@link Long#MIN_VALUE}. If the arguments have the same + * value, the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the smaller of {@code a} and {@code b}. + */ + public static Number min(Number a, Number b) { + return (a.longValue() <= b.longValue()) ? a : b; + } + + /** + * Returns the greater of two {@code Number}s. That is, the + * result is the argument closer to the value of + * {@link Long#MAX_VALUE}. If the arguments have the same value, + * the result is that same value. + * + * @param a an argument. + * @param b another argument. + * @return the larger of {@code a} and {@code b}. + */ + public static Number max(Number a, Number b) { + return (a.longValue() >= b.longValue()) ? a : b; + } + + public static long combineTwoIntegersToLong(int a, int b) { + long val = (((long) a) << 32) | (b & 0xffffffffL); + return val; + } + public static int[] splitLongIntoTwoIntegers(long aNum) { + int a = (int) (aNum >> 32); + int b = (int) aNum; + return new int[] {a, b}; + } + + public static String formatNumbers(long aNumber) { + return sNumberFormat.format(aNumber); + } + + public static String formatNumbers(double aNumber) { + return sNumberFormat.format(aNumber); + } + } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 3e294a076c..913b72fb0a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -55,7 +55,7 @@ import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputerCube_Setup; -import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; +import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMTE_ElementalDuplicator; import gtPlusPlus.xmod.gregtech.loaders.Gregtech_Blocks; @@ -178,7 +178,7 @@ public class HANDLER_GT { convertPyroToCokeOven(); generateElementalDuplicatorRecipes(); Meta_GT_Proxy.fixIC2FluidNames(); - GT_ComputercubeDescription.addStandardDescriptions(); + GT_Computercube_Description.addStandardDescriptions(); GT_ComputerCube_Setup.init(); RecipeLoader_AlgaeFarm.generateRecipes(); if (LoadedMods.AdvancedSolarPanel) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java index 477bcef092..80202695e7 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_Container_ComputerCube.java @@ -9,11 +9,12 @@ import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.gui.GT_Slot_Output; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.util.GT_ModHandler; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.common.tileentities.misc.GT_TileEntity_ComputerCube; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; @@ -23,7 +24,9 @@ import net.minecraft.item.ItemStack; public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { - public int mEUOut; + public long mEUOut; + public int mEUOut1; + public int mEUOut2; public int mHeat; @@ -33,7 +36,9 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { public int mExplosionStrength; - public int mEU; + public long mEU; + public int mEU1; + public int mEU2; public int mProgress; @@ -41,6 +46,10 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { public GT_Container_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, int aID) { super(aInventoryPlayer, aTileEntity); + Logger.INFO("1 Container Mode: "+aID); + Logger.INFO("2 Container Mode: "+getMode()); + mID = getMode(); + Logger.INFO("3 Container Mode: "+getMode()); // addSlotsComputer(aInventoryPlayer); detectAndSendChanges(); } @@ -56,7 +65,7 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { public void addSlotsComputer(InventoryPlayer aInventoryPlayer) { int y; mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; - Logger.INFO("Mode: " + mID); + Logger.INFO(""+(Utils.isClient() ? "Client" : "Server")+" Mode: " + mID); addSlotToContainer(new GT_Slot_Holo((IInventory) this.mTileEntity, 58, 156 + ((this.mID == 5) ? 50 : 0), 4, false, false, 1)); switch (this.mID) { case 1 : @@ -142,24 +151,24 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { } public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { - Logger.INFO("Clicked slot " + aSlotIndex); + //Logger.INFO("Clicked slot " + aSlotIndex); if (aSlotIndex < 0) { - Logger.INFO(""); + //Logger.INFO(""); return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } if (this.mID != ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode) { - Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + //Logger.INFO("This ID: " + mID + ", Tile: " + ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); return null; } Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); if (tSlot == null) { - Logger.INFO("Null Slot?"); + //Logger.INFO("Null Slot?"); } else { ItemStack tStack = tSlot.getStack(); - Logger.INFO("Good Slot!"); + //Logger.INFO("Good Slot!"); if (aSlotIndex == 0) { - Logger.INFO("Slot is 0"); + //Logger.INFO("Slot is 0"); if (aMouseclick == 0) { Logger.INFO("Forward"); ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeForward(); @@ -168,7 +177,12 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { Logger.INFO("Backwards"); ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).switchModeBackward(); } - aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); + if (aPlayer instanceof EntityPlayerMP) { + EntityPlayerMP aPlayerMP = (EntityPlayerMP) aPlayer; + changePage(aPlayerMP, ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode); + } + //FMLNetworkHandler.openGui(entityPlayer, mod, modGuiId, world, x, y, z); + //aPlayer.openGui(CORE.MODID, getComputerCubeGUIID(), this.mTileEntity.getWorld(), this.mTileEntity.getXCoord(), this.mTileEntity.getYCoord(), this.mTileEntity.getZCoord()); } else if (aSlotIndex <= 2 && this.mID == 3) { if (aSlotIndex == 1) { @@ -269,14 +283,21 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { } } else { - Logger.INFO("Super 2"); + //Logger.INFO("Super 2"); return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } } - Logger.INFO("???"); + //Logger.INFO("???"); return null; } + + + public void changePage(EntityPlayerMP aPlayerMP, int aMode) { + GT_TileEntity_ComputerCube aCompTile = (GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity(); + aCompTile.onRightclick(mTileEntity, aPlayerMP); + } + public boolean doesBindPlayerInventory() { return (this.mID != 1 && this.mID != 5); } @@ -288,26 +309,33 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { } this.mID = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMode; this.mEUOut = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEUOut; + int[] aEUSplit1 = MathUtils.splitLongIntoTwoIntegers(mEUOut); + this.mEUOut1 = aEUSplit1[0]; + this.mEUOut2 = aEUSplit1[1]; this.mHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHeat; this.mMaxHeat = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mMaxHeat; this.mHEM = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mHEM * 10000.0F); this.mExplosionStrength = (int) (((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mExplosionStrength * 100.0F); this.mEU = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mEU; this.mProgress = ((GT_TileEntity_ComputerCube) mTileEntity.getMetaTileEntity()).mProgress; + int[] aEUSplit2 = MathUtils.splitLongIntoTwoIntegers(mEU); + this.mEU1 = aEUSplit2[0]; + this.mEU2 = aEUSplit2[1]; Iterator<ICrafting> var2 = this.crafters.iterator(); while (var2.hasNext()) { ICrafting var1 = var2.next(); - var1.sendProgressBarUpdate((Container) this, 101, this.mEUOut); + var1.sendProgressBarUpdate((Container) this, 101, this.mID); var1.sendProgressBarUpdate((Container) this, 102, this.mHeat & 0xFFFF); var1.sendProgressBarUpdate((Container) this, 103, this.mMaxHeat & 0xFFFF); var1.sendProgressBarUpdate((Container) this, 104, this.mHEM); var1.sendProgressBarUpdate((Container) this, 105, this.mExplosionStrength); var1.sendProgressBarUpdate((Container) this, 106, this.mHeat >>> 16); var1.sendProgressBarUpdate((Container) this, 107, this.mMaxHeat >>> 16); - var1.sendProgressBarUpdate((Container) this, 108, this.mEU & 0xFFFF); - var1.sendProgressBarUpdate((Container) this, 109, this.mEU >>> 16); + var1.sendProgressBarUpdate((Container) this, 108, this.mEU1); + var1.sendProgressBarUpdate((Container) this, 109, this.mEU2); var1.sendProgressBarUpdate((Container) this, 110, this.mProgress); - var1.sendProgressBarUpdate((Container) this, 111, this.mID); + var1.sendProgressBarUpdate((Container) this, 111, this.mEUOut1); + var1.sendProgressBarUpdate((Container) this, 112, this.mEUOut2); } } @@ -316,7 +344,7 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { super.updateProgressBar(par1, par2); switch (par1) { case 101 : - this.mEUOut = par2; + this.mID = par2; break; case 102 : this.mHeat = this.mHeat & 0xFFFF0000 | par2; @@ -337,15 +365,19 @@ public class GT_Container_ComputerCube extends GT_ContainerMetaTile_Machine { this.mMaxHeat = this.mMaxHeat & 0xFFFF | par2 << 16; break; case 108 : - this.mEU = this.mEU & 0xFFFF0000 | par2; + this.mEU1 = par2; case 109 : - this.mEU = this.mEU & 0xFFFF | par2 << 16; + this.mEU2 = par2; + this.mEU = MathUtils.combineTwoIntegersToLong(mEU1, mEU2); break; case 110 : this.mProgress = par2; break; case 111 : - this.mID = par2; + this.mEUOut1 = par2; + case 112 : + this.mEUOut2 = par2; + this.mEUOut = MathUtils.combineTwoIntegersToLong(mEUOut1, mEUOut2); break; } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java index 47795f4510..c56e167319 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/computer/GT_GUIContainer_ComputerCube.java @@ -3,8 +3,9 @@ package gtPlusPlus.xmod.gregtech.api.gui.computer; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.common.computer.GT_ComputercubeDescription; +import gtPlusPlus.xmod.gregtech.common.computer.GT_Computercube_Description; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; @@ -12,8 +13,12 @@ import net.minecraft.util.StatCollector; public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machine { public GT_GUIContainer_ComputerCube(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aBaseMetaTileEntity, int aID) { super(new GT_Container_ComputerCube(aInventoryPlayer, aBaseMetaTileEntity, aID), CORE.RES_PATH_GUI + "computer/"+aID+".png"); - if (aID == 5) + GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + Logger.INFO("1 GUI Mode: "+aID); + Logger.INFO("2 GUI Mode: "+tContainer.mID); + if (tContainer.mID == 5) { this.xSize += 50; + } } @@ -33,6 +38,7 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin protected void drawGuiContainerForegroundLayer(int par1, int par2) { GT_Container_ComputerCube tContainer = (GT_Container_ComputerCube) this.mContainer; + //Logger.INFO("3 GUI Mode: "+xSize); //GT_TileEntity_ComputerCube tTileEntity = (GT_TileEntity_ComputerCube) tContainer.mTileEntity; if (tContainer != null) switch (tContainer.mID) { @@ -78,13 +84,16 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin this.fontRendererObj.drawString("OUT: " + toNumber(tContainer.mEUOut * tContainer.mHeat) + "EU", 7, 55, 16448255); break; case 5 : - if (tContainer.mMaxHeat >= 0 && tContainer.mMaxHeat < GT_ComputercubeDescription.sDescriptions.size()) - for (int i = 0; i < ((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription.length; i++) { + if (tContainer.mID == 5 && this.xSize == 176) { + this.xSize += 50; + } + if (tContainer.mMaxHeat >= 0 && tContainer.mMaxHeat < GT_Computercube_Description.sDescriptions.size()) + for (int i = 0; i < ((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription.length; i++) { if (i == 0) { - this.fontRendererObj.drawString(((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7, 16448255); + this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7, 16448255); } else { - this.fontRendererObj.drawString(((GT_ComputercubeDescription) GT_ComputercubeDescription.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7 + this.fontRendererObj.drawString(((GT_Computercube_Description) GT_Computercube_Description.sDescriptions.get(tContainer.mMaxHeat)).mDescription[i], 7, 7 + 8 * i, 16448255); } } @@ -113,16 +122,16 @@ public class GT_GUIContainer_ComputerCube extends GT_GUIContainerMetaTile_Machin } } - public String toNumber(int aNumber) { + public String toNumber(long mEU) { String tString = ""; boolean temp = true, negative = false; - if (aNumber < 0) { - aNumber *= -1; + if (mEU < 0) { + mEU *= -1; negative = true; } int i; for (i = 1000000000; i > 0; i /= 10) { - int tDigit = aNumber / i % 10; + long tDigit = mEU / i % 10; if (temp && tDigit != 0) temp = false; if (!temp) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index ec7115cb0f..1232166baa 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -753,26 +753,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll); } - public boolean checkRecipeGeneric(GT_Recipe aRecipe, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) { - if (aRecipe == null) { - return false; - } - ArrayList<ItemStack> tItems = getStoredInputs(); - ArrayList<FluidStack> tFluids = getStoredFluids(); - ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); - FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, isPerfectOC); - } - - public boolean checkRecipeGeneric( - ItemStack[] aItemInputs, FluidStack[] aFluidInputs, - int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll) { - return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, false); - } - public boolean checkRecipeGeneric(GT_Recipe aRecipe, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) { @@ -783,14 +763,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En ArrayList<FluidStack> tFluids = getStoredFluids(); ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]); FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]); - return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe, false); + return checkRecipeGeneric(tItemInputs, tFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); } public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, boolean isPerfectOC) { - return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null, isPerfectOC); + int aSpeedBonusPercent, int aOutputChanceRoll) { + return checkRecipeGeneric(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, null); } @@ -941,10 +921,14 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En return rEnergy; } + public boolean hasPerfectOverclock() { + return false; + } + public boolean checkRecipeGeneric( ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, - int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe, boolean isPerpectOC) { + int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { // Based on the Processing Array. A bit overkill, but very flexible. // Reset outputs and progress stats @@ -1069,8 +1053,12 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En } else { while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { this.mEUt *= 4; - if (isPerpectOC) this.mMaxProgresstime /= 4; - else this.mMaxProgresstime /= 2; + if (hasPerfectOverclock()) { + this.mMaxProgresstime /= 4; + } + else { + this.mMaxProgresstime /= 2; + } } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java index ba48df1311..fedb4e6028 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_ComputercubeDescription.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/computer/GT_Computercube_Description.java @@ -10,14 +10,14 @@ import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.item.ItemStack; -public class GT_ComputercubeDescription { - public static ArrayList<GT_ComputercubeDescription> sDescriptions = new ArrayList<GT_ComputercubeDescription>(); +public class GT_Computercube_Description { + public static ArrayList<GT_Computercube_Description> sDescriptions = new ArrayList<GT_Computercube_Description>(); public String[] mDescription; public ItemStack[] mStacks; - public GT_ComputercubeDescription(String[] aDescription, ItemStack[] aStacks) { + public GT_Computercube_Description(String[] aDescription, ItemStack[] aStacks) { this.mDescription = aDescription; this.mStacks = aStacks; sDescriptions.add(this); @@ -25,162 +25,167 @@ public class GT_ComputercubeDescription { public static void addStandardDescriptions() { Logger.INFO("Adding Default Description Set of the Computer Cube"); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "Lightning Rod", "Also known as the Bane of", "Alblaka. The Lightning Rod", "enables you to gain Energy", "from Lightning! To set it up", "you just need the Block", "itself, 4 HV-Transformers", "and a crapton of Ironfences,", "which you then place on top", "of it. After that you have to", "wait for a Thunderstorm and", "when you are lucky you get", "2.5 MFSU of Energy out of", "it. If a Rod is high enough", "then Rain is also enough to", "get stroke, but with less", "probability ofcourse." }, new ItemStack[] { GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), GT_ModHandler.getIC2Item("ironFence", 1), ItemList.Machine_IV_LightningRod.get(1), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "Quantum Chest", "You want to store tons of", "Materials into your Chests", "but you hate the Item limit", "of them? Not anymore! The", "Quantum Chest is able to", "store an INFINITE* amount", "of one single Item type per", "Chest.", "This Chest stores your Items", - "like Data and ever has a", "Stack of the Item ready for", "extraction. It is compatible", "with any Item that doesnt", "have a NBT-Tag. You ask what", "NBT is? I know it, thats enough.", "* = 2147483391" }, new ItemStack[] { - null, null, null, null, ItemList.Quantum_Chest_LV.get(1), null, null, null, null, null, - null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + "like Data and ever has a", "Stack of the Item ready for", "extraction. It is compatible", "with any Item that doesnt", "have a NBT-Tag. You ask what", "NBT is? I know it, thats enough.", "Up to 2147483391*" }, new ItemStack[] { + ItemList.Quantum_Chest_IV.get(1), ItemList.Quantum_Chest_EV.get(1), ItemList.Quantum_Chest_HV.get(1), ItemList.Quantum_Chest_MV.get(1), ItemList.Quantum_Chest_LV.get(1), null, + null, null, null, null, null, null, null, null }); + new GT_Computercube_Description(new String[] { + "Quantum Tank", "You want to store tons of", "Fluids into your Tanks", "but you hate the capacity", "of them? Not anymore! The", "Quantum Tank is able to", "store an INFINITE* amount", "of one single Fluid type per", "Tank.", "This Tank stores your Fluids", + "like Data and ever has a", "Stack of the Fluid ready for", "extraction. It is compatible", "with any Fluid. ", "You ask what", "NBT is? I know it, thats enough.", "* = 2147483391" }, new ItemStack[] { + ItemList.Quantum_Tank_IV.get(1), ItemList.Quantum_Tank_EV.get(1), ItemList.Quantum_Tank_HV.get(1), ItemList.Quantum_Tank_MV.get(1), ItemList.Quantum_Tank_LV.get(1), null, + null, null, null, null, null, null, null, null }); + new GT_Computercube_Description(new String[] { "Computer Cube", "The Device you are", "currently using. This Computer", "is running the G.L.A.D.-OS,", "which is containing many", "usefull Apps:", "- Reactor Planner", "- Seedbag Scanner", "- Recipelists for GT-Devices", "- ", "- ", "- ", "- ", "- ", "And the Description List you", "are currently reading.", "~This Device has private Access~" }, new ItemStack[] { - null, null, null, null, GregtechItemList.Gregtech_Computer_Cube.get(1), null, null, null, null, null, + null, null, null, null, GregtechItemList.Gregtech_Computer_Cube_Machine.get(1), null, null, null, null, null, null, null, null, null }); - /* new GT_ComputercubeDescription(new String[] { + /* new GT_Computercube_Description(new String[] { "UUM-Assembler", "It's like an automatic", "Crafting Table just for UUM", "It can store 20 UUM-Recipes", "and produces those on demand", "It costs 512EU per used piece", "of Universal-Usable-Matter(TM).", "The integrated Quantum Chest", "allows it to store all your", "UUM inside it.", "Top and Bottom are for Input,", "while the Output is on the", "Sides. The Output is designed,", "to work with RP-Managers, so", "build it into your recursive", "Autocraftingsystem.", "" }, new ItemStack[] { null, null, null, GT_ModHandler.getIC2Item("matter", 1), new ItemStack(GregTech_API.sBlockList[1], 1, 5), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "Sonictron", "You like Music? Then the", "Sonictron 9001 is your best", "choice! You can compose Alarms,", "Doorbell Sounds or boring", "Elevator Music, with the 64 Slots", "inside it. Just leftclick them", "to switch the Sound, rightclick", "them to switch the modulation", "and shiftclick to remove it.", "Then apply Redstone to play", "With the mobile Version you can", "play sounds everywhere, after", "you copied them from a normal", "Sonictron via rightclicking", "Sneakrightclicking pastes", "Emits Redstone when finished." }, new ItemStack[] { null, null, null, GregTech_API.getGregTechItem(32, 1, 0), new ItemStack(GregTech_API.sBlockList[1], 1, 6), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "L.E.S.U.", "The unlaggiest Multiblock ever!", "One Controllerblock, and as many", "'stupid' Storageblocks as you want.", "To use it, place one Controller", "and then place the LESU-Storages", "adjacent to it or other placed", "LESU-Storages. The Tier (max EU/t)", "of it depends on the amount of", "adjacent Storages. The", "Storageblocks are NOT TileEntities,", "what means that they cause as much", "Lag as a random Dirtblock. And the", "Controller Block only checks ONCE", "for the Storages, so no", "Blockiterationlag, AT. ALL. Anyone,", "who says that they lag gets murdered!" }, new ItemStack[] { null, null, null, new ItemStack(GregTech_API.sBlockList[0], 1, 6), new ItemStack(GregTech_API.sBlockList[1], 1, 7), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "I.D.S.U.", "The Interdimensional Storage Unit", "is a Device, which is like a", "wireless, crossdimensional and", "enderchestlike EU-Storage Block", "", "Every Player has one Network of", "these. The ID is determined by", "the Hashcode of the Name from the", "first Player, who opens it's GUI", "", "It stores up to 1 Billion EU", "and emits EV. But you need at", "least two of them for Energy", "Transfer", "", "" }, new ItemStack[] { null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 8), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "A.E.S.U.", "The Adjustable Energy Storage Unit", "is like 10 MFSU and has an", "adjustable Output between 0 and", "2048EU/t. You could use it as a", "Transformer. It is Tier-IV, so", "it's basically needed to charge", "Energy Orbs and Lapotron Packs", "", "Not much else to say about it.", "", "", "", "", "", "", "" }, new ItemStack[] { null, null, null, null, new ItemStack(GregTech_API.sBlockList[1], 1, 9), null, null, null, null, null, null, null, null, null }); - new GT_ComputercubeDescription(new String[] { + new GT_Computercube_Description(new String[] { "Charge-O-Mat", "An automatable Charging Bench", "It puts (de-)charged Tools into", "the right Outputslots, which are", "accessible on the Sides of it.", "", "The Energy Orb inside stores enough", "to charge your QSuit almost instantly", "", "This is a Tier-V Charging Station", "even when the Max-IN/OUT is only", "2048EU/t. It also charges your Armor", "when you are standing close to it.", "", "If you apply Redstone, then it", "decharges instead.", "" }, new ItemStack[] { null, null, null, null, new ItemStack(GregTech_API.sBloc |
