From 1ecc44f5f27451bd6f82f8e81a1d4809cc52152d Mon Sep 17 00:00:00 2001 From: TheDarkDnKTv Date: Mon, 1 Feb 2021 03:55:48 +0200 Subject: [PATCH] API fixes, Recipe#match etc - Fixed partically centrifuge (UI desync, glitchy recipe logic, nbt save) - Fixed RecipeLogic NBT save issue, has resetting recipe progress - Added one interface to work with RecipeLogic - Fixed syntax errors in generators --- README.md | 12 +- .../api/interfaces/IRecipeWorkable.java | 36 +++ .../metatileentity/BaseMetaTileEntity.java | 5 +- .../examples/GT_MetaTileEntity_E_Furnace.java | 4 +- .../GT_MetaTileEntity_BasicGenerator.java | 25 +- .../GT_MetaTileEntity_BasicMachine.java | 74 +---- .../GT_MetaTileEntity_MultiBlockBase.java | 4 +- .../java/gregtechmod/api/recipe/Recipe.java | 40 ++- .../gregtechmod/api/recipe/RecipeLogic.java | 122 +++++---- .../gregtechmod/api/recipe/RecipeMaps.java | 2 - .../containers/GT_Container_Centrifuge.java | 36 --- .../gui/GT_GUIContainer_Centrifuge.java | 8 +- .../GT_MetaTileEntity_ElectricTypeSorter.java | 3 +- .../GT_MetaTileEntity_TesseractGenerator.java | 4 +- .../GT_MetaTileEntity_TesseractTerminal.java | 4 +- .../GT_MetaTileEntity_DieselGenerator.java | 12 +- .../GT_MetaTileEntity_GasTurbine.java | 12 +- ...T_MetaTileEntity_MagicEnergyConverter.java | 12 +- .../GT_MetaTileEntity_PlasmaGenerator.java | 12 +- .../GT_MetaTileEntity_SemifluidGenerator.java | 12 +- .../GT_MetaTileEntity_ThermalGenerator.java | 12 +- .../GT_MetaTileEntity_Centrifuge.java | 255 +++++++----------- .../preload/GT_MetaTileEntityLoader.java | 12 +- .../assets/gregtech_addon/lang/en_US.lang | 1 + 24 files changed, 313 insertions(+), 406 deletions(-) create mode 100644 src/main/java/gregtechmod/api/interfaces/IRecipeWorkable.java diff --git a/README.md b/README.md index 7ae6cf5..856537c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# A port of GregTech 4 to Minecraft 1.7.10 +# GregTech 4 + +Port of GregTech 4 to Minecraft 1.7.10 with improved compat and bugfixes Our website [click](https://nukepowered.info) @@ -8,12 +10,12 @@ Permissions from GregoriusT ## Contributing & Build guide #### Setting up enviroment ``` - 1. git clone https://github.com/Nukepowered/GregTech4.git - 2. gradlew setupDecompWorkspace - 3. gradlew eclipse/idea +1. git clone https://github.com/Nukepowered/GregTech4.git +2. gradlew setupDecompWorkspace +3. gradlew eclipse/idea ``` #### Building jar file ``` - gradlew build +gradlew build ``` \ No newline at end of file diff --git a/src/main/java/gregtechmod/api/interfaces/IRecipeWorkable.java b/src/main/java/gregtechmod/api/interfaces/IRecipeWorkable.java new file mode 100644 index 0000000..b9ae2b5 --- /dev/null +++ b/src/main/java/gregtechmod/api/interfaces/IRecipeWorkable.java @@ -0,0 +1,36 @@ +package gregtechmod.api.interfaces; + +import gregtechmod.api.recipe.Recipe; +import net.minecraft.item.ItemStack; + +/** + * @author TheDarkDnKTv + * Using for mark classes working with RecipeLogic class + */ +public interface IRecipeWorkable { + public IGregTechTileEntity getBaseMetaTileEntity(); + + public int getMinimumStoredEU(); + + public void startProcess(); + + public void endProcess(); + + public void stutterProcess(); + + public boolean allowToCheckRecipe(); + + public boolean spaceForOutput(Recipe recipe); + + public ItemStack getStackInSlot(int slotIdx); + + /** + * Array of input slot ids + */ + public int[] getInputSlots(); + + /** + * Array of output slot ids + */ + public int[] getOutputSlots(); +} diff --git a/src/main/java/gregtechmod/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtechmod/api/metatileentity/BaseMetaTileEntity.java index d67c17c..2141e46 100644 --- a/src/main/java/gregtechmod/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtechmod/api/metatileentity/BaseMetaTileEntity.java @@ -700,8 +700,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE @Override public boolean hasCustomInventoryName() {return false;} @Override public ItemStack getStackInSlotOnClosing(int slot) {ItemStack stack = getStackInSlot(slot); if (stack != null) setInventorySlotContents(slot, null); return stack;} @Override public void onMachineBlockUpdate() {if (hasValidMetaTileEntity()) mMetaTileEntity.onMachineBlockUpdate();} - @Override public int getProgress() {return hasValidMetaTileEntity()?mMetaTileEntity.getRecipeLogic().getProgressTime():0;} - @Override public int getMaxProgress() {return hasValidMetaTileEntity()?mMetaTileEntity.getRecipeLogic().getMaxProgressTime():0;} + @Override public int getProgress() {return hasValidMetaTileEntity()?mMetaTileEntity.getRecipeLogic() != null?mMetaTileEntity.getRecipeLogic().getProgressTime():0:0;} + @Override public int getMaxProgress() {return hasValidMetaTileEntity()?mMetaTileEntity.getRecipeLogic() != null?mMetaTileEntity.getRecipeLogic().getMaxProgressTime():0:0;} @Override public boolean increaseProgress(int aProgressAmountInTicks) {return hasValidMetaTileEntity()?mMetaTileEntity.increaseProgress(aProgressAmountInTicks)!=aProgressAmountInTicks:false;} @Override public boolean hasThingsToDo() {return getMaxProgress()>0;} @Override public void enableWorking() {if (!mWorks) mWorkUpdate = true; mWorks = true;} @@ -1529,6 +1529,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE aStack = GT_OreDictUnificator.get(aStack); if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) { tStack.stackSize+=aStack.stackSize; + mInventoryChanged = true; return true; } return false; diff --git a/src/main/java/gregtechmod/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtechmod/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java index f4132a8..6f24ce6 100644 --- a/src/main/java/gregtechmod/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java +++ b/src/main/java/gregtechmod/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java @@ -32,9 +32,9 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine // An empty constructor, which is needed for several Java reasons public GT_MetaTileEntity_E_Furnace(List recipeMap) { super(recipeMap); - recipeLogic.setHandler(() -> { + recipeLogic.setRecipeProvider(() -> { ItemStack output; - if (mInventory[2] != null && null != (output = GT_ModHandler.getSmeltingOutput(mInventory[2], true, mInventory[3]))) { + if (mInventory[2] != null && null != (output = GT_ModHandler.getSmeltingOutput(mInventory[2], false, mInventory[3]))) { if (mInventory[2].stackSize == 0) mInventory[2] = null; // It shall cook at 3 EU/t, if this Machine is overclocked then it will consume more // The time it usually needs, the Heating Coils re decreasing this Time, and if the Machine is overclocked, then it gets processed faster diff --git a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 284e39d..fa27251 100644 --- a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -12,13 +12,18 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity_BasicTank { + protected List recipeMap; + protected int efficiency; - public GT_MetaTileEntity_BasicGenerator(int aID, String aName) { + public GT_MetaTileEntity_BasicGenerator(int aID, String aName, List recipeMap, int efficiency) { super(aID, aName); + this.recipeMap = recipeMap; + this.efficiency = efficiency; } - public GT_MetaTileEntity_BasicGenerator() { - + public GT_MetaTileEntity_BasicGenerator(List recipeMap, int efficiency) { + this.recipeMap = recipeMap; + this.efficiency = efficiency; } @Override public boolean isSimpleMachine() {return false;} @@ -68,28 +73,24 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity if (getBaseMetaTileEntity().isServerSide()) getBaseMetaTileEntity().setActive(getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().getUniversalEnergyStored() >= getBaseMetaTileEntity().getOutputVoltage() + getMinimumStoredEU()); } - public abstract List getRecipes(); - - public abstract int getEfficiency(); - public int getFuelValue(FluidStack aLiquid) { if (aLiquid == null) return 0; FluidStack tLiquid; - for (Recipe tFuel : getRecipes()) if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0))) != null) if (aLiquid.isFluidEqual(tLiquid)) return (int)(((long)tFuel.mStartEU * getEfficiency()) / 100); + for (Recipe tFuel : recipeMap) if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getFirstInputs()[0])) != null) if (aLiquid.isFluidEqual(tLiquid)) return (int)(((long)tFuel.mStartEU * efficiency) / 100); return 0; } public int getFuelValue(ItemStack aStack) { if (GT_Utility.isStackInvalid(aStack)) return 0; - Recipe tFuel = Recipe.findEqualRecipe(true, false, getRecipes(), aStack); - if (tFuel != null) return (int)((tFuel.mStartEU * 1000L * getEfficiency()) / 100); + Recipe tFuel = Recipe.findEqualRecipe(true, false, recipeMap, aStack); + if (tFuel != null) return (int)((tFuel.mStartEU * 1000L * efficiency) / 100); return 0; } public ItemStack getEmptyContainer(ItemStack aStack) { if (GT_Utility.isStackInvalid(aStack)) return null; - Recipe tFuel = Recipe.findEqualRecipe(true, false, getRecipes(), aStack); - if (tFuel != null) return GT_Utility.copy(tFuel.getOutput(0)); + Recipe tFuel = Recipe.findEqualRecipe(true, false, recipeMap, aStack); + if (tFuel != null) return GT_Utility.copy(tFuel.getOutputs()[0]); return GT_Utility.getContainerItem(aStack); } diff --git a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 0ae7f4f..c311c4e 100644 --- a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.Map; import gregtechmod.api.GregTech_API; +import gregtechmod.api.interfaces.IRecipeWorkable; import gregtechmod.api.metatileentity.MetaTileEntity; import gregtechmod.api.recipe.Recipe; import gregtechmod.api.recipe.RecipeLogic; @@ -22,8 +23,8 @@ import net.minecraft.util.ChatComponentTranslation; * This is the main construct for my Basic Machines such as the Automatic Extractor * Extend this class to make a simple Machine */ -public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { - public boolean bAlloyInputFromOutputSide = false, bOutput = false, bOutputBlocked = false, bItemTransfer = false, bSeperatedInputs = false, bHasBeenUpdated = false, bStuttering = false; +public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity implements IRecipeWorkable { + public boolean bAlloyInputFromOutputSide = false, bOutput = false, bItemTransfer = false, bSeperatedInputs = false, bHasBeenUpdated = false, bStuttering = false; public int mMainFacing = -1; protected RecipeLogic recipeLogic; @@ -60,7 +61,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { @Override public int dechargerSlotCount() {return getElectricTier()>0?1:0;} @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} @Override public RecipeLogic getRecipeLogic() {return recipeLogic;} -// @Override public int increaseProgress(int aProgress) {mProgresstime += aProgress; return mMaxProgresstime-mProgresstime;} // TODO recipe logic related + @Override public int increaseProgress(int aProgress) {recipeLogic.increaseProgressTime(aProgress);return recipeLogic.getMaxProgressTime()-recipeLogic.getProgressTime();} @Override public boolean isLiquidInput (byte aSide) {return aSide != mMainFacing;} @Override public boolean isLiquidOutput(byte aSide) {return aSide != mMainFacing;} @@ -89,7 +90,6 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { @Override public void onPostTick() { if (getBaseMetaTileEntity().isServerSide()) { - boolean tSucceeded = false; if (mMainFacing < 2 && getBaseMetaTileEntity().getFrontFacing() > 1) { mMainFacing = getBaseMetaTileEntity().getFrontFacing(); } @@ -98,32 +98,9 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing()); } - recipeLogic.update(); -// if (mMaxProgresstime > 0) { -// if (mProgresstime < 0 || getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt*(int)Math.pow(4, getBaseMetaTileEntity().getOverclockerUpgradeCount()), false)) { -// if ((mProgresstime+=(int)Math.pow(2, getBaseMetaTileEntity().getOverclockerUpgradeCount()))>=mMaxProgresstime) { -// if (!getBaseMetaTileEntity().addStackToSlot(3, mOutputItem1)) getBaseMetaTileEntity().addStackToSlot(4, mOutputItem1); -// if (!getBaseMetaTileEntity().addStackToSlot(3, mOutputItem2)) getBaseMetaTileEntity().addStackToSlot(4, mOutputItem2); -// mOutputItem1 = null; -// mOutputItem2 = null; -// mProgresstime = 0; -// mMaxProgresstime = 0; -// tSucceeded = true; -// endProcess(); -// } -// bStuttering = false; -// } else { -// if (!bStuttering) { -// stutterProcess(); -// if (useStandardStutterSound()) sendSound((byte)8); -// bStuttering = true; -// } -// } -// } else { -// getBaseMetaTileEntity().setActive(false); -// } - - if (bItemTransfer && (mInventory[3] != null || mInventory[4] != null) && getBaseMetaTileEntity().getFrontFacing() != mMainFacing && doesAutoOutput() && (tSucceeded || bOutputBlocked || getBaseMetaTileEntity().hasInventoryBeenModified() || getBaseMetaTileEntity().getTimer()%600 == 0) && getBaseMetaTileEntity().isUniversalEnergyStored(500)) { + boolean succeded = recipeLogic.update(); + + if (bItemTransfer && (mInventory[3] != null || mInventory[4] != null) && getBaseMetaTileEntity().getFrontFacing() != mMainFacing && doesAutoOutput() && (succeded || getBaseMetaTileEntity().hasInventoryBeenModified() || getBaseMetaTileEntity().getTimer()%600 == 0) && getBaseMetaTileEntity().isUniversalEnergyStored(500)) { TileEntity tTileEntity2 = getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getFrontFacing()); int tCost = GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), tTileEntity2, getBaseMetaTileEntity().getFrontFacing(), getBaseMetaTileEntity().getBackFacing(), null, false, (byte)64, (byte)1, (byte)64, (byte)1); if (tCost > 0) { @@ -134,36 +111,6 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { } } } - - if (mInventory[3] == null && mInventory[4] == null) bOutputBlocked = false; // FIXME output blocked wtf - -// if (getBaseMetaTileEntity().isAllowedToWork()) { -// if (mMaxProgresstime <= 0 && (tSucceeded || getBaseMetaTileEntity().hasInventoryBeenModified() || getBaseMetaTileEntity().getTimer()%600 == 0 || getBaseMetaTileEntity().hasWorkJustBeenEnabled()) && getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU()-100)) { -// checkRecipe(); -// if (mInventory[1] != null && mInventory[1].stackSize <= 0) mInventory[1] = null; -// if (mInventory[2] != null && mInventory[2].stackSize <= 0) mInventory[2] = null; -// if (mMaxProgresstime > 0) { -// mOutputItem1 = GT_OreDictUnificator.get(true, mOutputItem1); -// mOutputItem2 = GT_OreDictUnificator.get(true, mOutputItem2); -// if (GT_Utility.isDebugItem(mInventory[5])) mMaxProgresstime = 1; -// } else { -// mOutputItem1 = null; -// mOutputItem2 = null; -// } -// if (mOutputItem1 != null && mOutputItem1.stackSize > 64) mOutputItem1.stackSize = 64; -// if (mOutputItem2 != null && mOutputItem2.stackSize > 64) mOutputItem2.stackSize = 64; -// -// if (mMaxProgresstime > 0) { -// startProcess(); -// } -// } -// } else { -// if (!bStuttering) { -// stutterProcess(); -// if (useStandardStutterSound()) sendSound((byte)8); -// bStuttering = true; -// } -// } } } @@ -182,11 +129,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { return mMainFacing<2?aSide==aFacing?aActive?getFrontFacingActive():getFrontFacingInactive():aSide==0?aActive?getBottomFacingActive():getBottomFacingInactive():aSide==1?aActive?getTopFacingActive():getTopFacingInactive():aActive?getSideFacingActive():getSideFacingInactive():aSide==mMainFacing?aActive?getFrontFacingActive():getFrontFacingInactive():(showPipeFacing()&&aSide==aFacing)?aSide==0?getBottomFacingPipe():aSide==1?getTopFacingPipe():getSideFacingPipe():aSide==0?aActive?getBottomFacingActive():getBottomFacingInactive():aSide==1?aActive?getTopFacingActive():getTopFacingInactive():aActive?getSideFacingActive():getSideFacingInactive(); } - public boolean spaceForOutput(ItemStack aOutput1, ItemStack aOutput2) { + @Override + public boolean spaceForOutput(Recipe recipe) { + ItemStack aOutput1 = recipe.getOutputs()[0], aOutput2 = recipe.getOutputs().length > 1 ? recipe.getOutputs()[1] : null; if (mInventory[3] == null || aOutput1 == null || (mInventory[3].stackSize + aOutput1.stackSize <= mInventory[3].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[3], aOutput1))) if (mInventory[4] == null || aOutput2 == null || (mInventory[4].stackSize + aOutput2.stackSize <= mInventory[4].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[4], aOutput2))) return true; - bOutputBlocked = true; return false; } @@ -303,7 +251,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends MetaTileEntity { /** Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects */ public void stutterProcess() { - // + if (useStandardStutterSound()) sendSound((byte)8); } public boolean useStandardStutterSound() { diff --git a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java index 5543c0f..923b33c 100644 --- a/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java +++ b/src/main/java/gregtechmod/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java @@ -49,8 +49,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity { @Override public boolean isFacingValid(byte aFacing) {return true;} @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} @Override public boolean isValidSlot(int aIndex) {return aIndex > 0;} - @Override public int getProgresstime() {return mProgresstime;} - @Override public int maxProgresstime() {return mMaxProgresstime;} + public int getProgresstime() {return mProgresstime;} + public int maxProgresstime() {return mMaxProgresstime;} @Override public int increaseProgress(int aProgress) {return aProgress;} @Override public int getInvSize() {return 2;} diff --git a/src/main/java/gregtechmod/api/recipe/Recipe.java b/src/main/java/gregtechmod/api/recipe/Recipe.java index bf66e1e..1e6d71b 100644 --- a/src/main/java/gregtechmod/api/recipe/Recipe.java +++ b/src/main/java/gregtechmod/api/recipe/Recipe.java @@ -8,11 +8,14 @@ import gregtechmod.api.util.GT_Log; import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_OreDictUnificator; import gregtechmod.api.util.GT_Utility; +import gregtechmod.api.util.ItemStackKey; import static gregtechmod.api.recipe.RecipeMaps.*; import java.util.*; import java.util.Map.Entry; +import java.util.stream.Collectors; + import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -95,24 +98,39 @@ public class Recipe { assert inputSlots.length > 0 : "Recipe check failed, inputSlots size < 1"; Map decreaseMap = new HashMap<>(); - for (ItemStack[] validItems : mInputs) { // Iterating slots - for (ItemStack validItem : validItems) { // Iterating valid items for slot - for (int slot : inputSlots) { // Iterating machine's input - ItemStack slotStack = tile.getStackInSlot(slot); - if (slotStack != null) { - if (isItemStackMatch(slotStack, validItem)) { - decreaseMap.put(slot, validItem); - } - } else continue; + Map slotStacks = new HashMap<>(); + for (int i : inputSlots) { + ItemStack stack = tile.getStackInSlot(i); + if (stack != null) + slotStacks.put(i, stack); + } + + for (ItemStack[] slot : mInputs) { + Map variants = Arrays.stream(slot) + .collect(Collectors.toMap(stack -> ItemStackKey.from(stack), stack -> stack.stackSize)); + Iterator> iter = slotStacks.entrySet().iterator(); + while (iter.hasNext()) { + Entry value = iter.next(); + ItemStackKey temp = ItemStackKey.from(value.getValue()); + if ((variants.keySet().contains(temp))) { + ItemStack recipeItem = temp.get(); + recipeItem.stackSize = variants.get(temp); + ItemStack slotItem = value.getValue(); + if (recipeItem.stackSize <= slotItem.stackSize) { + decreaseMap.put(value.getKey(), recipeItem); + iter.remove(); + break; + } else return false; } + return false; } } - if (decrease) for (Entry e : decreaseMap.entrySet()) { + if (decrease && decreaseMap.size() == mInputs.length) for (Entry e : decreaseMap.entrySet()) { tile.decrStackSize(e.getKey(), e.getValue().stackSize); } - return !decreaseMap.isEmpty(); + return decreaseMap.size() == mInputs.length; } private boolean isItemStackMatch(ItemStack invStack, ItemStack recipeStack) { diff --git a/src/main/java/gregtechmod/api/recipe/RecipeLogic.java b/src/main/java/gregtechmod/api/recipe/RecipeLogic.java index 7b9b009..c947bb8 100644 --- a/src/main/java/gregtechmod/api/recipe/RecipeLogic.java +++ b/src/main/java/gregtechmod/api/recipe/RecipeLogic.java @@ -4,7 +4,8 @@ import java.lang.ref.WeakReference; import java.util.List; import java.util.function.Supplier; -import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.interfaces.IRecipeWorkable; import gregtechmod.api.util.GT_Log; import gregtechmod.api.util.GT_Utility; import net.minecraft.inventory.IInventory; @@ -17,58 +18,70 @@ import net.minecraft.nbt.NBTTagCompound; * */ public class RecipeLogic { - public final WeakReference metaTileEntity; + public final WeakReference metaTileEntity; public final List recipeMap; - protected Supplier recipeHandler; + public int batterySlot = 5; + public boolean moveItems = true; + /** Do not consume inputs on custom recipe provider, it is only should provide a recipe instance */ + protected Supplier customRecipeProvider; protected int maxProgressTime; protected int progressTime; protected int EUt; private int overclockersCount; private Recipe previousRecipe; - private boolean needRecipeRecheck; + private boolean stuttering; + private boolean wasNoEnergy; - - public RecipeLogic(List recipeMap, GT_MetaTileEntity_BasicMachine machine) { + public RecipeLogic(List recipeMap, IRecipeWorkable machine) { this.recipeMap = recipeMap; maxProgressTime = 0; progressTime = 0; EUt = 0; overclockersCount = 0; + stuttering = false; + wasNoEnergy = false; metaTileEntity = new WeakReference<>(machine); - needRecipeRecheck = true; } - public void update() { - overclockersCount = getMachine().getBaseMetaTileEntity().getOverclockerUpgradeCount(); - moveItems(); + public boolean update() { + boolean success = false; + IGregTechTileEntity base = getMachine().getBaseMetaTileEntity(); + overclockersCount = base.getOverclockerUpgradeCount(); + if (moveItems) moveItems(); - if (getMachine().getBaseMetaTileEntity().isAllowedToWork()) { - if (getMachine().getBaseMetaTileEntity().hasInventoryBeenModified() || getMachine().getBaseMetaTileEntity().hasWorkJustBeenEnabled()) - needRecipeRecheck = true; - + if (base.isAllowedToWork()) { if (progressTime > 0) { - updateRecipeProgress(); - } - - if (progressTime == 0 && needRecipeRecheck) { - if (isInputNonEmpty()) { - trySerachRecipe(); - } else { - previousRecipe = null; - needRecipeRecheck = false; - getMachine().getBaseMetaTileEntity().setActive(false); + int tmp = progressTime; + success = updateRecipeProgress(); + if (tmp == 0 && !success) { + throw new IllegalStateException(); } } - } + + if (progressTime == 0) { + if (base.hasInventoryBeenModified() || base.hasWorkJustBeenEnabled() || success || base.getTimer() % 600 == 0 || wasNoEnergy) { + if (isInputNonEmpty() && base.isUniversalEnergyStored(getMachine().getMinimumStoredEU() - 100)) { + trySerachRecipe(); + wasNoEnergy = false; + } else { + previousRecipe = null; + wasNoEnergy = true; + base.setActive(false); + } + } + } + } + + return success; } - public void setHandler(Supplier handler) { - recipeHandler = handler; + public void setRecipeProvider(Supplier handler) { + customRecipeProvider = handler; } - protected void updateRecipeProgress() { + protected boolean updateRecipeProgress() { if (getMachine().getBaseMetaTileEntity().decreaseStoredEnergyUnits(EUt * (int)Math.pow(4, overclockersCount), false)) { if ((progressTime += (int)Math.pow(2, overclockersCount)) >= maxProgressTime) { progressTime = 0; @@ -77,21 +90,22 @@ public class RecipeLogic { endRecipe(previousRecipe); getMachine().endProcess(); + return true; } } else { - getMachine().getBaseMetaTileEntity().setActive(false); - if (!getMachine().bStuttering) { + if (!stuttering) { getMachine().stutterProcess(); - if (getMachine().useStandardStutterSound()) getMachine().sendSound((byte)8); - getMachine().bStuttering = true; + stuttering = true; } } + + return false; } protected void trySerachRecipe() { if (getMachine().allowToCheckRecipe()) { if (previousRecipe != null) { - if (previousRecipe.match(false, getMachine().getBaseMetaTileEntity(), getMachineInputs())) { // TODO add I/O item handlers to MTE + if (previousRecipe.match(false, getMachine().getBaseMetaTileEntity(), getMachine().getInputSlots())) { // TODO add I/O item handlers to MTE startRecipe(previousRecipe); } else { previousRecipe = null; @@ -99,15 +113,13 @@ public class RecipeLogic { } } else { // find new recipe - Recipe resRec = recipeHandler != null ? recipeHandler.get() : + Recipe resRec = customRecipeProvider != null ? customRecipeProvider.get() : recipeMap.stream() - .filter(rec -> rec.match(false, getMachine().getBaseMetaTileEntity(), getMachineInputs())) + .filter(rec -> rec.match(false, getMachine().getBaseMetaTileEntity(), getMachine().getInputSlots())) .findFirst().orElse(null); if (resRec != null) startRecipe(resRec); } - - needRecipeRecheck = false; } } @@ -126,12 +138,12 @@ public class RecipeLogic { } protected void startRecipe(Recipe recipe) { - if (getMachine().spaceForOutput(recipe.getOutputs()[0], recipe.getOutputs().length > 1 ? recipe.getOutputs()[1] : null)) { + if (getMachine().spaceForOutput(recipe)) { previousRecipe = recipe; - maxProgressTime = recipe.mDuration; + maxProgressTime = GT_Utility.isDebugItem(getMachine().getStackInSlot(batterySlot)) ? 1 : recipe.mDuration; progressTime = 1; EUt = recipe.mEUt; - recipe.match(true, getMachine().getBaseMetaTileEntity(), getMachineInputs()); + recipe.match(true, getMachine().getBaseMetaTileEntity(), getMachine().getInputSlots()); getMachine().getBaseMetaTileEntity().setActive(true); getMachine().startProcess(); } @@ -139,9 +151,9 @@ public class RecipeLogic { protected void endRecipe(Recipe recipe) { ItemStack[] outputs = recipe.getOutputs(); - if (outputs.length <= getMachineOutputs().length) { + if (outputs.length <= getMachine().getOutputSlots().length) { for (ItemStack out : outputs) { - for (int i : getMachineOutputs()) { + for (int i : getMachine().getOutputSlots()) { if (getMachine().getBaseMetaTileEntity().addStackToSlot(i, out.copy())) { break; } @@ -151,35 +163,27 @@ public class RecipeLogic { GT_Log.log.catching(new IllegalStateException("Found recipe with more items output machine has slots!")); } - getMachine().bStuttering = false; + stuttering = false; getMachine().endProcess(); } private boolean isInputNonEmpty() { - for (int i : getMachineInputs()) { + for (int i : getMachine().getInputSlots()) { ItemStack s = getMachine().getStackInSlot(i); if (s != null && s.stackSize > 0) return true; } - return false; } - /** - * Specify machine input slots - */ - protected int[] getMachineInputs() { - return new int[] {1, 2}; - } - - protected int[] getMachineOutputs() { - return new int[] {3, 4}; - } - - private GT_MetaTileEntity_BasicMachine getMachine() { + private IRecipeWorkable getMachine() { return metaTileEntity.get(); } + public void increaseProgressTime(int amount) { + progressTime += amount; + } + public boolean isActive() { return maxProgressTime > 0; } @@ -201,12 +205,12 @@ public class RecipeLogic { data1.setInteger("TotalTime", maxProgressTime); data1.setInteger("CurrentTime", progressTime); data1.setInteger("EUt", EUt); - data.setTag("RecipeLogic", data1); + data.setTag("RecipeLogic", data1); // TODO save recipe items to NBT! } public void loadFromNBT(NBTTagCompound data) { NBTTagCompound data1 = data.getCompoundTag("RecipeLogic"); - if (data1 != null) { + if (data1 != null && (maxProgressTime == 0 && progressTime == 0 && EUt == 0)) { maxProgressTime = data1.getInteger("TotalTime"); progressTime = data1.getInteger("CurrentTime"); EUt = data1.getInteger("EUt"); diff --git a/src/main/java/gregtechmod/api/recipe/RecipeMaps.java b/src/main/java/gregtechmod/api/recipe/RecipeMaps.java index d1f7b3c..f91666f 100644 --- a/src/main/java/gregtechmod/api/recipe/RecipeMaps.java +++ b/src/main/java/gregtechmod/api/recipe/RecipeMaps.java @@ -32,6 +32,4 @@ public class RecipeMaps { public static final List sDenseLiquidFuels = new ArrayList(); public static final List sPlasmaFuels = new ArrayList(); public static final List sMagicFuels = new ArrayList(); - - } diff --git a/src/main/java/gregtechmod/common/containers/GT_Container_Centrifuge.java b/src/main/java/gregtechmod/common/containers/GT_Container_Centrifuge.java index 9bd730d..7cfa4cc 100644 --- a/src/main/java/gregtechmod/common/containers/GT_Container_Centrifuge.java +++ b/src/main/java/gregtechmod/common/containers/GT_Container_Centrifuge.java @@ -4,15 +4,8 @@ import gregtechmod.api.gui.GT_ContainerMetaTile_Machine; import gregtechmod.api.gui.GT_Slot_Holo; import gregtechmod.api.gui.GT_Slot_Output; import gregtechmod.api.interfaces.IGregTechTileEntity; -import gregtechmod.common.tileentities.machines.GT_MetaTileEntity_Centrifuge; - -import java.util.Iterator; - import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; public class GT_Container_Centrifuge extends GT_ContainerMetaTile_Machine { @@ -29,35 +22,6 @@ public class GT_Container_Centrifuge extends GT_ContainerMetaTile_Machine { addSlotToContainer(new GT_Slot_Output (mTileEntity, 5, 50, 35)); addSlotToContainer(new GT_Slot_Holo (mTileEntity, 6, 110, 65, false, false, 64)); } - - public int mProgress, mMaxProgress, mProgressScale; - - @SuppressWarnings("rawtypes") - public void detectAndSendChanges() { - super.detectAndSendChanges(); - if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return; - mProgress = ((GT_MetaTileEntity_Centrifuge)mTileEntity.getMetaTileEntity()).getProgresstime(); - mMaxProgress = ((GT_MetaTileEntity_Centrifuge)mTileEntity.getMetaTileEntity()).maxProgresstime(); - mProgressScale = Math.max(0, Math.min(10, (mProgress>0?1:0) + (mProgress * 10) / (mMaxProgress<1?1:mMaxProgress))); - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting)var2.next(); - var1.sendProgressBarUpdate(this, 100, mProgress); - var1.sendProgressBarUpdate(this, 101, mMaxProgress); - var1.sendProgressBarUpdate(this, 102, mProgressScale); - } - } - - @SideOnly(Side.CLIENT) - public void updateProgressBar(int par1, int par2) { - super.updateProgressBar(par1, par2); - switch (par1) { - case 100: mProgress = par2; break; - case 101: mMaxProgress = par2; break; - case 102: mProgressScale = par2; break; - } - } public int getSlotCount() { return 6; diff --git a/src/main/java/gregtechmod/common/gui/GT_GUIContainer_Centrifuge.java b/src/main/java/gregtechmod/common/gui/GT_GUIContainer_Centrifuge.java index 8ff9887..be05b54 100644 --- a/src/main/java/gregtechmod/common/gui/GT_GUIContainer_Centrifuge.java +++ b/src/main/java/gregtechmod/common/gui/GT_GUIContainer_Centrifuge.java @@ -18,11 +18,10 @@ public class GT_GUIContainer_Centrifuge extends GT_GUIContainerMetaTile_Machine @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; - fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 94, 4210752); fontRenderer.drawString("Industrial", 110, 4, 4210752); fontRenderer.drawString("Centrifuge", 110, 12, 4210752); if ((((GT_Container_Centrifuge)mContainer).mDisplayErrorCode & 1) != 0) - fontRenderer.drawString("Insufficient Energy Line!", 8, ySize - 94, 4210752); + fontRenderer.drawSplitString(StatCollector.translateToLocal("metatileentity.NOT_ENOUGH_ENERGY"), 8, ySize - 102, 90, 4210752); else fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, ySize - 94, 4210752); } @@ -33,9 +32,10 @@ public class GT_GUIContainer_Centrifuge extends GT_GUIContainerMetaTile_Machine int x = (width - xSize) / 2; int y = (height - ySize) / 2; drawTexturedModalRect(x, y, 0, 0, xSize, ySize); - + if (mContainer != null && mContainer.mProgressTime>0) { - int tScale = ((GT_Container_Centrifuge)mContainer).mProgressScale; + int tScale = Math.max(0, Math.min(10, + (mContainer.mProgressTime>0?1:0) + (mContainer.mProgressTime * 10) / (mContainer.mMaxProgressTime<1?1:mContainer.mMaxProgressTime))); drawTexturedModalRect(x + 83, y + 33 - tScale, 193, 33 - tScale, 10, tScale); drawTexturedModalRect(x + 78 - tScale, y + 38, 188 - tScale, 38 , tScale, 10); drawTexturedModalRect(x + 83, y + 53, 193, 53, 10, tScale); diff --git a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_ElectricTypeSorter.java b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_ElectricTypeSorter.java index 3ef2de8..b1cf133 100644 --- a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_ElectricTypeSorter.java +++ b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_ElectricTypeSorter.java @@ -4,6 +4,7 @@ import gregtechmod.api.enums.OrePrefixes; import gregtechmod.api.interfaces.IGregTechTileEntity; import gregtechmod.api.metatileentity.MetaTileEntity; import gregtechmod.api.recipe.Recipe; +import gregtechmod.api.recipe.RecipeMaps; import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_OreDictUnificator; import gregtechmod.api.util.GT_Utility; @@ -100,7 +101,7 @@ public class GT_MetaTileEntity_ElectricTypeSorter extends GT_MetaTileEntity_Elec OrePrefixes tPrefix = OrePrefixes.getPrefix(sTypeList[mMode]); - if (((mMode == 11 && mInventory[0].getItem() instanceof ItemFood) || (mMode == 12 && Recipe.findEqualRecipe(false, false, Recipe.sGrinderRecipes, mInventory[0], GT_ModHandler.getWaterCell(1)) != null) || (tPrefix != null && tPrefix.contains(mInventory[0])) || GT_OreDictUnificator.isItemStackInstanceOf(mInventory[0], sTypeList[mMode]))) { + if (((mMode == 11 && mInventory[0].getItem() instanceof ItemFood) || (mMode == 12 && Recipe.findEqualRecipe(false, false, RecipeMaps.sGrinderRecipes, mInventory[0], GT_ModHandler.getWaterCell(1)) != null) || (tPrefix != null && tPrefix.contains(mInventory[0])) || GT_OreDictUnificator.isItemStackInstanceOf(mInventory[0], sTypeList[mMode]))) { getBaseMetaTileEntity().decreaseStoredEnergyUnits(tPrice = GT_Utility.moveOneItemStack(getBaseMetaTileEntity(), getBaseMetaTileEntity().getIInventoryAtSide(mTargetDirection), getBaseMetaTileEntity().getBackFacing(), GT_Utility.getOppositeSide(mTargetDirection), null, false, mTargetStackSize!=0?(byte)mTargetStackSize:64, mTargetStackSize!=0?(byte)mTargetStackSize:1, (byte)64, (byte)1)*3, true); } if (tPrice <= 0) { diff --git a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java index a79b806..7e7b4e7 100644 --- a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java +++ b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractGenerator.java @@ -64,8 +64,8 @@ public class GT_MetaTileEntity_TesseractGenerator extends MetaTileEntity { @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} @Override public boolean ownerControl() {return true;} @Override public boolean unbreakable() {return true;} - @Override public int getProgresstime() {return sTesseractGenerators.get(mFrequency) == this && isWorking >= 20 ? 999 : 0;} - @Override public int maxProgresstime() {return 1000;} + public int getProgresstime() {return sTesseractGenerators.get(mFrequency) == this && isWorking >= 20 ? 999 : 0;} + public int maxProgresstime() {return 1000;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { diff --git a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java index c1ccf14..0a09fe4 100644 --- a/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java +++ b/src/main/java/gregtechmod/common/tileentities/automation/GT_MetaTileEntity_TesseractTerminal.java @@ -45,8 +45,8 @@ public class GT_MetaTileEntity_TesseractTerminal extends MetaTileEntity { @Override public int getInvSize() {return 0;} @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} @Override public boolean ownerControl() {return true;} - @Override public int getProgresstime() {return getTesseract(mFrequency, false) != null ? 999 : 0;} - @Override public int maxProgresstime() {return 1000;} + public int getProgresstime() {return getTesseract(mFrequency, false) != null ? 999 : 0;} + public int maxProgresstime() {return 1000;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_DieselGenerator.java index 5898b45..591eb90 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_DieselGenerator.java @@ -14,21 +14,21 @@ import net.minecraft.item.ItemStack; public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_DieselGenerator(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_DieselGenerator(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_DieselGenerator() {} + public GT_MetaTileEntity_DieselGenerator(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) {return aFacing > 1;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 12 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 117);} - @Override public List getRecipes() {return Recipe.sDieselFuels;} - @Override public int getEfficiency() {return 100;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_DieselGenerator(); + return new GT_MetaTileEntity_DieselGenerator(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_GasTurbine.java index 78e9c72..07ab04f 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_GasTurbine.java @@ -10,21 +10,21 @@ import net.minecraft.entity.player.EntityPlayer; public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_GasTurbine(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_GasTurbine(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_GasTurbine() {} + public GT_MetaTileEntity_GasTurbine(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) {return true;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 16 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 118);} - @Override public List getRecipes() {return Recipe.sTurbineFuels;} - @Override public int getEfficiency() {return 75;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_GasTurbine(); + return new GT_MetaTileEntity_GasTurbine(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_MagicEnergyConverter.java index fe27f1c..bca0570 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_MagicEnergyConverter.java @@ -13,21 +13,21 @@ import net.minecraft.world.biome.BiomeGenBase; public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_MagicEnergyConverter(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_MagicEnergyConverter(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_MagicEnergyConverter() {} + public GT_MetaTileEntity_MagicEnergyConverter(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) {return true;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 24 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 125);} - @Override public List getRecipes() {return Recipe.sMagicFuels;} - @Override public int getEfficiency() {return 100;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MagicEnergyConverter(); + return new GT_MetaTileEntity_MagicEnergyConverter(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_PlasmaGenerator.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_PlasmaGenerator.java index 58e4c7f..6e8b738 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_PlasmaGenerator.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_PlasmaGenerator.java @@ -10,23 +10,23 @@ import net.minecraft.entity.player.EntityPlayer; public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_PlasmaGenerator(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_PlasmaGenerator(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_PlasmaGenerator() {} + public GT_MetaTileEntity_PlasmaGenerator(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) {return true;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 2048 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 121);} - @Override public List getRecipes() {return Recipe.sPlasmaFuels;} - @Override public int getEfficiency() {return 100;} @Override public boolean isOutputFacing(byte aSide) {return aSide == this.getBaseMetaTileEntity().getFrontFacing();} @Override public int maxEUStore() {return 1000000000;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_PlasmaGenerator(); + return new GT_MetaTileEntity_PlasmaGenerator(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_SemifluidGenerator.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_SemifluidGenerator.java index ea35f22..507267c 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_SemifluidGenerator.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_SemifluidGenerator.java @@ -10,21 +10,21 @@ import net.minecraft.entity.player.EntityPlayer; public class GT_MetaTileEntity_SemifluidGenerator extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_SemifluidGenerator(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_SemifluidGenerator(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_SemifluidGenerator() {} + public GT_MetaTileEntity_SemifluidGenerator(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) {return false;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 8 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 120);} - @Override public List getRecipes() {return Recipe.sDenseLiquidFuels;} - @Override public int getEfficiency() {return 100;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SemifluidGenerator(); + return new GT_MetaTileEntity_SemifluidGenerator(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_ThermalGenerator.java b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_ThermalGenerator.java index ebf87ce..32f8032 100644 --- a/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_ThermalGenerator.java +++ b/src/main/java/gregtechmod/common/tileentities/energy/production/GT_MetaTileEntity_ThermalGenerator.java @@ -10,21 +10,21 @@ import net.minecraft.entity.player.EntityPlayer; public class GT_MetaTileEntity_ThermalGenerator extends GT_MetaTileEntity_BasicGenerator { - public GT_MetaTileEntity_ThermalGenerator(int aID, String aName) { - super(aID, aName); + public GT_MetaTileEntity_ThermalGenerator(int aID, String aName, List recipeMap, int efficiency) { + super(aID, aName, recipeMap, efficiency); } - public GT_MetaTileEntity_ThermalGenerator() {} + public GT_MetaTileEntity_ThermalGenerator(List recipeMap, int efficiency) { + super(recipeMap, efficiency); + } @Override public boolean isFacingValid(byte aFacing) { return false;} @Override public int maxEUOutput() {return this.getBaseMetaTileEntity().isAllowedToWork() ? 24 : 0;} @Override public void onRightclick(EntityPlayer aPlayer) {this.getBaseMetaTileEntity().openGUI(aPlayer, 119);} - @Override public List getRecipes() {return Recipe.sHotFuels;} - @Override public int getEfficiency() {return 80;} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_ThermalGenerator(); + return new GT_MetaTileEntity_ThermalGenerator(recipeMap, efficiency); } @Override diff --git a/src/main/java/gregtechmod/common/tileentities/machines/GT_MetaTileEntity_Centrifuge.java b/src/main/java/gregtechmod/common/tileentities/machines/GT_MetaTileEntity_Centrifuge.java index d31371d..1aa9851 100644 --- a/src/main/java/gregtechmod/common/tileentities/machines/GT_MetaTileEntity_Centrifuge.java +++ b/src/main/java/gregtechmod/common/tileentities/machines/GT_MetaTileEntity_Centrifuge.java @@ -5,30 +5,41 @@ import java.util.Map; import gregtechmod.api.GregTech_API; import gregtechmod.api.interfaces.IGregTechTileEntity; +import gregtechmod.api.interfaces.IRecipeWorkable; import gregtechmod.api.metatileentity.MetaTileEntity; import gregtechmod.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; import gregtechmod.api.recipe.Recipe; +import gregtechmod.api.recipe.RecipeLogic; +import gregtechmod.api.recipe.RecipeMaps; +import gregtechmod.api.util.GT_Log; import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.InfoBuilder; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraftforge.fluids.FluidStack; -public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank { - - private byte mSpeed = 0; - private int mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0; - private ItemStack mOutputItem1, mOutputItem2, mOutputItem3, mOutputItem4; +public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank implements IRecipeWorkable { + + private RecipeLogic recipeLogic; + private int mSpeed = 0; public GT_MetaTileEntity_Centrifuge(int aID, String mName) { super(aID, mName); + init(); } public GT_MetaTileEntity_Centrifuge() { - + init(); + } + + private void init() { + recipeLogic = new RecipeLogic(RecipeMaps.sCentrifugeRecipes, this); + recipeLogic.moveItems = false; +// recipeLogic.setRecipeProvider(() -> { +// +// return null; +// }); } @Override public boolean isTransformerUpgradable() {return true;} @@ -46,9 +57,8 @@ public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank { @Override public int getInvSize() {return 7;} @Override public void onRightclick(EntityPlayer aPlayer) {getBaseMetaTileEntity().openGUI(aPlayer, 146);} @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} - @Override public int getProgresstime() {return mProgresstime;} - @Override public int maxProgresstime() {return mMaxProgresstime;} - @Override public int increaseProgress(int aProgress) {mProgresstime += aProgress; return mMaxProgresstime-mProgresstime;} + @Override public RecipeLogic getRecipeLogic() {return recipeLogic;} + @Override public int increaseProgress(int aProgress) {recipeLogic.increaseProgressTime(aProgress); return recipeLogic.getMaxProgressTime()-recipeLogic.getProgressTime();} @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { @@ -58,55 +68,13 @@ public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank { @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setInteger("mEUt", mEUt); - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - - if (mOutputItem1 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItem1.writeToNBT(tNBT); - aNBT.setTag("mOutputItem1", tNBT); - } - if (mOutputItem2 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItem2.writeToNBT(tNBT); - aNBT.setTag("mOutputItem2", tNBT); - } - if (mOutputItem3 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItem3.writeToNBT(tNBT); - aNBT.setTag("mOutputItem3", tNBT); - } - if (mOutputItem4 != null) { - NBTTagCompound tNBT = new NBTTagCompound(); - mOutputItem4.writeToNBT(tNBT); - aNBT.setTag("mOutputItem4", tNBT); - } + recipeLogic.loadFromNBT(aNBT); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - mEUt = aNBT.getInteger("mEUt"); - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - - NBTTagCompound tNBT1 = (NBTTagCompound)aNBT.getTag("mOutputItem1"); - if (tNBT1 != null) { - mOutputItem1 = GT_Utility.loadItem(tNBT1); - } - NBTTagCompound tNBT2 = (NBTTagCompound)aNBT.getTag("mOutputItem2"); - if (tNBT2 != null) { - mOutputItem2 = GT_Utility.loadItem(tNBT2); - } - NBTTagCompound tNBT3 = (NBTTagCompound)aNBT.getTag("mOutputItem3"); - if (tNBT3 != null) { - mOutputItem3 = GT_Utility.loadItem(tNBT3); - } - NBTTagCompound tNBT4 = (NBTTagCompound)aNBT.getTag("mOutputItem4"); - if (tNBT4 != null) { - mOutputItem4 = GT_Utility.loadItem(tNBT4); - } + recipeLogic.loadFromNBT(aNBT); } @Override public boolean doesFillContainers() {return false;} @@ -123,130 +91,61 @@ public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank { @Override public void onPostTick() { if (getBaseMetaTileEntity().isServerSide()) { - if (getBaseMetaTileEntity().getOverclockerUpgradeCount() >=2) { - mSpeed = 2; - } else if (getBaseMetaTileEntity().getOverclockerUpgradeCount() == 1) { - mSpeed = 1; - } else { - mSpeed = 0; - } - - if (mMaxProgresstime > 0) { - getBaseMetaTileEntity().setActive(true); - if (mProgresstime < 0 || getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt*(int)Math.pow(4, getBaseMetaTileEntity().getOverclockerUpgradeCount()), false)) { - if ((mProgresstime+=(int)Math.pow(2, getBaseMetaTileEntity().getOverclockerUpgradeCount()))>=mMaxProgresstime) { - addOutputProducts(); - mOutputItem1 = null; - mOutputItem2 = null; - mOutputItem3 = null; - mOutputItem4 = null; - mProgresstime = 0; - mMaxProgresstime = 0; - getBaseMetaTileEntity().setErrorDisplayID(0); - } - } else { - getBaseMetaTileEntity().setActive(false); - if (GregTech_API.sConstantEnergy) { - mProgresstime = -10; - getBaseMetaTileEntity().setErrorDisplayID(1); - } - } - } else { - getBaseMetaTileEntity().setActive(false); - if (getBaseMetaTileEntity().isAllowedToWork() && getBaseMetaTileEntity().getUniversalEnergyStored() > 100) checkRecipe(); - } + mSpeed = getBaseMetaTileEntity().getOverclockerUpgradeCount(); + recipeLogic.update(); } } - private void addOutputProducts() { - if (mOutputItem1 != null) - if (mInventory[2] == null) - mInventory[2] = GT_Utility.copy(mOutputItem1); - else if (GT_Utility.areStacksEqual(mInventory[2], mOutputItem1)) - mInventory[2].stackSize = Math.min(mOutputItem1.getMaxStackSize(), mOutputItem1.stackSize + mInventory[2].stackSize); - - if (mOutputItem2 != null) - if (mInventory[3] == null) - mInventory[3] = GT_Utility.copy(mOutputItem2); - else if (GT_Utility.areStacksEqual(mInventory[3], mOutputItem2)) - mInventory[3].stackSize = Math.min(mOutputItem2.getMaxStackSize(), mOutputItem2.stackSize + mInventory[3].stackSize); - - if (mOutputItem3 != null) - if (mInventory[4] == null) - mInventory[4] = GT_Utility.copy(mOutputItem3); - else if (GT_Utility.areStacksEqual(mInventory[4], mOutputItem3)) - mInventory[4].stackSize = Math.min(mOutputItem3.getMaxStackSize(), mOutputItem3.stackSize + mInventory[4].stackSize); - - if (mOutputItem4 != null) - if (mInventory[5] == null) - mInventory[5] = GT_Utility.copy(mOutputItem4); - else if (GT_Utility.areStacksEqual(mInventory[5], mOutputItem4)) - mInventory[5].stackSize = Math.min(mOutputItem4.getMaxStackSize(), mOutputItem4.stackSize + mInventory[5].stackSize); - } - - private boolean spaceForOutput(Recipe aRecipe) { - if (mInventory[2] == null || aRecipe.getOutput(0) == null || (mInventory[2].stackSize + aRecipe.getOutput(0).stackSize <= mInventory[2].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[2], aRecipe.getOutput(0)))) - if (mInventory[3] == null || aRecipe.getOutput(1) == null || (mInventory[3].stackSize + aRecipe.getOutput(1).stackSize <= mInventory[3].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[3], aRecipe.getOutput(1)))) - if (mInventory[4] == null || aRecipe.getOutput(2) == null || (mInventory[4].stackSize + aRecipe.getOutput(2).stackSize <= mInventory[4].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[4], aRecipe.getOutput(2)))) - if (mInventory[5] == null || aRecipe.getOutput(3) == null || (mInventory[5].stackSize + aRecipe.getOutput(3).stackSize <= mInventory[5].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[5], aRecipe.getOutput(3)))) + public boolean spaceForOutput(Recipe aRecipe) { + if (mInventory[2] == null || aRecipe.getOutputs()[0] == null || (mInventory[2].stackSize + aRecipe.getOutputs()[0].stackSize <= mInventory[2].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[2], aRecipe.getOutputs()[0]))) + if (mInventory[3] == null || aRecipe.getOutputs()[1] == null || (mInventory[3].stackSize + aRecipe.getOutputs()[1].stackSize <= mInventory[3].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[3], aRecipe.getOutputs()[1]))) + if (mInventory[4] == null || aRecipe.getOutputs()[2] == null || (mInventory[4].stackSize + aRecipe.getOutputs()[2].stackSize <= mInventory[4].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[4], aRecipe.getOutputs()[2]))) + if (mInventory[5] == null || aRecipe.getOutputs()[3] == null || (mInventory[5].stackSize + aRecipe.getOutputs()[3].stackSize <= mInventory[5].getMaxStackSize() && GT_Utility.areStacksEqual(mInventory[5], aRecipe.getOutputs()[3]))) return true; + GT_Log.log.error("NO space: " + mInventory[2] + " " + mInventory[3] + " " + mInventory[4] + " " + mInventory[5]); return false; } private boolean checkRecipe() { - Recipe tRecipe = Recipe.findEqualRecipe(false, false, Recipe.sCentrifugeRecipes, mInventory[0], mInventory[1]); - if (tRecipe != null) { - if (spaceForOutput(tRecipe) && tRecipe.isRecipeInputEqual(true, true, mInventory[0], mInventory[1])) { - if (mInventory[0] != null) if (mInventory[0].stackSize == 0) mInventory[0] = null; - if (mInventory[1] != null) if (mInventory[1].stackSize == 0) mInventory[1] = null; - mMaxProgresstime = tRecipe.mDuration; - mEUt = tRecipe.mEUt; - mOutputItem1 = GT_Utility.copy(tRecipe.getOutput(0)); - mOutputItem2 = GT_Utility.copy(tRecipe.getOutput(1)); - mOutputItem3 = GT_Utility.copy(tRecipe.getOutput(2)); - mOutputItem4 = GT_Utility.copy(tRecipe.getOutput(3)); - return true; - } - } - if (mFluid != null) { - ItemStack tStack = GT_Utility.fillFluidContainer(mFluid, new ItemStack(Items.bucket, 1)); - FluidStack tFluid = GT_Utility.getFluidForFilledItem(tStack); - if (tStack != null && tFluid != null) { - tStack.stackSize = mFluid.amount / tFluid.amount; - int tAmount = tStack.stackSize; - tRecipe = Recipe.findEqualRecipe(false, false, Recipe.sCentrifugeRecipes, tStack, mInventory[1]); - if (tRecipe != null) { - if (spaceForOutput(tRecipe) && tRecipe.isRecipeInputEqual(true, true, tStack, mInventory[1])) { - mFluid.amount -= (tAmount - tStack.stackSize) * tFluid.amount; - if (mFluid.amount <= 0) mFluid = null; - if (mInventory[1] != null) if (mInventory[1].stackSize == 0) mInventory[1] = null; - mMaxProgresstime = tRecipe.mDuration; - mEUt = tRecipe.mEUt; - mOutputItem1 = GT_Utility.copy(tRecipe.getOutput(0)); - mOutputItem2 = GT_Utility.copy(tRecipe.getOutput(1)); - mOutputItem3 = GT_Utility.copy(tRecipe.getOutput(2)); - if (!GT_Utility.areStacksEqual(tRecipe.getOutput(3), new ItemStack(Items.bucket, 1))) mOutputItem4 = GT_Utility.copy(tRecipe.getOutput(3)); - return true; - } - } - } - } +// if (mFluid != null) { +// ItemStack tStack = GT_Utility.fillFluidContainer(mFluid, new ItemStack(Items.bucket, 1)); +// FluidStack tFluid = GT_Utility.getFluidForFilledItem(tStack); +// if (tStack != null && tFluid != null) { +// tStack.stackSize = mFluid.amount / tFluid.amount; +// int tAmount = tStack.stackSize; +// tRecipe = Recipe.findEqualRecipe(false, false, Recipe.sCentrifugeRecipes, tStack, mInventory[1]); +// if (tRecipe != null) { +// if (spaceForOutput(tRecipe) && tRecipe.isRecipeInputEqual(true, true, tStack, mInventory[1])) { +// mFluid.amount -= (tAmount - tStack.stackSize) * tFluid.amount; +// if (mFluid.amount <= 0) mFluid = null; +// if (mInventory[1] != null) if (mInventory[1].stackSize == 0) mInventory[1] = null; +// mMaxProgresstime = tRecipe.mDuration; +// mEUt = tRecipe.mEUt; +// mOutputItem1 = GT_Utility.copy(tRecipe.getOutput(0)); +// mOutputItem2 = GT_Utility.copy(tRecipe.getOutput(1)); +// mOutputItem3 = GT_Utility.copy(tRecipe.getOutput(2)); +// if (!GT_Utility.areStacksEqual(tRecipe.getOutput(3), new ItemStack(Items.bucket, 1))) mOutputItem4 = GT_Utility.copy(tRecipe.getOutput(3)); +// return true; +// } +// } +// } +// } return false; } @Override public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone) { if (aSide == 0) return 32; - if (aSide == 1) return aActive?mSpeed==2?44:mSpeed==1?43:42:41; - return aActive?mSpeed==2?28:mSpeed==1?27:26:25; + if (aSide == 1) return aActive ? mSpeed >= 2 ? 44 : mSpeed == 1 ? 43 : 42 : 41; + return aActive ? mSpeed >= 2 ? 28 : mSpeed == 1 ? 27 : 26 : 25; } @Override public Map> getInfoData() { return InfoBuilder.create() - .newKey("sensor.progress.percentage", mProgresstime * 100.0D / mMaxProgresstime) - .newKey("sensor.progress.secs", mProgresstime / 20) - .newKey("sensor.progress.secs", mMaxProgresstime / 20) + .newKey("sensor.progress.percentage", recipeLogic.getProgressTime() * 100.0D / recipeLogic.getMaxProgressTime()) + .newKey("sensor.progress.secs", recipeLogic.getProgressTime() / 20) + .newKey("sensor.progress.secs", recipeLogic.getMaxProgressTime() / 20) .build(); } @@ -276,9 +175,43 @@ public class GT_MetaTileEntity_Centrifuge extends GT_MetaTileEntity_BasicTank { @Override public byte getUpdateData() { - return mSpeed; + return (byte) mSpeed; } @Override public int getTankPressure() {return -100;} @Override public int getCapacity() {return 64000;} + + @Override + public void startProcess() {} + + @Override + public void endProcess() { + getBaseMetaTileEntity().setErrorDisplayID(0); + } + + @Override + public void stutterProcess() { + if (GregTech_API.sConstantEnergy) { + int val = (int) (recipeLogic.getMaxProgressTime() * 0.1D); + + if (recipeLogic.getProgressTime() > val) + recipeLogic.increaseProgressTime(-val); + getBaseMetaTileEntity().setErrorDisplayID(1); + } + } + + @Override + public boolean allowToCheckRecipe() { + return true; + } + + @Override + public int[] getInputSlots() { + return new int[] {0, 1}; + } + + @Override + public int[] getOutputSlots() { + return new int[] {2, 3, 4, 5}; + } } diff --git a/src/main/java/gregtechmod/loaders/preload/GT_MetaTileEntityLoader.java b/src/main/java/gregtechmod/loaders/preload/GT_MetaTileEntityLoader.java index 13fa86a..3141472 100644 --- a/src/main/java/gregtechmod/loaders/preload/GT_MetaTileEntityLoader.java +++ b/src/main/java/gregtechmod/loaders/preload/GT_MetaTileEntityLoader.java @@ -44,16 +44,16 @@ public class GT_MetaTileEntityLoader implements Runnable { new GT_MetaTileEntity_QuantumTank ( 30, "GT_QuantumTank"); new GT_MetaTileEntity_ImplosionCompressor ( 31, "GT_ImplosionCompressor"); new GT_MetaTileEntity_Sawmill ( 32, "GT_Sawmill"); - new GT_MetaTileEntity_DieselGenerator ( 33, "GT_DieselGenerator"); - new GT_MetaTileEntity_GasTurbine ( 34, "GT_GasTurbine"); - new GT_MetaTileEntity_ThermalGenerator ( 35, "GT_ThermalGenerator"); - new GT_MetaTileEntity_SemifluidGenerator ( 36, "GT_SemifluidGenerator"); - new GT_MetaTileEntity_PlasmaGenerator ( 37, "GT_PlasmaGenerator"); + new GT_MetaTileEntity_DieselGenerator ( 33, "GT_DieselGenerator" , RecipeMaps.sDieselFuels , 100); + new GT_MetaTileEntity_GasTurbine ( 34, "GT_GasTurbine" , RecipeMaps.sTurbineFuels , 75 ); + new GT_MetaTileEntity_ThermalGenerator ( 35, "GT_ThermalGenerator" , RecipeMaps.sHotFuels , 80 ); + new GT_MetaTileEntity_SemifluidGenerator ( 36, "GT_SemifluidGenerator" , RecipeMaps.sDenseLiquidFuels , 100); + new GT_MetaTileEntity_PlasmaGenerator ( 37, "GT_PlasmaGenerator" , RecipeMaps.sPlasmaFuels , 100); new GT_MetaTileEntity_VacuumFreezer ( 38, "GT_VacuumFreezer"); new GT_MetaTileEntity_ElectricRegulatorAdvanced ( 39, "GT_RegulatorAdvanced"); new GT_MetaTileEntity_DragonEggEnergySiphon ( 40, "GT_DragonEggEnergySiphon"); new GT_MetaTileEntity_ChemicalReactor ( 41, "GT_ChemicalReactor"); - new GT_MetaTileEntity_MagicEnergyConverter ( 42, "GT_MagicConverter"); + new GT_MetaTileEntity_MagicEnergyConverter ( 42, "GT_MagicConverter" , RecipeMaps.sMagicFuels , 100); new GT_MetaTileEntity_MagicEnergyAbsorber ( 43, "GT_MagicAbsorber"); new GT_MetaTileEntity_DistillationTower ( 44, "GT_DistillationTower"); new GT_MetaTileEntity_Safe ( 45, "GT_Safe"); diff --git a/src/main/resources/assets/gregtech_addon/lang/en_US.lang b/src/main/resources/assets/gregtech_addon/lang/en_US.lang index fb644dc..c9660e6 100644 --- a/src/main/resources/assets/gregtech_addon/lang/en_US.lang +++ b/src/main/resources/assets/gregtech_addon/lang/en_US.lang @@ -348,6 +348,7 @@ metatileentity.TRANSFORMERS.tooltip=%d Transformer Upgrades metatileentity.ENERGYCELLS.tooltip=%d Energy Cell Upgrades metatileentity.STEAMTANKS.tooltip=%d Steam Tank Upgrades metatileentity.EUSTORAGES.tooltip=%d Additional EU-Storage +metatileentity.NOT_ENOUGH_ENERGY=Insufficient Energy Line! item.180k_Helium_Coolantcell.name=180k Helium Coolant Cell item.180k_NaK_Coolantcell.name=180k NaK Coolantcell