aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-09-14 13:47:51 +1000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-09-14 13:47:51 +1000
commit678a32be304bcffe457cf869ba6c5d57bdc1b2e1 (patch)
tree1db1454a7f2dcb3453370cea0ca995ec9188a9d2 /src/Java/gtPlusPlus
parent84cce1bba9a1091f2428ebee464cbfdf57491def (diff)
downloadGT5-Unofficial-678a32be304bcffe457cf869ba6c5d57bdc1b2e1.tar.gz
GT5-Unofficial-678a32be304bcffe457cf869ba6c5d57bdc1b2e1.tar.bz2
GT5-Unofficial-678a32be304bcffe457cf869ba6c5d57bdc1b2e1.zip
$ Fixed the XP Convertor.
% Rewrote base tile entity system. % Added hashCode() to Pair.java. % Changed some calculations on Materials. % Made Rocket Engines produce heavy pollution.
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/IGregtechPower.java6
-rw-r--r--src/Java/gtPlusPlus/api/interfaces/ILazyCoverable.java144
-rw-r--r--src/Java/gtPlusPlus/api/objects/data/Pair.java8
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java188
-rw-r--r--src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java164
-rw-r--r--src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java90
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java1
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java52
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java150
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TileEntityBase.java1148
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/base/TilePoweredGT.java19
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityXpConverter.java399
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityModularityTable.java7
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityTradeTable.java1
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java21
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityRocketFuelGenerator.java6
16 files changed, 2057 insertions, 347 deletions
diff --git a/src/Java/gtPlusPlus/api/interfaces/IGregtechPower.java b/src/Java/gtPlusPlus/api/interfaces/IGregtechPower.java
index 5f624e7a8c..4bb29b3354 100644
--- a/src/Java/gtPlusPlus/api/interfaces/IGregtechPower.java
+++ b/src/Java/gtPlusPlus/api/interfaces/IGregtechPower.java
@@ -8,8 +8,6 @@ import net.minecraft.world.World;
import gregtech.api.interfaces.IDescribable;
import gregtech.api.interfaces.tileentity.*;
-import gtPlusPlus.core.tileentities.base.TilePoweredGT;
-
public abstract interface IGregtechPower extends IGearEnergyTileEntity, ITurnable, IGregTechDeviceInformation, IDescribable, IBasicEnergyContainer {
@Override
@@ -137,11 +135,11 @@ public abstract interface IGregtechPower extends IGearEnergyTileEntity, ITurnabl
return true;
}
- boolean onPreTick(TilePoweredGT tilePoweredGT, long mTickTimer2);
+/* boolean onPreTick(TilePoweredGT tilePoweredGT, long mTickTimer2);
boolean onTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2);
- boolean onPostTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2);
+ boolean onPostTick(TilePoweredGT iGregTechTileEntity, long mTickTimer2);*/
}
diff --git a/src/Java/gtPlusPlus/api/interfaces/ILazyCoverable.java b/src/Java/gtPlusPlus/api/interfaces/ILazyCoverable.java
new file mode 100644
index 0000000000..9e1a7431db
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/interfaces/ILazyCoverable.java
@@ -0,0 +1,144 @@
+package gtPlusPlus.api.interfaces;
+
+import gregtech.api.interfaces.tileentity.ICoverable;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+
+public interface ILazyCoverable extends ICoverable {
+
+ @Override
+ default byte getColorization() {
+ return 0;
+ }
+
+ @Override
+ default byte setColorization(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default byte getInputRedstoneSignal(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default byte getStrongestRedstone() {
+ return 0;
+ }
+
+ @Override
+ default boolean getRedstone() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ default boolean getRedstone(byte arg0) {
+ return false;
+ }
+
+ @Override
+ default boolean isUniversalEnergyStored(long arg0) {
+ return false;
+ }
+
+ @Override
+ default long getUniversalEnergyStored() {
+ return 0;
+ }
+
+ @Override
+ default long getUniversalEnergyCapacity() {
+ return 0;
+ }
+
+ @Override
+ default long getStoredSteam() {
+ return 0;
+ }
+
+ @Override
+ default long getSteamCapacity() {
+ return 0;
+ }
+
+ @Override
+ default boolean increaseStoredSteam(long arg0, boolean arg2) {
+ return false;
+ }
+
+ @Override
+ default byte getOutputRedstoneSignal(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default void setOutputRedstoneSignal(byte arg0, byte arg1) {
+
+ }
+
+ @Override
+ default byte getStrongOutputRedstoneSignal(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default void setStrongOutputRedstoneSignal(byte arg0, byte arg1) {
+
+ }
+
+ @Override
+ default byte getComparatorValue(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default IGregTechTileEntity getIGregTechTileEntity(int arg0, int arg1, int arg2) {
+ return null;
+ }
+
+ @Override
+ default IGregTechTileEntity getIGregTechTileEntityOffset(int arg0, int arg1, int arg2) {
+ return null;
+ }
+
+ @Override
+ default IGregTechTileEntity getIGregTechTileEntityAtSide(byte arg0) {
+ return null;
+ }
+
+ @Override
+ default IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte arg0, int arg1) {
+ return null;
+ }
+
+ @Override
+ default byte getMetaID(int arg0, int arg1, int arg2) {
+ return 0;
+ }
+
+ @Override
+ default byte getMetaIDOffset(int arg0, int arg1, int arg2) {
+ return 0;
+ }
+
+ @Override
+ default byte getMetaIDAtSide(byte arg0) {
+ return 0;
+ }
+
+ @Override
+ default byte getMetaIDAtSideAndDistance(byte arg0, int arg1) {
+ return 0;
+ }
+
+ @Override
+ default boolean isDead() {
+ return false;
+ }
+
+ @Override
+ default void setLightValue(byte arg0) {
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/data/Pair.java b/src/Java/gtPlusPlus/api/objects/data/Pair.java
index 6ab781cf1e..e1d23e6b43 100644
--- a/src/Java/gtPlusPlus/api/objects/data/Pair.java
+++ b/src/Java/gtPlusPlus/api/objects/data/Pair.java
@@ -2,6 +2,8 @@ package gtPlusPlus.api.objects.data;
import java.io.Serializable;
+import com.google.common.base.Objects;
+
public class Pair<K,V> implements Serializable {
/**
@@ -24,4 +26,10 @@ public class Pair<K,V> implements Serializable {
return this.value;
}
+ @Override
+ public int hashCode() {
+ Integer aCode = Objects.hashCode(getKey(), getValue());
+ return aCode != null ? aCode : super.hashCode();
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
new file mode 100644
index 0000000000..0b8f97b378
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_FluidTank.java
@@ -0,0 +1,188 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import gtPlusPlus.core.util.minecraft.FluidUtils;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTank;
+import net.minecraftforge.fluids.FluidTankInfo;
+
+public class BTF_FluidTank extends FluidTank {
+
+ public FluidStack mFluid;
+
+ public BTF_FluidTank(int capacity) {
+ super(capacity);
+ }
+
+ /**
+ * Let's replace the Default handling with GT's own handling code, because it's probably better, right?
+ * @author Alkalus/GregoriusT
+ */
+
+
+ public FluidStack getFluid() {
+ return this.getDrainableStack();
+ }
+
+ public int getFluidAmount() {
+ return this.getDrainableStack() != null ? this.getDrainableStack().amount : 0;
+ }
+
+ public NBTTagCompound writeToNBT(NBTTagCompound aNBT) {
+ super.writeToNBT(aNBT);
+ if (this.mFluid != null) {
+ aNBT.setTag("mFluid", this.mFluid.writeToNBT(new NBTTagCompound()));
+ }
+ return aNBT;
+ }
+
+ public FluidTank readFromNBT(NBTTagCompound aNBT) {
+ this.mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ return this;
+ }
+
+/* public abstract boolean isLiquidInput(byte arg0);
+
+ public abstract boolean isLiquidOutput(byte arg0);
+
+ public abstract boolean doesFillContainers();
+
+ public abstract boolean doesEmptyContainers();*/
+
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ return true;
+ }
+
+ public FluidStack getFillableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setFillableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+ public FluidStack getDrainableStack() {
+ return this.mFluid;
+ }
+
+ public FluidStack setDrainableStack(FluidStack aFluid) {
+ this.mFluid = aFluid;
+ return this.mFluid;
+ }
+
+ public FluidStack getDisplayedFluid() {
+ return this.getDrainableStack();
+ }
+
+ public boolean isFluidChangingAllowed() {
+ return true;
+ }
+
+ public int fill(FluidStack aFluid, boolean doFill) {
+ if (aFluid != null && aFluid.getFluid().getID() > 0 && aFluid.amount > 0 && this.canTankBeFilled()
+ && this.isFluidInputAllowed(aFluid)) {
+ if (this.getFillableStack() != null && this.getFillableStack().getFluid().getID() > 0) {
+ if (!this.getFillableStack().isFluidEqual(aFluid)) {
+ return 0;
+ } else {
+ int space = this.getCapacity() - this.getFillableStack().amount;
+ if (aFluid.amount <= space) {
+ if (doFill) {
+ FluidStack arg9999 = this.getFillableStack();
+ arg9999.amount += aFluid.amount;
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return space;
+ }
+ }
+ } else if (aFluid.amount <= this.getCapacity()) {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ }
+
+ return aFluid.amount;
+ } else {
+ if (doFill) {
+ this.setFillableStack(aFluid.copy());
+ this.getFillableStack().amount = this.getCapacity();
+ }
+
+ return this.getCapacity();
+ }
+ } else {
+ return 0;
+ }
+ }
+
+ public FluidStack drain(int maxDrain, boolean doDrain) {
+ if (this.getDrainableStack() != null && this.canTankBeEmptied()) {
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ return null;
+ } else {
+ int used = maxDrain;
+ if (this.getDrainableStack().amount < maxDrain) {
+ used = this.getDrainableStack().amount;
+ }
+
+ if (doDrain) {
+ FluidStack arg9999 = this.getDrainableStack();
+ arg9999.amount -= used;
+ }
+
+ FluidStack drained = this.getDrainableStack().copy();
+ drained.amount = used;
+ if (this.getDrainableStack().amount <= 0 && this.isFluidChangingAllowed()) {
+ this.setDrainableStack((FluidStack) null);
+ }
+
+ return drained;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public int getCapacity() {
+ return super.getCapacity();
+ }
+
+ @Override
+ public FluidTankInfo getInfo() {
+ return new FluidTankInfo(this);
+ }
+
+ @Override
+ public void setFluid(FluidStack fluid) {
+ setFillableStack(fluid);
+ }
+
+ @Override
+ public void setCapacity(int capacity) {
+ super.setCapacity(capacity);
+ }
+
+ public FluidStack drain(FluidStack aFluid, boolean doDrain) {
+ return drain(aFluid.amount, doDrain);
+ }
+
+
+
+}
diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java
new file mode 100644
index 0000000000..25968f1908
--- /dev/null
+++ b/src/Java/gtPlusPlus/api/objects/minecraft/BTF_Inventory.java
@@ -0,0 +1,164 @@
+package gtPlusPlus.api.objects.minecraft;
+
+import java.util.ArrayList;
+
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.tileentities.base.TileEntityBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.ISidedInventory;
+import net.minecraft.item.ItemStack;
+
+public class BTF_Inventory implements ISidedInventory{
+
+ public final ItemStack[] mInventory;
+ public final TileEntityBase mTile;
+
+ public BTF_Inventory(int aSlots, TileEntityBase tile) {
+ this.mInventory = new ItemStack[aSlots];
+ this.mTile = tile;
+ }
+
+ public ItemStack[] getRealInventory() {
+ return this.mInventory;
+ }
+
+ public int getSizeInventory() {
+ return this.mInventory.length;
+ }
+
+ public ItemStack getStackInSlot(int aIndex) {
+ return aIndex >= 0 && aIndex < this.mInventory.length ? this.mInventory[aIndex] : null;
+ }
+
+ public void setInventorySlotContents(int aIndex, ItemStack aStack) {
+ if (aIndex >= 0 && aIndex < this.mInventory.length) {
+ this.mInventory[aIndex] = aStack;
+ }
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ public int getInventoryStackLimit() {
+ return 64;
+ }
+
+
+ public boolean setStackToZeroInsteadOfNull(int aIndex) {
+ return false;
+}
+
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ return isValidSlot(aIndex);
+ }
+
+ public ItemStack decrStackSize(int aIndex, int aAmount) {
+ ItemStack tStack = this.getStackInSlot(aIndex);
+ ItemStack rStack = GT_Utility.copy(new Object[]{tStack});
+ if (tStack != null) {
+ if (tStack.stackSize <= aAmount) {
+ if (this.setStackToZeroInsteadOfNull(aIndex)) {
+ tStack.stackSize = 0;
+ } else {
+ this.setInventorySlotContents(aIndex, (ItemStack) null);
+ }
+ } else {
+ rStack = tStack.splitStack(aAmount);
+ if (tStack.stackSize == 0 && !this.setStackToZeroInsteadOfNull(aIndex)) {
+ this.setInventorySlotContents(aIndex, (ItemStack) null);
+ }
+ }
+ }
+
+ return rStack;
+ }
+
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ ArrayList<Integer> tList = new ArrayList<Integer>();
+ TileEntityBase tTileEntity = this.mTile;
+ boolean tSkip = tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2,
+ tTileEntity)
+ || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), -2,
+ tTileEntity);
+
+ for (int rArray = 0; rArray < this.getSizeInventory(); ++rArray) {
+ if (this.isValidSlot(rArray) && (tSkip
+ || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide),
+ rArray, tTileEntity)
+ || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide,
+ tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide),
+ rArray, tTileEntity))) {
+ tList.add(Integer.valueOf(rArray));
+ }
+ }
+
+ int[] arg6 = new int[tList.size()];
+
+ for (int i = 0; i < arg6.length; ++i) {
+ arg6[i] = ((Integer) tList.get(i)).intValue();
+ }
+
+ return arg6;
+ }
+
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return this.isValidSlot(aIndex) && aStack != null && aIndex < this.mInventory.length
+ && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, this.mInventory[aIndex]))
+ && this.allowPutStack(this.mTile, aIndex, (byte) aSide, aStack);
+ }
+
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ return this.isValidSlot(aIndex) && aStack != null && aIndex < this.mInventory.length
+ && this.allowPullStack(this.mTile, aIndex, (byte) aSide, aStack);
+ }
+
+ public boolean allowPullStack(TileEntityBase mTile2, int aIndex, byte aSide, ItemStack aStack) {
+ return aIndex >= 0 && aIndex < this.getSizeInventory();
+ }
+
+ public boolean allowPutStack(TileEntityBase aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (aIndex >= 0 && aIndex < this.getSizeInventory()) && (this.mInventory[aIndex] == null || GT_Utility.areStacksEqual(this.mInventory[aIndex], aStack));
+ }
+
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return null;
+ }
+
+ public final boolean hasCustomInventoryName() {
+ return mTile != null ? mTile.hasCustomInventoryName() : false;
+ }
+
+
+ public void markDirty() {
+ if (mTile != null) {
+ mTile.markDirty();
+ }
+ }
+
+ public boolean isUseableByPlayer(EntityPlayer entityplayer) {
+ return true;
+ }
+
+ public void openInventory() {
+
+ }
+
+ public void closeInventory() {
+
+ }
+
+ @Override
+ public final String getInventoryName() {
+ return this.mTile != null ? mTile.getInventoryName() : "";
+ }
+
+
+}
diff --git a/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java b/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java
index bab2ecc349..215c79ed10 100644
--- a/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java
+++ b/src/Java/gtPlusPlus/core/block/general/BlockTankXpConverter.java
@@ -165,71 +165,18 @@ public class BlockTankXpConverter extends BlockContainer {
}
private final boolean generateRainbowMap() {
- int id = 0;
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(51, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(102, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(153, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(204, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 255, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 204, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 153, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 102, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 51, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 0));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 51));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 102));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 153));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 204));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(255, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(204, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(153, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(102, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(51, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 0, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 51, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 102, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 153, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 204, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 255));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 204));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 153));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 102));
- this.mRainbowMap.put(id++, new Triplet<Integer, Integer, Integer>(0, 255, 51));
- this.mRainbowTickMax = this.mRainbowMap.size();
return true;
}
@Override
public int getBlockColor() {
- return Utils.rgbtoHexValue(0, 0, 0);
+ return super.getBlockColor();
}
@Override
public int colorMultiplier(final IBlockAccess p_149720_1_, final int p_149720_2_, final int p_149720_3_,
final int p_149720_4_) {
-
- if ((this.mRainbowTick < 0) || (this.mRainbowTick > this.mRainbowTickMax)) {
- this.mRainbowTick = 0;
- }
- //Utils.LOG_INFO("x: "+this.mRainbowTick);
- if (this.mRainbowTick <= this.mRainbowTickMax) {
- Triplet<Integer, Integer, Integer> mT = this.mRainbowMap.get(this.mRainbowTick);
- try {
- return Utils.rgbtoHexValue(mT.getValue_1(), mT.getValue_1(), mT.getValue_1());
- }
- catch (final Throwable t) {
- try {
- mT = this.mRainbowMap.get(this.mRainbowTick - 1);
- return Utils.rgbtoHexValue(mT.getValue_1(), mT.getValue_1(), mT.getValue_1());
- }
- catch (final Throwable t1) {
- return Utils.rgbtoHexValue(0, 0, 0);
- }
- }
- }
-
- return Utils.rgbtoHexValue(0, 0, 0);
+ return super.colorMultiplier(p_149720_1_, p_149720_2_, p_149720_3_, p_149720_4_);
}
@Override
@@ -240,7 +187,7 @@ public class BlockTankXpConverter extends BlockContainer {
@Override
public void randomDisplayTick(final World world, final int x, final int y, final int z, final Random rand) {
- this.mRainbowTick++;
+ //this.mRainbowTick++;
super.randomDisplayTick(world, x, y, z, rand);
}
@@ -251,36 +198,7 @@ public class BlockTankXpConverter extends BlockContainer {
@Override
public int getLightValue() {
- final int mTicker = this.mRainbowTick;
- if ((mTicker == 0) || (mTicker == 17)){
- return 1;
- }
- else if ((mTicker == 1) || (mTicker == 16)){
- return 2;
- }
- else if ((mTicker == 2) || (mTicker == 15)){
- return 3;
- }
- else if ((mTicker == 3) || (mTicker == 14)){
- return 4;
- }
- else if ((mTicker == 4) || (mTicker == 13)){
return 6;
- }
- else if ((mTicker == 5) || (mTicker == 12)){
- return 8;
- }
- else if ((mTicker == 6) || (mTicker == 11)){
- return 10;
- }
- else if ((mTicker == 7) || (mTicker == 10)){
- return 12;
- }
- else if ((mTicker == 8) || (mTicker == 9)){
- return 14;
- }
- return 0;
-
- }
+ }
}
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java
index 0ca5197ee0..e21e9ffdc6 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockEntityBase.java
@@ -31,6 +31,7 @@ public class ItemBlockEntityBase extends ItemBlock {
if (Block.getBlockFromItem(stack.getItem()) instanceof BlockTankXpConverter){
list.add(EnumChatFormatting.GRAY+"Can convert Liquid Xp to Mob Essence and back.");
list.add(EnumChatFormatting.GRAY+"Right click with a Screwdriver to change mode.");
+ list.add(EnumChatFormatting.GRAY+"Shift+Right click to view tank information.");
}
else if (Block.getBlockFromItem(stack.getItem()) instanceof BlockTankXpConverter){
//list.add(EnumChatFormatting.GRAY+"A pile of " + materialName + " dust.");
diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java
index 7d251c8682..01999ecbd4 100644
--- a/src/Java/gtPlusPlus/core/material/Material.java
+++ b/src/Java/gtPlusPlus/core/material/Material.java
@@ -945,7 +945,18 @@ public class Material {
final public int calculateMeltingPoint(){
try {
- int meltingPoint = 0;
+
+ AutoMap<Integer> aDataSet = new AutoMap<Integer>();
+ for (MaterialStack m : this.vMaterialInput) {
+ aDataSet.put(m.getStackMaterial().getMeltingPointC());
+ }
+ long aAverage = MathUtils.getAverage(aDataSet);
+ return MathUtils.safeInt(aAverage);
+
+
+
+
+ /*int meltingPoint = 0;
for (MaterialStack part : this.vMaterialInput){
if (part != null){
int incrementor = part.getStackMaterial().getMeltingPointC();
@@ -959,7 +970,7 @@ public class Material {
int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
Logger.WARNING("Dividing "+meltingPoint+" / "+divisor+" to get average melting point.");
meltingPoint = (meltingPoint/divisor);
- return meltingPoint;
+ return meltingPoint;*/
}
catch (Throwable r){
return 500;
@@ -968,7 +979,16 @@ public class Material {
final public int calculateBoilingPoint(){
try {
- int boilingPoint = 0;
+
+ AutoMap<Integer> aDataSet = new AutoMap<Integer>();
+ for (MaterialStack m : this.vMaterialInput) {
+ aDataSet.put(m.getStackMaterial().getBoilingPointC());
+ }
+ long aAverage = MathUtils.getAverage(aDataSet);
+ return MathUtils.safeInt(aAverage);
+
+
+ /*int boilingPoint = 0;
for (MaterialStack part : this.vMaterialInput){
if (part != null){
boilingPoint += part.getStackMaterial().getBoilingPointC();
@@ -980,7 +1000,7 @@ public class Material {
}
int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
boilingPoint = (boilingPoint/divisor);
- return boilingPoint;
+ return boilingPoint;*/
}
catch (Throwable r){
return 2500;
@@ -989,7 +1009,15 @@ public class Material {
final public long calculateProtons(){
try {
- long protonCount = 0;
+
+ AutoMap<Long> aDataSet = new AutoMap<Long>();
+ for (MaterialStack m : this.vMaterialInput) {
+ aDataSet.put(m.getStackMaterial().getProtons());
+ }
+ long aAverage = MathUtils.getAverage(aDataSet);
+ return aAverage;
+
+ /*long protonCount = 0;
for (MaterialStack part : this.vMaterialInput){
if (part != null){
protonCount += (part.getStackMaterial().getProtons());
@@ -1000,7 +1028,7 @@ public class Material {
}
int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
protonCount = (protonCount/divisor);
- return protonCount;
+ return protonCount;*/
}
catch (Throwable r){
return 50;
@@ -1009,7 +1037,15 @@ public class Material {
final public long calculateNeutrons(){
try {
- long neutronCount = 0;
+
+ AutoMap<Long> aDataSet = new AutoMap<Long>();
+ for (MaterialStack m : this.vMaterialInput) {
+ aDataSet.put(m.getStackMaterial().getNeutrons());
+ }
+ long aAverage = MathUtils.getAverage(aDataSet);
+ return aAverage;
+
+ /*long neutronCount = 0;
for (MaterialStack part : this.vMaterialInput){
if (part != null){
neutronCount += (part.getStackMaterial().getNeutrons());
@@ -1020,7 +1056,7 @@ public class Material {
}
int divisor = (this.vMaterialInput.size()>0 ? this.vMaterialInput.size() : 1);
neutronCount = (neutronCount/divisor);
- return neutronCount;
+ return neutronCount;*/
}
catch (Throwable r){
return 75;
diff --git a/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java b/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
new file mode 100644
index 0000000000..671a49fca5
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/base/TileBasicTank.java
@@ -0,0 +1,150 @@
+package gtPlusPlus.core.tileentities.base;
+
+import gtPlusPlus.api.objects.minecraft.BTF_FluidTank;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.fluids.IFluidTank;
+
+public class TileBasicTank extends TileEntityBase implements IFluidHandler, IFluidTank {
+
+ public final BTF_FluidTank mTank;
+
+ public TileBasicTank(int aMaxSlots, int aFluidCapacity) {
+ super(aMaxSlots);
+ mTank = new BTF_FluidTank(aFluidCapacity);
+ }
+
+ @Override
+ public boolean onPreTick(long aTick) {
+
+ if (this.isServerSide()) {
+ if (mTank.isFluidChangingAllowed() && mTank.getFillableStack() != null
+ && mTank.getFillableStack().amount <= 0) {
+ mTank.setFillableStack((FluidStack) null);
+ }
+ }
+
+ return super.onPreTick(aTick);
+
+ }
+
+
+ private final boolean canFillEx(ForgeDirection aSide, Fluid aFluid) {
+ return this.fill(aSide, new FluidStack(aFluid, 1), false) == 1;
+ }
+
+
+ private final boolean canDrainEx(ForgeDirection aSide, Fluid aFluid) {
+ return this.drain(aSide, new FluidStack(aFluid, 1), false) != null;
+ }
+
+
+ private final FluidTankInfo[] getTankInfoEx(ForgeDirection aSide) {
+ return mTank.getCapacity() <= 0 ? new FluidTankInfo[0]
+ : new FluidTankInfo[]{mTank.getInfo()};
+ }
+
+ private final int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ return mTank.fill(aFluid, doFill);
+ }
+
+
+ private final int fillEx(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ return this.fill_default(aSide, aFluid, doFill);
+ }
+
+
+ private final FluidStack drainEx(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
+ return mTank.getFluid() != null && aFluid != null && mTank.getFluid().isFluidEqual(aFluid)
+ ? mTank.drain(aFluid.amount, doDrain)
+ : null;
+ }
+
+
+ private final FluidStack drainEx(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ return mTank.drain(maxDrain, doDrain);
+ }
+
+
+ public boolean isLiquidInput(byte aSide) {
+ return true;
+ }
+
+ public boolean isLiquidOutput(byte aSide) {
+ return true;
+ }
+
+ @Override
+ public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this))))
+ return this.fillEx(aSide, aFluid, doFill);
+ return 0;
+ }
+
+ @Override
+ public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
+ if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (this.isLiquidOutput((byte) aSide.ordinal()) &am