aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java85
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java35
2 files changed, 35 insertions, 85 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
index 7e2bcdd4f4..987ea57b99 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -87,7 +87,7 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override
public long getMinimumStoredEU() {
- return 1;
+ return Long.MAX_VALUE;
}
@Override
@@ -123,84 +123,32 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
@Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
@Override
- public void saveNBTData(final NBTTagCompound aNBT) {
- //
- }
-
- @Override
- public void loadNBTData(final NBTTagCompound aNBT) {
- //
- }
-
- @Override
public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
final IGregTechTileEntity aBaseMetaTileEntity) {
- switch (this.mInventory.length) {
- case 1: return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
- case 4: return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity);
- case 9: return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity);
- case 16: return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
- }
- return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ return null;
}
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
final IGregTechTileEntity aBaseMetaTileEntity) {
- switch (this.mInventory.length) {
- case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
- case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
- case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
- case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
- }
- return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ return null;
}
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
if (aBaseMetaTileEntity.isServerSide()) {
- this.mCharge = (aBaseMetaTileEntity.getStoredEU() / 2) > (aBaseMetaTileEntity
- .getEUCapacity() / 3);
- this.mDecharge = aBaseMetaTileEntity.getStoredEU() < (aBaseMetaTileEntity.getEUCapacity() / 3);
- this.mBatteryCount = 1;
- this.mChargeableCount = 1;
- this.getBaseMetaTileEntity().increaseStoredEnergyUnits(this.mMax, true);
- for (final ItemStack tStack : this.mInventory) {
- if (GT_ModHandler.isElectricItem(tStack, this.mTier)) {
- if (GT_ModHandler.isChargerItem(tStack)) {
- this.mBatteryCount++;
- }
- this.mChargeableCount++;
- }
- }
+ aBaseMetaTileEntity.increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
}
}
@Override
public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
- if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){
- final String name = aStack.getUnlocalizedName();
- if(name.equals("gt.metaitem.01.32510")||
- name.equals("gt.metaitem.01.32511")||
- name.equals("gt.metaitem.01.32520")||
- name.equals("gt.metaitem.01.32521")||
- name.equals("gt.metaitem.01.32530")||
- name.equals("gt.metaitem.01.32531")){
- return true;
- }
- }
return false;
}
@Override
public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
- if(!GT_Utility.isStackValid(aStack)){
- return false;
- }
- if(GT_ModHandler.isElectricItem(aStack, this.mTier)){
- return true;
- }
return false;
}
@@ -209,31 +157,6 @@ public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
long tScale = this.getBaseMetaTileEntity().getEUCapacity();
long tStored = this.getBaseMetaTileEntity().getStoredEU();
this.setEUVar(Long.MAX_VALUE);
- if (this.mInventory != null) {
- for (final ItemStack aStack : this.mInventory) {
- if (GT_ModHandler.isElectricItem(aStack)) {
-
- if (aStack.getItem() instanceof GT_MetaBase_Item) {
- final Long[] stats = ((GT_MetaBase_Item) aStack.getItem())
- .getElectricStats(aStack);
- if (stats != null) {
- tScale = tScale + stats[0];
- tStored = tStored
- + ((GT_MetaBase_Item) aStack.getItem())
- .getRealCharge(aStack);
- }
- } else if (aStack.getItem() instanceof IElectricItem) {
- tStored = tStored
- + (long) ic2.api.item.ElectricItem.manager
- .getCharge(aStack);
- tScale = tScale
- + (long) ((IElectricItem) aStack.getItem())
- .getMaxCharge(aStack);
- }
- }
- }
-
- }
return new long[] { tStored, tScale };
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
index 47c82163e9..f22859e186 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GT4Entity_AutoCrafter.java
@@ -6,6 +6,7 @@ import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Recipe;
@@ -157,11 +158,18 @@ extends GT_MetaTileEntity_MultiBlockBase
}
}
- if ((this.mInputHatches.size() >= 1) || (this.mOutputHatches.size() >= 1) ||
- (this.mInputBusses.size() >= 1) || (this.mOutputBusses.size() >= 1) ||
+ if ((this.mInputHatches.size() == 0) || (this.mOutputHatches.size() == 0) ||
+ (this.mInputBusses.size() == 0) || (this.mOutputBusses.size() == 0) ||
(this.mMufflerHatches.size() != 1) || (this.mMaintenanceHatches.size() != 1) ||
- (this.mEnergyHatches.size() >= 1)){
+ (this.mEnergyHatches.size() == 0)){
Utils.LOG_INFO("Wrong Hatch count.");
+ Utils.LOG_INFO("|"+this.mInputHatches.size()+
+ "|"+this.mOutputHatches.size()+
+ "|"+this.mInputBusses.size()+
+ "|"+this.mOutputBusses.size()+
+ "|"+this.mMufflerHatches.size()+
+ "|"+this.mMaintenanceHatches.size()+
+ "|"+this.mEnergyHatches.size()+"|");
return false;
}
@@ -290,9 +298,22 @@ extends GT_MetaTileEntity_MultiBlockBase
final ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]);
ItemStack inputItem = tInputs[0];
+ if (tInputs[0].stackSize <= 0){
+ tInputs[0] = null;
+ this.updateSlots();
+ }
int outputSlots = this.mOutputBusses.get(0).getSizeInventory();
+
+ if (this.mOutputBusses.size() > 1){
+ outputSlots=0;
+ for (GT_MetaTileEntity_Hatch_OutputBus r : this.mOutputBusses){
+ outputSlots+=r.getSizeInventory();
+ }
+ }
+
this.mOutputItems = new ItemStack[outputSlots];
- if (inputItem != null) {
+ Utils.LOG_INFO("1 Size: "+inputItem.stackSize);
+ if (inputItem != null && inputItem.stackSize > 0) {
Utils.LOG_INFO("test 1");
NBTTagCompound tNBT = inputItem.getTagCompound();
if (tNBT != null) {
@@ -317,12 +338,18 @@ extends GT_MetaTileEntity_MultiBlockBase
if (this.mMaxProgresstime == 400) {
return false;
}
+ Utils.LOG_INFO("2 Size: "+inputItem.stackSize);
final ItemStack input2 = inputItem;
inputItem.stackSize--;
+ if (inputItem.stackSize <= 0){
+ tInputs[0] = null;
+ }
+ this.updateSlots();
return true;
}
}
}
+
Utils.LOG_INFO("test - bad");
return false;
}