aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java71
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java50
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java462
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java33
9 files changed, 510 insertions, 221 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
index 808eb90728..93591b2aaf 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
@@ -1,11 +1,15 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import net.minecraft.entity.player.InventoryPlayer;
+import java.util.Iterator;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -13,9 +17,12 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.Gr
* The Container I use for all my Basic Machines
*/
public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine {
-
- public int mUUA_USED = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getAmplifierUsed();
- public int mUUM_MADE = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getMatterProduced();
+
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
@@ -39,4 +46,58 @@ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine {
public int getShiftClickSlotCount() {
return 0;
}
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) {
+ return;
+ }
+ GregtechMetaTileEntity_MassFabricator aTile = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity());
+
+ mAmplifierProduced = aTile.mAmplifierProduced;
+ mAmplifierUsed = aTile.mAmplifierUsed;
+ mMatterProduced = aTile.mMatterProduced;
+ mScrapProduced = aTile.mScrapProduced;
+ mScrapUsed = aTile.mScrapUsed;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 201, mAmplifierProduced);
+ var1.sendProgressBarUpdate(this, 202, mAmplifierUsed);
+ var1.sendProgressBarUpdate(this, 203, mMatterProduced);
+ var1.sendProgressBarUpdate(this, 204, mScrapProduced);
+ var1.sendProgressBarUpdate(this, 205, mScrapUsed);
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 201:
+ mAmplifierProduced = (par2);
+ break;
+ case 202:
+ mAmplifierUsed = (par2);
+ break;
+ case 203:
+ mMatterProduced = (par2);
+ break;
+ case 204:
+ mScrapProduced = (par2);
+ break;
+ case 205:
+ mScrapUsed = (par2);
+ break;
+ }
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
index 95bde9fd9f..f7869bff60 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
@@ -5,7 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
/**
@@ -18,8 +18,11 @@ import gtPlusPlus.core.lib.CORE;
public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine {
String mName = "";
- int uuaUsed = 0;
- int uumMade = 0;
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public GUI_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) {
super(new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile));
@@ -61,11 +64,21 @@ public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine {
this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255);
this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255);
} else {
- this.uuaUsed = ((CONTAINER_MatterFab) this.mContainer).mUUA_USED;
- this.uumMade = ((CONTAINER_MatterFab) this.mContainer).mUUM_MADE;
+ CONTAINER_MatterFab aContainer = (CONTAINER_MatterFab) this.mContainer;
+
+ this.mMatterProduced = aContainer.mMatterProduced;
+ this.mAmplifierProduced = aContainer.mAmplifierProduced;
+ this.mAmplifierUsed = aContainer.mAmplifierUsed;
+ this.mScrapProduced = aContainer.mScrapProduced;
+ this.mScrapUsed = aContainer.mScrapUsed;
+
this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255);
- this.fontRendererObj.drawString("UU-Amplifier Used: "+this.uuaUsed, 10, 24, 16448255);
- this.fontRendererObj.drawString("UU-Matter Fabricated: "+this.uumMade, 10, 32, 16448255);
+
+ this.fontRendererObj.drawString("Scrap Made: "+this.mScrapProduced, 10, 32, 16448255);
+ this.fontRendererObj.drawString("Scrap Used: "+this.mScrapUsed, 10, 40, 16448255);
+ this.fontRendererObj.drawString("UUA Made: "+this.mAmplifierProduced, 10, 48, 16448255);
+ this.fontRendererObj.drawString("UUA Used: "+this.mAmplifierUsed, 10, 56, 16448255);
+ this.fontRendererObj.drawString("UUM Made: "+this.mMatterProduced, 10, 64, 16448255);
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
index 79d1033bd0..e4dc7835cb 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
@@ -58,6 +58,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank {
super.detectAndSendChanges();
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
+ Logger.INFO("TEST");
mReduction = ((GregtechMetaAtmosphericReconditioner) mTileEntity.getMetaTileEntity()).mPollutionReduction;
Iterator var2 = this.crafters.iterator();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index 0ed4a690bb..a72c6e98f3 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -313,7 +313,9 @@ public interface IGregtech_RecipeAdder {
public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt);
- public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt);
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt);
+
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt);
public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
index b27cb95ca4..d0682b85e8 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
@@ -6,16 +6,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
import gregtech.api.util.extensions.ArrayExt;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus {
public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) {
@@ -72,54 +69,10 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In
return null;
}
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) {
- this.fillStacksIntoFirstSlots();
- }
-
- }
-
- public void updateSlots() {
- for (int i = 0; i < this.mInventory.length; ++i) {
- if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) {
- this.mInventory[i] = null;
- }
- }
-
- this.fillStacksIntoFirstSlots();
- }
-
- protected void fillStacksIntoFirstSlots() {
- for (int i = 0; i < this.mInventory.length; ++i) {
- for (int j = i + 1; j < this.mInventory.length; ++j) {
- if (this.mInventory[j] != null && (this.mInventory[i] == null
- || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) {
- GT_Utility.moveStackFromSlotAToSlotB((IInventory) this.getBaseMetaTileEntity(), (IInventory) this.getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
- }
- }
- }
-
- }
-
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return aSide == this.getBaseMetaTileEntity().getFrontFacing();
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == this.getBaseMetaTileEntity().getFrontFacing()
- && (this.mRecipeMap == null || this.mRecipeMap.containsInput(aStack));
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- }
-
@Override
public String[] getDescription() {
String[] aDesc = new String[] {
@@ -192,39 +145,4 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In
}
- @Override
- public int getMaxItemCount() {
- // TODO Auto-generated method stub
- return super.getMaxItemCount();
- }
-
- @Override
- public int getSizeInventory() {
- // TODO Auto-generated method stub
- return super.getSizeInventory();
- }
-
- @Override
- public ItemStack getStackInSlot(int aIndex) {
- // TODO Auto-generated method stub
- return super.getStackInSlot(aIndex);
- }
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- // TODO Auto-generated method stub
- return super.canInsertItem(aIndex, aStack, aSide);
- }
-
- @Override
- public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- // TODO Auto-generated method stub
- return super.canExtractItem(aIndex, aStack, aSide);
- }
-
- @Override
- public ItemStack[] getRealInventory() {
- // TODO Auto-generated method stub
- return super.getRealInventory();
- }
} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
index b50031ac00..6f0176da25 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -1,23 +1,15 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import java.util.*;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.EntityUtils;
@@ -25,12 +17,18 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
private boolean mHasBeenMapped = false;
private int mCurrentDimension = 0;
public int mMode = 0;
+ public boolean mLocked = true;
public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
@@ -43,6 +41,9 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public String[] getDescription() {
return new String[] {this.mDescription,
+ "Can be locked to the owner by sneaking with a screwdriver",
+ "Can also be locked with a lock upgrade",
+ "",
"3 Modes, Long-Range, Local and Mixed.",
"Long-Range: Can supply 2A of power to a single player up to "+(GT_Values.V[this.mTier]*4)+"m away.",
"Local: Can supply several Amps to each player within "+this.mTier*20+"m.",
@@ -151,6 +152,11 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
mWirelessChargingMap.clear();
mLocalChargingMap.clear();
+ if (aPlayer.isSneaking()) {
+ mLocked = !mLocked;
+ PlayerUtils.messagePlayer(aPlayer, mLocked ? "Locked to owner." : "Unlocked.");
+ }
+
if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
@@ -349,12 +355,14 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setBoolean("mLocked", this.mLocked);
aNBT.setInteger("mMode", this.mMode);
aNBT.setInteger("mCurrentDimension", this.mCurrentDimension);
}
@Override
public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mLocked = aNBT.getBoolean("mLocked");
this.mMode = aNBT.getInteger("mMode");
this.mCurrentDimension = aNBT.getInteger("mCurrentDimension");
}
@@ -364,9 +372,21 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
super.onFirstTick(aBaseMetaTileEntity);
}
-
private Map<String, UUID> mWirelessChargingMap = new HashMap<String, UUID>();
private Map<String, UUID> mLocalChargingMap = new HashMap<String, UUID>();
+
+ private boolean isValidPlayer(EntityPlayer aPlayer) {
+ BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
+ if (mLocked || ( aTile != null && aTile.privateAccess())) {
+ if (aPlayer.getUniqueID().equals(getBaseMetaTileEntity().getOwnerUuid())){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
@@ -380,7 +400,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
mHasBeenMapped = true;
}
-
+
if (aTick % 20 == 0 && mHasBeenMapped){
if (!aBaseMetaTileEntity.getWorld().playerEntities.isEmpty()){
for (Object mTempPlayer : aBaseMetaTileEntity.getWorld().playerEntities){
@@ -390,7 +410,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
if (this.mMode == 1 || this.mMode == 2){
int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
- if (!mLocalChargingMap.containsKey(mTemp.getDisplayName())){
+ if (isValidPlayer(mTemp) && !mLocalChargingMap.containsKey(mTemp.getDisplayName())){
mLocalChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
//PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
@@ -409,7 +429,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) <= tempRange){
if (!mWirelessChargingMap.containsKey(mTemp.getDisplayName())){
- if (mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
+ if (isValidPlayer(mTemp)) {
mWirelessChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Long-Range].");
@@ -424,7 +444,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
}
}
}
- if (mWirelessChargingMap.containsKey(mTemp.getDisplayName()) && !mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())){
+ if (mWirelessChargingMap.containsKey(mTemp.getDisplayName())){
if (mWirelessChargingMap.remove(mTemp.getDisplayName()) != null){
ChargingHelper.removeValidPlayer(mTemp, this);
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index 09bee76272..1b24b8f264 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -364,6 +364,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
this.mOutputItems = outputs;
this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)};
+ this.updateSlots();
return true;
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
index 7a703e5bc5..253d70d275 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -1,45 +1,29 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
+
+import org.apache.commons.lang3.ArrayUtils;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.ConfigCategories;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
-import gregtech.api.util.GT_Config;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.*;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.*;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MatterFab;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -55,11 +39,11 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public static int sUUASpeedBonus = 4;
public static int sDurationMultiplier = 3200;
- private int mMatterProduced = 0;
- private int mScrapProduced = 0;
- private int mAmplifierProduced = 0;
- private int mScrapUsed = 0;
- private int mAmplifierUsed = 0;
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public static String mCasingName1 = "Matter Fabricator Casing";
public static String mCasingName2 = "Containment Casing";
@@ -85,6 +69,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return this.mMatterProduced;
}
+ public int getScrapProduced(){
+ return this.mScrapProduced;
+ }
+
public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -144,25 +132,17 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return "MatterFabricator";
}
- public static ItemStack getScrapPile() {
- if (mScrap[0] == null) {
- mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap"));
- }
- return mScrap[0];
- }
- public static ItemStack getScrapBox() {
- if (mScrap[1] == null) {
- mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox"));
- }
- return mScrap[1];
- }
-
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png");
}
@Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_MatterFab(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
public void onConfigLoad(final GT_Config aConfig) {
super.onConfigLoad(aConfig);
sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier);
@@ -178,9 +158,30 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
ArrayList<FluidStack> tFluids = getStoredFluids();
ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
- return checkRecipeGeneric(tItemInputs, tFluidInputs, getMaxParallelRecipes(), 80, 100, 100);
+ init();
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, 4, 80, 00, 100);
}
+ public static boolean sInit = false;
+
+ public static void init() {
+ if (!sInit) {
+ if (mScrap[0] == null) {
+ mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap"));
+ }
+ if (mScrap[1] == null) {
+ mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox"));
+ }
+ if (mUU[0] == null) {
+ mUU[0] = Materials.UUAmplifier.getFluid(100);
+ }
+ if (mUU[1] == null) {
+ mUU[1] = Materials.UUMatter.getFluid(100);
+ }
+ sInit = true;
+ }
+ }
+
@Override
public IStructureDefinition<GregtechMetaTileEntity_MassFabricator> getStructureDefinition() {
if (STRUCTURE_DEFINITION == null) {
@@ -282,28 +283,6 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return new GregtechMetaTileEntity_MassFabricator(this.mName);
}
- public boolean doesHatchContainUUA() {
- if (mUU[0] == null) {
- mUU[0] = Materials.UUAmplifier.getFluid(100);
- }
- if (mUU[1] == null) {
- mUU[1] = Materials.UUMatter.getFluid(100);
- }
-
- if (mUU[0] != null && mUU[1] != null) {
- for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) {
- if (g.getFluid() != null) {
- if (g.mFluid.isFluidEqual(mUU[0])) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
-
/**
* Special Recipe Handling
*/
@@ -316,55 +295,332 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
}
@Override
- public boolean checkRecipeGeneric(
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ if (this.mMode == MODE_SCRAP) {
+ return checkRecipeScrap(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
+ }
+ else {
+ return checkRecipeUU(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
+ }
+ }
+
+ public boolean checkRecipeScrap(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ ItemStack aPotentialOutput = GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(1, aItemInputs[0]), 0);
+ GT_Recipe tRecipe = new GTPP_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aItemInputs[0])}, aPotentialOutput == null ? null : new ItemStack[]{aPotentialOutput}, null, new int[]{2000}, null, null, 40, MaterialUtils.getVoltageForTier(1), 0);
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ break;
+ }
+ log("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ". ");
+ tTotalEUt += tRecipeEUt;
+ }
+ log("Broke at " + parallelRecipes + ".");
+ if (parallelRecipes > 0) {
+ // -- Try not to fail after this point - inputs have already been
+ // consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe
+ // duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ this.mEUt = (int) Math.ceil(tTotalEUt);
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ }
+ else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+ tOutputItems = removeNulls(tOutputItems);
+ for (ItemStack aOutputStack : tOutputItems) {
+ if (aOutputStack != null) {
+ mScrapProduced += aOutputStack.stackSize;
+ }
+ }
+ // Sanitize item stack size, splitting any stacks greater than max
+ // stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ updateSlots();
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean checkRecipeUU(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
int aSpeedBonusPercent, int aOutputChanceRoll) {
- if (this.mMode == MODE_SCRAP) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- long tEnergy = getMaxInputEnergy();
- GT_Recipe c = new GTPP_Recipe(false, new ItemStack[] { GT_Utility.copyAmount(1, aItemInputs[0]) },
- GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(64, aItemInputs[0]), 0) == null ? null
- : new ItemStack[] { ItemList.IC2_Scrap.get(1) },
- null, new int[] { 2000 }, null, null, 100,
- (int) gregtech.api.enums.GT_Values.V[2], 0);
-
- // EU discount
- float tRecipeEUt = (c.mEUt * aEUPercent) / 100.0f;
- float tTotalEUt = 0.0f;
-
- int parallelRecipes = 0;
- // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
- if (!c.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
- log("Broke at "+parallelRecipes+".");
- break;
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, true, aFluidInputs, aItemInputs)) {
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ log("Broke at "+parallelRecipes+".");
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
}
- log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
- tTotalEUt += tRecipeEUt;
}
+ }
- if (parallelRecipes == 0) {
- this.mEUt = (int) gregtech.api.enums.GT_Values.V[tTier];
- this.mMaxProgresstime = 10;
- return true;
+ tOutputItems = removeNulls(tOutputItems);
+
+
+ int aMatterProduced = 0;
+ int aAmplifierProduced = 0;
+ int aScrapUsed = 0;
+ int aAmplifierUsed = 0;
+
+ for (int i=0; i<parallelRecipes; i++) {
+ //Logger.INFO("Trying to bump stats "+i);
+ for (ItemStack aInput : tRecipe.mInputs) {
+ if (aInput != null && GT_Utility.areStacksEqual(aInput, mScrap[0], true)) {
+ aScrapUsed += aInput.stackSize;
+ //Logger.INFO("Found Scrap to use.");
+ }
+ }
+ for (FluidStack aInput : tRecipe.mFluidInputs) {
+ if (aInput != null && GT_Utility.areFluidsEqual(aInput, mUU[0], true)) {
+ aAmplifierUsed += aInput.amount;
+ //Logger.INFO("Found UU-A to use.");
+ }
+ }
+ for (FluidStack aOutput : tRecipe.mFluidOutputs) {
+ if (aOutput != null && GT_Utility.areFluidsEqual(aOutput, mUU[0], true)) {
+ aAmplifierProduced += aOutput.amount;
+ //Logger.INFO("Found UU-A as Output.");
+ }
+ if (aOutput != null && GT_Utility.areFluidsEqual(aOutput, mUU[1], true)) {
+ aMatterProduced += aOutput.amount;
+ //Logger.INFO("Found UU-M as Output.");
+ }
}
-
- return super.checkRecipeGeneric(c, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
}
+
+ this.mMatterProduced += aMatterProduced;
+ this.mAmplifierProduced += aAmplifierProduced;
+ this.mScrapUsed += aScrapUsed;
+ this.mAmplifierUsed += aAmplifierUsed;
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
- //Return normal Recipe handling
- return super.checkRecipeGeneric(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
- }
-
- @Override
- public boolean hasPerfectOverclock() {
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
return true;
+
}
-
+
@Override
public int getMaxParallelRecipes() {
return this.mMode == MODE_SCRAP ? 64 : 8 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
index 2b8a110b09..79a9f788df 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
@@ -1578,15 +1578,32 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
@Override
public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) {
+ return addExtractorRecipe(aInput, aOutput, 10000, aDuration, aEUt);
+ }
+
+ @Override
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt) {
if (aInput != null && aOutput != null) {
- if ((aDuration = GregTech_API.sRecipeFile.get("extractor", aInput, aDuration)) <= 0) {
- return false;
- } else {
- GT_Recipe_Map.sExtractorRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput},
- (Object) null, (FluidStack[]) null, (FluidStack[]) null, aDuration, aEUt, 0);
- return true;
- }
- } else {
+ GT_Recipe aRecipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] {
+ aInput.copy()
+ },
+ new ItemStack[] {
+ aOutput.copy()
+ },
+ null,
+ new int[] {aChance},
+ null,
+ null,
+ aDuration,
+ aEUt,
+ 0);
+ int aSize = GT_Recipe_Map.sExtractorRecipes.mRecipeList.size();
+ GT_Recipe_Map.sExtractorRecipes.add(aRecipe);
+ return GT_Recipe_Map.sExtractorRecipes.mRecipeList.size() > aSize;
+ }
+ else {
return false;
}
}