aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/basic
diff options
context:
space:
mode:
authorShawn Buckley <shawntbuckley@gmail.com>2015-10-21 22:06:25 -0400
committerShawn Buckley <shawntbuckley@gmail.com>2015-10-21 22:06:25 -0400
commit9353aa711b1d750ff945acdfed2d3b956291b615 (patch)
treed6ca62ab093dede52afef0d82ac29d32c56fb29b /src/main/java/gregtech/common/tileentities/machines/basic
parent445e6c3f25714ecf15c07dcd3462375d65b6dc92 (diff)
downloadGT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.tar.gz
GT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.tar.bz2
GT5-Unofficial-9353aa711b1d750ff945acdfed2d3b956291b615.zip
Reformat code
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/basic')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java163
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java121
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java85
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java125
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java595
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java185
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java242
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java82
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java752
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java172
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java110
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java358
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java168
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java761
14 files changed, 1990 insertions, 1929 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
index b7a1f3cc02..a869ad8d3a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java
@@ -1,9 +1,7 @@
package gregtech.common.tileentities.machines.basic;
-import gregtech.api.enums.GT_Values;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -11,98 +9,91 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_Boxinator
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR) });
- }
-
- public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Boxinator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeList()
- {
- return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes;
- }
-
- public int checkRecipe()
- {
- int tCheck = super.checkRecipe();
- if (tCheck != 0) {
- return tCheck;
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR)});
}
- if ((GT_Utility.isStackValid(getInputAt(0))) && (GT_Utility.isStackValid(getInputAt(1))) && (GT_Utility.getContainerItem(getInputAt(0), true) == null))
- {
- if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 1))
- {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[] { getInputAt(0) });
- if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[] { this.mOutputItems[0] }))
- {
- getInputAt(0).stackSize -= 1;
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (16 / (1 << this.mTier - 1));
- return 2;
- }
- }
- return 0;
- }
- if ((ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 4))
- {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[] { getInputAt(0), getInputAt(0), null, getInputAt(0), getInputAt(0) });
- if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[] { this.mOutputItems[0] }))
- {
- getInputAt(0).stackSize -= 4;
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (32 / (1 << this.mTier - 1));
- return 2;
- }
+
+ public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Boxinator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes;
+ }
+
+ public int checkRecipe() {
+ int tCheck = super.checkRecipe();
+ if (tCheck != 0) {
+ return tCheck;
}
- return 0;
- }
- if ((ItemList.Schematic_3by3.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 9))
- {
- this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[] { getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0) });
- if (this.mOutputItems[0] != null) {
- if (canOutput(new ItemStack[] { this.mOutputItems[0] }))
- {
- getInputAt(0).stackSize -= 9;
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (64 / (1 << this.mTier - 1));
- return 2;
- }
+ if ((GT_Utility.isStackValid(getInputAt(0))) && (GT_Utility.isStackValid(getInputAt(1))) && (GT_Utility.getContainerItem(getInputAt(0), true) == null)) {
+ if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 1)) {
+ this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0)});
+ if (this.mOutputItems[0] != null) {
+ if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ getInputAt(0).stackSize -= 1;
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (16 / (1 << this.mTier - 1));
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if ((ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 4)) {
+ this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0), getInputAt(0), null, getInputAt(0), getInputAt(0)});
+ if (this.mOutputItems[0] != null) {
+ if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ getInputAt(0).stackSize -= 4;
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (32 / (1 << this.mTier - 1));
+ return 2;
+ }
+ }
+ return 0;
+ }
+ if ((ItemList.Schematic_3by3.isStackEqual(getInputAt(1))) && (getInputAt(0).stackSize >= 9)) {
+ this.mOutputItems[0] = GT_ModHandler.getRecipeOutput(new ItemStack[]{getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0), getInputAt(0)});
+ if (this.mOutputItems[0] != null) {
+ if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ getInputAt(0).stackSize -= 9;
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (64 / (1 << this.mTier - 1));
+ return 2;
+ }
+ }
+ return 0;
+ }
}
return 0;
- }
}
- return 0;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack))
- {
- if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) || (ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) || (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)))) {
- if(GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[this.mTier], null, new ItemStack[] { GT_Utility.copyAmount(64L, new Object[] { aStack }), getInputAt(1) }) != null){return true;}
- if(ItemList.Schematic_1by1.isStackEqual(getInputAt(1))&&GT_ModHandler.getRecipeOutput(new ItemStack[] { aStack })!=null)return true;
- if(ItemList.Schematic_2by2.isStackEqual(getInputAt(1))&&GT_ModHandler.getRecipeOutput(new ItemStack[] { aStack, aStack, null, aStack, aStack })!=null){return true;}
- if(ItemList.Schematic_3by3.isStackEqual(getInputAt(1))&&(GT_ModHandler.getRecipeOutput(new ItemStack[] { aStack,aStack,aStack,aStack,aStack,aStack,aStack,aStack,aStack })!=null)){return true;}
- }else{return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);}
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
+ if ((ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) || (ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) || (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)))) {
+ if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[this.mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), getInputAt(1)}) != null) {
+ return true;
+ }
+ if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null)
+ return true;
+ if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) {
+ return true;
+ }
+ if (ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null)) {
+ return true;
+ }
+ } else {
+ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack);
+ }
+ }
+ return false;
}
- return false;
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java
index 8504cf3197..8937dfbcf5 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Charger.java
@@ -1,6 +1,5 @@
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -9,71 +8,73 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer;
import gregtech.api.util.GT_ModHandler;
+import static gregtech.api.enums.GT_Values.V;
+
public class GT_MetaTileEntity_Charger extends GT_MetaTileEntity_BasicBatteryBuffer {
- public GT_MetaTileEntity_Charger(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) {
- super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
- }
+ public GT_MetaTileEntity_Charger(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ public GT_MetaTileEntity_Charger(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ }
- public GT_MetaTileEntity_Charger(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) {
- super(aName, aTier, aDescription, aTextures, aSlotCount);
- }
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Charger(mName, mTier, mDescription, mTextures, mInventory.length);
+ }
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Charger(mName, mTier, mDescription, mTextures, mInventory.length);
- }
-
- @Override
- public long getMinimumStoredEU() {
- return V[mTier] * 64 * mInventory.length;
- }
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 64 * mInventory.length;
+ }
- @Override
- public long maxEUStore() {
- return V[mTier] * 256 * mInventory.length;
- }
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 256 * mInventory.length;
+ }
- @Override
- public long maxAmperesIn() {
- return mChargeableCount * 8;
- }
+ @Override
+ public long maxAmperesIn() {
+ return mChargeableCount * 8;
+ }
- @Override
- public long maxAmperesOut() {
- return mBatteryCount * 4;
- }
+ @Override
+ public long maxAmperesOut() {
+ return mBatteryCount * 4;
+ }
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
- if (this.getBaseMetaTileEntity() instanceof BaseMetaTileEntity) {
- BaseMetaTileEntity mBaseMetaTileEntity = (BaseMetaTileEntity) getBaseMetaTileEntity();
- if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) {
- MetaTileEntity mMetaTileEntity = (MetaTileEntity) mBaseMetaTileEntity.getMetaTileEntity();
- //for (int t = 0; t < 6; t++) {
- if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) {
- for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
- if (mMetaTileEntity.mInventory[i] != null && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) {
- mBaseMetaTileEntity.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(mMetaTileEntity.mInventory[i], (int)Math.min(V[mTier]*15, mBaseMetaTileEntity.getEUCapacity() - mBaseMetaTileEntity.getStoredEU()), (int)Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, false), true);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- }
- }
- }
- if (mMetaTileEntity.rechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() > 0) {
- for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
- if (mBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
- mBaseMetaTileEntity.decreaseStoredEU(GT_ModHandler.chargeElectricItem(mMetaTileEntity.mInventory[i], (int)Math.min(V[this.mTier]*15, mBaseMetaTileEntity.getStoredEU()), (int)Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), true, false), true);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- }
- }
- //}
- }
- }
- }
- }
- }
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity() instanceof BaseMetaTileEntity) {
+ BaseMetaTileEntity mBaseMetaTileEntity = (BaseMetaTileEntity) getBaseMetaTileEntity();
+ if (mBaseMetaTileEntity.getMetaTileEntity() instanceof MetaTileEntity) {
+ MetaTileEntity mMetaTileEntity = (MetaTileEntity) mBaseMetaTileEntity.getMetaTileEntity();
+ //for (int t = 0; t < 6; t++) {
+ if (mMetaTileEntity.dechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) {
+ for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
+ if (mMetaTileEntity.mInventory[i] != null && mBaseMetaTileEntity.getStoredEU() < mBaseMetaTileEntity.getEUCapacity()) {
+ mBaseMetaTileEntity.increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(mMetaTileEntity.mInventory[i], (int) Math.min(V[mTier] * 15, mBaseMetaTileEntity.getEUCapacity() - mBaseMetaTileEntity.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), true, false, false), true);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ mMetaTileEntity.mInventory[i] = null;
+ }
+ }
+ }
+ if (mMetaTileEntity.rechargerSlotCount() > 0 && mBaseMetaTileEntity.getStoredEU() > 0) {
+ for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
+ if (mBaseMetaTileEntity.getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
+ mBaseMetaTileEntity.decreaseStoredEU(GT_ModHandler.chargeElectricItem(mMetaTileEntity.mInventory[i], (int) Math.min(V[this.mTier] * 15, mBaseMetaTileEntity.getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), true, false), true);
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ mMetaTileEntity.mInventory[i] = null;
+ }
+ }
+ //}
+ }
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
index 8be43c1b94..a9c4299edd 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java
@@ -1,7 +1,6 @@
package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -12,54 +11,44 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_Disassembler
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Disassembles Machines at " + (50 + 10 * aTier) + "% Efficiency", 1, 9, "Disassembler.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER) });
- }
-
- public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public int checkRecipe()
- {
- if ((getInputAt(0) != null) && (isOutputEmpty()))
- {
- NBTTagCompound tNBT = getInputAt(0).getTagCompound();
- if (tNBT != null)
- {
- tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
- if (tNBT != null)
- {
- getInputAt(0).stackSize -= 1;
- this.mEUt = (16 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = 80;
- for (int i = 0; i < this.mOutputItems.length; i++) {
- if (getBaseMetaTileEntity().getRandomNumber(100) < 50 + 10 * this.mTier)
- {
- this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i);
- if (this.mOutputItems[i] != null) {
- this.mMaxProgresstime *= 1.7;
- }
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Disassembles Machines at " + (50 + 10 * aTier) + "% Efficiency", 1, 9, "Disassembler.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER)});
+ }
+
+ public GT_MetaTileEntity_Disassembler(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public int checkRecipe() {
+ if ((getInputAt(0) != null) && (isOutputEmpty())) {
+ NBTTagCompound tNBT = getInputAt(0).getTagCompound();
+ if (tNBT != null) {
+ tNBT = tNBT.getCompoundTag("GT.CraftingComponents");
+ if (tNBT != null) {
+ getInputAt(0).stackSize -= 1;
+ this.mEUt = (16 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = 80;
+ for (int i = 0; i < this.mOutputItems.length; i++) {
+ if (getBaseMetaTileEntity().getRandomNumber(100) < 50 + 10 * this.mTier) {
+ this.mOutputItems[i] = GT_Utility.loadItem(tNBT, "Ingredient." + i);
+ if (this.mOutputItems[i] != null) {
+ this.mMaxProgresstime *= 1.7;
+ }
+ }
+ }
+ return 2;
+ }
}
- }
- return 2;
}
- }
+ return 0;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getTagCompound() != null) && (aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null);
}
- return 0;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (aStack.getTagCompound() != null) && (aStack.getTagCompound().getCompoundTag("GT.CraftingComponents") != null);
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
index 292014245b..030eca8984 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java
@@ -1,11 +1,9 @@
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -14,68 +12,67 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import net.minecraftforge.fluids.FluidStack;
+import static gregtech.api.enums.GT_Values.V;
+
public class GT_MetaTileEntity_Massfabricator
- extends GT_MetaTileEntity_BasicMachine
-{
- public static int sUUAperUUM = 1;
- public static int sUUASpeedBonus = 4;
- public static int sDurationMultiplier = 3215;
- public static boolean sRequiresUUA = false;
-
- public GT_MetaTileEntity_Massfabricator(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "UUM = Matter * Fabrication Squared", 1, 1, "Massfabricator.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB) });
- }
-
- public GT_MetaTileEntity_Massfabricator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Massfabricator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public void onConfigLoad(GT_Config aConfig)
- {
- super.onConfigLoad(aConfig);
- sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier);
- sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM);
- sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus);
- sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA);
- Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus);
- }
-
-@Override public long maxAmperesIn(){return 10;}
-@Override public long maxEUStore() {return V[mTier]*512;}
-
- public int checkRecipe()
- {
- FluidStack tFluid = getDrainableStack();
- if ((tFluid == null) || (tFluid.amount < getCapacity()))
- {
- this.mOutputFluid = Materials.UUMatter.getFluid(1L);
- this.mEUt = ((int)gregtech.api.enums.GT_Values.V[this.mTier])*8;
- this.mMaxProgresstime = (sDurationMultiplier / (1 << (this.mTier*2) - 2));
- if (((tFluid = getFillableStack()) != null) && (tFluid.amount >= sUUAperUUM) && (tFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L))))
- {
- tFluid.amount -= sUUAperUUM;
- this.mMaxProgresstime /= sUUASpeedBonus;
- return 2;
- }
- return (sRequiresUUA) || (ItemList.Circuit_Integrated.isStackEqual(getInputAt(0), true, true)) ? 1 : 2;
+ extends GT_MetaTileEntity_BasicMachine {
+ public static int sUUAperUUM = 1;
+ public static int sUUASpeedBonus = 4;
+ public static int sDurationMultiplier = 3215;
+ public static boolean sRequiresUUA = false;
+
+ public GT_MetaTileEntity_Massfabricator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "UUM = Matter * Fabrication Squared", 1, 1, "Massfabricator.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)});
+ }
+
+ public GT_MetaTileEntity_Massfabricator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Massfabricator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public void onConfigLoad(GT_Config aConfig) {
+ super.onConfigLoad(aConfig);
+ sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier);
+ sUUAperUUM = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_per_UUM", sUUAperUUM);
+ sUUASpeedBonus = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Speed_Bonus", sUUASpeedBonus);
+ sRequiresUUA = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUA_Requirement", sRequiresUUA);
+ Materials.UUAmplifier.mChemicalFormula = ("Mass Fabricator Eff/Speed Bonus: x" + sUUASpeedBonus);
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 10;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 512;
+ }
+
+ public int checkRecipe() {
+ FluidStack tFluid = getDrainableStack();
+ if ((tFluid == null) || (tFluid.amount < getCapacity())) {
+ this.mOutputFluid = Materials.UUMatter.getFluid(1L);
+ this.mEUt = ((int) gregtech.api.enums.GT_Values.V[this.mTier]) * 8;
+ this.mMaxProgresstime = (sDurationMultiplier / (1 << (this.mTier * 2) - 2));
+ if (((tFluid = getFillableStack()) != null) && (tFluid.amount >= sUUAperUUM) && (tFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L)))) {
+ tFluid.amount -= sUUAperUUM;
+ this.mMaxProgresstime /= sUUASpeedBonus;
+ return 2;
+ }
+ return (sRequiresUUA) || (ItemList.Circuit_Integrated.isStackEqual(getInputAt(0), true, true)) ? 1 : 2;
+ }
+ return 0;
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return aFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L));
+ }
+
+ public int getCapacity() {
+ return Math.max(sUUAperUUM, 1000);
}
- return 0;
- }
-
- public boolean isFluidInputAllowed(FluidStack aFluid)
- {
- return aFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L));
- }
-
- public int getCapacity()
- {
- return Math.max(sUUAperUUM, 1000);
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
index 11489dfa56..de0a468582 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java
@@ -1,296 +1,331 @@
-
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
-import net.minecraft.client.particle.EntityFX;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityHanging;
-import net.minecraft.entity.EntityLiving;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.boss.EntityDragonPart;
-import net.minecraft.entity.effect.EntityWeatherEffect;
-import net.minecraft.entity.item.EntityBoat;
-import net.minecraft.entity.item.EntityEnderCrystal;
-import net.minecraft.entity.item.EntityEnderEye;
-import net.minecraft.entity.item.EntityFireworkRocket;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.item.EntityMinecart;
-import net.minecraft.entity.item.EntityTNTPrimed;
-import net.minecraft.entity.item.EntityXPOrb;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.entity.projectile.EntityArrow;
-import net.minecraft.entity.projectile.EntityFireball;
-import net.minecraft.entity.projectile.EntityFishHook;
-import net.minecraft.entity.projectile.EntityThrowable;
-import net.minecraft.init.Blocks;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.World;
-import net.minecraftforge.common.DimensionManager;
-import net.minecraftforge.fluids.FluidStack;
import gregtech.api.enums.ConfigCategories;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IEnergyConnected;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_MicrowaveEnergyTransmitter;
-import gregtech.common.gui.GT_Container_Teleporter;
-import gregtech.common.gui.GT_GUIContainer_FusionReactor;
import gregtech.common.gui.GT_GUIContainer_MicrowaveEnergyTransmitter;
-import gregtech.common.gui.GT_GUIContainer_Teleporter;
-
-public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEntity_BasicTank{
-
- public int mTargetX = 0;
- public int mTargetY = 0;
- public int mTargetZ = 0;
- public int mTargetD = 0;
- public boolean mDebug = false;
- public boolean hasEgg = false;
- public static boolean sInterDimensionalTeleportAllowed = true;
- public int mMaxLoss = 50;
- public int mMaxLossDistance = 10000;
- public boolean mPassiveEnergyUse = true;
-
- public GT_MetaTileEntity_MicrowaveEnergyTransmitter(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Transmits Energy wireless");
- }
-
- public GT_MetaTileEntity_MicrowaveEnergyTransmitter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- this.hasEgg = checkForEgg();
- aBaseMetaTileEntity.openGUI(aPlayer);
- return true;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_MicrowaveEnergyTransmitter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_MicrowaveEnergyTransmitter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_MicrowaveEnergyTransmitter(this.mName, this.mTier, this.mDescription, this.mTextures);
- }
-
- public String[] getInfoData()
- {
- return new String[] { "Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD };
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide == 0) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER) };
- }
-
-
- public void saveNBTData(NBTTagCompound aNBT)
- {
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- aNBT.setInteger("mTargetX", this.mTargetX);
- aNBT.setInteger("mTargetY", this.mTargetY);
- aNBT.setInteger("mTargetZ", this.mTargetZ);
- aNBT.setInteger("mTargetD", this.mTargetD);
- aNBT.setBoolean("mDebug", this.mDebug);
- }
-
- public void loadNBTData(NBTTagCompound aNBT)
- {
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- this.mTargetX = aNBT.getInteger("mTargetX");
- this.mTargetY = aNBT.getInteger("mTargetY");
- this.mTargetZ = aNBT.getInteger("mTargetZ");
- this.mTargetD = aNBT.getInteger("mTargetD");
- this.mDebug = aNBT.getBoolean("mDebug");
- }
-
- public void onConfigLoad(GT_Config aConfig)
- {
- sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true);
- mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss",50),11);
- mMaxLossDistance = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLossDistance",10000);
- mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy",true);
- }
-
- public void onFirstTick()
- {
- if (getBaseMetaTileEntity().isServerSide())
- {
- if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0))
- {
- this.mTargetX = getBaseMetaTileEntity().getXCoord();
- this.mTargetY = getBaseMetaTileEntity().getYCoord();
- this.mTargetZ = getBaseMetaTileEntity().getZCoord();
- this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
- }
- this.hasEgg = checkForEgg();
- }
- }
-
- public boolean checkForEgg()
- {
- for (byte i = -5; i <= 5; i = (byte)(i + 1)) {
- for (byte j = -5; j <= 5; j = (byte)(j + 1)) {
- for (byte k = -5; k <= 5; k = (byte)(k + 1)) {
- if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public boolean hasDimensionalTeleportCapability()
- {
- return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))&&mFluid.amount>=1000);
- }
-
- public boolean isDimensionalTeleportAvailable()
- {
- return (this.mDebug) || ((hasDimensionalTeleportCapability()) && (GT_Utility.isRealDimension(this.mTargetD)) && (GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)));
- }
-
- public int tTargetX = 0;
- public int tTargetY = 0;
- public int tTargetZ = 0;
- public int tTargetD = 0;
- public TileEntity tTile = null;
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if(mFluid==null){
- mFluid=Materials.Nitrogen.getPlasma(0);
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
- if (getBaseMetaTileEntity().isServerSide())
- {
- if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
- this.hasEgg = checkForEgg();
- }
- if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone()))
- {
- if(getBaseMetaTileEntity().getStoredEU()>(V[mTier]*16)){
- if(mPassiveEnergyUse){getBaseMetaTileEntity().decreaseStoredEnergyUnits((long) Math.pow(2, mTier), false);}
- if(hasDimensionalTeleportCapability()&&this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId&&mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))){
- mFluid.amount--;
- if(mFluid.amount<1){mFluid=null;}
- }
- if(tTargetD!=mTargetD||tTargetX!=mTargetX||tTargetY!=mTargetY||tTargetZ!=mTargetZ){
- tTargetD=mTargetD;
- tTargetX=mTargetX;
- tTargetY=mTargetY;
- tTargetZ=mTargetZ;
- if(this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId){
- tTile = getBaseMetaTileEntity().getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);}else{
- World tWorld = DimensionManager.getWorld(this.mTargetD);
- if(tWorld!=null){
- tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
- }
- }
- }
- int tDistance = distanceCalculation();
- long tEnergyTrans = Math.min(V[mTier], getBaseMetaTileEntity().getStoredEU());
- if(tTile!=null&&tTile instanceof IEnergyConnected){
- if(((IEnergyConnected)tTile).injectEnergyUnits((byte) 6, V[mTier], 1)>0){
- int tLoss=1;
- if(mMaxLossDistance!=0){
- tLoss = 10 + tDistance*(mMaxLoss-10)/mMaxLossDistance;}
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier]+((V[mTier]*tLoss)/100), false);
- }
- }
- }
- getBaseMetaTileEntity().setActive(true);
- }
- else
- {
- getBaseMetaTileEntity().setActive(false);
- }
- }
- }
-
- private int distanceCalculation()
- {
- return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int)Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)));
- }
-
- @Override public boolean isSimpleMachine() {return false;}
- @Override public boolean isOverclockerUpgradable() {return false;}
- @Override public boolean isTransformerUpgradable() {return false;}
- @Override public boolean isElectric() {return true;}
- @Override public boolean isFacingValid(byte aFacing) {return true;}
- @Override public boolean isEnetInput() {return true;}
- @Override public boolean isInputFacing(byte aSide) {return true;}
- @Override public boolean isOutputFacing(byte aSide) {return false;}
- @Override public boolean isTeleporterCompatible() {return false;}
- @Override public long getMinimumStoredEU() {return V[mTier]*16;}
- @Override public long maxEUStore() {return V[mTier]*256;}
- @Override public long maxEUInput() {return V[mTier];}
- @Override public long maxSteamStore() {return maxEUStore();}
- @Override public long maxAmperesIn() {return 3;}
- @Override public int getStackDisplaySlot() {return 2;}
- @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
- @Override public int getInputSlot() {return 0;}
- @Override public int getOutputSlot() {return 0;}
-
- @Override
- public int getCapacity() {return 64000;}
-
- @Override
- public boolean doesFillContainers() {
- return false;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return false;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return false;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return null;
- }
-
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.world.World;
+import net.minecraftforge.common.DimensionManager;
+import net.minecraftforge.fluids.FluidStack;
+
+import static gregtech.api.enums.GT_Values.V;
+
+public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEntity_BasicTank {
+
+ public static boolean sInterDimensionalTeleportAllowed = true;
+ public int mTargetX = 0;
+ public int mTargetY = 0;
+ public int mTargetZ = 0;
+ public int mTargetD = 0;
+ public boolean mDebug = false;
+ public boolean hasEgg = false;
+ public int mMaxLoss = 50;
+ public int mMaxLossDistance = 10000;
+ public boolean mPassiveEnergyUse = true;
+ public int tTargetX = 0;
+ public int tTargetY = 0;
+ public int tTargetZ = 0;
+ public int tTargetD = 0;
+ public TileEntity tTile = null;
+
+ public GT_MetaTileEntity_MicrowaveEnergyTransmitter(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "Transmits Energy wireless");
+ }
+
+ public GT_MetaTileEntity_MicrowaveEnergyTransmitter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ this.hasEgg = checkForEgg();
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_MicrowaveEnergyTransmitter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_MicrowaveEnergyTransmitter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_MicrowaveEnergyTransmitter(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public String[] getInfoData() {
+ return new String[]{"Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD};
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)};
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ aNBT.setInteger("mTargetX", this.mTargetX);
+ aNBT.setInteger("mTargetY", this.mTargetY);
+ aNBT.setInteger("mTargetZ", this.mTargetZ);
+ aNBT.setInteger("mTargetD", this.mTargetD);
+ aNBT.setBoolean("mDebug", this.mDebug);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ this.mTargetX = aNBT.getInteger("mTargetX");
+ this.mTargetY = aNBT.getInteger("mTargetY");
+ this.mTargetZ = aNBT.getInteger("mTargetZ");
+ this.mTargetD = aNBT.getInteger("mTargetD");
+ this.mDebug = aNBT.getBoolean("mDebug");
+ }
+
+ public void onConfigLoad(GT_Config aConfig) {
+ sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true);
+ mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss", 50), 11);
+ mMaxLossDistance = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLossDistance", 10000);
+ mPassiveEnergyUse = aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.PassiveEnergy", true);
+ }
+
+ public void onFirstTick() {
+ if (getBaseMetaTileEntity().isServerSide()) {
+ if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0)) {
+ this.mTargetX = getBaseMetaTileEntity().getXCoord();
+ this.mTargetY = getBaseMetaTileEntity().getYCoord();
+ this.mTargetZ = getBaseMetaTileEntity().getZCoord();
+ this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
+ }
+ this.hasEgg = checkForEgg();
+ }
+ }
+
+ public boolean checkForEgg() {
+ for (byte i = -5; i <= 5; i = (byte) (i + 1)) {
+ for (byte j = -5; j <= 5; j = (byte) (j + 1)) {
+ for (byte k = -5; k <= 5; k = (byte) (k + 1)) {
+ if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean hasDimensionalTeleportCapability() {
+ return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000);
+ }
+
+ public boolean isDimensionalTeleportAvailable() {
+ return (this.mDebug) || ((hasDimensionalTeleportCapability()) && (GT_Utility.isRealDimension(this.mTargetD)) && (GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)));
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (mFluid == null) {
+ mFluid = Materials.Nitrogen.getPlasma(0);
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide()) {
+ if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
+ this.hasEgg = checkForEgg();
+ }
+ if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) {
+ if (getBaseMetaTileEntity().getStoredEU() > (V[mTier] * 16)) {
+ if (mPassiveEnergyUse) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits((long) Math.pow(2, mTier), false);
+ }
+ if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) {
+ mFluid.amount--;
+ if (mFluid.amount < 1) {
+ mFluid = null;
+ }
+ }
+ if (tTargetD != mTargetD || tTargetX != mTargetX || tTargetY != mTargetY || tTargetZ != mTargetZ) {
+ tTargetD = mTargetD;
+ tTargetX = mTargetX;
+ tTargetY = mTargetY;
+ tTargetZ = mTargetZ;
+ if (this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) {
+ tTile = getBaseMetaTileEntity().getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
+ } else {
+ World tWorld = DimensionManager.getWorld(this.mTargetD);
+ if (tWorld != null) {
+ tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
+ }
+ }
+ }
+ int tDistance = distanceCalculation();
+ long tEnergyTrans = Math.min(V[mTier], getBaseMetaTileEntity().getStoredEU());
+ if (tTile != null && tTile instanceof IEnergyConnected) {
+ if (((IEnergyConnected) tTile).injectEnergyUnits((byte) 6, V[mTier], 1) > 0) {
+ int tLoss = 1;
+ if (mMaxLossDistance != 0) {
+ tLoss = 10 + tDistance * (mMaxLoss - 10) / mMaxLossDistance;
+ }
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(V[mTier] + ((V[mTier] * tLoss) / 100), false);
+ }
+ }
+ }
+ getBaseMetaTileEntity().setActive(true);
+ } else {
+ getBaseMetaTileEntity().setActive(false);
+ }
+ }
+ }
+
+ private int distanceCalculation() {
+ return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)));
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 16;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 256;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return maxEUStore();
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 3;
+ }
+
+ @Override
+ public int getStackDisplaySlot() {
+ return 2;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public int getInputSlot() {
+ return 0;
+ }
+
+ @Override
+ public int getOutputSlot() {
+ return 0;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 64000;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
index 871835020d..88434e315f 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java
@@ -1,13 +1,5 @@
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
-import cpw.mods.fml.common.eventhandler.SubscribeEvent;
-import cpw.mods.fml.common.eventhandler.Event;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -15,65 +7,124 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_SpawnEventHandler;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+import static gregtech.api.enums.GT_Values.V;
public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_TieredMachineBlock {
- public int mRange = 16;
-
- public GT_MetaTileEntity_MonsterRepellent(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: "+(4 + (12*aTier))+" unpowered / "+(16 + (48*aTier))+" powered");
- }
-
- public GT_MetaTileEntity_MonsterRepellent(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_MonsterRepellent(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER) };
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) {
- int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(),aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord(),aBaseMetaTileEntity.getWorld().provider.dimensionId};
- if((aTimer%600 == 0)&&!GT_SpawnEventHandler.mobReps.contains(tCoords)){
- GT_SpawnEventHandler.mobReps.add(tCoords);
- }
- if(aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier*2), false)){
- mRange = 16 + (48*mTier);
- }else{
- mRange = 4 + (12*mTier);
- }}
- }
-
- @Override
- public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
- int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(),aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord(),aBaseMetaTileEntity.getWorld().provider.dimensionId};
- GT_SpawnEventHandler.mobReps.add(tCoords);
- }
-
- @Override
- public void onRemoval() {
- int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(),this.getBaseMetaTileEntity().getYCoord(),this.getBaseMetaTileEntity().getZCoord(),this.getBaseMetaTileEntity().getWorld().provider.dimensionId};
- GT_SpawnEventHandler.mobReps.remove(tCoords);
- }
- @Override public boolean isSimpleMachine() {return false;}
- @Override public boolean isFacingValid(byte aFacing) {return true;}
- @Override public boolean isEnetInput() {return true;}
- @Override public boolean isInputFacing(byte aSide) {return true;}
- @Override public boolean isTeleporterCompatible() {return false;}
- @Override public long getMinimumStoredEU() {return 512;}
- @Override public long maxEUStore() {return 512+V[mTier]*50;}
- @Override public long maxEUInput() {return V[mTier];}
- @Override public long maxAmperesIn() {return 2;}
- @Override public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {return false;}
- @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {return false;}
- @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) {return null;}
- @Override public void saveNBTData(NBTTagCompound aNBT) {}
- @Override public void loadNBTData(NBTTagCompound aNBT) {}
- }
+ public int mRange = 16;
+
+ public GT_MetaTileEntity_MonsterRepellent(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 0, "Reprells nasty Creatures. Range: " + (4 + (12 * aTier)) + " unpowered / " + (16 + (48 * aTier)) + " powered");
+ }
+
+ public GT_MetaTileEntity_MonsterRepellent(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_MonsterRepellent(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)};
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) {
+ int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId};
+ if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) {
+ GT_SpawnEventHandler.mobReps.add(tCoords);
+ }
+ if (aBaseMetaTileEntity.isUniversalEnergyStored(getMinimumStoredEU()) && aBaseMetaTileEntity.decreaseStoredEnergyUnits(1 << (this.mTier * 2), false)) {
+ mRange = 16 + (48 * mTier);
+ } else {
+ mRange = 4 + (12 * mTier);
+ }
+ }
+ }
+
+ @Override
+ public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {
+ int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId};
+ GT_SpawnEventHandler.mobReps.add(tCoords);
+ }
+
+ @Override
+ public void onRemoval() {
+ int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId};
+ GT_SpawnEventHandler.mobReps.remove(tCoords);
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 512;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 512 + V[mTier] * 50;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
index 35110b6adf..2dcde9c082 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java
@@ -3,7 +3,6 @@ package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -11,149 +10,130 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
-import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
public class GT_MetaTileEntity_PotionBrewer
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_PotionBrewer(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Brewing your Drinks", 1, 0, "PotionBrewer.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER) });
- }
-
- public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 0, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_PotionBrewer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeList()
- {
- return GT_Recipe.GT_Recipe_Map.sBrewingRecipes;
- }
-
- public int checkRecipe()
- {
- int tCheck = super.checkRecipe();
- if (tCheck != 0) {
- return tCheck;
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_PotionBrewer(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Brewing your Drinks", 1, 0, "PotionBrewer.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER)});
}
- FluidStack aFluid = getFillableStack();
- if ((getDrainableStack() == null) && (aFluid != null) && (getInputAt(0) != null))
- {
- String tInputName = aFluid.getFluid().getName();
- if (tInputName.startsWith("potion."))
- {
- tInputName = tInputName.replaceFirst("potion.", "");
- int tFirstDot = tInputName.indexOf('.') + 1;
- String tModifier = tFirstDot <= 0 ? "" : tInputName.substring(tFirstDot);
- if (!tModifier.isEmpty()) {
- tInputName = tInputName.replaceFirst("." + tModifier, "");
- }
- if (GT_Utility.areStacksEqual(new ItemStack(Items.fermented_spider_eye, 1, 0), getInputAt(0)))
- {
- if (tInputName.equals("poison")) {
- return setOutput("potion.damage" + tModifier);
- }
- if (tInputName.equals("health")) {
- return setOutput("potion.damage" + tModifier);
- }
- if (tInputName.equals("waterbreathing")) {
- return setOutput("potion.damage" + tModifier);
- }
- if (tInputName.equals("nightvision")) {
- return setOutput("potion.invisibility" + tModifier);
- }
- if (tInputName.equals("fireresistance")) {
- return setOutput("potion.slowness" + tModifier);
- }
- if (tInputName.equals("speed")) {
- return setOutput("potion.slowness" + tModifier);
- }
- if (tInputName.equals("strength")) {
- return setOutput("potion.weakness" + tModifier);
- }
- if (tInputName.equals("regen")) {
- return setOutput("potion.poison" + tModifier);
- }
- return setOutput("potion.weakness");
+
+ public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 0, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_PotionBrewer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GT_Recipe.GT_Recipe_Map.sBrewingRecipes;
+ }
+
+ public int checkRecipe() {
+ int tCheck = super.checkRecipe();
+ if (tCheck != 0) {
+ return tCheck;
}
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), getInputAt(0)))
- {
- if (!tModifier.startsWith("strong")) {
- return setOutput("potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString()));
- }
- if (tModifier.startsWith("long")) {
- return setOutput("potion." + tInputName + tModifier.replaceFirst("long", ""));
- }
- return setOutput("potion.thick");
+ FluidStack aFluid = getFillableStack();
+ if ((getDrainableStack() == null) && (aFluid != null) && (getInputAt(0) != null)) {
+ String tInputName = aFluid.getFluid().getName();
+ if (tInputName.startsWith("potion.")) {
+ tInputName = tInputName.replaceFirst("potion.", "");
+ int tFirstDot = tInputName.indexOf('.') + 1;
+ String tModifier = tFirstDot <= 0 ? "" : tInputName.substring(tFirstDot);
+ if (!tModifier.isEmpty()) {
+ tInputName = tInputName.replaceFirst("." + tModifier, "");
+ }
+ if (GT_Utility.areStacksEqual(new ItemStack(Items.fermented_spider_eye, 1, 0), getInputAt(0))) {
+ if (tInputName.equals("poison")) {
+ return setOutput("potion.damage" + tModifier);
+ }
+ if (tInputName.equals("health")) {
+ return setOutput("potion.damage" + tModifier);
+ }
+ if (tInputName.equals("waterbreathing")) {
+ return setOutput("potion.damage" + tModifier);
+ }
+ if (tInputName.equals("nightvision")) {
+ return setOutput("potion.invisibility" + tModifier);
+ }
+ if (tInputName.equals("fireresistance")) {
+ return setOutput("potion.slowness" + tModifier);
+ }
+ if (tInputName.equals("speed")) {
+ return setOutput("potion.slowness" + tModifier);
+ }
+ if (tInputName.equals("strength")) {
+ return setOutput("potion.weakness" + tModifier);
+ }
+ if (tInputName.equals("regen")) {
+ return setOutput("potion.poison" + tModifier);
+ }
+ return setOutput("potion.weakness");
+ }
+ if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), getInputAt(0))) {
+ if (!tModifier.startsWith("strong")) {
+ return setOutput("potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString()));
+ }
+ if (tModifier.startsWith("long")) {
+ return setOutput("potion." + tInputName + tModifier.replaceFirst("long", ""));
+ }
+ return setOutput("potion.thick");
+ }
+ if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), getInputAt(0))) {
+ if (!tModifier.startsWith("long")) {
+ return setOutput("potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString()));
+ }
+ if (tModifier.startsWith("strong")) {
+ return setOutput("potion." + tInputName + tModifier.replaceFirst("strong", ""));
+ }
+ return setOutput("potion.mundane");
+ }
+ if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gunpowder, 1L), getInputAt(0))) {
+ if (!tInputName.endsWith(".splash")) {
+ return setOutput("potion." + tInputName + ".splash");
+ }
+ return setOutput("potion.mundane");
+ }
+ }
}
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), getInputAt(0)))
- {
- if (!tModifier.startsWith("long")) {
- return setOutput("potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString()));
- }
- if (tModifier.startsWith("strong")) {
- return setOutput("potion." + tInputName + tModifier.replaceFirst("strong", ""));
- }
- return setOutput("potion.mundane");
+ return 0;
+ }
+
+ private final int setOutput(String aFluidName) {
+ this.mOutputFluid = FluidRegistry.getFluidStack(aFluidName, 750);
+ if (this.mOutputFluid == null) {
+ this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount);
+ getInputAt(0).stackSize -= 1;
+ getFillableStack().amount = 0;
+ this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ return 2;
}
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Gunpowder, 1L), getInputAt(0)))
- {
- if (!tInputName.endsWith(".splash")) {
- return setOutput("potion." + tInputName + ".splash");
- }
- return setOutput("potion.mundane");
+ if (getFillableStack().amount < 750) {
+ return 0;
}
- }
+ getInputAt(0).stackSize -= 1;
+ getFillableStack().amount -= 750;
+ this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ return 2;
}
- return 0;
- }
-
- private final int setOutput(String aFluidName)
- {
- this.mOutputFluid = FluidRegistry.getFluidStack(aFluidName, 750);
- if (this.mOutputFluid == null)
- {
- this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount);
- getInputAt(0).stackSize -= 1;
- getFillableStack().amount = 0;
- this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- return 2;
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
}
- if (getFillableStack().amount < 750) {
- return 0;
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return (aFluid.getFluid().getName().startsWith("potion.")) || (super.isFluidInputAllowed(aFluid));
+ }
+
+ public int getCapacity() {
+ return 750;
}
- getInputAt(0).stackSize -= 1;
- getFillableStack().amount -= 750;
- this.mEUt = (4 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- return 2;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
- }
-
- public boolean isFluidInputAllowed(FluidStack aFluid)
- {
- return (aFluid.getFluid().getName().startsWith("potion.")) || (super.isFluidInputAllowed(aFluid));
- }
-
- public int getCapacity()
- {
- return 750;
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
index b4058f8830..2f1eecdd91 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Printer.java
@@ -7,59 +7,47 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import net.minecraft.item.ItemStack;
import java.util.ArrayList;
-import net.minecraft.item.ItemStack;
-
public class GT_MetaTileEntity_Printer
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_Printer(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "It can copy Books and paint Stuff", 1, 1, "Printer.png", GT_Recipe.GT_Recipe_Map.sPrinterRecipes.mNEIName, new ITexture[0]);
- }
-
- public GT_MetaTileEntity_Printer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName);
- }
-
- public int checkRecipe()
- {
- if (getOutputAt(0) != null)
- {
- this.mOutputBlocked += 1;
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_Printer(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "It can copy Books and paint Stuff", 1, 1, "Printer.png", GT_Recipe.GT_Recipe_Map.sPrinterRecipes.mNEIName, new ITexture[0]);
+ }
+
+ public GT_MetaTileEntity_Printer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 2, 2, aGUIName, aNEIName);
}
- else if ((GT_Utility.isStackValid(getInputAt(0))) && (getInputAt(0).stackSize > 0) &&
- (GT_Utility.isStackInvalid(getSpecialSlot())) &&
- (OrePrefixes.block.contains(getInputAt(0))))
- {
- ArrayList<ItemStack> tList = GT_OreDictUnificator.getOres(GT_OreDictUnificator.getAssociation(getInputAt(0)));
- if (tList.size() > 1)
- {
- tList.add(tList.get(0));
- int i = 0;
- for (int j = tList.size() - 1; i < j; i++) {
- if (GT_Utility.areStacksEqual(getInputAt(0), (ItemStack)tList.get(i)))
- {
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { tList.get(i + 1) });
- this.mEUt = (1 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- this.mMaxProgresstime = (32 / (1 << this.mTier - 1));
- getInputAt(0).stackSize -= 1;
- return 2;
- }
+
+ public int checkRecipe() {
+ if (getOutputAt(0) != null) {
+ this.mOutputBlocked += 1;
+ } else if ((GT_Utility.isStackValid(getInputAt(0))) && (getInputAt(0).stackSize > 0) &&
+ (GT_Utility.isStackInvalid(getSpecialSlot())) &&
+ (OrePrefixes.block.contains(getInputAt(0)))) {
+ ArrayList<ItemStack> tList = GT_OreDictUnificator.getOres(GT_OreDictUnificator.getAssociation(getInputAt(0)));
+ if (tList.size() > 1) {
+ tList.add(tList.get(0));
+ int i = 0;
+ for (int j = tList.size() - 1; i < j; i++) {
+ if (GT_Utility.areStacksEqual(getInputAt(0), (ItemStack) tList.get(i))) {
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{tList.get(i + 1)});
+ this.mEUt = (1 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ this.mMaxProgresstime = (32 / (1 << this.mTier - 1));
+ getInputAt(0).stackSize -= 1;
+ return 2;
+ }
+ }
+ }
}
- }
+ this.mMaxProgresstime = 0;
+ return 0;
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return null;
}
- this.mMaxProgresstime = 0;
- return 0;
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return null;
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
index 92248da910..6aabea8286 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java
@@ -1,19 +1,5 @@
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.world.ChunkPosition;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidBlock;
import gregtech.api.enums.Textures;
import gregtech.api.gui.GT_Container_BasicTank;
import gregtech.api.gui.GT_GUIContainer_BasicTank;
@@ -21,359 +7,439 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.ChunkPosition;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidBlock;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import static gregtech.api.enums.GT_Values.V;
public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch {
- public ArrayList<ChunkPosition> mPumpList = new ArrayList();
- public int mPumpTimer = 0;
- public int mPumpCountBelow = 0;
- public Block mPumpedBlock1 = null;
- public Block mPumpedBlock2 = null;
-
- public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "The best way of emptying Oceans!");
- }
-
- public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription,aTextures);
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Pump(this.mName, this.mTier, this.mDescription, this.mTextures);
- }
-
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setString("mPumpedBlock1", this.mPumpedBlock1 == null ? "" : this.mPumpedBlock1.getUnlocalizedName());
- aNBT.setString("mPumpedBlock2", this.mPumpedBlock2 == null ? "" : this.mPumpedBlock2.getUnlocalizedName());
- }
-
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- this.mPumpedBlock1 = Block.getBlockFromName(aNBT.getString("mPumpedBlock1"));
- this.mPumpedBlock2 = Block.getBlockFromName(aNBT.getString("mPumpedBlock2"));
- }
-
- @Override
+ public ArrayList<ChunkPosition> mPumpList = new ArrayList();
+ public int mPumpTimer = 0;
+ public int mPumpCountBelow = 0;
+ public Block mPumpedBlock1 = null;
+ public Block mPumpedBlock2 = null;
+
+ public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "The best way of emptying Oceans!");
+ }
+
+ public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Pump(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setString("mPumpedBlock1", this.mPumpedBlock1 == null ? "" : this.mPumpedBlock1.getUnlocalizedName());
+ aNBT.setString("mPumpedBlock2", this.mPumpedBlock2 == null ? "" : this.mPumpedBlock2.getUnlocalizedName());
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mPumpedBlock1 = Block.getBlockFromName(aNBT.getString("mPumpedBlock1"));
+ this.mPumpedBlock2 = Block.getBlockFromName(aNBT.getString("mPumpedBlock2"));
+ }
+
+ @Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
+ return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
- }
- @Override
- public boolean doesFillContainers() {
- return true;
- }
- @Override
- public boolean doesEmptyContainers() {
- return false;
- }
- @Override
- public boolean canTankBeFilled() {
- return false;
- }
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
- @Override
- public boolean displaysItemStack() {
- return true;
- }
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return false;
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
- if (getBaseMetaTileEntity().isServerSide()) {
- this.mPumpTimer -= 1;
- if ((getBaseMetaTileEntity() instanceof BaseTileEntity)) {
- ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = false;
- }
- this.doTickProfilingInThisTick = true;
- this.mPumpCountBelow = 0;
- IGregTechTileEntity tTileEntity;
- for (int i = 1; (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null)
- && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) {
- getBaseMetaTileEntity().setActive(tTileEntity.isActive());
- this.mPumpCountBelow += 1;
- ((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1;
- }
- if (this.mPumpCountBelow <= 0) {
- if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(16*((int)Math.pow(4, this.mTier))))
- && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) {
- boolean tMovedOneDown = false;
- if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) {
- tMovedOneDown = moveOneDown();
- }
- if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
- getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead() - 1, getBaseMetaTileEntity().getZCoord());
- if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
- getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() + 1);
- }
- if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
- getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() - 1);
- }
- if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
- getFluidAt(getBaseMetaTileEntity().getXCoord() + 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord());
- }
- if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
- getFluidAt(getBaseMetaTileEntity().getXCoord() - 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord());
- }
- } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) {
- if ((tMovedOneDown) || ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) || (getBaseMetaTileEntity().getTimer() % 72000L == 100L)) {
- this.mPumpList.clear();
- int y = getBaseMetaTileEntity().getYCoord() - 1;
- for (int yHead = getYOfPumpHead(); (this.mPumpList.isEmpty()) && (y >= yHead); y--) {
- scanForFluid(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), this.mPumpList, getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), 10*((int)Math.pow(1.6, this.mTier)));
- }
- }
- if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) {
- while ((!this.mPumpList.isEmpty())
- && (!consumeFluid(((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosX,
- ((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosY,
- ((ChunkPosition) this.mPumpList.remove(this.mPumpList.size() - 1)).chunkPosZ))) {
- }
- this.mPumpTimer = 160/((int)Math.pow(2, this.mTier));
- }
- }
- }
- getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty());
- }
- }
- }
-
- private boolean moveOneDown() {
- if ((this.mInventory[0] == null) || (this.mInventory[0].stackSize < 1)
- || (!GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L)))) {
- return false;
- }
- int yHead = getYOfPumpHead();
- if (yHead <= 0) {
- return false;
- }
- if ((!consumeFluid(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))&& (!getBaseMetaTileEntity().getAir(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))) {
-
- return false;
- }
- if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord(),GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) {
- return false;
- }
- if (yHead != getBaseMetaTileEntity().getYCoord()) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead, getBaseMetaTileEntity().getZCoord(),GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L)));
- }
- getBaseMetaTileEntity().decrStackSize(0, 1);
- return true;
- }
-
- private int getYOfPumpHead() {
- int y = getBaseMetaTileEntity().getYCoord() - 1;
- while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) == GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- y--;
- }
- if (y == getBaseMetaTileEntity().getYCoord() - 1) {
- if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) {
- return y + 1;
- }
- } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
- .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))&&this.mInventory[0] != null&&this.mInventory[0].stackSize>0&&GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L))) {
- getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(),
- GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)));
- getBaseMetaTileEntity().decrStackSize(0, 1);
- }
- return y;
- }
-
- private void scanForFluid(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList, int mX, int mZ, int mDist) {
- doTickProfilingInThisTick = false;
+ return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return false;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide()) {
+ this.mPumpTimer -= 1;
+ if ((getBaseMetaTileEntity() instanceof BaseTileEntity)) {
+ ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = false;
+ }
+ this.doTickProfilingInThisTick = true;
+ this.mPumpCountBelow = 0;
+ IGregTechTileEntity tTileEntity;
+ for (int i = 1; (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null)
+ && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) {
+ getBaseMetaTileEntity().setActive(tTileEntity.isActive());
+ this.mPumpCountBelow += 1;
+ ((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1;
+ }
+ if (this.mPumpCountBelow <= 0) {
+ if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(16 * ((int) Math.pow(4, this.mTier))))
+ && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) {
+ boolean tMovedOneDown = false;
+ if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) {
+ tMovedOneDown = moveOneDown();
+ }
+ if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
+ getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead() - 1, getBaseMetaTileEntity().getZCoord());
+ if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
+ getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() + 1);
+ }
+ if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
+ getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() - 1);
+ }
+ if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
+ getFluidAt(getBaseMetaTileEntity().getXCoord() + 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord());
+ }
+ if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) {
+ getFluidAt(getBaseMetaTileEntity().getXCoord() - 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord());
+ }
+ } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) {
+ if ((tMovedOneDown) || ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) || (getBaseMetaTileEntity().getTimer() % 72000L == 100L)) {
+ this.mPumpList.clear();
+ int y = getBaseMetaTileEntity().getYCoord() - 1;
+ for (int yHead = getYOfPumpHead(); (this.mPumpList.isEmpty()) && (y >= yHead); y--) {
+ scanForFluid(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), this.mPumpList, getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), 10 * ((int) Math.pow(1.6, this.mTier)));
+ }
+ }
+ if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) {
+ while ((!this.mPumpList.isEmpty())
+ && (!consumeFluid(((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosX,
+ ((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosY,
+ ((ChunkPosition) this.mPumpList.remove(this.mPumpList.size() - 1)).chunkPosZ))) {
+ }
+ this.mPumpTimer = 160 / ((int) Math.pow(2, this.mTier));
+ }
+ }
+ }
+ getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty());
+ }
+ }
+ }
+
+ private boolean moveOneDown() {
+ if ((this.mInventory[0] == null) || (this.mInventory[0].stackSize < 1)
+ || (!GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L)))) {
+ return false;
+ }
+ int yHead = getYOfPumpHead();
+ if (yHead <= 0) {
+ return false;
+ }
+ if ((!consumeFluid(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord())) && (!getBaseMetaTileEntity().getAir(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))) {
+
+ return false;
+ }
+ if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord(), GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) {
+ return false;
+ }
+ if (yHead != getBaseMetaTileEntity().getYCoord()) {
+ getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead, getBaseMetaTileEntity().getZCoord(), GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L)));
+ }
+ getBaseMetaTileEntity().decrStackSize(0, 1);
+ return true;
+ }
+
+ private int getYOfPumpHead() {
+ int y = getBaseMetaTileEntity().getYCoord() - 1;
+ while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) == GT_Utility
+ .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) {
+ y--;
+ }
+ if (y == getBaseMetaTileEntity().getYCoord() - 1) {
+ if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
+ .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) {
+ return y + 1;
+ }
+ } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility
+ .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)) && this.mInventory[0] != null && this.mInventory[0].stackSize > 0 && GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L))) {
+ getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(),
+ GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L)));
+ getBaseMetaTileEntity().decrStackSize(0, 1);
+ }
+ return y;
+ }
+
+ private void scanForFluid(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList, int mX, int mZ, int mDist) {
+ doTickProfilingInThisTick = false;
ArrayList tList1 = new ArrayList();
ArrayList tList2 = new ArrayList();
tList1.add(new ChunkPosition(aX, aY, aZ));
- while(!tList1.isEmpty())
- {
+ while (!tList1.isEmpty()) {
Iterator i$ = tList1.iterator();
- do
- {
- if(!i$.hasNext())
+ do {
+ if (!i$.hasNext())
break;
- ChunkPosition tPos = (ChunkPosition)i$.next();
- if(tPos.chunkPosX < mX + mDist)
+ ChunkPosition tPos = (ChunkPosition) i$.next();
+ if (tPos.chunkPosX < mX + mDist)
addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, tList2, aList);
- if(tPos.chunkPosX > mX - mDist)
+ if (tPos.chunkPosX > mX - mDist)
addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, tList2, aList);
- if(tPos.chunkPosZ < mZ + mDist)
+ if (tPos.chunkPosZ < mZ + mDist)
addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, tList2, aList);
- if(tPos.chunkPosZ > mZ - mDist)
+ if (tPos.chunkPosZ > mZ - mDist)
addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, tList2, aList);
addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY + 1, tPos.chunkPosZ, tList2, aList);
ChunkPosition tCoordinate = new ChunkPosition(aX, aY + 1, aZ);
- if(tPos.chunkPosX == mX && tPos.chunkPosZ == mZ && tPos.chunkPosY < getBaseMetaTileEntity().getYCoord() && !aList.contains(tCoordinate) && !tList2.contains(tCoordinate))
+ if (tPos.chunkPosX == mX && tPos.chunkPosZ == mZ && tPos.chunkPosY < getBaseMetaTileEntity().getYCoord() && !aList.contains(tCoordinate) && !tList2.contains(tCoordinate))
tList2.add(tCoordinate);
- } while(true);
+ } while (true);
aList.addAll(tList2);
tList1 = tList2;
tList2 = new ArrayList();
}
- for(int y = getBaseMetaTileEntity().getYCoord(); y >= aY; y--)
+ for (int y = getBaseMetaTileEntity().getYCoord(); y >= aY; y--)
aList.remove(new ChunkPosition(aX, y, aZ));
- }
-
- private boolean addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList1,
- ArrayList<ChunkPosition> aList2) {
- ChunkPosition tCoordinate = new ChunkPosition(aX, aY, aZ);
- if ((!aList1.contains(tCoordinate)) && (!aList2.contains(tCoordinate))) {
- Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- if ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock)) {
- aList1.add(tCoordinate);
- return true;
- }
- }
- return false;
- }
-
- private void getFluidAt(int aX, int aY, int aZ) {
- Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- if (GT_Utility.isBlockValid(aBlock)) {
- if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
- this.mPumpedBlock1 = Blocks.water;
- this.mPumpedBlock2 = Blocks.flowing_water;
- return;
- }
- if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) {
- this.mPumpedBlock1 = Blocks.lava;
- this.mPumpedBlock2 = Blocks.flowing_lava;
- return;
- }
- if ((aBlock instanceof IFluidBlock)) {
- this.mPumpedBlock1 = aBlock;
- this.mPumpedBlock2 = aBlock;
- return;
- }
- }
- this.mPumpedBlock1 = null;
- this.mPumpedBlock2 = null;
- }
-
- private boolean consumeFluid(int aX, int aY, int aZ) {
- Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
- int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ);
- if ((GT_Utility.isBlockValid(aBlock)) && ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock))) {
- if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
- if (aMeta == 0) {
- if (this.mFluid == null) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true);
- this.mFluid = GT_ModHandler.getWater(1000L);
- } else if (GT_ModHandler.isWater(this.mFluid)) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true);
- this.mFluid.amount += 1000;
- } else {
- return false;
- }
- } else {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(4*((int)Math.pow(4, this.mTier)), true);
- }
- }
- if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) {
- if (aMeta == 0) {
- if (this.mFluid == null) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true);
- this.mFluid = GT_ModHandler.getLava(1000L);
- } else if (GT_ModHandler.isLava(this.mFluid)) {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true);
- this.mFluid.amount += 1000;
- } else {
- return false;
- }
- } else {
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(4*((int)Math.pow(4, this.mTier)), true);
- }
- }
- if ((aBlock instanceof IFluidBlock)) {
- if (this.mFluid == null) {
- this.mFluid = ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, true);
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mFluid == null ? 1000 : this.mFluid.amount, true);
- }else if(this.mFluid.isFluidEqual(((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))){
- this.getBaseMetaTileEntity().getWorld().setBlockToAir( aX, aY, aZ);
- this.mFluid.amount += 1000;
- getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true);
- }else {
- return false;
- }
- }
- getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ,Blocks.air,0,2);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- aBaseMetaTileEntity.openGUI(aPlayer);
- return true;
- }
-
-
- @Override public boolean isSimpleMachine() {return false;}
- @Override public boolean isOverclockerUpgradable() {return false;}
- @Override public boolean isTransformerUpgradable() {return false;}
- @Override public boolean isElectric() {return true;}
- @Override public boolean isFacingValid(byte aFacing) {return true;}
- @Override public boolean isEnetInput() {return true;}
- @Override public boolean isInputFacing(byte aSide) {return true;}
- @Override public boolean isOutputFacing(byte aSide) {return false;}
- @Override public boolean isTeleporterCompatible() {return false;}
- @Override public long getMinimumStoredEU() {return V[mTier]*16;}
- @Override public long maxEUStore() {return V[mTier]*64;}
- @Override public long maxEUInput() {return V[mTier];}
- @Override public long maxSteamStore() {return maxEUStore();}
- @Override public long maxAmperesIn() {return 2;}
- @Override public int getStackDisplaySlot() {return 2;}
- @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
-
-
- @Override
- public int getCapacity() {
- return 16000*this.mTier;
- }
- @Override
- public int getTankPressure() {
- return 100;
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide == 0||aSide ==1) ? null : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP) };
- }
-
- @Override
- public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return getTexturesInactive(aBaseTexture);
- }
-
- @Override
- public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),
- new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),};
- }
+ }
+
+ private boolean addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList1,
+ ArrayList<ChunkPosition> aList2) {
+ ChunkPosition tCoordinate = new ChunkPosition(aX, aY, aZ);
+ if ((!aList1.contains(tCoordinate)) && (!aList2.contains(tCoordinate))) {
+ Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
+ if ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock)) {
+ aList1.add(tCoordinate);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void getFluidAt(int aX, int aY, int aZ) {
+ Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
+ if (GT_Utility.isBlockValid(aBlock)) {
+ if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
+ this.mPumpedBlock1 = Blocks.water;
+ this.mPumpedBlock2 = Blocks.flowing_water;
+ return;
+ }
+ if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) {
+ this.mPumpedBlock1 = Blocks.lava;
+ this.mPumpedBlock2 = Blocks.flowing_lava;
+ return;
+ }
+ if ((aBlock instanceof IFluidBlock)) {
+ this.mPumpedBlock1 = aBlock;
+ this.mPumpedBlock2 = aBlock;
+ return;
+ }
+ }
+ this.mPumpedBlock1 = null;
+ this.mPumpedBlock2 = null;
+ }
+
+ private boolean consumeFluid(int aX, int aY, int aZ) {
+ Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ);
+ int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ);
+ if ((GT_Utility.isBlockValid(aBlock)) && ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock))) {
+ if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) {
+ if (aMeta == 0) {
+ if (this.mFluid == null) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ this.mFluid = GT_ModHandler.getWater(1000L);
+ } else if (GT_ModHandler.isWater(this.mFluid)) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ this.mFluid.amount += 1000;
+ } else {
+ return false;
+ }
+ } else {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((int) Math.pow(4, this.mTier)), true);
+ }
+ }
+ if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) {
+ if (aMeta == 0) {
+ if (this.mFluid == null) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ this.mFluid = GT_ModHandler.getLava(1000L);
+ } else if (GT_ModHandler.isLava(this.mFluid)) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ this.mFluid.amount += 1000;
+ } else {
+ return false;
+ }
+ } else {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(4 * ((int) Math.pow(4, this.mTier)), true);
+ }
+ }
+ if ((aBlock instanceof IFluidBlock)) {
+ if (this.mFluid == null) {
+ this.mFluid = ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, true);
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mFluid == null ? 1000 : this.mFluid.amount, true);
+ } else if (this.mFluid.isFluidEqual(((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, false))) {
+ this.getBaseMetaTileEntity().getWorld().setBlockToAir(aX, aY, aZ);
+ this.mFluid.amount += 1000;
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(16 * ((int) Math.pow(4, this.mTier)), true);
+ } else {
+ return false;
+ }
+ }
+ getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ, Blocks.air, 0, 2);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 16;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return V[mTier] * 64;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return maxEUStore();
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public int getStackDisplaySlot() {
+ return 2;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+
+ @Override
+ public int getCapacity() {
+ return 16000 * this.mTier;
+ }
+
+ @Override
+ public int getTankPressure() {
+ return 100;
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0 || aSide == 1) ? null : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP)};
+ }
+
+ @Override
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return getTexturesInactive(aBaseTexture);
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),
+ new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),};
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
index c5a0ecfc92..6f3818b47e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java
@@ -1,12 +1,7 @@
package gregtech.common.tileentities.machines.basic;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Element;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -15,105 +10,86 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.behaviors.Behaviour_DataOrb;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
+import java.util.Iterator;
+
public class GT_MetaTileEntity_Replicator
- extends GT_MetaTileEntity_BasicMachine
-{
- private static int sHeaviestElementMass = 0;
-
- public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR) });
- }
-
- public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Replicator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public int checkRecipe()
- {
- FluidStack tFluid = getFillableStack();
- if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L))))
- {
- ItemStack tDataOrb = getSpecialSlot();
- if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan")))
- {
- Materials tMaterial = (Materials)Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0);
- long tMass = tMaterial.getMass();
- if ((tFluid.amount >= tMass) && (tMass > 0L))
- {
- this.mEUt = ((int)gregtech.api.enums.GT_Values.V[this.mTier]);
- this.mMaxProgresstime = ((int)(tMass * 512L / (1 << this.mTier - 1)));
- if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L)) == null)
- {
- if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) {
- if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) == null)
- {
- if (ItemList.Cell_Empty.isStackEqual(getInputAt(0))) {
- if (canOutput(new ItemStack[] { this.mOutputItems[0] }))
- {
- getInputAt(0).stackSize -= 1; FluidStack
- tmp231_230 = tFluid;tmp231_230.amount = ((int)(tmp231_230.amount - tMass));
- return 2;
- }
- }
- }
- else
- {
- this.mOutputItems[0] = null;
- if ((getDrainableStack() == null) || ((getDrainableStack().isFluidEqual(this.mOutputFluid)) && (getDrainableStack().amount < 16000)))
- {
- FluidStack tmp287_286 = tFluid;tmp287_286.amount = ((int)(tmp287_286.amount - tMass));
- return 2;
+ extends GT_MetaTileEntity_BasicMachine {
+ private static int sHeaviestElementMass = 0;
+
+ public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR)});
+ }
+
+ public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Replicator(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public int checkRecipe() {
+ FluidStack tFluid = getFillableStack();
+ if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)))) {
+ ItemStack tDataOrb = getSpecialSlot();
+ if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan"))) {
+ Materials tMaterial = (Materials) Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0);
+ long tMass = tMaterial.getMass();
+ if ((tFluid.amount >= tMass) && (tMass > 0L)) {
+ this.mEUt = ((int) gregtech.api.enums.GT_Values.V[this.mTier]);
+ this.mMaxProgresstime = ((int) (tMass * 512L / (1 << this.mTier - 1)));
+ if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.dust, tMaterial, 1L)) == null) {
+ if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) {
+ if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) == null) {
+ if (ItemList.Cell_Empty.isStackEqual(getInputAt(0))) {
+ if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ getInputAt(0).stackSize -= 1;
+ FluidStack
+ tmp231_230 = tFluid;
+ tmp231_230.amount = ((int) (tmp231_230.amount - tMass));
+ return 2;
+ }
+ }
+ } else {
+ this.mOutputItems[0] = null;
+ if ((getDrainableStack() == null) || ((getDrainableStack().isFluidEqual(this.mOutputFluid)) && (getDrainableStack().amount < 16000))) {
+ FluidStack tmp287_286 = tFluid;
+ tmp287_286.amount = ((int) (tmp287_286.amount - tMass));
+ return 2;
+ }
+ }
+ }
+ } else if (canOutput(new ItemStack[]{this.mOutputItems[0]})) {
+ FluidStack tmp322_321 = tFluid;
+ tmp322_321.amount = ((int) (tmp322_321.amount - tMass));
+ return 2;
+ }
}
- }
}
- }
- else if (canOutput(new ItemStack[] { this.mOutputItems[0] }))
- {
- FluidStack tmp322_321 = tFluid;tmp322_321.amount = ((int)(tmp322_321.amount - tMass));
- return 2;
- }
}
- }
+ return 0;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (ItemList.Cell_Empty.isStackEqual(aStack));
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return aFluid.isFluidEqual(Materials.UUMatter.getFluid(1L));
}
- return 0;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (ItemList.Cell_Empty.isStackEqual(aStack));
- }
-
- public boolean isFluidInputAllowed(FluidStack aFluid)
- {
- return aFluid.isFluidEqual(Materials.UUMatter.getFluid(1L));
- }
-
- public int getCapacity()
- {
- if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished))
- {
- Materials tMaterial;
- for (Iterator i$ = Materials.VALUES.iterator(); i$.hasNext(); sHeaviestElementMass = Math.max(sHeaviestElementMass, (int)tMaterial.getMass()))
- {
- tMaterial = (Materials)i$.next();
- if ((tMaterial.mElement == null) || (tMaterial.mElement.mIsIsotope)) {}
- }
+
+ public int getCapacity() {
+ if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) {
+ Materials tMaterial;
+ for (Iterator i$ = Materials.VALUES.iterator(); i$.hasNext(); sHeaviestElementMass = Math.max(sHeaviestElementMass, (int) tMaterial.getMass())) {
+ tMaterial = (Materials) i$.next();
+ if ((tMaterial.mElement == null) || (tMaterial.mElement.mIsIsotope)) {
+ }
+ }
+ }
+ return sHeaviestElementMass;
}
- return sHeaviestElementMass;
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
index aab40f712d..171c6a847a 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java
@@ -3,7 +3,6 @@ package gregtech.common.tileentities.machines.basic;
import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -11,72 +10,59 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
public class GT_MetaTileEntity_RockBreaker
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_RockBreaker(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Put Lava and Water adjacent", 1, 1, "RockBreaker.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) });
- }
-
- public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_RockBreaker(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public GT_Recipe.GT_Recipe_Map getRecipeList()
- {
- return GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
- }
-
- public int checkRecipe()
- {
- IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity();
- if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.water))
- {
- ItemStack tOutput = null;
- if (aBaseMetaTileEntity.getBlockOffset(0, 1, 0) == Blocks.lava) {
- tOutput = new ItemStack(Blocks.stone, 1);
- } else if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.lava)) {
- tOutput = new ItemStack(Blocks.cobblestone, 1);
- }
- if (tOutput != null) {
- if (GT_Utility.areStacksEqual(getInputAt(0), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L)))
- {
- tOutput = new ItemStack(Blocks.obsidian, 1);
- if (canOutput(new ItemStack[] { tOutput }))
- {
- getInputAt(0).stackSize -= 1;
- this.mOutputItems[0] = tOutput;
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
- }
- }
- else if (canOutput(new ItemStack[] { tOutput }))
- {
- this.mOutputItems[0] = tOutput;
- this.mMaxProgresstime = (16 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_RockBreaker(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Put Lava and Water adjacent", 1, 1, "RockBreaker.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)});
+ }
+
+ public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_RockBreaker(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
+
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ public int checkRecipe() {
+ IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity();
+ if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.water)) {
+ ItemStack tOutput = null;
+ if (aBaseMetaTileEntity.getBlockOffset(0, 1, 0) == Blocks.lava) {
+ tOutput = new ItemStack(Blocks.stone, 1);
+ } else if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.lava) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.lava)) {
+ tOutput = new ItemStack(Blocks.cobblestone, 1);
+ }
+ if (tOutput != null) {
+ if (GT_Utility.areStacksEqual(getInputAt(0), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L))) {
+ tOutput = new ItemStack(Blocks.obsidian, 1);
+ if (canOutput(new ItemStack[]{tOutput})) {
+ getInputAt(0).stackSize -= 1;
+ this.mOutputItems[0] = tOutput;
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ } else if (canOutput(new ItemStack[]{tOutput})) {
+ this.mOutputItems[0] = tOutput;
+ this.mMaxProgresstime = (16 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ }
}
- }
+ return 0;
}
- return 0;
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
index 76a79c7f9e..95d6ef9364 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java
@@ -1,229 +1,191 @@
package gregtech.common.tileentities.machines.basic;
import forestry.api.genetics.AlleleManager;
-import forestry.api.genetics.IAlleleRegistry;
import forestry.api.genetics.IIndividual;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Element;
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
+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_BasicMachine;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.ItemData;
-import gregtech.api.objects.MaterialStack;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
import gregtech.common.items.behaviors.Behaviour_DataOrb;
-
-import java.util.Map;
-
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
public class GT_MetaTileEntity_Scanner
- extends GT_MetaTileEntity_BasicMachine
-{
- public GT_MetaTileEntity_Scanner(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Scans Crops and other things.", 1, 1, "Scanner.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER) });
- }
-
- public GT_MetaTileEntity_Scanner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Scanner(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
-
- public int checkRecipe()
- {
- ItemStack aStack = getInputAt(0);
- if (getOutputAt(0) != null)
- {
- this.mOutputBlocked += 1;
+ extends GT_MetaTileEntity_BasicMachine {
+ public GT_MetaTileEntity_Scanner(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Scans Crops and other things.", 1, 1, "Scanner.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER)});
+ }
+
+ public GT_MetaTileEntity_Scanner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Scanner(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
}
- else if ((GT_Utility.isStackValid(aStack)) && (aStack.stackSize > 0))
- {
- if ((getFillableStack() != null) && (getFillableStack().containsFluid(Materials.Honey.getFluid(100L)))) {
- try
- {
- Object tIndividual = AlleleManager.alleleRegistry.getIndividual(aStack);
- if (tIndividual != null)
- {
- if (((IIndividual)tIndividual).analyze())
- {
- getFillableStack().amount -= 100;
- this.mOutputItems[0] = GT_Utility.copy(new Object[] { aStack });
- aStack.stackSize = 0;
- NBTTagCompound tNBT = new NBTTagCompound();
- ((IIndividual)tIndividual).writeToNBT(tNBT);
- this.mOutputItems[0].setTagCompound(tNBT);
- this.mMaxProgresstime = (500 / (1 << this.mTier - 1));
- this.mEUt = (2 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
+
+ public int checkRecipe() {
+ ItemStack aStack = getInputAt(0);
+ if (getOutputAt(0) != null) {
+ this.mOutputBlocked += 1;
+ } else if ((GT_Utility.isStackValid(aStack)) && (aStack.stackSize > 0)) {
+ if ((getFillableStack() != null) && (getFillableStack().containsFluid(Materials.Honey.getFluid(100L)))) {
+ try {
+ Object tIndividual = AlleleManager.alleleRegistry.getIndividual(aStack);
+ if (tIndividual != null) {
+ if (((IIndividual) tIndividual).analyze()) {
+ getFillableStack().amount -= 100;
+ this.mOutputItems[0] = GT_Utility.copy(new Object[]{aStack});
+ aStack.stackSize = 0;
+ NBTTagCompound tNBT = new NBTTagCompound();
+ ((IIndividual) tIndividual).writeToNBT(tNBT);
+ this.mOutputItems[0].setTagCompound(tNBT);
+ this.mMaxProgresstime = (500 / (1 << this.mTier - 1));
+ this.mEUt = (2 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ this.mOutputItems[0] = GT_Utility.copy(new Object[]{aStack});
+ aStack.stackSize = 0;
+ this.mMaxProgresstime = 1;
+ this.mEUt = 1;
+ return 2;
+ }
+ } catch (Throwable e) {
+ if (GT_Values.D1) {
+ e.printStackTrace(GT_Log.err);
+ }
+ }
}
- this.mOutputItems[0] = GT_Utility.copy(new Object[] { aStack });
- aStack.stackSize = 0;
- this.mMaxProgresstime = 1;
- this.mEUt = 1;
- return 2;
- }
- }
- catch (Throwable e)
- {
- if (GT_Values.D1) {
- e.printStackTrace(GT_Log.err);
- }
- }
- }
- if (ItemList.IC2_Crop_Seeds.isStackEqual(aStack, true, true))
- {
- NBTTagCompound tNBT = aStack.getTagCompound();
- if (tNBT == null) {
- tNBT = new NBTTagCompound();
- }
- if (tNBT.getByte("scan") < 4)
- {
- tNBT.setByte("scan", (byte)4);
- this.mMaxProgresstime = (160 / (1 << this.mTier - 1));
- this.mEUt = (8 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- }
- else
- {
- this.mMaxProgresstime = 1;
- this.mEUt = 1;
- }
- aStack.stackSize -= 1;
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { aStack });
- this.mOutputItems[0].setTagCompound(tNBT);
- return 2;
- }
- if (ItemList.Tool_DataOrb.isStackEqual(getSpecialSlot(), false, true))
- {
- if (ItemList.Tool_DataOrb.isStackEqual(aStack, false, true))
- {
- aStack.stackSize -= 1;
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { getSpecialSlot() });
- this.mMaxProgresstime = (512 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
- }
- ItemData tData = GT_OreDictUnificator.getAssociation(aStack);
- if ((tData != null) && ((tData.mPrefix == OrePrefixes.dust) || (tData.mPrefix == OrePrefixes.cell)) && (tData.mMaterial.mMaterial.mElement != null) && (!tData.mMaterial.mMaterial.mElement.mIsIsotope) && (tData.mMaterial.mMaterial != Materials.Magic) && (tData.mMaterial.mMaterial.getMass() > 0L))
- {
- getSpecialSlot().stackSize -= 1;
- aStack.stackSize -= 1;
-
- this.mOutputItems[0] = ItemList.Tool_DataOrb.get(1L, new Object[0]);
- Behaviour_DataOrb.setDataTitle(this.mOutputItems[0], "Elemental-Scan");
- Behaviour_DataOrb.setDataName(this.mOutputItems[0], tData.mMaterial.mMaterial.mElement.name());
- this.mMaxProgresstime = ((int)(tData.mMaterial.mMaterial.getMass() * 8192L / (1 << this.mTier - 1)));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
- }
- }
- if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true))
- {
- if (ItemList.Tool_DataStick.isStackEqual(aStack, false, true))
- {
- aStack.stackSize -= 1;
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { getSpecialSlot() });
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
+ if (ItemList.IC2_Crop_Seeds.isStackEqual(aStack, true, true)) {
+ NBTTagCompound tNBT = aStack.getTagCompound();
+ if (tNBT == null) {
+ tNBT = new NBTTagCompound();
+ }
+ if (tNBT.getByte("scan") < 4) {
+ tNBT.setByte("scan", (byte) 4);
+ this.mMaxProgresstime = (160 / (1 << this.mTier - 1));
+ this.mEUt = (8 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ } else {
+ this.mMaxProgresstime = 1;
+ this.mEUt = 1;
+ }
+ aStack.stackSize -= 1;
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{aStack});
+ this.mOutputItems[0].setTagCompound(tNBT);
+ return 2;
+ }
+ if (ItemList.Tool_DataOrb.isStackEqual(getSpecialSlot(), false, true)) {
+ if (ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) {
+ aStack.stackSize -= 1;
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
+ this.mMaxProgresstime = (512 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ ItemData tData = GT_OreDictUnificator.getAssociation(aStack);
+ if ((tData != null) && ((tData.mPrefix == OrePrefixes.dust) || (tData.mPrefix == OrePrefixes.cell)) && (tData.mMaterial.mMaterial.mElement != null) && (!tData.mMaterial.mMaterial.mElement.mIsIsotope) && (tData.mMaterial.mMaterial != Materials.Magic) && (tData.mMaterial.mMaterial.getMass() > 0L)) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mOutputItems[0] = ItemList.Tool_DataOrb.get(1L, new Object[0]);
+ Behaviour_DataOrb.setDataTitle(this.mOutputItems[0], "Elemental-Scan");
+ Behaviour_DataOrb.setDataName(this.mOutputItems[0], tData.mMaterial.mMaterial.mElement.name());
+ this.mMaxProgresstime = ((int) (tData.mMaterial.mMaterial.getMass() * 8192L / (1 << this.mTier - 1)));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ }
+ if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true)) {
+ if (ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) {
+ aStack.stackSize -= 1;
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ if (aStack.getItem() == Items.written_book) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
+ this.mOutputItems[0].setTagCompound(aStack.getTagCompound());
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ if (aStack.getItem() == Items.filled_map) {
+ getSpecialSlot().stackSize -= 1;
+ aStack.stackSize -= 1;
+
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{getSpecialSlot()});
+ this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "map_id", (short) aStack.getItemDamage()));
+ this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+ }
+ }
+ if (getSpecialSlot() == null && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) {
+ if (GT_Utility.ItemNBT.getBookTitle(aStack).equals("Raw Prospection Data")) {
+ GT_Utility.ItemNBT.setBookTitle(aStack, "Analyzed Prospection Data");
+ GT_Utility.ItemNBT.convertProspectionData(aStack);
+ aStack.stackSize -= 1;
+
+ this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[]{aStack});
+ this.mMaxProgresstime = (1000 / (1 << this.mTier - 1));
+ this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
+ return 2;
+
+ }
+ }
+
}
- if (aStack.getItem() == Items.written_book)
- {
- getSpecialSlot().stackSize -= 1;
- aStack.stackSize -= 1;
-
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { getSpecialSlot() });
- this.mOutputItems[0].setTagCompound(aStack.getTagCompound());
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
+ return 0;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (mProgresstime >= (mMaxProgresstime - 1)) {
+ try {
+ if (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707")) {
+ GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning");
+ }
+ } catch (Exception e) {
+ }
}
- if (aStack.getItem() == Items.filled_map)
- {
- getSpecialSlot().stackSize -= 1;
- aStack.stackSize -= 1;
-
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { getSpecialSlot() });
- this.mOutputItems[0].setTagCompound(GT_Utility.getNBTContainingShort(new NBTTagCompound(), "map_id", (short)aStack.getItemDamage()));
- this.mMaxProgresstime = (128 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ }
+
+
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes;
+ }
+
+ public int getCapacity() {
+ return 1000;
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
+ }
+
+ public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
+ super.startSoundLoop(aIndex, aX, aY, aZ);
+ if (aIndex == 1) {
+ GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY, aZ);
}
- }
- if(getSpecialSlot()==null&&ItemList.Tool_DataStick.isStackEqual(aStack, false, true)){
- if(GT_Utility.ItemNBT.getBookTitle(aStack).equals("Raw Prospection Data")){
- GT_Utility.ItemNBT.setBookTitle(aStack,"Analyzed Prospection Data");
- GT_Utility.ItemNBT.convertProspectionData(aStack);
- aStack.stackSize -= 1;
-
- this.mOutputItems[0] = GT_Utility.copyAmount(1L, new Object[] { aStack });
- this.mMaxProgresstime = (1000 / (1 << this.mTier - 1));
- this.mEUt = (32 * (1 << this.mTier - 1) * (1 << this.mTier - 1));
- return 2;
-
- }
- }
-
}
- return 0;
- }
-
-@Override
-public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (mProgresstime>=(mMaxProgresstime-1)) {try{
- if(this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707")){
- GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning");}}catch (Exception e){}
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
-}
-
- public GT_Recipe.GT_Recipe_Map getRecipeList()
- {
- return GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes;
- }
-
- public int getCapacity()
- {
- return 1000;
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (getRecipeList().containsInput(aStack));
- }
-
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ)
- {
- super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1) {
- GT_Utility.doSoundAtClient((String)GregTech_API.sSoundList.get(Integer.valueOf(212)), 10, 1.0F, aX, aY, aZ);
+ public void startProcess() {
+ sendLoopStart((byte) 1);
}
- }
-
- public void startProcess()
- {
- sendLoopStart((byte)1);
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java
index 09b06b033e..5af6e69cee 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java
@@ -1,23 +1,10 @@
package gregtech.common.tileentities.machines.basic;
-import ic2.core.Ic2Items;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Blocks;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.fluids.FluidStack;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ItemList;
import gregtech.api.enums.Materials;
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.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
@@ -27,83 +14,86 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_TileEntity_Ores;
+import ic2.core.Ic2Items;
+import net.minecraft.block.Block;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraftforge.fluids.FluidStack;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_BasicMachine {
+
+ boolean ready = false;
+
+ public GT_MetaTileEntity_SeismicProspector(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 1, "Place, activate with explosives, use Data Stick", 1, 1, "Default.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)});
+ }
+
+ public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) {
+ super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
+ }
+
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_SeismicProspector(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
+ }
-public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_BasicMachine{
-
- boolean ready = false;
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ ItemStack aStack = aPlayer.getCurrentEquippedItem();
+ if ((aStack != null) && (aStack.getItem() == Item.getItemFromBlock(Blocks.tnt) || aStack.getItem() == Ic2Items.industrialTnt.getItem()) && aStack.stackSize > 7 && !ready) {
+ if ((!aPlayer.capabilities.isCreativeMode) && (aStack.stackSize != 111)) {
+ aStack.stackSize -= 8;
+ }
+ this.ready = true;
+ this.mMaxProgresstime = 200;
+ } else if (ready && mMaxProgresstime == 0 && aStack != null && aStack.stackSize == 1 && aStack.getItem() == ItemList.Tool_DataStick.getItem()) {
+ this.ready = false;
+ GT_Utility.ItemNBT.setBookTitle(aPlayer.getCurrentEquippedItem(), "Raw Prospection Data");
+ List<String> tStringList = new ArrayList<String>();
+ for (int i = this.getBaseMetaTileEntity().getYCoord(); i > 0; i--) {
+ for (int f = -1; f < 2; f++) {
+ for (int g = -1; g < 2; g++) {
+ Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(f, -i, g);
+ if ((tBlock instanceof GT_Block_Ores)) {
+ TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(getBaseMetaTileEntity().getXCoord() + f, getBaseMetaTileEntity().getYCoord() + (-i), getBaseMetaTileEntity().getZCoord() + g);
+ if ((tTileEntity instanceof GT_TileEntity_Ores)) {
+ Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores) tTileEntity).mMetaData % 1000)];
+ if ((tMaterial != null) && (tMaterial != Materials._NULL)) {
+ if (!tStringList.contains(tMaterial.mDefaultLocalName)) {
+ tStringList.add(tMaterial.mDefaultLocalName);
+ }
+ }
+ }
+ } else {
+ int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(getBaseMetaTileEntity().getXCoord() + f, getBaseMetaTileEntity().getYCoord() + (-i), getBaseMetaTileEntity().getZCoord() + g);
+ ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
+ if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore"))) {
+ if (!tStringList.contains(tAssotiation.mMaterial.mMaterial.mDefaultLocalName)) {
+ tStringList.add(tAssotiation.mMaterial.mMaterial.mDefaultLocalName);
+ }
+ }
+ }
+ }
+ }
+ }
+ FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
+ String[] tStringArray = new String[tStringList.size()];
+ {
+ for (int i = 0; i < tStringArray.length; i++) {
+ tStringArray[i] = tStringList.get(i);
+ }
+ }
+ GT_Utility.ItemNBT.setProspectionData(aPlayer.getCurrentEquippedItem(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId, tFluid, tStringArray);
+ }
+ }
- public GT_MetaTileEntity_SeismicProspector(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 1, "Place, activate with explosives, use Data Stick", 1, 1, "Default.png", "", new ITexture[] { new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER) });
- }
-
- public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName)
- {
- super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName);
- }
-
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_SeismicProspector(this.mName, this.mTier, this.mDescription, this.mTextures, this.mGUIName, this.mNEIName);
- }
+ return true;
+ }
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isServerSide()) {
- ItemStack aStack = aPlayer.getCurrentEquippedItem();
- if ((aStack != null) && (aStack.getItem() == Item.getItemFromBlock(Blocks.tnt)||aStack.getItem() == Ic2Items.industrialTnt.getItem()) && aStack.stackSize > 7&&!ready) {
- if ((!aPlayer.capabilities.isCreativeMode) && (aStack.stackSize != 111)) {
- aStack.stackSize -= 8;
- }
- this.ready = true;
- this.mMaxProgresstime = 200;
- } else if (ready&&mMaxProgresstime==0&&aStack!=null&&aStack.stackSize==1&&aStack.getItem()==ItemList.Tool_DataStick.getItem()) {
- this.ready=false;
- GT_Utility.ItemNBT.setBookTitle(aPlayer.getCurrentEquippedItem(),"Raw Prospection Data");
- List<String> tStringList = new ArrayList<String>();
- for(int i = this.getBaseMetaTileEntity().getYCoord();i>0;i--){
- for(int f = -1; f<2;f++){
- for(int g = -1; g<2;g++){
- Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(f, -i, g);
- if ((tBlock instanceof GT_Block_Ores))
- {
- TileEntity tTileEntity = getBaseMetaTileEntity().getWorld().getTileEntity(getBaseMetaTileEntity().getXCoord()+f, getBaseMetaTileEntity().getYCoord()+(-i), getBaseMetaTileEntity().getZCoord()+g);
- if ((tTileEntity instanceof GT_TileEntity_Ores))
- {
- Materials tMaterial = GregTech_API.sGeneratedMaterials[(((GT_TileEntity_Ores)tTileEntity).mMetaData % 1000)];
- if ((tMaterial != null) && (tMaterial != Materials._NULL))
- {
- if(!tStringList.contains(tMaterial.mDefaultLocalName)){
- tStringList.add(tMaterial.mDefaultLocalName);
- }
- }
- }
- }
- else
- {
- int tMetaID = getBaseMetaTileEntity().getWorld().getBlockMetadata(getBaseMetaTileEntity().getXCoord()+f, getBaseMetaTileEntity().getYCoord()+(-i), getBaseMetaTileEntity().getZCoord()+g);
- ItemData tAssotiation = GT_OreDictUnificator.getAssociation(new ItemStack(tBlock, 1, tMetaID));
- if ((tAssotiation != null) && (tAssotiation.mPrefix.toString().startsWith("ore")))
- {
- if(!tStringList.contains( tAssotiation.mMaterial.mMaterial.mDefaultLocalName)){
- tStringList.add( tAssotiation.mMaterial.mMaterial.mDefaultLocalName);
- }
- }
- }
- }
- }
- }
- FluidStack tFluid = GT_Utility.getUndergroundOil(getBaseMetaTileEntity().getWorld(), getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord());
- String[] tStringArray = new String[tStringList.size()];{
- for(int i = 0;i<tStringArray.length;i++){
- tStringArray[i] = tStringList.get(i);
- }
- }
- GT_Utility.ItemNBT.setProspectionData(aPlayer.getCurrentEquippedItem(), this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId,tFluid, tStringArray);
- }
- }
-
- return true;
- }
-
}
diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
index 4f6259e7e8..36272e13a7 100644
--- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
+++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java
@@ -1,6 +1,17 @@
package gregtech.common.tileentities.machines.basic;
-import static gregtech.api.enums.GT_Values.V;
+import gregtech.api.enums.ConfigCategories;
+import gregtech.api.enums.Materials;
+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.implementations.GT_MetaTileEntity_BasicTank;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Config;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.gui.GT_Container_Teleporter;
+import gregtech.common.gui.GT_GUIContainer_Teleporter;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
@@ -8,14 +19,7 @@ import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityDragonPart;
import net.minecraft.entity.effect.EntityWeatherEffect;
-import net.minecraft.entity.item.EntityBoat;
-import net.minecraft.entity.item.EntityEnderCrystal;
-import net.minecraft.entity.item.EntityEnderEye;
-import net.minecraft.entity.item.EntityFireworkRocket;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.item.EntityMinecart;
-import net.minecraft.entity.item.EntityTNTPrimed;
-import net.minecraft.entity.item.EntityXPOrb;
+import net.minecraft.entity.item.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@@ -30,352 +34,397 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fluids.FluidStack;
-import gregtech.api.enums.ConfigCategories;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_Container_MultiMachine;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Config;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.GT_Container_Teleporter;
-import gregtech.common.gui.GT_GUIContainer_FusionReactor;
-import gregtech.common.gui.GT_GUIContainer_Teleporter;
-public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank{
-
- public int mTargetX = 0;
- public int mTargetY = 0;
- public int mTargetZ = 0;
- public int mTargetD = 0;
- public boolean mDebug = false;
- public boolean hasEgg = false;
- public static boolean sInterDimensionalTeleportAllowed = true;
-
- public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Teleport long distances with this little device.");
- }
-
- public GT_MetaTileEntity_Teleporter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- this.hasEgg = checkForEgg();
- aBaseMetaTileEntity.openGUI(aPlayer);
- return true;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_Teleporter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_Teleporter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_Teleporter(this.mName, this.mTier, this.mDescription, this.mTextures);
- }
-
- public String[] getInfoData()
- {
- return new String[] { "Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD };
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide !=this.getBaseMetaTileEntity().getFrontFacing()) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER) };
- }
-
- public void saveNBTData(NBTTagCompound aNBT)
- {
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- aNBT.setInteger("mTargetX", this.mTargetX);
- aNBT.setInteger("mTargetY", this.mTargetY);
- aNBT.setInteger("mTargetZ", this.mTargetZ);
- aNBT.setInteger("mTargetD", this.mTargetD);
- aNBT.setBoolean("mDebug", this.mDebug);
- }
-
- public void loadNBTData(NBTTagCompound aNBT)
- {
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- this.mTargetX = aNBT.getInteger("mTargetX");
- this.mTargetY = aNBT.getInteger("mTargetY");
- this.mTargetZ = aNBT.getInteger("mTargetZ");
- this.mTargetD = aNBT.getInteger("mTargetD");
- this.mDebug = aNBT.getBoolean("mDebug");
- }
-
- public void onConfigLoad(GT_Config aConfig)
- {
- sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true);
- }
-
- public void onFirstTick()
- {
- if (getBaseMetaTileEntity().isServerSide())
- {
- if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0))
- {
- this.mTargetX = getBaseMetaTileEntity().getXCoord();
- this.mTargetY = getBaseMetaTileEntity().getYCoord();
- this.mTargetZ = getBaseMetaTileEntity().getZCoord();
- this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
- }
- this.hasEgg = checkForEgg();
- }
- }
-
- public boolean checkForEgg()
- {
- for (byte i = -5; i <= 5; i = (byte)(i + 1)) {
- for (byte j = -5; j <= 5; j = (byte)(j + 1)) {
- for (byte k = -5; k <= 5; k = (byte)(k + 1)) {
- if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public boolean hasDimensionalTeleportCapability()
- {
- return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))&&mFluid.amount>=1000);
- }
-
- public boolean isDimensionalTeleportAvailable()
- {
- return (this.mDebug) || ((hasDimensionalTeleportCapability()) && (GT_Utility.isRealDimension(this.mTargetD)) && (GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)));
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if(mFluid==null){
- mFluid=Materials.Nitrogen.getPlasma(0);
- }
- super.onPostTick(aBaseMetaTileEntity, aTick);
- if (getBaseMetaTileEntity().isServerSide())
- {
- if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
- this.hasEgg = checkForEgg();
- }
- if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone()))
- {
- if(getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)){
- if(hasDimensionalTeleportCapability()&&this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId&&mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))){
- mFluid.amount--;
- if(mFluid.amount<1){mFluid=null;}
- }
- int tDistance = distanceCalculation();
- if(mInventory[0]!=null){
- TileEntity tTile = null;
- if(this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId){
- tTile = getBaseMetaTileEntity().getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);}else{
- World tWorld = DimensionManager.getWorld(this.mTargetD);
- if(tWorld!=null){
- tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
- }
- }
- if(tTile!=null&&tTile instanceof IInventory){
- int tStacksize = mInventory[0].stackSize;
- GT_Utility.moveOneItemStack(this, tTile, (byte)0 ,(byte)0, null, false, (byte)64, (byte)1, (byte)64, (byte)1);
- if(mInventory[0]==null||mInventory[0].stackSize<tStacksize){
- getBaseMetaTileEntity().decreaseStoredEnergyUnits((int)(tDistance * tDistance * (tStacksize - (mInventory[0]==null ? 0 : mInventory[0].stackSize))), false);
- }
- }
-
- }
- for (Object tObject : getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) + 2))) {
- if (((tObject instanceof Entity)) && (!((Entity)tObject).isDead))
- {
- Entity tEntity = (Entity)tObject;
- if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int)(tDistance * tDistance * weightCalculation(tEntity)), false))
- {
- if(hasDimensionalTeleportCapability()&&this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId&&mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))){
- mFluid.amount = mFluid.amount - ((int)Math.min(1000,(tDistance * tDistance * weightCalculation(tEntity)/8192)));
- if(mFluid.amount<1){mFluid=null;}
- }
- if (tEntity.ridingEntity != null) {
- tEntity.mountEntity(null);
- }
- if (tEntity.riddenByEntity != null) {
- tEntity.riddenByEntity.mountEntity(null);
- }
- if ((this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) || (!isDimensionalTeleportAvailable()) || (!GT_Utility.moveEntityToDimensionAtCoords(tEntity, this.mTargetD, this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D))) {
- if ((tEntity instanceof EntityLivingBase)) {
- ((EntityLivingBase)tEntity).setPositionAndUpdate(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D);
- } else {
- tEntity.setPosition(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D);
- }
- }
- }
- }
- }}
- getBaseMetaTileEntity().setActive(true);
- }
- else
- {
- getBaseMetaTileEntity().setActive(false);
- }
- }
- }
-
- private int distanceCalculation()
- {
- return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int)Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)));
- }
-
- private static float weightCalculation(Entity aEntity)
- {
- try
- {
- if ((aEntity instanceof EntityFX)) {
- return -1.0F;
- }
- }
- catch (Throwable e) {}
- if ((aEntity instanceof EntityFishHook)) {
- return -1.0F;
- }
- if ((aEntity instanceof EntityDragonPart)) {
- return -1.0F;
- }
- if ((aEntity instanceof EntityWeatherEffect)) {
- return -1.0F;
- }
- if ((aEntity instanceof EntityPlayer))
- {
- EntityPlayer tPlayer = (EntityPlayer)aEntity;
- int tCount = 64;
- for (int i = 0; i < 36; i++) {
- if (tPlayer.inventory.getStackInSlot(i) != null) {
- tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 ? tPlayer.inventory.getStackInSlot(i).stackSize : 64);
- }
- }
- for (int i = 0; i < 4; i++) {
- if (tPlayer.inventory.armorInventory[i] != null) {
- tCount += 256;
- }
- }
- return Math.min(5.0F, tCount / 666.6F);
- }
- if (GT_Utility.getClassName(aEntity).equals("EntityItnt")) {
- return 5.0F;
- }
- if (GT_Utility.getClassName(aEntity).equals("EntityNuke")) {
- return 50.0F;
- }
- if ((aEntity instanceof EntityArrow)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityBoat)) {
- return 0.1F;
- }
- if ((aEntity instanceof EntityEnderCrystal)) {
- return 2.0F;
- }
- if ((aEntity instanceof EntityEnderEye)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityFireball)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityFireworkRocket)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityHanging)) {
- return 0.005F;
- }
- if ((aEntity instanceof EntityItem)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityLiving)) {
- return 0.5F;
- }
- if ((aEntity instanceof EntityMinecart)) {
- return 0.1F;
- }
- if ((aEntity instanceof EntityThrowable)) {
- return 0.001F;
- }
- if ((aEntity instanceof EntityTNTPrimed)) {
- return 5.0F;
- }
- if ((aEntity instanceof EntityXPOrb)) {
- return 0.001F;
- }
- return -1.0F;
- }
-
- @Override public boolean isSimpleMachine() {return false;}
- @Override public boolean isOverclockerUpgradable() {return false;}
- @Override public boolean isTransformerUpgradable() {return false;}
- @Override public boolean isElectric() {return true;}
- @Override public boolean isFacingValid(byte aFacing) {return true;}
- @Override public boolean isEnetInput() {return true;}
- @Override public boolean isInputFacing(byte aSide) {return true;}
- @Override public boolean isOutputFacing(byte aSide) {return false;}
- @Override public boolean isTeleporterCompatible() {return false;}
- @Override public long getMinimumStoredEU() {return V[mTier]*16;}
- @Override public long maxEUStore() {return 100000000;}
- @Override public long maxEUInput() {return V[mTier];}
- @Override public long maxSteamStore() {return maxEUStore();}
- @Override public long maxAmperesIn() {return 2;}
- @Override public int getStackDisplaySlot() {return 2;}
- @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
- @Override public int getInputSlot() {return 0;}
- @Override public int getOutputSlot() {return 0;}
-
- @Override
- public int getCapacity() {return 64000;}
-
- @Override
- public boolean doesFillContainers() {
- return false;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return false;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return false;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return null;
- }
-
+import static gregtech.api.enums.GT_Values.V;
+
+public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank {
+
+ public static boolean sInterDimensionalTeleportAllowed = true;
+ public int mTargetX = 0;
+ public int mTargetY = 0;
+ public int mTargetZ = 0;
+ public int mTargetD = 0;
+ public boolean mDebug = false;
+ public boolean hasEgg = false;
+
+ public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "Teleport long distances with this little device.");
+ }
+
+ public GT_MetaTileEntity_Teleporter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ private static float weightCalculation(Entity aEntity) {
+ try {
+ if ((aEntity instanceof EntityFX)) {
+ return -1.0F;
+ }
+ } catch (Throwable e) {
+ }
+ if ((aEntity instanceof EntityFishHook)) {
+ return -1.0F;
+ }
+ if ((aEntity instanceof EntityDragonPart)) {
+ return -1.0F;
+ }
+ if ((aEntity instanceof EntityWeatherEffect)) {
+ return -1.0F;
+ }
+ if ((aEntity instanceof EntityPlayer)) {
+ EntityPlayer tPlayer = (EntityPlayer) aEntity;
+ int tCount = 64;
+ for (int i = 0; i < 36; i++) {
+ if (tPlayer.inventory.getStackInSlot(i) != null) {
+ tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 ? tPlayer.inventory.getStackInSlot(i).stackSize : 64);
+ }
+ }
+ for (int i = 0; i < 4; i++) {
+ if (tPlayer.inventory.armorInventory[i] != null) {
+ tCount += 256;
+ }
+ }
+ return Math.min(5.0F, tCount / 666.6F);
+ }
+ if (GT_Utility.getClassName(aEntity).equals("EntityItnt")) {
+ return 5.0F;
+ }
+ if (GT_Utility.getClassName(aEntity).equals("EntityNuke")) {
+ return 50.0F;
+ }
+ if ((aEntity instanceof EntityArrow)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityBoat)) {
+ return 0.1F;
+ }
+ if ((aEntity instanceof EntityEnderCrystal)) {
+ return 2.0F;
+ }
+ if ((aEntity instanceof EntityEnderEye)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityFireball)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityFireworkRocket)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityHanging)) {
+ return 0.005F;
+ }
+ if ((aEntity instanceof EntityItem)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityLiving)) {
+ return 0.5F;
+ }
+ if ((aEntity instanceof EntityMinecart)) {
+ return 0.1F;
+ }
+ if ((aEntity instanceof EntityThrowable)) {
+ return 0.001F;
+ }
+ if ((aEntity instanceof EntityTNTPrimed)) {
+ return 5.0F;
+ }
+ if ((aEntity instanceof EntityXPOrb)) {
+ return 0.001F;
+ }
+ return -1.0F;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ this.hasEgg = checkForEgg();
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_Teleporter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_Teleporter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Teleporter(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ public String[] getInfoData() {
+ return new String[]{"Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD};
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != this.getBaseMetaTileEntity().getFrontFacing()) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)};
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ aNBT.setInteger("mTargetX", this.mTargetX);
+ aNBT.setInteger("mTargetY", this.mTargetY);
+ aNBT.setInteger("mTargetZ", this.mTargetZ);
+ aNBT.setInteger("mTargetD", this.mTargetD);
+ aNBT.setBoolean("mDebug", this.mDebug);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ this.mTargetX = aNBT.getInteger("mTargetX");
+ this.mTargetY = aNBT.getInteger("mTargetY");
+ this.mTargetZ = aNBT.getInteger("mTargetZ");
+ this.mTargetD = aNBT.getInteger("mTargetD");
+ this.mDebug = aNBT.getBoolean("mDebug");
+ }
+
+ public void onConfigLoad(GT_Config aConfig) {
+ sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true);
+ }
+
+ public void onFirstTick() {
+ if (getBaseMetaTileEntity().isServerSide()) {
+ if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0)) {
+ this.mTargetX = getBaseMetaTileEntity().getXCoord();
+ this.mTargetY = getBaseMetaTileEntity().getYCoord();
+ this.mTargetZ = getBaseMetaTileEntity().getZCoord();
+ this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId;
+ }
+ this.hasEgg = checkForEgg();
+ }
+ }
+
+ public boolean checkForEgg() {
+ for (byte i = -5; i <= 5; i = (byte) (i + 1)) {
+ for (byte j = -5; j <= 5; j = (byte) (j + 1)) {
+ for (byte k = -5; k <= 5; k = (byte) (k + 1)) {
+ if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean hasDimensionalTeleportCapability() {
+ return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000);
+ }
+
+ public boolean isDimensionalTeleportAvailable() {
+ return (this.mDebug) || ((hasDimensionalTeleportCapability()) && (GT_Utility.isRealDimension(this.mTargetD)) && (GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId)));
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (mFluid == null) {
+ mFluid = Materials.Nitrogen.getPlasma(0);
+ }
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (getBaseMetaTileEntity().isServerSide()) {
+ if (getBaseMetaTileEntity().getTimer() % 100L == 50L) {
+ this.hasEgg = checkForEgg();
+ }
+ if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) {
+ if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)) {
+ if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) {
+ mFluid.amount--;
+ if (mFluid.amount < 1) {
+ mFluid = null;
+ }
+ }
+ int tDistance = distanceCalculation();
+ if (mInventory[0] != null) {
+ TileEntity tTile = null;
+ if (this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) {
+ tTile = getBaseMetaTileEntity().getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
+ } else {
+ World tWorld = DimensionManager.getWorld(this.mTargetD);
+ if (tWorld != null) {
+ tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ);
+ }
+ }
+ if (tTile != null && tTile instanceof IInventory) {
+ int tStacksize = mInventory[0].stackSize;
+ GT_Utility.moveOneItemStack(this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) {
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * (tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize))), false);
+ }
+ }
+
+ }
+ for (Object tObject : getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) + 2))) {
+ if (((tObject instanceof Entity)) && (!((Entity) tObject).isDead)) {
+ Entity tEntity = (Entity) tObject;
+ if (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * weightCalculation(tEntity)), false)) {
+ if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1))) {
+ mFluid.amount = mFluid.amount - ((int) Math.min(1000, (tDistance * tDistance * weightCalculation(tEntity) / 8192)));
+ if (mFluid.amount < 1) {
+ mFluid = null;
+ }
+ }
+ if (tEntity.ridingEntity != null) {
+ tEntity.mountEntity(null);
+ }
+ if (tEntity.riddenByEntity != null) {
+ tEntity.riddenByEntity.mountEntity(null);
+ }
+ if ((this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) || (!isDimensionalTeleportAvailable()) || (!GT_Utility.moveEntityToDimensionAtCoords(tEntity, this.mTargetD, this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D))) {
+ if ((tEntity instanceof EntityLivingBase)) {
+ ((EntityLivingBase) tEntity).setPositionAndUpdate(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D);
+ } else {
+ tEntity.setPosition(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D);
+ }
+ }
+ }
+ }
+ }
+ }
+ getBaseMetaTileEntity().setActive(true);
+ } else {
+ getBaseMetaTileEntity().setActive(false);
+ }
+ }
+ }
+
+ private int distanceCalculation() {
+ return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int) Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D)));
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isEnetInput() {
+ return true;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean isTeleporterCompatible() {
+ return false;
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return V[mTier] * 16;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return 100000000;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[mTier];
+ }
+
+ @Override
+ public long maxSteamStore() {
+ return maxEUStore();
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 2;
+ }
+
+ @Override
+ public int getStackDisplaySlot() {
+ return 2;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public int getInputSlot() {
+ return 0;
+ }
+
+ @Override
+ public int getOutputSlot() {
+ return 0;
+ }
+
+ @Override
+ public int getCapacity() {
+ return 64000;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return false;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return false;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
}