aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gregtech/api/metatileentity/BaseMetaTileEntityEx.java2091
-rw-r--r--src/Java/gregtech/api/metatileentity/MetaTileEntityEx.java972
-rw-r--r--src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachineEx.java798
-rw-r--r--src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTankEx.java251
-rw-r--r--src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlockEx.java67
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java5
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java5
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java180
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java162
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java30
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java30
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java10
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java553
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java555
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java160
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java343
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java202
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java24
20 files changed, 180 insertions, 6268 deletions
diff --git a/src/Java/gregtech/api/metatileentity/BaseMetaTileEntityEx.java b/src/Java/gregtech/api/metatileentity/BaseMetaTileEntityEx.java
deleted file mode 100644
index 955b7eb045..0000000000
--- a/src/Java/gregtech/api/metatileentity/BaseMetaTileEntityEx.java
+++ /dev/null
@@ -1,2091 +0,0 @@
-package gregtech.api.metatileentity;
-
-import static gregtech.api.enums.GT_Values.NW;
-import static gregtech.api.enums.GT_Values.V;
-import gregtech.GT_Mod;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
-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.net.GT_Packet_TileEntity;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.GT_CoverBehavior;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
-import ic2.api.Direction;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.BlockFire;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.init.Items;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraft.network.Packet;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.world.EnumSkyBlock;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.Constants;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main TileEntity for EVERYTHING.
- */
-public class BaseMetaTileEntityEx extends BaseTileEntity implements IGregTechTileEntity {
- private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior};
- protected MetaTileEntityEx mMetaTileEntity;
- protected long mStoredEnergy = 0, mStoredSteam = 0;
- protected int mAverageEUInputIndex = 0, mAverageEUOutputIndex = 0;
- protected boolean mReleaseEnergy = false;
- protected int[] mAverageEUInput = new int[]{0, 0, 0, 0, 0}, mAverageEUOutput = new int[]{0, 0, 0, 0, 0};
- private boolean[] mActiveEUInputs = new boolean[]{false, false, false, false, false, false}, mActiveEUOutputs = new boolean[]{false, false, false, false, false, false};
- private byte[] mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15};
- private int[] mCoverSides = new int[]{0, 0, 0, 0, 0, 0}, mCoverData = new int[]{0, 0, 0, 0, 0, 0}, mTimeStatistics = new int[GregTech_API.TICKS_FOR_LAG_AVERAGING];
-
-
- //TODO
- //TODO
- //TODO
- //TODO
- private boolean mHasEnoughEnergy = true;
- private boolean mRunningThroughTick = false;
- private boolean mInputDisabled = false;
- private boolean mOutputDisabled = false;
- private boolean mMuffler = false;
- private boolean mLockUpgrade = false;
- private boolean mActive = false;
- private boolean mRedstone = false;
- private boolean mWorkUpdate = false;
- private boolean mSteamConverter = false;
- private boolean mInventoryChanged = false;
- private boolean mWorks = true;
- private boolean mNeedsUpdate = true;
- private boolean mNeedsBlockUpdate = true;
- private boolean mSendClientData = false;
- private boolean oRedstone = false;
- //TODO
- //TODO
-
- // Create a new NBT Tag List to store itemstacks as NBT Tags
- protected NBTTagList mInventoryItems = new NBTTagList();
- protected ItemStack[] mInventory;
- //TODO
- //TODO
- //TODO
-
- private byte mColor = 0, oColor = 0, mStrongRedstone = 0, oRedstoneData = 63, oTextureData = 0, oUpdateData = 0, oLightValueClient = -1, oLightValue = -1, mLightValue = 0, mOtherUpgrades = 0, mFacing = 0, oFacing = 0, mWorkData = 0;
- private int mDisplayErrorCode = 0, oX = 0, oY = 0, oZ = 0, mTimeStatisticsIndex = 0, mLagWarningCount = 0;
- private short mID = 0;
- private long mTickTimer = 0, oOutput = 0, mAcceptedAmperes = Long.MAX_VALUE;
- private String mOwnerName = "";
- private NBTTagCompound mRecipeStuff = new NBTTagCompound();
-
- public BaseMetaTileEntityEx() {
- /* this.mInventory = mMetaTileEntity.mInventory;
- Utils.LOG_INFO(UtilsItems.getArrayStackNames(mInventory));*/
- }
-
-
- @Override
- public void writeToNBT(NBTTagCompound aNBT) {
- try {
- super.writeToNBT(aNBT);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- try {
- aNBT.setInteger("mID", mID);
- aNBT.setLong("mStoredSteam", mStoredSteam);
- aNBT.setLong("mStoredEnergy", mStoredEnergy);
- aNBT.setIntArray("mCoverData", mCoverData);
- aNBT.setIntArray("mCoverSides", mCoverSides);
- aNBT.setByteArray("mRedstoneSided", mSidedRedstone);
- aNBT.setByte("mColor", mColor);
- aNBT.setByte("mLightValue", mLightValue);
- aNBT.setByte("mOtherUpgrades", mOtherUpgrades);
- aNBT.setByte("mWorkData", mWorkData);
- aNBT.setByte("mStrongRedstone", mStrongRedstone);
- aNBT.setShort("mFacing", mFacing);
- aNBT.setString("mOwnerName", mOwnerName);
- aNBT.setBoolean("mLockUpgrade", mLockUpgrade);
- aNBT.setBoolean("mMuffler", mMuffler);
- aNBT.setBoolean("mSteamConverter", mSteamConverter);
- aNBT.setBoolean("mActive", mActive);
- aNBT.setBoolean("mRedstone", mRedstone);
- aNBT.setBoolean("mWorks", !mWorks);
- aNBT.setBoolean("mInputDisabled", mInputDisabled);
- aNBT.setBoolean("mOutputDisabled", mOutputDisabled);
- aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
-
- //Let's try save the contents of the inventory
- // Create a new NBT Tag List to store itemstacks as NBT Tags
- NBTTagList items = new NBTTagList();
-
- for (int i = 0; i < getSizeInventory(); ++i)
- {
- // Only write stacks that contain items
- if (getStackInSlot(i) != null){
- // Make a new NBT Tag Compound to write the itemstack and slot index to
- NBTTagCompound item = new NBTTagCompound();
- item.setInteger("Slot", i);
- // Writes the itemstack in slot(i) to the Tag Compound we just made
- getStackInSlot(i).writeToNBT(item);
- // add the tag compound to our tag list
- items.appendTag(item);
- }
- }
- // Add the TagList to the ItemStack's Tag Compound with the name "ItemInventory"
- aNBT.setTag("TileEntityInventory", items);
-
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- try {
- if (hasValidMetaTileEntity()) {
- NBTTagList tItemList = new NBTTagList();
- for (int i = 0; i < mMetaTileEntity.getRealInventory().length; i++) {
- ItemStack tStack = mMetaTileEntity.getRealInventory()[i];
- if (tStack != null) {
- NBTTagCompound tTag = new NBTTagCompound();
- tTag.setInteger("IntSlot", i);
- tStack.writeToNBT(tTag);
- tItemList.appendTag(tTag);
- }
- }
- aNBT.setTag("Inventory", tItemList);
-
- try {
- mMetaTileEntity.saveNBTData(aNBT);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
-
-
- @Override
- public void readFromNBT(NBTTagCompound aNBT) {
- super.readFromNBT(aNBT);
- setInitialValuesAsNBT(aNBT, (short) 0);
- }
-
-
- @Override
- public void setInitialValuesAsNBT(NBTTagCompound aNBT, short aID) {
- if (aNBT == null) {
- if (aID > 0) mID = aID;
- else mID = mID > 0 ? mID : 0;
- if (mID != 0) createNewMetatileEntity(mID);
- mSidedRedstone = (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior() ? new byte[]{0, 0, 0, 0, 0, 0} : new byte[]{15, 15, 15, 15, 15, 15});
- } else {
- if (aID <= 0) mID = (short) aNBT.getInteger("mID");
- else mID = aID;
- mStoredSteam = aNBT.getInteger("mStoredSteam");
- mStoredEnergy = aNBT.getInteger("mStoredEnergy");
- mColor = aNBT.getByte("mColor");
- mLightValue = aNBT.getByte("mLightValue");
- mWorkData = aNBT.getByte("mWorkData");
- mStrongRedstone = aNBT.getByte("mStrongRedstone");
- mFacing = oFacing = (byte) aNBT.getShort("mFacing");
- mOwnerName = aNBT.getString("mOwnerName");
- mLockUpgrade = aNBT.getBoolean("mLockUpgrade");
- mMuffler = aNBT.getBoolean("mMuffler");
- mSteamConverter = aNBT.getBoolean("mSteamConverter");
- mActive = aNBT.getBoolean("mActive");
- mRedstone = aNBT.getBoolean("mRedstone");
- mWorks = !aNBT.getBoolean("mWorks");
- mInputDisabled = aNBT.getBoolean("mInputDisabled");
- mOutputDisabled = aNBT.getBoolean("mOutputDisabled");
- mOtherUpgrades = (byte) (aNBT.getByte("mOtherUpgrades") + aNBT.getByte("mBatteries") + aNBT.getByte("mLiBatteries"));
- mCoverSides = aNBT.getIntArray("mCoverSides");
- mCoverData = aNBT.getIntArray("mCoverData");
- mSidedRedstone = aNBT.getByteArray("mRedstoneSided");
- mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
-
- //Loading Invetory contents
- // Gets the custom taglist we wrote to this compound, if any
- NBTTagList items = aNBT.getTagList("TileEntityInventory", Constants.NBT.TAG_COMPOUND);
- for (int i = 0; i < items.tagCount(); ++i){
- NBTTagCompound item = (NBTTagCompound) items.getCompoundTagAt(i);
- int slot = item.getInteger("Slot");
- // Just double-checking that the saved slot index is within our inventory array bounds
- if (slot >= 0 && slot < getSizeInventory()) {
- mInventory[slot] = ItemStack.loadItemStackFromNBT(item);
- }
- }
-
- if (mCoverData.length != 6) mCoverData = new int[]{0, 0, 0, 0, 0, 0};
- if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0};
- if (mSidedRedstone.length != 6)
- if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior())
- mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0};
- else mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15};
-
- for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
-
- if (mID != 0 && createNewMetatileEntity(mID)) {
- NBTTagList tItemList = aNBT.getTagList("Inventory", 10);
- for (int i = 0; i < tItemList.tagCount(); i++) {
- NBTTagCompound tTag = tItemList.getCompoundTagAt(i);
- int tSlot = tTag.getInteger("IntSlot");
- if (tSlot >= 0 && tSlot < mMetaTileEntity.getRealInventory().length) {
- mMetaTileEntity.getRealInventory()[tSlot] = GT_Utility.loadItem(tTag);
- }
- }
-
- try {
- mMetaTileEntity.loadNBTData(aNBT);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
- }
-
- if (mCoverData.length != 6) mCoverData = new int[]{0, 0, 0, 0, 0, 0};
- if (mCoverSides.length != 6) mCoverSides = new int[]{0, 0, 0, 0, 0, 0};
- if (mSidedRedstone.length != 6)
- if (hasValidMetaTileEntity() && mMetaTileEntity.hasSidedRedstoneOutputBehavior())
- mSidedRedstone = new byte[]{0, 0, 0, 0, 0, 0};
- else mSidedRedstone = new byte[]{15, 15, 15, 15, 15, 15};
-
- for (byte i = 0; i < 6; i++) mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
- }
-
- private boolean createNewMetatileEntity(short aID) {
- if (aID <= 0 || aID >= Meta_GT_Proxy.METATILEENTITIES.length || Meta_GT_Proxy.METATILEENTITIES[aID] == null) {
- GT_Log.err.println("GT++ - MetaID " + aID + " not loadable => locking TileEntity!");
- } else {
- if (aID != 0) {
- if (hasValidMetaTileEntity()) mMetaTileEntity.setBaseMetaTileEntity(null);
- Meta_GT_Proxy.METATILEENTITIES[aID].newMetaEntity(this).setBaseMetaTileEntity(this);
- mTickTimer = 0;
- mID = aID;
- return true;
- }
- }
- return false;
- }
-
- /**
- * Used for ticking special BaseMetaTileEntities, which need that for Energy Conversion
- * It's called right before onPostTick()
- */
- public void updateStatus() {
- //
- }
-
- /**
- * Called when trying to charge Items
- */
- public void chargeItem(ItemStack aStack) {
- decreaseStoredEU(GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getOutputTier()), false, false), true);
- }
-
- /**
- * Called when trying to discharge Items
- */
- public void dischargeItem(ItemStack aStack) {
- increaseStoredEnergyUnits(GT_ModHandler.dischargeElectricItem(aStack, (int) Math.min(Integer.MAX_VALUE, getEUCapacity() - getStoredEU()), (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getInputTier()), false, false, false), true);
- }
-
-
- @Override
- public void updateEntity() {
- super.updateEntity();
-
- if (!hasValidMetaTileEntity()) {
- if (mMetaTileEntity == null) return;
- mMetaTileEntity.setBaseMetaTileEntity(this);
- }
-
- mRunningThroughTick = true;
- long tTime = System.currentTimeMillis();
-
- for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
- try {
- switch (tCode) {
- case 0:
- tCode++;
- if (mTickTimer++ == 0) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- if (isServerSide()) for (byte i = 0; i < 6; i++)
- if (getCoverIDAtSide(i) != 0)
- if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
- dropCover(i, i, true);
-
- worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
-
- mMetaTileEntity.onFirstTick(this);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- }
- case 1:
- tCode++;
- if (isClientSide()) {
- if (mColor != oColor) {
- mMetaTileEntity.onColorChangeClient(oColor = mColor);
- issueTextureUpdate();
- }
-
- if (mLightValue != oLightValueClient) {
- worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
- oLightValueClient = mLightValue;
- issueTextureUpdate();
- }
-
- if (mNeedsUpdate) {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- //worldObj.func_147479_m(xCoord, yCoord, zCoord);
- mNeedsUpdate = false;
- }
- }
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- if (isServerSide() && mTickTimer > 10) {
- for (byte i = (byte) (tCode - 2); i < 6; i++)
- if (getCoverIDAtSide(i) != 0) {
- tCode++;
- GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
- int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
- if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
- mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- }
- }
-
- }
- case 8:
- tCode = 9;
- if (isServerSide()) {
- if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
- if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
-
- mAverageEUInput[mAverageEUInputIndex] = 0;
- mAverageEUOutput[mAverageEUOutputIndex] = 0;
- }
- case 9:
- tCode++;
- mMetaTileEntity.onPreTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- case 10:
- tCode++;
- if (isServerSide()) {
- if (mRedstone != oRedstone || mTickTimer == 10) {
- for (byte i = 0; i < 6; i++)
- mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
- oRedstone = mRedstone;
- issueBlockUpdate();
- }
-
- if (xCoord != oX || yCoord != oY || zCoord != oZ) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- issueClientUpdate();
- clearTileEntityBuffer();
- }
-
- if (mFacing != oFacing) {
- oFacing = mFacing;
- for (byte i = 0; i < 6; i++)
- if (getCoverIDAtSide(i) != 0)
- if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
- dropCover(i, i, true);
- issueBlockUpdate();
- }
-
- if (mTickTimer > 20 && mMetaTileEntity.isElectric()) {
- mAcceptedAmperes = 0;
-
- if (getOutputVoltage() != oOutput) {
- oOutput = getOutputVoltage();
- }
-
- if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) {
- for (byte i = 0; i < 6; i++) {
- boolean
- temp = isEnergyInputSide(i);
- if (temp != mActiveEUInputs[i]) {
- mActiveEUInputs[i] = temp;
- }
- temp = isEnergyOutputSide(i);
- if (temp != mActiveEUOutputs[i]) {
- mActiveEUOutputs[i] = temp;
- }
- }
- }
-
- if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
- long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
- if (tUsableAmperage > 0) {
- long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
- mAverageEUOutput[mAverageEUOutputIndex] += tEU;
- decreaseStoredEU(tEU, true);
- }
- }
- if (getEUCapacity() > 0) {
- if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) {
- Block tBlock = getBlockAtSide((byte) getRandomNumber(6));
- if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion();
- }
-
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
-
- if (getRandomNumber(1000) == 0) {
- if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
- || (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
- || (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
- if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
- if (getRandomNumber(10) == 0) {
- try {
- GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
- } catch (Exception e) {
- }
- doEnergyExplosion();
- } else setOnFire();
- }
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
- try {
- GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
- } catch (Exception e) {
- }
- doEnergyExplosion();
- }
- }
- }
- }
- }
-
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- }
- case 11:
- tCode++;
- if (isServerSide()) {
- if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
- for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
- if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
- dischargeItem(mMetaTileEntity.mInventory[i]);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
- }
- }
- }
- }
- case 12:
- tCode++;
- if (isServerSide()) {
- if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
- for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
- if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
- chargeItem(mMetaTileEntity.mInventory[i]);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
- mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
- }
- }
- }
- }
- case 13:
- tCode++;
- updateStatus();
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- case 14:
- tCode++;
- mMetaTileEntity.onPostTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) {
- mRunningThroughTick = false;
- return;
- }
- case 15:
- tCode++;
- if (isServerSide()) {
- if (mTickTimer % 10 == 0) {
- if (mSendClientData) {
- NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
- mSendClientData = false;
- }
- }
-
- if (mTickTimer > 10) {
- byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
- if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
- tData = mMetaTileEntity.getUpdateData();
- if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
- if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
- tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
- if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
- if (mLightValue != oLightValue) {
- worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
- worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
- issueTextureUpdate();
- sendBlockEvent((byte) 7, oLightValue = mLightValue);
- }
- }
-
- if (mNeedsBlockUpdate) {
- worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
- mNeedsBlockUpdate = false;
- }
- }
- default:
- tCode = -1;
- break;
- }
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
-
- if (isServerSide() && hasValidMetaTileEntity()) {
- tTime = System.currentTimeMillis() - tTime;
- if (mTimeStatistics.length > 0)
- mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime;
- if (tTime > 0 && tTime > GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING && mTickTimer > 1000 && getMetaTileEntity().doTickProfilingMessageDuringThisTick() && mLagWarningCount++ < 10)
- System.out.println("GT++ - WARNING: Possible Lag Source at [" + xCoord + ", " + yCoord + ", " + zCoord + "] in Dimension " + worldObj.provider.dimensionId + " with " + tTime + "ms caused by an instance of " + getMetaTileEntity().getClass());
- }
-
- mWorkUpdate = mInventoryChanged = mRunningThroughTick = false;
- }
-
-
- @Override
- public Packet getDescriptionPacket() {
- issueClientUpdate();
- return null;
- }
-
-
- @Override
- public boolean receiveClientEvent(int aEventID, int aValue) {
- super.receiveClientEvent(aEventID, aValue);
-
- if (hasValidMetaTileEntity()) {
- try {
- mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
-
- if (isClientSide()) {
- issueTextureUpdate();
- switch (aEventID) {
- case 0:
- mFacing = (byte) (aValue & 7);
- mActive = ((aValue & 8) != 0);
- mRedstone = ((aValue & 16) != 0);
- //mLockUpgrade = ((aValue&32) != 0);
- break;
- case 1:
- if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue);
- break;
- case 2:
- if (aValue > 16 || aValue < 0) aValue = 0;
- mColor = (byte) aValue;
- break;
- case 3:
- mSidedRedstone[0] = (byte) ((aValue & 1) > 0 ? 15 : 0);
- mSidedRedstone[1] = (byte) ((aValue & 2) > 0 ? 15 : 0);
- mSidedRedstone[2] = (byte) ((aValue & 4) > 0 ? 15 : 0);
- mSidedRedstone[3] = (byte) ((aValue & 8) > 0 ? 15 : 0);
- mSidedRedstone[4] = (byte) ((aValue & 16) > 0 ? 15 : 0);
- mSidedRedstone[5] = (byte) ((aValue & 32) > 0 ? 15 : 0);
- break;
- case 4:
- if (hasValidMetaTileEntity() && mTickTimer > 20)
- mMetaTileEntity.doSound((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case 5:
- if (hasValidMetaTileEntity() && mTickTimer > 20)
- mMetaTileEntity.startSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case 6:
- if (hasValidMetaTileEntity() && mTickTimer > 20)
- mMetaTileEntity.stopSoundLoop((byte) aValue, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5);
- break;
- case 7:
- mLightValue = (byte) aValue;
- break;
- }
- }
- return true;
- }
-
- public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
- ArrayList<String> tList = new ArrayList<String>();
- if (aLogLevel > 2) {
- tList.add("GT++ - Meta-ID: " + mID + (canAccessData() ? " valid" : " invalid") + (mMetaTileEntity == null ? " MetaTileEntity == null!" : " "));
- }
- if (aLogLevel > 1) {
- if (mTimeStatistics.length > 0) {
- double tAverageTime = 0;
- for (int tTime : mTimeStatistics) tAverageTime += tTime;
- tList.add("GT++ - This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms over the last " + mTimeStatistics.length + " ticks.");
- }
- if (mLagWarningCount > 0) {
- tList.add("GT++ - This TileEntity has also caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
- }
- tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you");
- }
- if (aLogLevel > 0) {
- if (getSteamCapacity() > 0 && hasSteamEngineUpgrade())
- tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam");
- tList.add("Machine is " + (mActive ? "active" : "inactive"));
- if (!mHasEnoughEnergy)
- tList.add("GT++ - ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process.");
- }
- return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
- }
-
-
- @Override
- public void issueTextureUpdate() {
- mNeedsUpdate = true;
- }
-
-
- @Override
- public void issueBlockUpdate() {
- mNeedsBlockUpdate = true;
- }
-
-
- @Override
- public void issueClientUpdate() {
- mSendClientData = true;
- }
-
-
- @Override
- public void issueCoverUpdate(byte aSide) {
- issueClientUpdate();
- }
-
-
- @Override
- public byte getStrongestRedstone() {
- return (byte) Math.max(getInternalInputRedstoneSignal((byte) 0), Math.max(getInternalInputRedstoneSignal((byte) 1), Math.max(getInternalInputRedstoneSignal((byte) 2), Math.max(getInternalInputRedstoneSignal((byte) 3), Math.max(getInternalInputRedstoneSignal((byte) 4), getInternalInputRedstoneSignal((byte) 5))))));
- }
-
-
- @Override
- public boolean getRedstone() {
- return getRedstone((byte) 0) || getRedstone((byte) 1) || getRedstone((byte) 2) || getRedstone((byte) 3) || getRedstone((byte) 4) || getRedstone((byte) 5);
- }
-
-
- @Override
- public boolean getRedstone(byte aSide) {
- return getInternalInputRedstoneSignal(aSide) > 0;
- }
-
- public ITexture getCoverTexture(byte aSide) {
- return GregTech_API.sCovers.get(new GT_ItemStack(getCoverIDAtSide(aSide)));
- }
-
-
- @Override
- public boolean isGivingInformation() {
- if (canAccessData()) return mMetaTileEntity.isGivingInformation();
- return false;
- }
-
-
- @Override
- public boolean isValidFacing(byte aSide) {
- if (canAccessData()) return mMetaTileEntity.isFacingValid(aSide);
- return false;
- }
-
-
- @Override
- public byte getBackFacing() {
- return GT_Utility.getOppositeSide(mFacing);
- }
-
-
- @Override
- public byte getFrontFacing() {
- return mFacing;
- }
-
-
- @Override
- public void setFrontFacing(byte aFacing) {
- if (isValidFacing(aFacing)) {
- mFacing = aFacing;
- mMetaTileEntity.onFacingChange();
- onMachineBlockUpdate();
- }
- }
-
-
- @Override
- public int getSizeInventory() {
- if (canAccessData()) return mMetaTileEntity.getSizeInventory();
- return 0;
- }
-
-
- @Override
- public ItemStack getStackInSlot(int aIndex) {
- if (canAccessData()) return mMetaTileEntity.getStackInSlot(aIndex);
- return null;
- }
-
-
- @Override
- public void setInventorySlotContents(int aIndex, ItemStack aStack) {
- mInventoryChanged = true;
- if (canAccessData())
- mMetaTileEntity.setInventorySlotContents(aIndex, worldObj.isRemote ? aStack : GT_OreDictUnificator.setStack(true, aStack));
- }
-
-
- @Override
- public String getInventoryName() {
- if (canAccessData()) return mMetaTileEntity.getInventoryName();
- if (Meta_GT_Proxy.METATILEENTITIES[mID] != null) return Meta_GT_Proxy.METATILEENTITIES[mID].getInventoryName();
- return "";
- }
-
-
- @Override
- public int getInventoryStackLimit() {
- if (canAccessData()) return mMetaTileEntity.getInventoryStackLimit();
- return 64;
- }
-
-
- @Override
- public void openInventory() {
- if (canAccessData()) mMetaTileEntity.onOpenGUI();
- }
-
-
- @Override
- public void closeInventory() {
- if (canAccessData()) mMetaTileEntity.onCloseGUI();
- }
-
-
- @Override
- public boolean isUseableByPlayer(EntityPlayer aPlayer) {
- return canAccessData() && playerOwnsThis(aPlayer, false) && mTickTimer > 40 && getTileEntityOffset(0, 0, 0) == this && aPlayer.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64 && mMetaTileEntity.isAccessAllowed(aPlayer);
- }
-
-
- @Override
- public void validate() {
- super.validate();
- mTickTimer = 0;
- }
-
-
- @Override
- public void invalidate() {
- tileEntityInvalid = false;
- if (canAccessData()) {
- mMetaTileEntity.onRemoval();
- mMetaTileEntity.setBaseMetaTileEntity(null);
- }
- super.invalidate();
- }
-
-
- @Override
- public void onChunkUnload() {
- super.onChunkUnload();
- }
-
-
- @Override
- public boolean hasCustomInventoryName() {
- return false;
- }
-
-
- @Override
- public ItemStack getStackInSlotOnClosing(int slot) {
- ItemStack stack = getStackInSlot(slot);
- if (stack != null) setInventorySlotContents(slot, null);
- return stack;
- }
-
-
- @Override
- public void onMachineBlockUpdate() {
- if (canAccessData()) mMetaTileEntity.onMachineBlockUpdate();
- }
-
-
- @Override
- public int getProgress() {
- return canAccessData() ? mMetaTileEntity.getProgresstime() : 0;
- }
-
-
- @Override
- public int getMaxProgress() {
- return canAccessData() ? mMetaTileEntity.maxProgresstime() : 0;
- }
-
-
- @Override
- public boolean increaseProgress(int aProgressAmountInTicks) {
- return canAccessData() ? mMetaTileEntity.increaseProgress(aProgressAmountInTicks) != aProgressAmountInTicks : false;
- }
-
-
- @Override
- public boolean hasThingsToDo() {
- return getMaxProgress() > 0;
- }
-
-
- @Override
- public void enableWorking() {
- if (!mWorks) mWorkUpdate = true;
- mWorks = true;
- }
-
-
- @Override
- public void disableWorking() {
- mWorks = false;
- }
-
-
- @Override
- public boolean isAllowedToWork() {
- return mWorks;
- }
-
-
- @Override
- public boolean hasWorkJustBeenEnabled() {
- return mWorkUpdate;
- }
-
-
- @Override
- public byte getWorkDataValue() {
- return mWorkData;
- }
-
-
- @Override
- public void setWorkDataValue(byte aValue) {
- mWorkData = aValue;
- }
-
-
- @Override
- public int getMetaTileID() {
- return mID;
- }
-
-
- @Override
- public int setMetaTileID(short aID) {
- return mID = aID;
- }
-
-
- @Override
- public boolean isActive() {
- return mActive;
- }
-
-
- @Override
- public void setActive(boolean aActive) {
- mActive = aActive;
- }
-
-
- @Override
- public long getTimer() {
- return mTickTimer;
- }
-
-
- @Override
- public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) {
- if (!canAccessData()) return false;
- return mHasEnoughEnergy = decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) || decreaseStoredSteam(aEnergy, false) || (aIgnoreTooLessEnergy && (decreaseStoredSteam(aEnergy, true)));
- }
-
-
- @Override
- public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) {
- if (!canAccessData()) return false;
- if (getStoredEU() < getEUCapacity() || aIgnoreTooMuchEnergy) {
- setStoredEU(mMetaTileEntity.getEUVar() + aEnergy);
- return true;
- }
- return false;
- }
-
-
- @Override
- public boolean inputEnergyFrom(byte aSide) {
- if (aSide == 6) return true;
- if (isServerSide()) return (aSide >= 0 && aSide < 6 ? mActiveEUInputs[aSide] : false) && !mReleaseEnergy;
- return isEnergyInputSide(aSide);
- }
-
-
- @Override
- public boolean outputsEnergyTo(byte aSide) {
- if (aSide == 6) return true;
- if (isServerSide()) return (aSide >= 0 && aSide < 6 ? mActiveEUOutputs[aSide] : false) || mReleaseEnergy;
- return isEnergyOutputSide(aSide);
- }
-
-
- @Override
- public long getOutputAmperage() {
- if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxAmperesOut();
- return 0;
- }
-
-
- @Override
- public long getOutputVoltage() {
- if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetOutput())
- return mMetaTileEntity.maxEUOutput();
- return 0;
- }
-
-
- @Override
- public long getInputAmperage() {
- if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxAmperesIn();
- return 0;
- }
-
-
- @Override
- public long getInputVoltage() {
- if (canAccessData() && mMetaTileEntity.isElectric()) return mMetaTileEntity.maxEUInput();
- return Integer.MAX_VALUE;
- }
-
-
- @Override
- public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) {
- if (!canAccessData()) return false;
- if (mMetaTileEntity.getSteamVar() < getSteamCapacity() || aIgnoreTooMuchEnergy) {
- setStoredSteam(mMetaTileEntity.getSteamVar() + aEnergy);
- return true;
- }
- return false;
- }
-
-
- @Override
- public String[] getDescription() {
- if (canAccessData()) return mMetaTileEntity.getDescription();
- return new String[0];
- }
-
-
- @Override
- public boolean isValidSlot(int aIndex) {
- if (canAccessData()) return mMetaTileEntity.isValidSlot(aIndex);
- return false;
- }
-
-
- @Override
- public long getUniversalEnergyStored() {
- return Math.max(getStoredEU(), getStoredSteam());
- }
-
-
- @Override
- public long getUniversalEnergyCapacity() {
- return Math.max(getEUCapacity(), getSteamCapacity());
- }
-
-
- @Override
- public long getStoredEU() {
- if (canAccessData()) return Math.min(mMetaTileEntity.getEUVar(), getEUCapacity());
- return 0;
- }
-
-
- @Override
- public long getEUCapacity() {
- if (canAccessData()) return mMetaTileEntity.maxEUStore();
- return 0;
- }
-
-
- @Override
- public long getStoredSteam() {
- if (canAccessData()) return Math.min(mMetaTileEntity.getSteamVar(), getSteamCapacity());
- return 0;
- }
-
-
- @Override
- public long getSteamCapacity() {
- if (canAccessData()) return mMetaTileEntity.maxSteamStore();
- return 0;
- }
-
-
- public ITexture[] getTexture(byte aSide) {
- ITexture rIcon = getCoverTexture(aSide);
- if (rIcon != null) return new ITexture[]{rIcon};
- if (hasValidMetaTileEntity())
- return mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0);
- return Textures.BlockIcons.ERROR_RENDERING;
- }
-
-
- public ITexture[] getTexture(Block arg0, byte aSide) {
- ITexture rIcon = getCoverTexture(aSide);
- if (rIcon != null) return new ITexture[]{rIcon};
- if (hasValidMetaTileEntity())
- return mMetaTileEntity.getTexture(this, aSide, mFacing, (byte) (mColor - 1), mActive, getOutputRedstoneSignal(aSide) > 0);
- return Textures.BlockIcons.ERROR_RENDERING;
- }
-
- private boolean isEnergyInputSide(byte aSide) {
- if (aSide >= 0 && aSide < 6) {
- if (!getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))
- return false;
- if (isInvalid() || mReleaseEnergy) return false;
- if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetInput())
- return mMetaTileEntity.isInputFacing(aSide);
- }
- return false;
- }
-
- private boolean isEnergyOutputSide(byte aSide) {
- if (aSide >= 0 && aSide < 6) {
- if (!getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))
- return false;
- if (isInvalid() || mReleaseEnergy) return mReleaseEnergy;
- if (canAccessData() && mMetaTileEntity.isElectric() && mMetaTileEntity.isEnetOutput())
- return mMetaTileEntity.isOutputFacing(aSide);
- }
- return false;
- }
-
-
- protected boolean hasValidMetaTileEntity() {
- return mMetaTileEntity != null && mMetaTileEntity.getBaseMetaTileEntity() == this;
- }
-
-
- protected boolean canAccessData() {
- return !isDead && hasValidMetaTileEntity();
- }
-
-
- public boolean setStoredEU(long aEnergy) {
- if (!canAccessData()) return false;
- if (aEnergy < 0) aEnergy = 0;
- mMetaTileEntity.setEUVar(aEnergy);
- return true;
- }
-
-
- public boolean setStoredSteam(long aEnergy) {
- if (!canAccessData()) return false;
- if (aEnergy < 0) aEnergy = 0;
- mMetaTileEntity.setSteamVar(aEnergy);
- return true;
- }
-
-
- public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) {
- if (!canAccessData()) {
- return false;
- }
- if (mMetaTileEntity.getEUVar() - aEnergy >= 0 || aIgnoreTooLessEnergy) {
- setStoredEU(mMetaTileEntity.getEUVar() - aEnergy);
- if (mMetaTileEntity.getEUVar() < 0) {
- setStoredEU(0);
- return false;
- }
- return true;
- }
- return false;
- }
-
-
- public boolean decreaseStoredSteam(long aEnergy, boolean aIgnoreTooLessEnergy) {
- if (!canAccessData()) return false;
- if (mMetaTileEntity.getSteamVar() - aEnergy >= 0 || aIgnoreTooLessEnergy) {
- setStoredSteam(mMetaTileEntity.getSteamVar() - aEnergy);
- if (mMetaTileEntity.getSteamVar() < 0) {
- setStoredSteam(0);
- return false;
- }
- return true;
- }
- return false;
- }
-
-
- public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) {
- if (!canAccessData()) return false;
- if (aCheckPrecicely || privateAccess() || mOwnerName.equals(""))
- if (mOwnerName.equals("") && isServerSide()) setOwnerName(aPlayer.getDisplayName());
- else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName()))
- return false;
- return true;
- }
-
-
- public boolean privateAccess() {
- if (!canAccessData()) return mLockUpgrade;
- return mLockUpgrade || mMetaTileEntity.ownerControl();
- }
-
-
- public void doEnergyExplosion() {
- if (getUniversalEnergyCapacity() > 0 && getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 5) {
- doExplosion(oOutput * (getUniversalEnergyStored() >= getUniversalEnergyCapacity() ? 4 : getUniversalEnergyStored() >= getUniversalEnergyCapacity() / 2 ? 2 : 1));
- GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "electricproblems");
- }
- }
-
-
- @Override
- public void doExplosion(long aAmount) {
- if (canAccessData()) {
- // This is only for Electric Machines
- if (GregTech_API.sMachineWireFire && mMetaTileEntity.isElectric()) {
- try {
- mReleaseEnergy = true;
- IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);
- } catch (Exception e) {/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */}
- }
- mReleaseEnergy = false;
- // Normal Explosion Code
- mMetaTileEntity.onExplosion();
- mMetaTileEntity.doExplosion(aAmount);
- }
- }
-
-
-
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
-
-
- @Override
- public ArrayList<ItemStack> getDrops() {
- ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, mID);
- NBTTagCompound tNBT = new NBTTagCompound();
- if (mRecipeStuff != null && !mRecipeStuff.hasNoTags()) tNBT.setTag("GT.CraftingComponents", mRecipeStuff);
- if (mMuffler) tNBT.setBoolean("mMuffler", mMuffler);
- if (mLockUpgrade) tNBT.setBoolean("mLockUpgrade", mLockUpgrade);
- if (mSteamConverter) tNBT.setBoolean("mSteamConverter", mSteamConverter);
- if (mColor > 0) tNBT.setByte("mColor", mColor);
- if (mOtherUpgrades > 0) tNBT.setByte("mOtherUpgrades", mOtherUpgrades);
- if (mStrongRedstone > 0) tNBT.setByte("mStrongRedstone", mStrongRedstone);
- for (byte i = 0; i < mCoverSides.length; i++) {
- if (mCoverSides[i] != 0) {
- tNBT.setIntArray("mCoverData", mCoverData);
- tNBT.setIntArray("mCoverSides", mCoverSides);
- break;
- }
- }
- if (hasValidMetaTileEntity()) mMetaTileEntity.setItemNBT(tNBT);
- if (!tNBT.hasNoTags()) rStack.setTagCompound(tNBT);
- return new ArrayList<ItemStack>(Arrays.asList(rStack));
- }
-
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
- //TODO
-
-
- public int getUpgradeCount() {
- return (mMuffler ? 1 : 0) + (mLockUpgrade ? 1 : 0) + (mSteamConverter ? 1 : 0) + mOtherUpgrades;
- }
-
-
- @Override
- public boolean onRightclick(EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
- if (isClientSide()) {
- if (getCoverBehaviorAtSide(aSide).onCoverRightclickClient(aSide, this, aPlayer, aX, aY, aZ)) return true;
- if (!getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))
- return false;
- }
- if (isServerSide()) {
- if (!privateAccess() || aPlayer.getDisplayName().equalsIgnoreCase(getOwnerName())) {
- ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
- if (tCurrentItem != null) {
- if (getColorization() >= 0 && GT_Utility.areStacksEqual(new ItemStack(Items.water_bucket, 1), tCurrentItem)) {
- tCurrentItem.func_150996_a(Items.bucket);
- setColorization((byte) (getColorization() >= 16 ? -2 : -1));
- return true;
- }
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
- if (mMetaTileEntity.onWrenchRightClick(aSide, GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ), aPlayer, aX, aY, aZ)) {
- GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
-
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)) {
- if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 200, aPlayer)) {
- setCoverDataAtSide(aSide, getCoverBehaviorAtSide(aSide).onCoverScrewdriverclick(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ));
- mMetaTileEntity.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
-
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sHardHammerList)) {
- if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- mInputDisabled = !mInputDisabled;
- if (mInputDisabled) mOutputDisabled = !mOutputDisabled;
- GT_Utility.sendChatToPlayer(aPlayer, "Auto-Input: " + (mInputDisabled ? "Disabled" : "Enabled") + " Auto-Output: " + (mOutputDisabled ? "Disabled" : "Enabled"));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(1), 1.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
-
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) {
- if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- if (mWorks) disableWorking();
- else enableWorking();
- GT_Utility.sendChatToPlayer(aPlayer, "Machine Processing: " + (isAllowedToWork() ? "Enabled" : "Disabled"));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(101), 1.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
-
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) {
- byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
- if (GT_ModHandler.useSolderingIron(tCurrentItem, aPlayer)) {
- mStrongRedstone ^= (1 << tSide);
- GT_Utility.sendChatToPlayer(aPlayer, "Redstone Output at Side " + tSide + " set to: " + ((mStrongRedstone & (1 << tSide)) != 0 ? "Strong" : "Weak"));
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(103), 3.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
-
- if (getCoverIDAtSide(aSide) == 0) {
- if (GregTech_API.sCovers.containsKey(new GT_ItemStack(tCurrentItem))) {
- if (GregTech_API.getCoverBehavior(tCurrentItem).isCoverPlaceable(aSide, new GT_ItemStack(tCurrentItem), this) && mMetaTileEntity.allowCoverOnSide(aSide, new GT_ItemStack(tCurrentItem))) {
- setCoverItemAtSide(aSide, tCurrentItem);
- if (!aPlayer.capabilities.isCreativeMode) tCurrentItem.stackSize--;
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(100), 1.0F, -1, xCoord, yCoord, zCoord);
- }
- return true;
- }
- } else {
- if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sCrowbarList)) {
- if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(0), 1.0F, -1, xCoord, yCoord, zCoord);
- dropCover(aSide, aSide, false);
- }
- return true;
- }
- }
- }
-
- if (getCoverBehaviorAtSide(aSide).onCoverRightclick(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this, aPlayer, aX, aY, aZ))
- return true;
-
- if (!getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))
- return false;
-
- if (isUpgradable() && aPlayer.inventory.getCurrentItem() != null) {/*
- if (ItemList.Upgrade_SteamEngine.isStackEqual(aPlayer.inventory.getCurrentItem())) {
- if (addSteamEngineUpgrade()) {
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord);
- if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--;
- }
- return true;
- }*/
- if (ItemList.Upgrade_Muffler.isStackEqual(aPlayer.inventory.getCurrentItem())) {
- if (addMufflerUpgrade()) {
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord);
- if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--;
- }
- return true;
- }
- if (ItemList.Upgrade_Lock.isStackEqual(aPlayer.inventory.getCurrentItem())) {
- if (isUpgradable() && !mLockUpgrade) {
- mLockUpgrade = true;
- setOwnerName(aPlayer.getDisplayName());
- GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(3), 1.0F, -1, xCoord, yCoord, zCoord);
- if (!aPlayer.capabilities.isCreativeMode) aPlayer.inventory.getCurrentItem().stackSize--;
- }
- return true;
- }
- }
- }
- }
-
- try {
- if (hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
-
- return true;
- }
-
-
- @Override
- public void onLeftclick(EntityPlayer aPlayer) {
- try {
- if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer);
- } catch (Throwable e) {
- GT_Log.err.println("GT++ - Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
- e.printStackTrace(GT_Log.err);
- }
- }
-
-
- @Override
- public boolean isDigitalChest() {
- if (canAccessData()) return mMetaTileEntity.isDigitalChest();
- return false;
- }
-
-
- @Override
- public ItemStack[] getStoredItemData() {
- if (canAccessData()) return mMetaTileEntity.getStoredItemData();
- return null;
- }
-
-
- @Override
- public void setItemCount(int aCount) {
- if (canAccessData()) mMetaTileEntity.setItemCount(aCount);
- }
-
-
- @Override
- public int getMaxItemCount() {
- if (canAccessData()) return mMetaTileEntity.getMaxItemCount();
- return 0;
- }
-
- /**
- * Can put aStack into Slot
- */
-
- @Override
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
- return canAccessData() && mMetaTileEntity.isItemValidForSlot(aIndex, aStack);
- }
-
- /**
- * returns all valid Inventory Slots, no matter which Side (Unless it's covered).
- * The Side Stuff is done in the following two Functions.
- */
-
- @Override
- public int[] getAccessibleSlotsFromSide(int aSide) {
- if (canAccessData() && (getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this) || getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), -1, this)))
- return mMetaTileEntity.getAccessibleSlotsFromSide(aSide);
- return new int[0];
- }
-
- /**
- * Can put aStack into Slot at Side
- */
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData() && (mRunningThroughTick || !mInputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canInsertItem(aIndex, aStack, aSide);
- }
-
- /**
- * Can pull aStack out of Slot from Side
- */
-
- @Override
- public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return canAccessData() && (mRunningThroughTick || !mOutputDisabled) && getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, getCoverIDAtSide((byte) aSide), getCoverDataAtSide((byte) aSide), aIndex, this) && mMetaTileEntity.canExtractItem(aIndex, aStack, aSide);
- }
-
-
- @Override
- public boolean isUpgradable() {
- return canAccessData() && getUpgradeCount() < 8;
- }
-
-
- @Override
- public byte getInternalInputRedstoneSignal(byte aSide) {
- return (byte) (getCoverBehaviorAtSide(aSide).getRedstoneInput(aSide, getInputRedstoneSignal(aSide), getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) & 15);
- }
-
-
- @Override
- public byte getInputRedstoneSignal(byte aSide) {
- return (byte) (worldObj.getIndirectPowerLevelTo(getOffsetX(aSide, 1), getOffsetY(aSide, 1), getOffsetZ(aSide, 1), aSide) & 15);
- }
-
-
- @Override
- public byte getOutputRedstoneSignal(byte aSide) {
- return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0;
- // return (byte)(getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) || (mRedstone && getCoverBehaviorAtSide(aSide).letsRedstoneGoOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))?mSidedRedstone[aSide]&15:0);
- }
-
-
- @Override
- public void setInternalOutputRedstoneSignal(byte aSide, byte aStrength) {
- if (!getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))
- setOutputRedstoneSignal(aSide, aStrength);
- }
-
-
- @Override
- public void setOutputRedstoneSignal(byte aSide, byte aStrength) {
- aStrength = (byte) Math.min(Math.max(0, aStrength), 15);
- if (aSide >= 0 && aSide < 6 && mSidedRedstone[aSide] != aStrength) {
- mSidedRedstone[aSide] = aStrength;
- issueBlockUpdate();
- }
- }
-
-
- @Override
- public boolean isSteamEngineUpgradable() {
- return isUpgradable() && !hasSteamEngineUpgrade() && getSteamCapacity() > 0;
- }
-
-
- @Override
- public boolean addSteamEngineUpgrade() {
- if (isSteamEngineUpgradable()) {
- issueBlockUpdate();
- mSteamConverter = true;
- return true;
- }
- return false;
- }
-
-
- @Override
- public boolean hasSteamEngineUpgrade() {
- if (canAccessData() && mMetaTileEntity.isSteampowered()) return true;
- return mSteamConverter;
- }
-
-
- @Override
- public boolean hasMufflerUpgrade() {
- return mMuffler;
- }
-
-
- @Override
- public boolean isMufflerUpgradable() {
- return isUpgradable() && !hasMufflerUpgrade();
- }
-
-
- @Override
- public boolean addMufflerUpgrade() {
- if (isMufflerUpgradable()) return mMuffler = true;
- return false;
- }
-
-
- @Override
- public boolean hasInventoryBeenModified() {
- return mInventoryChanged;
- }
-
-
- @Override
- public void setGenericRedstoneOutput(boolean aOnOff) {
- mRedstone = aOnOff;
- }
-
-
- @Override
- public int getErrorDisplayID() {
- return mDisplayErrorCode;
- }
-
-
- @Override
- public void setErrorDisplayID(int aErrorID) {
- mDisplayErrorCode = aErrorID;
- }
-
-
- @Override
- public IMetaTileEntity getMetaTileEntity() {
- return hasValidMetaTileEntity() ? mMetaTileEntity : null;
- }
-
-
- @Override
- public void setMetaTileEntity(IMetaTileEntity aMetaTileEntity) {
- mMetaTileEntity = (MetaTileEntityEx) aMetaTileEntity;
- }
-
-
- @Override
- public GT_CoverBehavior getCoverBehaviorAtSide(byte aSide) {
- return aSide >= 0 && aSide < mCoverBehaviors.length ? mCoverBehaviors[aSide] : GregTech_API.sNoBehavior;
- }
-
-
- @Override
- public void setCoverIDAtSide(byte aSide, int aID) {
- if (aSide >= 0 && aSide < 6) {
- mCoverSides[aSide] = aID;
- mCoverData[aSide] = 0;
- mCoverBehaviors[aSide] = GregTech_API.getCoverBehavior(aID);
- issueCoverUpdate(aSide);
- issueBlockUpdate();
- }
- }
-
-
- @Override
- public void setCoverItemAtSide(byte aSide, ItemStack aCover) {
- GregTech_API.getCoverBehavior(aCover).placeCover(aSide, aCover, this);
- }
-
-
- @Override
- public int getCoverIDAtSide(byte aSide) {
- if (aSide >= 0 && aSide < 6) return mCoverSides[aSide];
- return 0;
- }
-
-
- @Override
- public ItemStack getCoverItemAtSide(byte aSide) {
- return GT_Utility.intToStack(getCoverIDAtSide(aSide));
- }
-
-
- @Override
- public boolean canPlaceCoverIDAtSide(byte aSide, int aID) {
- return getCoverIDAtSide(aSide) == 0;
- }
-
-
- @Override
- public boolean canPlaceCoverItemAtSide(byte aSide, ItemStack aCover) {
- return getCoverIDAtSide(aSide) == 0;
- }
-
-
- @Override
- public void setCoverDataAtSide(byte aSide, int aData) {
- if (aSide >= 0 && aSide < 6) mCoverData[aSide] = aData;
- }
-
-
- @Override
- public int getCoverDataAtSide(byte aSide) {
- if (aSide >= 0 && aSide < 6) return mCoverData[aSide];
- return 0;
- }
-
-
- public byte getLightValue() {
- return mLightValue;
- }
-
-
- @Override
- public void setLightValue(byte aLightValue) {
- mLightValue = (byte) (aLightValue & 15);
- }
-
-
- @Override
- public long getAverageElectricInput() {
- int rEU = 0;
- for (int tEU : mAverageEUInput) rEU += tEU;
- return rEU / mAverageEUInput.length;
- }
-
-
- @Override
- public long getAverageElectricOutput() {
- int rEU = 0;
- for (int tEU : mAverageEUOutput) rEU += tEU;
- return rEU / mAverageEUOutput.length;
- }
-
-
- @Override
- public boolean dropCover(byte aSide, byte aDroppedSide, boolean aForced) {
- if (getCoverBehaviorAtSide(aSide).onCoverRemoval(aSide, getCoverIDAtSide(aSide), mCoverData[aSide], this, aForced) || aForced) {
- ItemStack tStack = getCoverBehaviorAtSide(aSide).getDrop(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this);
- if (tStack != null) {
- tStack.setTagCompound(null);
- EntityItem tEntity = new EntityItem(worldObj, getOffsetX(aDroppedSide, 1) + 0.5, getOffsetY(aDroppedSide, 1) + 0.5, getOffsetZ(aDroppedSide, 1) + 0.5, tStack);
- tEntity.motionX = 0;
- tEntity.motionY = 0;
- tEntity.motionZ = 0;
- worldObj.spawnEntityInWorld(tEntity);
- }
- setCoverIDAtSide(aSide, 0);
- if (mMetaTileEntity.hasSidedRedstoneOutputBehavior()) {
- setOutputRedstoneSignal(aSide, (byte) 0);
- } else {
- setOutputRedstoneSignal(aSide, (byte) 15);
- }
- return true;
- }
- return false;
- }
-
-
- @Override
- public String getOwnerName() {
- if (GT_Utility.isStringInvalid(mOwnerName)) return "Player";
- return mOwnerName;
- }
-
-
- @Override
- public String setOwnerName(String aName) {
- if (GT_Utility.isStringInvalid(aName)) return mOwnerName = "Player";
- return mOwnerName = aName;
- }
-
-
- @Override
- public byte getComparatorValue(byte aSide) {
- return canAccessData() ? mMetaTileEntity.getComparatorValue(aSide) : 0;
- }
-
-
- @Override
- public byte getStrongOutputRedstoneSignal(byte aSide) {
- return aSide >= 0 && aSide < 6 && (mStrongRedstone & (1 << aSide)) != 0 ? (byte) (mSidedRedstone[aSide] & 15) : 0;
- }
-
-
- @Override
- public void setStrongOutputRedstoneSignal(byte aSide, byte aStrength) {
- mStrongRedstone |= (1 << aSide);
- setOutputRedstoneSignal(aSide, aStrength);
- }
-
-
- @Override
- public ItemStack decrStackSize(int aIndex, int aAmount) {
- if (canAccessData()) {
- mInventoryChanged = true;
- return mMetaTileEntity.decrStackSize(aIndex, aAmount);
- }
- return null;
- }
-
-
- @Override
- public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- if (!canAccessData() || !mMetaTileEntity.isElectric() || !inputEnergyFrom(aSide) || aAmperage <= 0 || aVoltage <= 0 || getStoredEU() >= getEUCapacity() || mMetaTileEntity.maxAmperesIn() <= mAcceptedAmperes)
- return 0;
- if (aVoltage > getInputVoltage()) {
- doExplosion(aVoltage);
- return 0;
- }
- if (increaseStoredEnergyUnits(aVoltage * (aAmperage = Math.min(aAmperage, Math.min(mMetaTileEntity.maxAmperesIn() - mAcceptedAmperes, 1 + ((getEUCapacity() - getStoredEU()) / aVoltage)))), true)) {
- mAverageEUInput[mAverageEUInputIndex] += aVoltage * aAmperage;
- mAcceptedAmperes += aAmperage;
- return aAmperage;
- }
- return 0;
- }
-
-
- @Override
- public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
- if (!canAccessData() || !mMetaTileEntity.isElectric() || !outputsEnergyTo(aSide) || getStoredEU() - (aVoltage * aAmperage) < mMetaTileEntity.getMinimumStoredEU())
- return false;
- if (decreaseStoredEU(aVoltage * aAmperage, false)) {
- mAverageEUOutput[mAverageEUOutputIndex] += aVoltage * aAmperage;
- return true;
- }
- return false;
- }
-
-
- @Override
- public boolean acceptsRotationalEnergy(byte aSide) {
- if (!canAccessData() || getCoverIDAtSide(aSide) != 0) return false;
- return mMetaTileEntity.acceptsRotationalEnergy(aSide);
- }
-
-
- @Override
- public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) {
- if (!canAccessData() || getCoverIDAtSide(aSide) != 0) return false;
- return mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy);
- }
-
-
- @Override
- public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.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 mMetaTileEntity.fill(aSide, aFluid, doFill);
- return 0;
- }
-
-
- @Override
- public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), mMetaTileEntity.getFluid() == null ? null : mMetaTileEntity.getFluid().getFluid(), this))))
- return mMetaTileEntity.drain(aSide, maxDrain, doDrain);
- return null;
- }
-
-
- @Override
- public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid == null ? null : aFluid.getFluid(), this))))
- return mMetaTileEntity.drain(aSide, aFluid, doDrain);
- return null;
- }
-
-
- @Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mInputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this))))
- return mMetaTileEntity.canFill(aSide, aFluid);
- return false;
- }
-
-
- @Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- if (mTickTimer > 5 && canAccessData() && (mRunningThroughTick || !mOutputDisabled) && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), aFluid, this))))
- return mMetaTileEntity.canDrain(aSide, aFluid);
- return false;
- }
-
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
- if (canAccessData() && (aSide == ForgeDirection.UNKNOWN || (mMetaTileEntity.isLiquidInput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidIn((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this)) || (mMetaTileEntity.isLiquidOutput((byte) aSide.ordinal()) && getCoverBehaviorAtSide((byte) aSide.ordinal()).letsFluidOut((byte) aSide.ordinal(), getCoverIDAtSide((byte) aSide.ordinal()), getCoverDataAtSide((byte) aSide.ordinal()), null, this))))
- return mMetaTileEntity.getTankInfo(aSide);
- return new FluidTankInfo[]{};
- }
-
-
- public double getOutputEnergyUnitsPerTick() {
- return oOutput;
- }
-
-
- public boolean isTeleporterCompatible(ForgeDirection aSide) {
- return canAccessData() && mMetaTileEntity.isTeleporterCompatible();
- }
-
-
- public double demandedEnergyUnits() {
- if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0;
- return getEUCapacity() - getStoredEU();
- }
-
-
- public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) {
- return injectEnergyUnits((byte) aDirection.ordinal(), (int) aAmount, 1) > 0 ? 0 : aAmount;
- }
-
-
- public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) {
- return inputEnergyFrom((byte) aDirection.ordinal());
- }
-
-
- public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) {
- return outputsEnergyTo((byte) aDirection.ordinal());
- }
-
-
- public double getOfferedEnergy() {
- return (canAccessData() && getStoredEU() - mMetaTileEntity.getMinimumStoredEU() >= oOutput) ? Math.max(0, oOutput) : 0;
- }
-
-
- public void drawEnergy(double amount) {
- mAverageEUOutput[mAverageEUOutputIndex] += amount;
- decreaseStoredEU((int) amount, true);
- }
-
-
- public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) {
- return injectEnergyUnits((byte) aForgeDirection.ordinal(), aAmount, 1) > 0 ? 0 : aAmount;
- }
-
-
- public int addEnergy(int aEnergy) {
- if (!canAccessData()) return 0;
- if (aEnergy > 0)
- increaseStoredEnergyUnits(aEnergy, true);
- else
- decreaseStoredEU(-aEnergy, true);
- return (int) Math.min(Integer.MAX_VALUE, mMetaTileEntity.getEUVar());
- }
-
-
- public boolean isAddedToEnergyNet() {
- return false;
- }
-
-
- public int demandsEnergy() {
- if (mReleaseEnergy || !canAccessData() || !mMetaTileEntity.isEnetInput()) return 0;
- return getCapacity() - getStored();
- }
-
-
- public int getCapacity() {
- return (int) Math.min(Integer.MAX_VALUE, getEUCapacity());
- }
-
-
- public int getStored() {
- return (int) Math.min(Integer.MAX_VALUE, Math.min(getStoredEU(), getCapacity()));
- }
-
-
- public void setStored(int aEU) {
- if (canAccessData()) setStoredEU(aEU);
- }
-
-
- public int getMaxSafeInput() {
- return (int) Math.min(Integer.MAX_VALUE, getInputVoltage());
- }
-
-
- public int getMaxEnergyOutput() {
- if (mReleaseEnergy) return Integer.MAX_VALUE;
- return getOutput();
- }
-
-
- public int getOutput() {
- return (int) Math.min(Integer.MAX_VALUE, oOutput);
- }
-
-
- public int injectEnergy(Direction aDirection, int aAmount) {
- return injectEnergyUnits((byte) aDirection.toSideValue(), aAmount, 1) > 0 ? 0 : aAmount;
- }
-
-
- public boolean isTeleporterCompatible(Direction aSide) {
- return canAccessData() && mMetaTileEntity.isTeleporterCompatible();
- }
-
-
- public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) {
- return inputEnergyFrom((byte) aDirection.toSideValue());
- }
-
-
- public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) {
- return outputsEnergyTo((byte) aDirection.toSideValue());
- }
-
-
- @Override
- public boolean isInvalidTileEntity() {
- return isInvalid();
- }
-
-
- @Override
- public boolean addStackToSlot(int aIndex, ItemStack aStack) {
- if (GT_Utility.isStackInvalid(aStack)) return true;
- if (aIndex < 0 || aIndex >= getSizeInventory()) return false;
- ItemStack tStack = getStackInSlot(aIndex);
- if (GT_Utility.isStackInvalid(tStack)) {
- setInventorySlotContents(aIndex, aStack);
- return true;
- }
- aStack = GT_OreDictUnificator.get(aStack);
- if (GT_Utility.areStacksEqual(tStack, aStack) && tStack.stackSize + aStack.stackSize <= Math.min(aStack.getMaxStackSize(), getInventoryStackLimit())) {
- tStack.stackSize += aStack.stackSize;
- return true;
- }
- return false;
- }
-
-
- @Override
- public boolean addStackToSlot(int aIndex, ItemStack aStack, int aAmount) {
- return addStackToSlot(aIndex, GT_Utility.copyAmount(aAmount, aStack));
- }
-
-
- @Override
- public byte getColorization() {
- return (byte) (mColor - 1);
- }
-
-
- @Override
- public byte setColorization(byte aColor) {
- if (aColor > 15 || aColor < -1) aColor = -1;
- if (canAccessData()) mMetaTileEntity.onColorChangeServer(aColor);
- return mColor = (byte) (aColor + 1);
- }
-
-
- @Override
- public float getBlastResistance(byte aSide) {
- return canAccessData() ? Math.max(0, getMetaTileEntity().getExplosionResistance(aSide)) : 10.0F;
- }
-
-
- @Override
- public boolean isUniversalEnergyStored(long aEnergyAmount) {
- if (getUniversalEnergyStored() >= aEnergyAmount) return true;
- mHasEnoughEnergy = false;
- return false;
- }
-
-
- @Override
- public String[] getInfoData() {
- {
- if (canAccessData()) return getMetaTileEntity().getInfoData();
- return new String[]{};
- }
- }
-
-
- @Override
- public void markDirty() {
- super.markDirty();
- mInventoryChanged = true;
- }
-
-
- @Override
- public int getLightOpacity() {
- return mMetaTileEntity == null ? getLightValue() > 0 ? 0 : 255 : mMetaTileEntity.getLightOpacity();
- }
-
-
- @Override
- public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
- mMetaTileEntity.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
- }
-
-
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- return mMetaTileEntity.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
-
-
- @Override
- public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
- mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
- }
-
-} \ No newline at end of file
diff --git a/src/Java/gregtech/api/metatileentity/MetaTileEntityEx.java b/src/Java/gregtech/api/metatileentity/MetaTileEntityEx.java
deleted file mode 100644
index acfcf083be..0000000000
--- a/src/Java/gregtech/api/metatileentity/MetaTileEntityEx.java
+++ /dev/null
@@ -1,972 +0,0 @@
-package gregtech.api.metatileentity;
-
-import static gregtech.api.enums.GT_Values.GT;
-import static gregtech.api.enums.GT_Values.V;
-import gregtech.api.GregTech_API;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.objects.GT_ItemStack;
-import gregtech.api.util.GT_Config;
-import gregtech.api.util.GT_LanguageManager;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import net.minecraft.block.Block;
-import net.minecraft.client.renderer.RenderBlocks;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.entity.Entity;
-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.util.AxisAlignedBB;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.Fluid;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * Extend this Class to add a new MetaMachine
- * Call the Constructor with the desired ID at the load-phase (not preload and also not postload!)
- * Implement the newMetaEntity-Method to return a new ready instance of your MetaTileEntity
- * <p/>
- * Call the Constructor like the following example inside the Load Phase, to register it.
- * "new GT_MetaTileEntity_E_Furnace(54, "GT_E_Furnace", "Automatic E-Furnace");"
- */
-public abstract class MetaTileEntityEx implements IMetaTileEntity {
- /**
- * Only assigned for the MetaTileEntity in the List! Also only used to get the localized Name for the ItemStack and for getInvName.
- */
- public final String mName;
- /**
- * The Inventory of the MetaTileEntity. Amount of Slots can be larger than 256. HAYO!
- */
- public final ItemStack[] mInventory;
- public boolean doTickProfilingInThisTick = true;
- /**
- * accessibility to this Field is no longer given, see below
- */
- private IGregTechTileEntity mBaseMetaTileEntity;
-
- /**
- * This registers your Machine at the List.
- * Use only ID's larger than 2048, because i reserved these ones.
- * See also the List in the API, as it has a Description containing all the reservations.
- *
- * @param aID the ID
- * @example for Constructor overload.
- * <p/>
- * public GT_MetaTileEntity_EBench(int aID, String mName, String mNameRegional) {
- * super(aID, mName, mNameRegional);
- * }
- */
- public MetaTileEntityEx(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
- if (GregTech_API.sPostloadStarted || !GregTech_API.sPreloadStarted)
- throw new IllegalAccessError("This Constructor has to be called in the load Phase");
- if (Meta_GT_Proxy.METATILEENTITIES[aID] == null) {
- Meta_GT_Proxy.METATILEENTITIES[aID] = this;
- } else {
- Utils.LOG_INFO("Taken by: "+Meta_GT_Proxy.METATILEENTITIES[aID].getMetaName());
- throw new IllegalArgumentException("MetaMachine-Slot Nr. " + aID + " is already occupied!");
- }
- mName = aBasicName.replaceAll(" ", "_").toLowerCase();
- setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity());
- getBaseMetaTileEntity().setMetaTileID((short) aID);
- GT_LanguageManager.addStringLocalization("gt.plusplus.blockmachines." + mName + ".name", aRegionalName);
- mInventory = new ItemStack[aInvSlotCount];
-
- if (GT.isClientSide()) {
- ItemStack tStack = new ItemStack(ModBlocks.blockMetaTileEntity, 1, aID);
- tStack.getItem().addInformation(tStack, null, new ArrayList<String>(), true);
- }
- }
-
- /**
- * This is the normal Constructor.
- */
- public MetaTileEntityEx(String aName, int aInvSlotCount) {
- mInventory = new ItemStack[aInvSlotCount];
- mName = aName;
- }
-
-
- @Override
- public IGregTechTileEntity getBaseMetaTileEntity() {
- return mBaseMetaTileEntity;
- }
-
-
- @Override
- public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) {
- if (mBaseMetaTileEntity != null && aBaseMetaTileEntity == null) {
- mBaseMetaTileEntity.getMetaTileEntity().inValidate();
- mBaseMetaTileEntity.setMetaTileEntity(null);
- }
- mBaseMetaTileEntity = aBaseMetaTileEntity;
- if (mBaseMetaTileEntity != null) {
- mBaseMetaTileEntity.setMetaTileEntity(this);
- }
- }
-
-
- @Override
- public ItemStack getStackForm(long aAmount) {
- return new ItemStack(GregTech_API.sBlockMachines, (int) aAmount, getBaseMetaTileEntity().getMetaTileID());
- }
-
- public String getLocalName() {
- return GT_LanguageManager.getTranslation("gt.plusplus.blockmachines." + mName + ".name");
- }
-
-
- @Override
- public void onServerStart() {/*Do nothing*/}
-
-
- @Override
- public void onWorldSave(File aSaveDirectory) {/*Do nothing*/}
-
-
- @Override
- public void onWorldLoad(File aSaveDirectory) {/*Do nothing*/}
-
-
- @Override
- public void onConfigLoad(GT_Config aConfig) {/*Do nothing*/}
-
-
- @Override
- public void setItemNBT(NBTTagCompound aNBT) {/*Do nothing*/}
-
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerIcons(IIconRegister aBlockIconRegister) {/*Do nothing*/}
-
-
- @Override
- public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
- return true;
- }
-
-
- @Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {/*Do nothing*/}
-
-
- @Override
- public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (getBaseMetaTileEntity().isValidFacing(aWrenchingSide)) {
- getBaseMetaTileEntity().setFrontFacing(aWrenchingSide);
- return true;
- }
- return false;
- }
-
-
- @Override
- public void onExplosion() {/*Do nothing*/}
-
-
- @Override
- public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) {/*Do nothing*/}
-
-
- @Override
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
-
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {/*Do nothing*/}
-
-
- @Override
- public void inValidate() {/*Do nothing*/}
-
-
- @Override
- public void onRemoval() {/*Do nothing*/}
-
-
- @Override
- public void initDefaultModes(NBTTagCompound aNBT) {/*Do nothing*/}
-
- /**
- * When a GUI is opened
- */
- public void onOpenGUI() {/*Do nothing*/}
-
- /**
- * When a GUI is closed
- */
- public void onCloseGUI() {/*Do nothing*/}
-
- /**
- * a Player rightclicks the Machine
- * Sneaky rightclicks are not getting passed to this!
- */
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- return false;
- }
-
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
- return onRightclick(aBaseMetaTileEntity, aPlayer);
- }
-
-
- @Override
- public void onLeftclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {/*Do nothing*/}
-
-
- @Override
- public void onValueUpdate(byte aValue) {/*Do nothing*/}
-
-
- @Override
- public byte getUpdateData() {
- return 0;
- }
-
-
- @Override
- public void doSound(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/}
-
-
- @Override
- public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {/*Do nothing*/}
-
-
- @Override
- public void stopSoundLoop(byte aValue, double aX, double aY, double aZ) {/*Do nothing*/}
-
- /**
- * @return true if this Device emits Energy at all
- */
- public boolean isElectric() {
- return true;
- }
-
- /**
- * @return true if this Device emits Energy at all
- */
- public boolean isPneumatic() {
- return false;
- }
-
- /**
- * @return true if this Device emits Energy at all
- */
- public boolean isSteampowered() {
- return false;
- }
-
- /**
- * @return true if this Device emits Energy at all
- */
- public boolean isEnetOutput() {
- return false;
- }
-
- /**
- * @return true if this Device consumes Energy at all
- */
- public boolean isEnetInput() {
- return false;
- }
-
- /**
- * @return the amount of EU, which can be stored in this Device. Default is 0 EU.
- */
-
- public long maxEUStore() {
- return 0;
- }
-
- /**
- * @return the amount of EU/t, which can be accepted by this Device before it explodes.
- */
-
- public long maxEUInput() {
- return 0;
- }
-
- /**
- * @return the amount of EU/t, which can be outputted by this Device.
- */
-
- public long maxEUOutput() {
- return 0;
- }
-
- /**
- * @return the amount of E-net Impulses of the maxEUOutput size, which can be outputted by this Device.
- * Default is 1 Pulse, this shouldn't be set to smaller Values than 1, as it won't output anything in that Case!
- */
-
- public long maxAmperesOut() {
- return 1;
- }
-
- /**
- * How many Amperes this Block can suck at max. Surpassing this value won't blow it up.
- */
-
- public long maxAmperesIn() {
- return 1;
- }
-
- /**
- * @return true if that Side is an Output.
- */
-
- public boolean isOutputFacing(byte aSide) {
- return false;
- }
-
- /**
- * @return true if that Side is an Input.
- */
-
- public boolean isInputFacing(byte aSide) {
- return false;
- }
-
- /**
- * @return true if Transformer Upgrades increase Packet Amount.
- */
-
- public boolean isTransformingLowEnergy() {
- return true;
- }
-
-
- @Override
- public boolean isFacingValid(byte aFacing) {
- return false;
- }
-
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return false;
- }
-
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return true;
- }
-
-
- @Override
- public boolean setStackToZeroInsteadOfNull(int aIndex) {
- return false;
- }
-
- /**
- * This is used to get the internal Energy. I use this for the IDSU.
- */
- public long getEUVar() {
- return ((BaseMetaTileEntityEx) mBaseMetaTileEntity).mStoredEnergy;
- }
-
- /**
- * This is used to set the internal Energy to the given Parameter. I use this for the IDSU.
- */
- public void setEUVar(long aEnergy) {
- ((BaseMetaTileEntityEx) mBaseMetaTileEntity).mStoredEnergy = aEnergy;
- }
-
- /**
- * This is used to get the internal Steam Energy.
- */
- public long getSteamVar() {
- return ((BaseMetaTileEntityEx) mBaseMetaTileEntity).mStoredSteam;
- }
-
- /**
- * This is used to set the internal Steam Energy to the given Parameter.
- */
- public void setSteamVar(long aSteam) {
- ((BaseMetaTileEntityEx) mBaseMetaTileEntity).mStoredSteam = aSteam;
- }
-
- /**
- * @return the amount of Steam, which can be stored in this Device. Default is 0 EU.
- */
-
- public long maxSteamStore() {
- return 0;
- }
-
- /**
- * @return the amount of EU, which this Device stores before starting to emit Energy.
- * useful if you don't want to emit stored Energy until a certain Level is reached.
- */
-
- public long getMinimumStoredEU() {
- return 512;
- }
-
- /**
- * Determines the Tier of the Machine, used for de-charging Tools.
- */
-
- public long getInputTier() {
- return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage());
- }
-
- /**
- * Determines the Tier of the Machine, used for charging Tools.
- */
-
- public long getOutputTier() {
- return GT_Utility.getTier(getBaseMetaTileEntity().getOutputVoltage());
- }
-
- /**
- * gets the first RechargerSlot
- */
-
- public int rechargerSlotStartIndex() {
- return 0;
- }
-
- /**
- * gets the amount of RechargerSlots
- */
-
- public int rechargerSlotCount() {
- return 0;
- }
-
- /**
- * gets the first DechargerSlot
- */
-
- public int dechargerSlotStartIndex() {
- return 0;
- }
-
- /**
- * gets the amount of DechargerSlots
- */
-
- public int dechargerSlotCount() {
- return 0;
- }
-
- /**
- * gets if this is protected from other Players per default or not
- */
-
- public boolean ownerControl() {
- return false;
- }
-
-
- @Override
- public ArrayList<String> getSpecialDebugInfo(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, int aLogLevel, ArrayList<String> aList) {
- return aList;
- }
-
-
- @Override
- public boolean isLiquidInput(byte aSide) {
- return true;
- }
-
-
- @Override
- public boolean isLiquidOutput(byte aSide) {
- return true;
- }
-
- /**
- * gets the contained Liquid
- */
-
- @Override
- public FluidStack getFluid() {
- return null;
- }
-
- /**
- * tries to fill this Tank
- */
-
- @Override
- public int fill(FluidStack resource, boolean doFill) {
- return 0;
- }
-
- /**
- * tries to empty this Tank
- */
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- return null;
- }
-
- /**
- * Tank pressure
- */
-
- public int getTankPressure() {
- return 0;
- }
-
- /**
- * Liquid Capacity
- */
-
- @Override
- public int getCapacity() {
- return 0;
- }
-
-
- @Override
- public void onMachineBlockUpdate() {/*Do nothing*/}
-
-
- @Override
- public void receiveClientEvent(byte aEventID, byte aValue) {/*Do nothing*/}
-
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- /**
- * If this accepts up to 4 Overclockers
- */
-
- public boolean isOverclockerUpgradable() {
- return false;
- }
-
- /**
- * If this accepts Transformer Upgrades
- */
-
- public boolean isTransformerUpgradable() {
- return false;
- }
-
- /**
- * Progress this machine has already made
- */
-
- public int getProgresstime() {
- return 0;
- }
-
- /**
- * Progress this Machine has to do to produce something
- */
-
- public int maxProgresstime() {
- return 0;
- }
-
- /**
- * Increases the Progress, returns the overflown Progress.
- */
-
- public int increaseProgress(int aProgress) {
- return 0;
- }
-
- /**
- * If this TileEntity makes use of Sided Redstone behaviors.
- * Determines only, if the Output Redstone Array is getting filled with 0 for true, or 15 for false.
- */
-
- public boolean hasSidedRedstoneOutputBehavior() {
- return false;
- }
-
- /**
- * When the Facing gets changed.
- */
-
- public void onFacingChange() {/*Do nothing*/}
-
- /**
- * if the IC2 Teleporter can drain from this.
- */
-
- public boolean isTeleporterCompatible() {
- return isEnetOutput() && getBaseMetaTileEntity().getOutputVoltage() >= 128 && getBaseMetaTileEntity().getUniversalEnergyCapacity() >= 500000;
- }
-
- /**
- * Gets the Output for the comparator on the given Side
- */
-
- @Override
- public byte getComparatorValue(byte aSide) {
- return 0;
- }
-
-
- @Override
- public boolean acceptsRotationalEnergy(byte aSide) {
- return false;
- }
-
-
- @Override
- public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) {
- return false;
- }
-
-
- @Override
- public String getSpecialVoltageToolTip() {
- return null;
- }
-
-
- @Override
- public boolean isGivingInformation() {
- return false;
- }
-
-
- @Override
- public String[] getInfoData() {
- return new String[]{};
- }
-
-
- public boolean isDigitalChest() {
- return false;
- }
-
-
- public ItemStack[] getStoredItemData() {
- return null;
- }
-
-
- public void setItemCount(int aCount) {/*Do nothing*/}
-
-
- public int getMaxItemCount() {
- return 0;
- }
-
-
- @Override
- public int getSizeInventory() {
- return mInventory.length;
- }
-
-
- @Override
- public ItemStack getStackInSlot(int aIndex) {
- if (aIndex >= 0 && aIndex < mInventory.length) return mInventory[aIndex];
- return null;
- }
-
-
- @Override
- public void setInventorySlotContents(int aIndex, ItemStack aStack) {
- if (aIndex >= 0 && aIndex < mInventory.length) mInventory[aIndex] = aStack;
- }
-
-
- @Override
- public String getInventoryName() {
- if (GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()] != null)
- return GregTech_API.METATILEENTITIES[getBaseMetaTileEntity().getMetaTileID()].getMetaName();
- return "";
- }
-
-
- @Override
- public int getInventoryStackLimit() {
- return 64;
- }
-
-
- @Override
- public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
- return getBaseMetaTileEntity().isValidSlot(aIndex);
- }
-
-
- @Override
- public ItemStack decrStackSize(int aIndex, int aAmount) {
- ItemStack tStack = getStackInSlot(aIndex), rStack = GT_Utility.copy(tStack);
- if (tStack != null) {
- if (tStack.stackSize <= aAmount) {
- if (setStackToZeroInsteadOfNull(aIndex)) tStack.stackSize = 0;
- else setInventorySlotContents(aIndex, null);
- } else {
- rStack = tStack.splitStack(aAmount);
- if (tStack.stackSize == 0 && !setStackToZeroInsteadOfNull(aIndex))
- setInventorySlotContents(aIndex, null);
- }
- }
- return rStack;
- }
-
-
- @Override
- public int[] getAccessibleSlotsFromSide(int aSide) {
- ArrayList<Integer> tList = new ArrayList<Integer>();
- IGregTechTileEntity tTileEntity = getBaseMetaTileEntity();
- 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 i = 0; i < getSizeInventory(); i++)
- if (isValidSlot(i) && (tSkip || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsOut((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity) || tTileEntity.getCoverBehaviorAtSide((byte) aSide).letsItemsIn((byte) aSide, tTileEntity.getCoverIDAtSide((byte) aSide), tTileEntity.getCoverDataAtSide((byte) aSide), i, tTileEntity)))
- tList.add(i);
- int[] rArray = new int[tList.size()];
- for (int i = 0; i < rArray.length; i++) rArray[i] = tList.get(i);
- return rArray;
- }
-
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && (mInventory[aIndex] == null || GT_Utility.areStacksEqual(aStack, mInventory[aIndex])) && allowPutStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
- }
-
-
- @Override
- public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- return isValidSlot(aIndex) && aStack != null && aIndex < mInventory.length && allowPullStack(getBaseMetaTileEntity(), aIndex, (byte) aSide, aStack);
- }
-
-
- @Override
- public boolean canFill(ForgeDirection aSide, Fluid aFluid) {
- return fill(aSide, new FluidStack(aFluid, 1), false) == 1;
- }
-
-
- @Override
- public boolean canDrain(ForgeDirection aSide, Fluid aFluid) {
- return drain(aSide, new FluidStack(aFluid, 1), false) != null;
- }
-
-
- @Override
- public FluidTankInfo[] getTankInfo(ForgeDirection aSide) {
- if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{};
- return new FluidTankInfo[]{getInfo()};
- }
-
-
- public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- return fill(aFluid, doFill);
- }
-
-
- @Override
- public int fill(ForgeDirection aSide, FluidStack aFluid, boolean doFill) {
- if (getBaseMetaTileEntity().hasSteamEngineUpgrade() && GT_ModHandler.isSteam(aFluid) && aFluid.amount > 1) {
- int tSteam = (int) Math.min(Integer.MAX_VALUE, Math.min(aFluid.amount / 2, getBaseMetaTileEntity().getSteamCapacity() - getBaseMetaTileEntity().getStoredSteam()));
- if (tSteam > 0) {
- if (doFill) getBaseMetaTileEntity().increaseStoredSteam(tSteam, true);
- return tSteam * 2;
- }
- } else {
- return fill_default(aSide, aFluid, doFill);
- }
- return 0;
- }
-
-
- @Override
- public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) {
- if (getFluid() != null && aFluid != null && getFluid().isFluidEqual(aFluid))
- return drain(aFluid.amount, doDrain);
- return null;
- }
-
-
- @Override
- public FluidStack drain(ForgeDirection aSide, int maxDrain, boolean doDrain) {
- return drain(maxDrain, doDrain);
- }
-
-
- @Override
- public int getFluidAmount() {
- return 0;
- }
-
-
- @Override
- public FluidTankInfo getInfo() {
- return new FluidTankInfo(this);
- }
-
-
- @Override
- public String getMetaName() {
- return mName;
- }
-
-
- @Override
- public ItemStack getStackInSlotOnClosing(int i) {
- return null;
- }
-
-
- @Override
- public boolean hasCustomInventoryName() {
- return false;
- }
-
-
- @Override
- public boolean doTickProfilingMessageDuringThisTick() {
- return doTickProfilingInThisTick;
- }
-
-
- @Override
- public void markDirty() {
- //
- }
-
-
- @Override
- public boolean isUseableByPlayer(EntityPlayer entityplayer) {
- return false;
- }
-
-
- @Override
- public void openInventory() {
- //
- }
-
-
- @Override
- public void closeInventory() {
- //
- }
-
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return null;
- }
-
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return null;
- }
-
-
- @Override
- public boolean connectsToItemPipe(byte aSide) {
- return false;
- }
-
-
- @Override
- public float getExplosionResistance(byte aSide) {
- return 10.0F;
- }
-
-
- @Override
- public ItemStack[] getRealInventory() {
- return mInventory;
- }
-
-
- @Override
- public void onColorChangeServer(byte aColor) {
- //
- }
-
-
- @Override
- public void onColorChangeClient(byte aColor) {
- //
- }
-
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean renderInInventory(Block aBlock, int aMeta, RenderBlocks aRenderer) {
- return false;
- }
-
-
- @Override
- @SideOnly(Side.CLIENT)
- public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, RenderBlocks aRenderer) {
- return false;
- }
-
-
- @Override
- public void doExplosion(long aExplosionPower) {
- float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F;
- int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord();
- World tWorld = getBaseMetaTileEntity().getWorld();
- GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);
- tWorld.setBlock(tX, tY, tZ, Blocks.air);
- if (GregTech_API.sMachineExplosions)
- tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
- }
-
-
- @Override
- public int getLightOpacity() {
- return ((BaseMetaTileEntityEx) getBaseMetaTileEntity()).getLightValue() > 0 ? 0 : 255;
- }
-
-
- @Override
- public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) {
- AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- if (axisalignedbb1 != null && inputAABB.intersectsWith(axisalignedbb1)) outputAABB.add(axisalignedbb1);
- }
-
-
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1);
- }
-
-
- @Override
- public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
- //
- }
-
-
- @Override
- public void onCreated(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
- //
- }
-} \ No newline at end of file
diff --git a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachineEx.java b/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachineEx.java
deleted file mode 100644
index fbf59d4de5..0000000000
--- a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachineEx.java
+++ /dev/null
@@ -1,798 +0,0 @@
-package gregtech.api.metatileentity.implementations;
-
-import static gregtech.api.enums.GT_Values.V;
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Textures;
-import gregtech.api.gui.GT_Container_BasicMachine;
-import gregtech.api.gui.GT_GUIContainer_BasicMachine;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.objects.GT_ItemStack;
-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 java.util.Arrays;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my Basic Machines such as the Automatic Extractor
- * Extend this class to make a simple Machine
- */
-public abstract class GT_MetaTileEntity_BasicMachineEx extends GT_MetaTileEntity_BasicTankEx {
- /**
- * return values for checkRecipe()
- */
- protected static final int
- DID_NOT_FIND_RECIPE = 0,
- FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS = 1,
- FOUND_AND_SUCCESSFULLY_USED_RECIPE = 2;
- private static final int OTHER_SLOT_COUNT = 4;
- public final ItemStack[] mOutputItems;
- public final int mInputSlotCount, mAmperage;
- public boolean mAllowInputFromOutputSide = false, mFluidTransfer = false, mItemTransfer = false, mHasBeenUpdated = false, mStuttering = false, mCharge = false, mDecharge = false;
- public int mMainFacing = -1, mProgresstime = 0, mMaxProgresstime = 0, mEUt = 0, mOutputBlocked = 0;
- public FluidStack mOutputFluid;
- public String mGUIName = "", mNEIName = "";
- private NBTTagCompound mRecipeStuff = new NBTTagCompound();
- /**
- * Contains the Recipe which has been previously used, or null if there was no previous Recipe, which could have been buffered
- */
- protected GT_Recipe mLastRecipe = null;
- private FluidStack mFluidOut;
-
- /**
- * @param aOverlays 0 = SideFacingActive
- * 1 = SideFacingInactive
- * 2 = FrontFacingActive
- * 3 = FrontFacingInactive
- * 4 = TopFacingActive
- * 5 = TopFacingInactive
- * 6 = BottomFacingActive
- * 7 = BottomFacingInactive
- * ----- Not all Array Elements have to be initialised, you can also just use 8 Parameters for the Default Pipe Texture Overlays -----
- * 8 = BottomFacingPipeActive
- * 9 = BottomFacingPipeInactive
- * 10 = TopFacingPipeActive
- * 11 = TopFacingPipeInactive
- * 12 = SideFacingPipeActive
- * 13 = SideFacingPipeInactive
- */
- public GT_MetaTileEntity_BasicMachineEx(int aID, String aName, String aNameRegional, int aTier, int aAmperage, String aDescription, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName, ITexture... aOverlays) {
- super(aID, aName, aNameRegional, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aOverlays);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- public GT_MetaTileEntity_BasicMachineEx(String aName, int aTier, int aAmperage, String aDescription, ITexture[][][] aTextures, int aInputSlotCount, int aOutputSlotCount, String aGUIName, String aNEIName) {
- super(aName, aTier, OTHER_SLOT_COUNT + aInputSlotCount + aOutputSlotCount + 1, aDescription, aTextures);
- mInputSlotCount = Math.max(0, aInputSlotCount);
- mOutputItems = new ItemStack[Math.max(0, aOutputSlotCount)];
- mAmperage = aAmperage;
- mGUIName = aGUIName;
- mNEIName = aNEIName;
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] rTextures = new ITexture[14][17][];
- aTextures = Arrays.copyOf(aTextures, 14);
-
- for (int i = 0; i < aTextures.length; i++)
- if (aTextures[i] != null) for (byte c = -1; c < 16; c++) {
- if (rTextures[i][c + 1] == null)
- rTextures[i][c + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i]};
- }
-
- for (byte c = -1; c < 16; c++) {
- if (rTextures[0][c + 1] == null) rTextures[0][c + 1] = getSideFacingActive(c);
- if (rTextures[1][c + 1] == null) rTextures[1][c + 1] = getSideFacingInactive(c);
- if (rTextures[2][c + 1] == null) rTextures[2][c + 1] = getFrontFacingActive(c);
- if (rTextures[3][c + 1] == null) rTextures[3][c + 1] = getFrontFacingInactive(c);
- if (rTextures[4][c + 1] == null) rTextures[4][c + 1] = getTopFacingActive(c);
- if (rTextures[5][c + 1] == null) rTextures[5][c + 1] = getTopFacingInactive(c);
- if (rTextures[6][c + 1] == null) rTextures[6][c + 1] = getBottomFacingActive(c);
- if (rTextures[7][c + 1] == null) rTextures[7][c + 1] = getBottomFacingInactive(c);
- if (rTextures[8][c + 1] == null) rTextures[8][c + 1] = getBottomFacingPipeActive(c);
- if (rTextures[9][c + 1] == null) rTextures[9][c + 1] = getBottomFacingPipeInactive(c);
- if (rTextures[10][c + 1] == null) rTextures[10][c + 1] = getTopFacingPipeActive(c);
- if (rTextures[11][c + 1] == null) rTextures[11][c + 1] = getTopFacingPipeInactive(c);
- if (rTextures[12][c + 1] == null) rTextures[12][c + 1] = getSideFacingPipeActive(c);
- if (rTextures[13][c + 1] == null) rTextures[13][c + 1] = getSideFacingPipeInactive(c);
- }
- return rTextures;
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return mTextures[mMainFacing < 2 ? aSide == aFacing ? aActive ? 2 : 3 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1 : aSide == mMainFacing ? aActive ? 2 : 3 : (showPipeFacing() && aSide == aFacing) ? aSide == 0 ? aActive ? 8 : 9 : aSide == 1 ? aActive ? 10 : 11 : aActive ? 12 : 13 : aSide == 0 ? aActive ? 6 : 7 : aSide == 1 ? aActive ? 4 : 5 : aActive ? 0 : 1][aColorIndex + 1];
- }
-
- @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 isValidSlot(int aIndex) {
- return aIndex > 0 && super.isValidSlot(aIndex) && aIndex != OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- }
-
- @Override
- public boolean isFacingValid(byte aFacing) {
- return mMainFacing > 1 || aFacing > 1;
- }
-
- @Override
- public boolean isEnetInput() {
- return true;
- }
-
- @Override
- public boolean isInputFacing(byte aSide) {
- return aSide != mMainFacing;
- }
-
- @Override
- public boolean isOutputFacing(byte aSide) {
- return false;
- }
-
- @Override
- public boolean isTeleporterCompatible() {
- return false;
- }
-
- @Override
- public boolean isLiquidInput(byte aSide) {
- return aSide != mMainFacing && (mAllowInputFromOutputSide || aSide != getBaseMetaTileEntity().getFrontFacing());
- }
-
- @Override
- public boolean isLiquidOutput(byte aSide) {
- return aSide != mMainFacing;
- }
-
- @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 (mEUt * 2) / V[mTier] + 1;
- }
-
- @Override
- public int getInputSlot() {
- return OTHER_SLOT_COUNT;
- }
-
- @Override
- public int getOutputSlot() {
- return OTHER_SLOT_COUNT + mInputSlotCount;
- }
-
- @Override
- public int getStackDisplaySlot() {
- return 2;
- }
-
- @Override
- public int rechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int dechargerSlotStartIndex() {
- return 1;
- }
-
- @Override
- public int rechargerSlotCount() {
- return mCharge ? 1 : 0;
- }
-
- @Override
- public int dechargerSlotCount() {
- return mDecharge ? 1 : 0;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public int getProgresstime() {
- return mProgresstime;
- }
-
- @Override
- public int maxProgresstime() {
- return mMaxProgresstime;
- }
-
- @Override
- public int increaseProgress(int aProgress) {
- mProgresstime += aProgress;
- return mMaxProgresstime - mProgresstime;
- }
-
- @Override
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return getFillableStack() != null || (getRecipeList() != null && getRecipeList().containsInput(aFluid));
- }
-
- @Override
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- @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 true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return true;
- }
-
- @Override
- public FluidStack getDisplayedFluid() {
- return displaysOutputFluid() ? getDrainableStack() : null;
- }
-
- @Override
- public FluidStack getDrainableStack() {
- return mFluidOut;
- }
-
- @Override
- public FluidStack setDrainableStack(FluidStack aFluid) {
- mFluidOut = aFluid;
- return mFluidOut;
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- if (aBaseMetaTileEntity.isClientSide()) return true;
- aBaseMetaTileEntity.openGUI(aPlayer);
- return true;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_BasicMachine(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : "");
- }
-
- @Override
- public void initDefaultModes(NBTTagCompound aNBT) {
- mMainFacing = -1;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("mFluidTransfer", mFluidTransfer);
- aNBT.setBoolean("mItemTransfer", mItemTransfer);
- aNBT.setBoolean("mHasBeenUpdated", mHasBeenUpdated);
- aNBT.setBoolean("mAllowInputFromOutputSide", mAllowInputFromOutputSide);
- aNBT.setInteger("mEUt", mEUt);
- aNBT.setInteger("mMainFacing", mMainFacing);
- aNBT.setInteger("mProgresstime", mProgresstime);
- aNBT.setInteger("mMaxProgresstime", mMaxProgresstime);
- aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
- if (mOutputFluid != null) aNBT.setTag("mOutputFluid", mOutputFluid.writeToNBT(new NBTTagCompound()));
- if (mFluidOut != null) aNBT.setTag("mFluidOut", mFluidOut.writeToNBT(new NBTTagCompound()));
-
- for (int i = 0; i < mOutputItems.length; i++)
- if (mOutputItems[i] != null)
- aNBT.setTag("mOutputItem" + i, mOutputItems[i].writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluidTransfer = aNBT.getBoolean("mFluidTransfer");
- mItemTransfer = aNBT.getBoolean("mItemTransfer");
- mHasBeenUpdated = aNBT.getBoolean("mHasBeenUpdated");
- mAllowInputFromOutputSide = aNBT.getBoolean("mAllowInputFromOutputSide");
- mEUt = aNBT.getInteger("mEUt");
- mMainFacing = aNBT.getInteger("mMainFacing");
- mProgresstime = aNBT.getInteger("mProgresstime");
- mMaxProgresstime = aNBT.getInteger("mMaxProgresstime");
- mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
- mOutputFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mOutputFluid"));
- mFluidOut = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluidOut"));
-
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
- }
-
- @Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- super.onPostTick(aBaseMetaTileEntity, aTick);
-
- if (aBaseMetaTileEntity.isServerSide()) {
- mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity.getEUCapacity() / 3;
- mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
-
- doDisplayThings();
-
- boolean tSucceeded = false;
-
- if (mMaxProgresstime > 0 && (mProgresstime >= 0 || aBaseMetaTileEntity.isAllowedToWork())) {
- aBaseMetaTileEntity.setActive(true);
- if (mProgresstime < 0 || drainEnergyForProcess(mEUt)) {
- if (++mProgresstime >= mMaxProgresstime) {
- for (int i = 0; i < mOutputItems.length; i++)
- for (int j = 0; j < mOutputItems.length; j++)
- if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot() + ((j + i) % mOutputItems.length), mOutputItems[i]))
- break;
- if (mOutputFluid != null)
- if (getDrainableStack() == null) setDrainableStack(mOutputFluid.copy());
- else if (mOutputFluid.isFluidEqual(getDrainableStack()))
- getDrainableStack().amount += mOutputFluid.amount;
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
- mOutputFluid = null;
- mEUt = 0;
- mProgresstime = 0;
- mMaxProgresstime = 0;
- mStuttering = false;
- tSucceeded = true;
- endProcess();
- }
- if (mProgresstime > 5) mStuttering = false;
- } else {
- if (!mStuttering) {
- stutterProcess();
- if (canHaveInsufficientEnergy()) mProgresstime = -100;
- mStuttering = true;
- }
- }
- } else {
- aBaseMetaTileEntity.setActive(false);
- }
-
- boolean tRemovedOutputFluid = false;
-
- if (doesAutoOutputFluids() && getDrainableStack() != null && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || aTick % 20 == 0)) {
- IFluidHandler tTank = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing());
- if (tTank != null) {
- FluidStack tDrained = drain(1000, false);
- if (tDrained != null) {
- int tFilledAmount = tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tDrained, false);
- if (tFilledAmount > 0)
- tTank.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), drain(tFilledAmount, true), true);
- }
- }
- if (getDrainableStack() == null) tRemovedOutputFluid = true;
- }
-
- if (doesAutoOutput() && !isOutputEmpty() && aBaseMetaTileEntity.getFrontFacing() != mMainFacing && (tSucceeded || mOutputBlocked % 300 == 1 || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0)) {
- TileEntity tTileEntity2 = aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getFrontFacing());
- for (int i = 0, tCosts = 1; i < mOutputItems.length && tCosts > 0 && aBaseMetaTileEntity.isUniversalEnergyStored(128); i++) {
- tCosts = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, tTileEntity2, aBaseMetaTileEntity.getFrontFacing(), aBaseMetaTileEntity.getBackFacing(), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
- if (tCosts > 0) aBaseMetaTileEntity.decreaseStoredEnergyUnits(tCosts, true);
- }
- }
-
- if (mOutputBlocked != 0) if (isOutputEmpty()) mOutputBlocked = 0;
- else mOutputBlocked++;
-
- if (allowToCheckRecipe()) {
- if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) {
- if (checkRecipe() == 2) {
- if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null;
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
- for (int i = 0; i < mOutputItems.length; i++) {
- mOutputItems[i] = GT_Utility.copy(mOutputItems[i]);
- if (mOutputItems[i] != null && mOutputItems[i].stackSize > 64)
- mOutputItems[i].stackSize = 64;
- mOutputItems[i] = GT_OreDictUnificator.get(true, mOutputItems[i]);
- }
- if (mFluid != null && mFluid.amount <= 0) mFluid = null;
- mMaxProgresstime = Math.max(1, mMaxProgresstime);
- if (GT_Utility.isDebugItem(mInventory[dechargerSlotStartIndex()])) {
- mEUt = mMaxProgresstime = 1;
- }
- startProcess();
- } else {
- mMaxProgresstime = 0;
- for (int i = 0; i < mOutputItems.length; i++) mOutputItems[i] = null;
- mOutputFluid = null;
- }
- }
- } else {
- if (!mStuttering) {
- stutterProcess();
- mStuttering = true;
- }
- }
- }
- }
-
- protected void doDisplayThings() {
- if (mMainFacing < 2 && getBaseMetaTileEntity().getFrontFacing() > 1) {
- mMainFacing = getBaseMetaTileEntity().getFrontFacing();
- }
- if (mMainFacing >= 2 && !mHasBeenUpdated) {
- mHasBeenUpdated = true;
- getBaseMetaTileEntity().setFrontFacing(getBaseMetaTileEntity().getBackFacing());
- }
-
- if (displaysInputFluid()) {
- int tDisplayStackSlot = OTHER_SLOT_COUNT + mInputSlotCount + mOutputItems.length;
- if (getFillableStack() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[tDisplayStackSlot], true, true))
- mInventory[tDisplayStackSlot] = null;
- } else {
- mInventory[tDisplayStackSlot] = GT_Utility.getFluidDisplayStack(getFillableStack(), displaysStackSize());
- }
- }
- }
-
- protected boolean hasEnoughEnergyToCheckRecipe() {
- return getBaseMetaTileEntity().isUniversalEnergyStored(getMinimumStoredEU() / 2);
- }
-
- protected boolean drainEnergyForProcess(long aEUt) {
- return getBaseMetaTileEntity().decreaseStoredEnergyUnits(aEUt, false);
- }
-
- protected void calculateOverclockedNess(GT_Recipe aRecipe) {
- calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
- }
-
- protected void calculateOverclockedNess(int aEUt, int aDuration) {
- if (aEUt <= 16) {
- mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1));
- mMaxProgresstime = aDuration / (1 << (mTier - 1));
- } else {
- mEUt = aEUt;
- mMaxProgresstime = aDuration;
- while (mEUt <= V[mTier - 1] * mAmperage) {
- mEUt *= 4;
- mMaxProgresstime /= 2;
- }
- }
- }
-
- protected ItemStack getSpecialSlot() {
- return mInventory[3];
- }
-
- protected ItemStack getOutputAt(int aIndex) {
- return mInventory[getOutputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllOutputs() {
- ItemStack[] rOutputs = new ItemStack[mOutputItems.length];
- for (int i = 0; i < mOutputItems.length; i++) rOutputs[i] = getOutputAt(i);
- return rOutputs;
- }
-
- protected boolean canOutput(GT_Recipe aRecipe) {
- return aRecipe != null && (aRecipe.mNeedsEmptyOutput ? isOutputEmpty() && getDrainableStack() == null : canOutput(aRecipe.getFluidOutput(0)) && canOutput(aRecipe.mOutputs));
- }
-
- protected boolean canOutput(ItemStack... aOutputs) {
- if (aOutputs == null) return true;
- ItemStack[] tOutputSlots = getAllOutputs();
- for (int i = 0; i < tOutputSlots.length && i < aOutputs.length; i++)
- if (tOutputSlots[i] != null && aOutputs[i] != null && (!GT_Utility.areStacksEqual(tOutputSlots[i], aOutputs[i], false) || tOutputSlots[i].stackSize + aOutputs[i].stackSize > tOutputSlots[i].getMaxStackSize())) {
- mOutputBlocked++;
- return false;
- }
- return true;
- }
-
- protected boolean canOutput(FluidStack aOutput) {
- return getDrainableStack() == null || aOutput == null || (getDrainableStack().isFluidEqual(aOutput) && (getDrainableStack().amount <= 0 || getDrainableStack().amount + aOutput.amount <= getCapacity()));
- }
-
- protected ItemStack getInputAt(int aIndex) {
- return mInventory[getInputSlot() + aIndex];
- }
-
- protected ItemStack[] getAllInputs() {
- ItemStack[] rInputs = new ItemStack[mInputSlotCount];
- for (int i = 0; i < mInputSlotCount; i++) rInputs[i] = getInputAt(i);
- return rInputs;
- }
-
- protected boolean isOutputEmpty() {
- boolean rIsEmpty = true;
- for (ItemStack tOutputSlotContent : getAllOutputs()) if (tOutputSlotContent != null) rIsEmpty = false;
- return rIsEmpty;
- }
-
- protected boolean displaysInputFluid() {
- return true;
- }
-
- protected boolean displaysOutputFluid() {
- return true;
- }
-
- @Override
- public void onValueUpdate(byte aValue) {
- mMainFacing = aValue;
- }
-
- @Override
- public byte getUpdateData() {
- return (byte) mMainFacing;
- }
-
- @Override
- public void doSound(byte aIndex, double aX, double aY, double aZ) {
- super.doSound(aIndex, aX, aY, aZ);
- if (aIndex == 8) GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(210), 100, 1.0F, aX, aY, aZ);
- }
-
- public boolean doesAutoOutput() {
- return mItemTransfer;
- }
-
- public boolean doesAutoOutputFluids() {
- return mFluidTransfer;
- }
-
- public boolean allowToCheckRecipe() {
- return true;
- }
-
- public boolean showPipeFacing() {
- return true;
- }
-
- /**
- * Called whenever the Machine successfully started a Process, useful for Sound Effects
- */
- public void startProcess() {
- //
- }
-
- /**
- * Called whenever the Machine successfully finished a Process, useful for Sound Effects
- */
- public void endProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process, useful for Sound Effects
- */
- public void abortProcess() {
- //
- }
-
- /**
- * Called whenever the Machine aborted a Process but still works on it, useful for Sound Effects
- */
- public void stutterProcess() {
- if (useStandardStutterSound()) sendSound((byte) 8);
- }
-
- /**
- * If this Machine can have the Insufficient Energy Line Problem
- */
- public boolean canHaveInsufficientEnergy() {
- return true;
- }
-
- public boolean useStandardStutterSound() {
- return true;
- }
-
- @Override
- public String[] getInfoData() {
- return new String[]{
- mRecipeStuff.toString(),
- mNEIName,
- "Progress:", (mProgresstime / 20) + " secs",
- (mMaxProgresstime / 20) + " secs",
- "Stored Energy:",
- getBaseMetaTileEntity().getStoredEU() + "EU",
- getBaseMetaTileEntity().getEUCapacity() + "EU"};
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- if (aSide == getBaseMetaTileEntity().getFrontFacing() || aSide == mMainFacing) {
- mAllowInputFromOutputSide = !mAllowInputFromOutputSide;
- GT_Utility.sendChatToPlayer(aPlayer, mAllowInputFromOutputSide ? "Input from Output Side allowed" : "Input from Output Side forbidden");
- }
- }
-
- @Override
- public boolean allowCoverOnSide(byte aSide, GT_ItemStack aCoverID) {
- return (aSide != mMainFacing || GregTech_API.getCoverBehavior(aCoverID.toStack()).isGUIClickable(aSide, GT_Utility.stackToInt(aCoverID.toStack()), 0, getBaseMetaTileEntity()));
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide != mMainFacing && aIndex >= getOutputSlot() && aIndex < getOutputSlot() + mOutputItems.length;
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- if (aSide == mMainFacing || aIndex < getInputSlot() || aIndex >= getInputSlot() + mInputSlotCount || (!mAllowInputFromOutputSide && aSide == aBaseMetaTileEntity.getFrontFacing()))
- return false;
- for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
- if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(aStack), mInventory[i])) return i == aIndex;
- return true;
- }
-
- /**
- * @return the Recipe List which is used for this Machine, this is a useful Default Handler
- */
- public GT_Recipe_Map getRecipeList() {
- return null;
- }
-
- /**
- * Override this to check the Recipes yourself, super calls to this could be useful if you just want to add a special case
- * <p/>
- * I thought about Enum too, but Enum doesn't add support for people adding other return Systems.
- * <p/>
- * Funny how Eclipse marks the word Enum as not correctly spelled.
- *
- * @return see constants above
- */
- public int checkRecipe() {
- GT_Recipe_Map tMap = getRecipeList();
- if (tMap == null) return DID_NOT_FIND_RECIPE;
- GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());
- if (tRecipe == null) return DID_NOT_FIND_RECIPE;
- if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe;
- if (!canOutput(tRecipe)) {
- mOutputBlocked++;
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
- }
- if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs()))
- return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
-
- for (int i = 0; i < mOutputItems.length; i++)
- if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(i))
- mOutputItems[i] = tRecipe.getOutput(i);
- mOutputFluid = tRecipe.getFluidOutput(0);
- calculateOverclockedNess(tRecipe);
- return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
- }
-
- public ITexture[] getSideFacingActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getSideFacingInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getFrontFacingActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getFrontFacingInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getTopFacingActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getTopFacingInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getBottomFacingActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getBottomFacingInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]};
- }
-
- public ITexture[] getBottomFacingPipeActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-
- public ITexture[] getBottomFacingPipeInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-
- public ITexture[] getTopFacingPipeActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-
- public ITexture[] getTopFacingPipeInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-
- public ITexture[] getSideFacingPipeActive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-
- public ITexture[] getSideFacingPipeInactive(byte aColor) {
- return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
- }
-} \ No newline at end of file
diff --git a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTankEx.java b/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTankEx.java
deleted file mode 100644
index 46f347cba2..0000000000
--- a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicTankEx.java
+++ /dev/null
@@ -1,251 +0,0 @@
-package gregtech.api.metatileentity.implementations;
-
-import gregtech.api.enums.ItemList;
-import gregtech.api.gui.GT_Container_BasicTank;
-import gregtech.api.gui.GT_GUIContainer_BasicTank;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Utility;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
-
-/**
- * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
- * <p/>
- * This is the main construct for my generic Tanks. Filling and emptying behavior have to be implemented manually
- */
-public abstract class GT_MetaTileEntity_BasicTankEx extends GT_MetaTileEntity_TieredMachineBlockEx {
-
- public FluidStack mFluid;
-
- /**
- * @param aInvSlotCount should be 3
- */
- public GT_MetaTileEntity_BasicTankEx(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GT_MetaTileEntity_BasicTankEx(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- @Override
- public boolean isSimpleMachine() {
- return false;
- }
-
- @Override
- public boolean isValidSlot(int aIndex) {
- return aIndex != getStackDisplaySlot();
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- }
-
- public abstract boolean doesFillContainers();
-
- public abstract boolean doesEmptyContainers();
-
- public abstract boolean canTankBeFilled();
-
- public abstract boolean canTankBeEmptied();
-
- public abstract boolean displaysItemStack();
-
- public abstract boolean displaysStackSize();
-
- public int getInputSlot() {
- return 0;
- }
-
- public int getOutputSlot() {
- return 1;
- }
-
- public int getStackDisplaySlot() {
- return 2;
- }
-
- public boolean isFluidInputAllowed(FluidStack aFluid) {
- return true;
- }
-
- public boolean isFluidChangingAllowed() {
- return true;
- }
-
- public FluidStack getFillableStack() {
- return mFluid;
- }
-
- public FluidStack setFillableStack(FluidStack aFluid) {
- mFluid = aFluid;
- return mFluid;
- }
-
- public FluidStack getDrainableStack() {
- return mFluid;
- }
-
- public FluidStack setDrainableStack(FluidStack aFluid) {
- mFluid = aFluid;
- return mFluid;
- }
-
- public FluidStack getDisplayedFluid() {
- return getDrainableStack();
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- 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 void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
- if (isFluidChangingAllowed() && getFillableStack() != null && getFillableStack().amount <= 0)
- setFillableStack(null);
-
- if (displaysItemStack() && getStackDisplaySlot() >= 0 && getStackDisplaySlot() < mInventory.length) {
- if (getDisplayedFluid() == null) {
- if (ItemList.Display_Fluid.isStackEqual(mInventory[getStackDisplaySlot()], true, true))
- mInventory[getStackDisplaySlot()] = null;
- } else {
- mInventory[getStackDisplaySlot()] = GT_Utility.getFluidDisplayStack(getDisplayedFluid(), displaysStackSize());
- }
- }
-
- if (doesEmptyContainers()) {
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(mInventory[getInputSlot()], true);
- if (tFluid != null && isFluidInputAllowed(tFluid)) {
- if (getFillableStack() == null) {
- if (isFluidInputAllowed(tFluid) && tFluid.amount <= getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
- setFillableStack(tFluid.copy());
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- }
- }
- } else {
- if (tFluid.isFluidEqual(getFillableStack()) && tFluid.amount + getFillableStack().amount <= getCapacity()) {
- if (aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), GT_Utility.getContainerItem(mInventory[getInputSlot()], true), 1)) {
- getFillableStack().amount += tFluid.amount;
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- }
- }
- }
- }
- }
-
- if (doesFillContainers()) {
- ItemStack tOutput = GT_Utility.fillFluidContainer(getDrainableStack(), mInventory[getInputSlot()], false, true);
- if (tOutput != null && aBaseMetaTileEntity.addStackToSlot(getOutputSlot(), tOutput, 1)) {
- FluidStack tFluid = GT_Utility.getFluidForFilledItem(tOutput, true);
- aBaseMetaTileEntity.decrStackSize(getInputSlot(), 1);
- if (tFluid != null) getDrainableStack().amount -= tFluid.amount;
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) setDrainableStack(null);
- }
- }
- }
- }
-
- @Override
- public FluidStack getFluid() {
- return getDrainableStack();
- }
-
- @Override
- public int getFluidAmount() {
- return getDrainableStack() != null ? getDrainableStack().amount : 0;
- }
-
- @Override
- public int fill(FluidStack aFluid, boolean doFill) {
- if (aFluid == null || aFluid.getFluid().getID() <= 0 || aFluid.amount <= 0 || !canTankBeFilled() || !isFluidInputAllowed(aFluid))
- return 0;
-
- if (getFillableStack() == null || getFillableStack().getFluid().getID() <= 0) {
- if (aFluid.amount <= getCapacity()) {
- if (doFill) {
- setFillableStack(aFluid.copy());
- getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill) {
- setFillableStack(aFluid.copy());
- getFillableStack().amount = getCapacity();
- getBaseMetaTileEntity().markDirty();
- }
- return getCapacity();
- }
-
- if (!getFillableStack().isFluidEqual(aFluid))
- return 0;
-
- int space = getCapacity() - getFillableStack().amount;
- if (aFluid.amount <= space) {
- if (doFill) {
- getFillableStack().amount += aFluid.amount;
- getBaseMetaTileEntity().markDirty();
- }
- return aFluid.amount;
- }
- if (doFill)
- getFillableStack().amount = getCapacity();
- return space;
- }
-
- @Override
- public FluidStack drain(int maxDrain, boolean doDrain) {
- if (getDrainableStack() == null || !canTankBeEmptied()) return null;
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
- setDrainableStack(null);
- getBaseMetaTileEntity().markDirty();
- return null;
- }
-
- int used = maxDrain;
- if (getDrainableStack().amount < used)
- used = getDrainableStack().amount;
-
- if (doDrain) {
- getDrainableStack().amount -= used;
- getBaseMetaTileEntity().markDirty();
- }
-
- FluidStack drained = getDrainableStack().copy();
- drained.amount = used;
-
- if (getDrainableStack().amount <= 0 && isFluidChangingAllowed()) {
- setDrainableStack(null);
- getBaseMetaTileEntity().markDirty();
- }
-
- return drained;
- }
-
- @Override
- public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aIndex == getOutputSlot();
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aIndex == getInputSlot();
- }
-} \ No newline at end of file
diff --git a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlockEx.java b/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlockEx.java
deleted file mode 100644
index 7e70c8dafb..0000000000
--- a/src/Java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlockEx.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package gregtech.api.metatileentity.implementations;
-
-import static gregtech.api.enums.GT_Values.GT;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.metatileentity.MetaTileEntityEx;
-
-public abstract class GT_MetaTileEntity_TieredMachineBlockEx extends MetaTileEntityEx {
- /**
- * Value between [0 - 9] to describe the Tier of this Machine.
- */
- public final byte mTier;
-
- /**
- * A simple Description.
- */
- public final String mDescription;
-
- /**
- * Contains all Textures used by this Block.
- */
- public final ITexture[][][] mTextures;
-
- public GT_MetaTileEntity_TieredMachineBlockEx(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
- super(aID, aName, aNameRegional, aInvSlotCount);
- mTier = (byte) Math.max(0, Math.min(aTier, 9));
- mDescription = aDescription;
-
- // must always be the last call!
- if (GT.isClientSide()) mTextures = getTextureSet(aTextures);
- else mTextures = null;
- }
-
- public GT_MetaTileEntity_TieredMachineBlockEx(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aInvSlotCount);
- mTier = (byte) aTier;
- mDescription = aDescription;
- mTextures = aTextures;
- }
-
- @Override
- public byte getTileEntityBaseType() {
- return (byte) (Math.min(3, mTier <= 0 ? 0 : 1 + ((mTier - 1) / 4)));
- }
-
- @Override
- public long getInputTier() {
- return mTier;
- }
-
- @Override
- public long getOutputTier() {
- return mTier;
- }
-
- @Override
- public String[] getDescription() {
- return new String[]{mDescription};
- }
-
- /**
- * Used Client Side to get a Texture Set for this Block.
- * Called after setting the Tier and the Description so that those two are accessible.
- *
- * @param aTextures is the optional Array you can give to the Constructor.
- */
- public abstract ITexture[][][] getTextureSet(ITexture[] aTextures);
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
index 212e9154be..9ac81bffe4 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.block.machine;
-import gregtech.api.items.GT_MetaGenerated_Tool;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
@@ -84,12 +83,12 @@ public class Machine_Workbench extends BlockContainer
else if (heldItem.getItem() instanceof ITool){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
+ /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem();
if (testTool.canWrench(player, x, y, z)){
holdingWrench = true;
}
- }
+ }*/
else {
holdingWrench = false;
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
index 46c08c0d4d..ce09ddab59 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
@@ -1,6 +1,5 @@
package gtPlusPlus.core.block.machine;
-import gregtech.api.items.GT_MetaGenerated_Tool;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
@@ -84,12 +83,12 @@ public class Machine_WorkbenchAdvanced extends BlockContainer
else if (heldItem.getItem() instanceof ITool){
holdingWrench = true;
}
- else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
+ /*else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){
GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem();
if (testTool.canWrench(player, x, y, z)){
holdingWrench = true;
}
- }
+ }*/
else {
holdingWrench = false;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java
deleted file mode 100644
index 47c8aedb98..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.gui;
-
-import gregtech.api.gui.GT_ContainerMetaTile_Machine;
-import gregtech.api.gui.GT_Slot_Holo;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.slots.SlotGtTool;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.inventory.Slot;
-import net.minecraft.item.ItemStack;
-
-public class CONTAINER_AdvancedWorkbench extends GT_ContainerMetaTile_Machine {
-
- public CONTAINER_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(aInventoryPlayer, aTileEntity);
- }
-
- public CONTAINER_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) {
- super(aInventoryPlayer, aTileEntity, bindInventory);
- }
-
- @Override
- public void addSlots(InventoryPlayer aInventoryPlayer)
- {
- addSlotToContainer(new Slot(mTileEntity, 0, 8, 8));
- addSlotToContainer(new Slot(mTileEntity, 1, 26, 8));
- addSlotToContainer(new Slot(mTileEntity, 2, 44, 8));
- addSlotToContainer(new Slot(mTileEntity, 3, 62, 8));
- addSlotToContainer(new Slot(mTileEntity, 4, 8, 26));
- addSlotToContainer(new Slot(mTileEntity, 5, 26, 26));
- addSlotToContainer(new Slot(mTileEntity, 6, 44, 26));
- addSlotToContainer(new Slot(mTileEntity, 7, 62, 26));
- addSlotToContainer(new Slot(mTileEntity, 8, 8, 44));
- addSlotToContainer(new Slot(mTileEntity, 9, 26, 44));
- addSlotToContainer(new Slot(mTileEntity, 10, 44, 44));
- addSlotToContainer(new Slot(mTileEntity, 11, 62, 44));
- addSlotToContainer(new Slot(mTileEntity, 12, 8, 62));
- addSlotToContainer(new Slot(mTileEntity, 13, 26, 62));
- addSlotToContainer(new Slot(mTileEntity, 14, 44, 62));
- addSlotToContainer(new Slot(mTileEntity, 15, 62, 62));
-
- addSlotToContainer(new SlotGtTool(mTileEntity, 16, 82, 8));
- addSlotToContainer(new SlotGtTool(mTileEntity, 17, 100, 8));
- addSlotToContainer(new SlotGtTool(mTileEntity, 18, 118, 8));
- addSlotToContainer(new SlotGtTool(mTileEntity, 19, 136, 8));
- addSlotToContainer(new SlotGtTool(mTileEntity, 20, 154, 8));
-
- addSlotToContainer(new Slot(mTileEntity, 21, 82, 28));
- addSlotToContainer(new Slot(mTileEntity, 22, 100, 28));
- addSlotToContainer(new Slot(mTileEntity, 23, 118, 28));
- addSlotToContainer(new Slot(mTileEntity, 24, 82, 46));
- addSlotToContainer(new Slot(mTileEntity, 25, 100, 46));
- addSlotToContainer(new Slot(mTileEntity, 26, 118, 46));
- addSlotToContainer(new Slot(mTileEntity, 27, 82, 64));
- addSlotToContainer(new Slot(mTileEntity, 28, 100, 64));
- addSlotToContainer(new Slot(mTileEntity, 29, 118, 64));
-
- addSlotToContainer(new Slot(mTileEntity, 33, 154, 28));
- addSlotToContainer(new Slot(mTileEntity, 34, 154, 64));
-
- addSlotToContainer(new Slot(mTileEntity, 30, 136, 28));
- addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1));
- addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1));
- addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1));
- }
-
- @Override
- public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){
- Utils.LOG_INFO("Player Clicked A Slot. "+aSlotIndex);
- if ((aSlotIndex < 21) || (aSlotIndex > 35)) {
- Utils.LOG_INFO("Returning slotClick for slot: "+aSlotIndex+" on line 75");
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
- }
- if ((mTileEntity == null) || (mTileEntity.getMetaTileEntity() == null)) {
- Utils.LOG_INFO("Returning null on Line 79");
- return null;
- }
- try
- {
- ItemStack tStack = ((Slot)this.inventorySlots.get(aSlotIndex)).getStack();
- if ((tStack != null) && (tStack.stackSize <= 0) && (!GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack()))) {
- Utils.LOG_INFO("Returning null on Line 86");
- return null;
- }
- if (aSlotIndex == 32)
- {
- if ((aMouseclick == 0) && (aShifthold == 1))
- {
- ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null);
- Utils.LOG_INFO("Returning null on Line 94");
- return null;
- }
- }
- else
- {
- if (aSlotIndex == 33)
- {
- ItemStack tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput();
- if (tCraftedStack != null) {
- if (aShifthold == 1)
- {
- for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i = (byte)(i + 1)) {
- for (byte j = 0; (j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); j = (byte)(j + 1))
- {
- ItemStack tStack2;
- if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) {
- Utils.LOG_INFO("Returning aPlayer.inventory.getItemStack() for slot: "+aSlotIndex+" on line 111");
- return aPlayer.inventory.getItemStack();
- }
- Utils.LOG_INFO("Doing something ~ 1");
- aPlayer.inventory.mainInventory[i] = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i]);
- }
- }
- }
- else
- {
- if (aMouseclick == 0)
- {
- if (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) {
- Utils.LOG_INFO("Doing something ~ 2");
- aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack()));
- }
- Utils.LOG_INFO("Returning aPlayer.inventory.getItemStack() for slot: "+aSlotIndex+" on line 127");
- return aPlayer.inventory.getItemStack();
- }
- for (int i = 0; (i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); i++)
- {
- ItemStack tStack2;
- if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) {
- Utils.LOG_INFO("Returning aPlayer.inventory.getItemStack() for slot: "+aSlotIndex+" on line 134");
- return aPlayer.inventory.getItemStack();
- }
- Utils.LOG_INFO("Doing something ~ 3");
- aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack()));
- }
- Utils.LOG_INFO("Returning aPlayer.inventory.getItemStack() for slot: "+aSlotIndex+" on line 140");
- return aPlayer.inventory.getItemStack();
- }
- }
- Utils.LOG_INFO("Returning null on Line 144");
- return null;
- }
- if (aSlotIndex == 34)
- {
- ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true;
- Utils.LOG_INFO("Returning null on Line 150");
- return null;
- }
- if (aSlotIndex == 35)
- {
- ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots();
- Utils.LOG_INFO("Returning null on Line 156");
- return null;
- }
- }
- }
- catch (Throwable e)
- {
- e.printStackTrace(GT_Log.err);
- }
- Utils.LOG_INFO("Returning super.slotClick() on Line 162");
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
- }
-
- @Override
- public int getSlotCount()
- {
- return 33;
- }
-
- @Override
- public int getShiftClickSlotCount()
- {
- return 21;
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java
deleted file mode 100644
index 650e80ebd5..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_BronzeWorkbench.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.gui;
-
-import gregtech.api.gui.GT_ContainerMetaTile_Machine;
-import gregtech.api.gui.GT_Slot_Holo;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.inventory.Slot;
-import net.minecraft.item.ItemStack;
-
-public class CONTAINER_BronzeWorkbench extends GT_ContainerMetaTile_Machine {
-
- public CONTAINER_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) {
- super(aInventoryPlayer, aTileEntity);
- }
-
- public CONTAINER_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, boolean bindInventory) {
- super(aInventoryPlayer, aTileEntity, bindInventory);
- }
-
- @Override
- public void addSlots(InventoryPlayer aInventoryPlayer)
- {
- addSlotToContainer(new Slot(this.mTileEntity, 0, 8, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 1, 26, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 2, 44, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 3, 62, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 4, 8, 26));
- addSlotToContainer(new Slot(this.mTileEntity, 5, 26, 26));
- addSlotToContainer(new Slot(this.mTileEntity, 6, 44, 26));
- addSlotToContainer(new Slot(this.mTileEntity, 7, 62, 26));
- addSlotToContainer(new Slot(this.mTileEntity, 8, 8, 44));
- addSlotToContainer(new Slot(this.mTileEntity, 9, 26, 44));
- addSlotToContainer(new Slot(this.mTileEntity, 10, 44, 44));
- addSlotToContainer(new Slot(this.mTileEntity, 11, 62, 44));
- addSlotToContainer(new Slot(this.mTileEntity, 12, 8, 62));
- addSlotToContainer(new Slot(this.mTileEntity, 13, 26, 62));
- addSlotToContainer(new Slot(this.mTileEntity, 14, 44, 62));
- addSlotToContainer(new Slot(this.mTileEntity, 15, 62, 62));
-
- addSlotToContainer(new Slot(this.mTileEntity, 16, 82, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 17, 100, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 18, 118, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 19, 136, 8));
- addSlotToContainer(new Slot(this.mTileEntity, 20, 154, 8));
-
- addSlotToContainer(new Slot(this.mTileEntity, 21, 82, 28));
- addSlotToContainer(new Slot(this.mTileEntity, 22, 100, 28));
- addSlotToContainer(new Slot(this.mTileEntity, 23, 118, 28));
- addSlotToContainer(new Slot(this.mTileEntity, 24, 82, 46));
- addSlotToContainer(new Slot(this.mTileEntity, 25, 100, 46));
- addSlotToContainer(new Slot(this.mTileEntity, 26, 118, 46));
- addSlotToContainer(new Slot(this.mTileEntity, 27, 82, 64));
- addSlotToContainer(new Slot(this.mTileEntity, 28, 100, 64));
- addSlotToContainer(new Slot(this.mTileEntity, 29, 118, 64));
-
- addSlotToContainer(new Slot(this.mTileEntity, 33, 154, 28));
- addSlotToContainer(new Slot(this.mTileEntity, 34, 154, 64));
-
- addSlotToContainer(new Slot(this.mTileEntity, 30, 136, 28));
- addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 31, 136, 64, false, false, 1));
- addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 154, 46, false, false, 1));
- addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 32, 136, 46, false, false, 1));
- }
-
- public ItemStack func_75144_a(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer)
- {
- if ((aSlotIndex < 21) || (aSlotIndex > 35)) {
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
- }
- if ((this.mTileEntity == null) || (this.mTileEntity.getMetaTileEntity() == null)) {
- return null;
- }
- try
- {
- ItemStack tStack = ((Slot)this.inventorySlots.get(aSlotIndex)).getStack();
- if ((tStack != null) && (tStack.stackSize <= 0) && (!GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack()))) {
- return null;
- }
- if (aSlotIndex == 32)
- {
- if ((aMouseclick == 0) && (aShifthold == 1))
- {
- ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).setBluePrint(null);
- return null;
- }
- }
- else
- {
- if (aSlotIndex == 33)
- {
- ItemStack tCraftedStack = ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput();
- if (tCraftedStack != null) {
- if (aShifthold == 1)
- {
- for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i = (byte)(i + 1)) {
- for (byte j = 0; (j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); j = (byte)(j + 1))
- {
- ItemStack tStack2;
- if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) {
- return aPlayer.inventory.getItemStack();
- }
- aPlayer.inventory.mainInventory[i] = ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i]);
- }
- }
- }
- else
- {
- if (aMouseclick == 0)
- {
- if (((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) {
- aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack()));
- }
- return aPlayer.inventory.getItemStack();
- }
- for (int i = 0; (i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize) && (((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).canDoCraftingOutput()); i++)
- {
- ItemStack tStack2;
- if ((!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack)) || ((tStack != null) && (tStack.stackSize != tStack2.stackSize))) {
- return aPlayer.inventory.getItemStack();
- }
- aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack()));
- }
- return aPlayer.inventory.getItemStack();
- }
- }
- return null;
- }
- if (aSlotIndex == 34)
- {
- ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).mFlushMode = true;
- return null;
- }
- if (aSlotIndex == 35)
- {
- ((GT_MetaTileEntity_BronzeCraftingTable)this.mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots();
- return null;
- }
- }
- }
- catch (Throwable e)
- {
- e.printStackTrace(GT_Log.err);
- }
- return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
- }
-
- @Override
- public int getSlotCount()
- {
- return 33;
- }
-
- @Override
- public int getShiftClickSlotCount()
- {
- return 21;
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java
deleted file mode 100644
index 7da9238bd5..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.gui;
-
-import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gtPlusPlus.core.lib.CORE;
-import net.minecraft.entity.player.InventoryPlayer;
-
-public class GUI_AdvancedWorkbench
-extends GT_GUIContainerMetaTile_Machine
-{
- public GUI_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity)
- {
- super(new CONTAINER_AdvancedWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "AdvancedCraftingTable.png");
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2)
- {
- //this.fontRendererObj.drawString("Condenser", 8, 4, 4210752);
- }
-
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
- {
- super.drawGuiContainerBackgroundLayer(par1, par2, par3);
- int x = (this.width - this.xSize) / 2;
- int y = (this.height - this.ySize) / 2;
- drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java
deleted file mode 100644
index 597edba503..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_BronzeWorkbench.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package gtPlusPlus.xmod.gregtech.api.gui;
-
-import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gtPlusPlus.core.lib.CORE;
-import net.minecraft.entity.player.InventoryPlayer;
-
-public class GUI_BronzeWorkbench
-extends GT_GUIContainerMetaTile_Machine
-{
- public GUI_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity)
- {
- super(new CONTAINER_BronzeWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "BronzeCraftingTable.png");
- }
-
- @Override
- protected void drawGuiContainerForegroundLayer(int par1, int par2)
- {
- //this.fontRendererObj.drawString("Condenser", 8, 4, 4210752);
- }
-
- @Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)
- {
- super.drawGuiContainerBackgroundLayer(par1, par2, par3);
- int x = (this.width - this.xSize) / 2;
- int y = (this.height - this.ySize) / 2;
- drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
index 98fcc6d6bb..3ef5af0774 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java
@@ -11,7 +11,7 @@ import gregtech.api.enums.SubTag;
import gregtech.api.enums.TC_Aspects;
import gregtech.api.enums.ToolDictNames;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.metatileentity.BaseMetaTileEntityEx;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.MaterialStack;
import gregtech.api.util.GT_Log;
@@ -914,17 +914,17 @@ public class Meta_GT_Proxy {
/**
* This gives you a new BaseMetaTileEntity. As some Interfaces are not always loaded (Buildcraft, Univeral Electricity) I have to use Invocation at the Constructor of the BaseMetaTileEntity
*/
- private static Class<BaseMetaTileEntityEx> sBaseMetaTileEntityClass = null;
+ private static Class<BaseMetaTileEntity> sBaseMetaTileEntityClass = null;
- public static BaseMetaTileEntityEx constructBaseMetaTileEntity() {
+ public static BaseMetaTileEntity constructBaseMetaTileEntity() {
if (sBaseMetaTileEntityClass == null) {
try {
- return (BaseMetaTileEntityEx) (sBaseMetaTileEntityClass = BaseMetaTileEntityEx.class).newInstance();
+ return (BaseMetaTileEntity) (sBaseMetaTileEntityClass = BaseMetaTileEntity.class).newInstance();
} catch (Throwable e) {/*Do nothing*/}
}
try {
- return (BaseMetaTileEntityEx) (sBaseMetaTileEntityClass.newInstance());
+ return (BaseMetaTileEntity) (sBaseMetaTileEntityClass.newInstance());
} catch (Throwable e) {
Utils.LOG_INFO("Fatal Error ocurred while initializing TileEntities, crashing Minecraft.");
e.printStackTrace(GT_Log.err);
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java
deleted file mode 100644
index 0b47d3c5c1..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechBlockMachines.java
+++ /dev/null
@@ -1,553 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.blocks;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.IDebugableBlock;
-import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
-import gregtech.api.interfaces.tileentity.ICoverable;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.items.GT_Generic_Block;
-import gregtech.api.metatileentity.BaseMetaPipeEntity;
-import gregtech.api.metatileentity.BaseMetaTileEntityEx;
-import gregtech.api.metatileentity.BaseTileEntity;
-import gregtech.api.util.GT_Log;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.blocks.GT_Item_Machines;
-import gregtech.common.blocks.GT_Material_Machines;
-import gregtech.common.render.GT_Renderer_Block;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.ITileEntityProvider;
-import net.minecraft.client.renderer.texture.IIconRegister;
-import net.minecraft.creativetab.CreativeTabs;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.EntityLivingBase;
-import net.minecraft.entity.EnumCreatureType;
-import net.minecraft.entity.item.EntityItem;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.util.AxisAlignedBB;
-import net.minecraft.util.IIcon;
-import net.minecraft.util.MathHelper;
-import net.minecraft.util.StatCollector;
-import net.minecraft.world.Explosion;
-import net.minecraft.world.IBlockAccess;
-import net.minecraft.world.World;
-import net.minecraftforge.common.util.ForgeDirection;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-public class GregtechBlockMachines
- extends GT_Generic_Block
- implements IDebugableBlock, ITileEntityProvider {
- public static ThreadLocal<IGregTechTileEntity> mTemporaryTileEntity = new ThreadLocal<IGregTechTileEntity>();
-
- public GregtechBlockMachines() {
- super(GT_Item_Machines.class, "gt.plusplus.blockmachines", new GT_Material_Machines());
- GregTech_API.registerMachineBlock(this, -1);
- setHardness(1.0F);
- setResistance(10.0F);
- setStepSound(soundTypeMetal);
- setCreativeTab(AddToCreativeTab.tabMachines);
- this.isBlockContainer = true;
- }
-
- @Override
- public String getHarvestTool(int aMeta) {
- switch (aMeta / 4) {
- case 0:
- return "wrench";
- case 1:
- return "wrench";
- case 2:
- return "cutter";
- case 3:
- return "axe";
- default:
- break;
- }
- return "wrench";
- }
-
- @Override
- public int getHarvestLevel(int aMeta) {
- return aMeta % 4;
- }
-
- @Override
- protected boolean canSilkHarvest() {
- return false;
- }
-
- @Override
- public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int aTileX, int aTileY, int aTileZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseTileEntity)) {
- ((BaseTileEntity) tTileEntity).onAdjacentBlockChange(aTileX, aTileY, aTileZ);
- }
- }
-
- @Override
- public void onBlockAdded(World aWorld, int aX, int aY, int aZ) {
- super.onBlockAdded(aWorld, aX, aY, aZ);
- if (GregTech_API.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- }
- }
-
- @Override
- public String getUnlocalizedName() {
- return "gt.plusplus.blockmachines";
- }
-
- @Override
- public String getLocalizedName() {
- return StatCollector.translateToLocal(getUnlocalizedName() + ".name");
- }
-
- @Override
- public int getFlammability(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return 0;
- }
-
- @Override
- public int getFireSpreadSpeed(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0) ? 100 : 0;
- }
-
- @Override
- public int getRenderType() {
- if (GT_Renderer_Block.INSTANCE == null) {
- return super.getRenderType();
- }
- return GT_Renderer_Block.INSTANCE.mRenderID;
- }
-
- @Override
- public boolean isFireSource(World aWorld, int aX, int aY, int aZ, ForgeDirection side) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
- }
-
- @Override
- public boolean isFlammable(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection face) {
- return (GregTech_API.sMachineFlammable) && (aWorld.getBlockMetadata(aX, aY, aZ) == 0);
- }
-
- @Override
- public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess aWorld, int aX, int aY, int aZ) {
- return false;
- }
-
- @Override
- public boolean canConnectRedstone(IBlockAccess var1, int var2, int var3, int var4, int var5) {
- return true;
- }
-
- @Override
- public boolean canBeReplacedByLeaves(IBlockAccess aWorld, int aX, int aY, int aZ) {
- return false;
- }
-
- @Override
- public boolean isNormalCube(IBlockAccess aWorld, int aX, int aY, int aZ) {
- return false;
- }
-
- @Override
- public boolean hasTileEntity(int aMeta) {
- return true;
- }
-
- @Override
- public boolean hasComparatorInputOverride() {
- return true;
- }
-
- @Override
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- @Override
- public boolean canProvidePower() {
- return true;
- }
-
- @Override
- public boolean isOpaqueCube() {
- return false;
- }
-
- @Override
- public TileEntity createNewTileEntity(World aWorld, int aMeta) {
- return createTileEntity(aWorld, aMeta);
- }
-
- @Override
- public IIcon getIcon(IBlockAccess aIBlockAccess, int aX, int aY, int aZ, int aSide) {
- return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
- }
-
- @Override
- public IIcon getIcon(int aSide, int aMeta) {
- return Textures.BlockIcons.MACHINE_LV_SIDE.getIcon();
- }
-
- @Override
- public boolean onBlockEventReceived(World aWorld, int aX, int aY, int aZ, int aData1, int aData2) {
- super.onBlockEventReceived(aWorld, aX, aY, aZ, aData1, aData2);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- return tTileEntity != null ? tTileEntity.receiveClientEvent(aData1, aData2) : false;
- }
-
- @Override
- public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List outputAABB, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- ((IGregTechTileEntity) tTileEntity).addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
- return;
- }
- super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider);
- }
-
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- return ((IGregTechTileEntity) tTileEntity).getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
- return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- }
-
- @Override
- public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getMetaTileEntity() != null)) {
- ((IGregTechTileEntity) tTileEntity).onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
- return;
- }
- super.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
- }
-
- @Override //TODO
- @SideOnly(Side.CLIENT) //TODO
- public void registerBlockIcons(IIconRegister aIconRegister) {
- if (GregTech_API.sPostloadFinished) {
- Utils.LOG_INFO("Setting up Icon Register for Blocks");
- Meta_GT_Proxy.sBlockIcons = aIconRegister;
-
- Utils.LOG_INFO("Registering MetaTileEntity specific Textures");
- for (IMetaTileEntity tMetaTileEntity : Meta_GT_Proxy.METATILEENTITIES) {
- try {
- if (tMetaTileEntity != null) {
- tMetaTileEntity.registerIcons(aIconRegister);
- }
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- }
-
- Utils.LOG_INFO("Starting Block Icon Load Phase");
- System.out.println("Starting Block Icon Load Phase");
- for (Runnable tRunnable : Meta_GT_Proxy.GT_BlockIconload) {
- try {
- tRunnable.run();
- } catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
- }
- Utils.LOG_INFO("Finished Block Icon Load Phase");
- System.out.println("Finished Block Icon Load Phase");
- }
- }
-
- @Override
- public float getBlockHardness(World aWorld, int aX, int aY, int aZ) {
- return super.getBlockHardness(aWorld, aX, aY, aZ);
- }
-
- @Override
- public float getPlayerRelativeBlockHardness(EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (((tTileEntity instanceof BaseMetaTileEntityEx)) && (((BaseMetaTileEntityEx) tTileEntity).privateAccess()) && (!((BaseMetaTileEntityEx) tTileEntity).playerOwnsThis(aPlayer, true))) {
- return -1.0F;
- }
- return super.getPlayerRelativeBlockHardness(aPlayer, aWorld, aX, aY, aZ);
- }
-
- @Override
- public boolean onBlockActivated(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer, int aSide, float par1, float par2, float par3) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return false;
- }
- if(aPlayer.isSneaking()){
- ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
- if(tCurrentItem!=null){
- if(!GT_Utility.isStackInList(tCurrentItem, GregTech_API.sScrewdriverList)){
- return false;
- }
- }else {return false;}
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- if (((IGregTechTileEntity) tTileEntity).getTimer() < 50L) {
- return false;
- }
- if ((!aWorld.isRemote) && (!((IGregTechTileEntity) tTileEntity).isUseableByPlayer(aPlayer))) {
- return true;
- }
- return ((IGregTechTileEntity) tTileEntity).onRightclick(aPlayer, (byte) aSide, par1, par2, par3);
- }
- return false;
- }
-
- @Override
- public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) &&
- ((tTileEntity instanceof IGregTechTileEntity))) {
- ((IGregTechTileEntity) tTileEntity).onLeftclick(aPlayer);
- }
- }
-
- @Override
- public int getDamageValue(World aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getMetaTileID();
- }
- return 0;
- }
-
- @Override
- public void onBlockExploded(World aWorld, int aX, int aY, int aZ, Explosion aExplosion) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntityEx)) {
- ((BaseMetaTileEntityEx) tTileEntity).doEnergyExplosion();
- }
- super.onBlockExploded(aWorld, aX, aY, aZ, aExplosion);
- }
-
- @Override
- public void breakBlock(World aWorld, int aX, int aY, int aZ, Block par5, int par6) {
- GregTech_API.causeMachineUpdate(aWorld, aX, aY, aZ);
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- IGregTechTileEntity tGregTechTileEntity = (IGregTechTileEntity) tTileEntity;
- Random tRandom = new Random();
- mTemporaryTileEntity.set(tGregTechTileEntity);
- for (int i = 0; i < tGregTechTileEntity.getSizeInventory(); i++) {
- ItemStack tItem = tGregTechTileEntity.getStackInSlot(i);
- if ((tItem != null) && (tItem.stackSize > 0) && (tGregTechTileEntity.isValidSlot(i))) {
- EntityItem tItemEntity = new EntityItem(aWorld, aX + tRandom.nextFloat() * 0.8F + 0.1F, aY + tRandom.nextFloat() * 0.8F + 0.1F, aZ + tRandom.nextFloat() * 0.8F + 0.1F, new ItemStack(tItem.getItem(), tItem.stackSize, tItem.getItemDamage()));
- if (tItem.hasTagCompound()) {
- tItemEntity.getEntityItem().setTagCompound((NBTTagCompound) tItem.getTagCompound().copy());
- }
- tItemEntity.motionX = (tRandom.nextGaussian() * 0.0500000007450581D);
- tItemEntity.motionY = (tRandom.nextGaussian() * 0.0500000007450581D + 0.2000000029802322D);
- tItemEntity.motionZ = (tRandom.nextGaussian() * 0.0500000007450581D);
- aWorld.spawnEntityInWorld(tItemEntity);
- tItem.stackSize = 0;
- tGregTechTileEntity.setInventorySlotContents(i, null);
- }
- }
- }
- super.breakBlock(aWorld, aX, aY, aZ, par5, par6);
- aWorld.removeTileEntity(aX, aY, aZ);
- }
-
- @Override
- public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getDrops();
- }
- return mTemporaryTileEntity.get() == null ? new ArrayList() : ((IGregTechTileEntity) mTemporaryTileEntity.get()).getDrops();
- }
-
- @Override
- public int getComparatorInputOverride(World aWorld, int aX, int aY, int aZ, int aSide) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getComparatorValue((byte) aSide);
- }
- return 0;
- }
-
- @Override
- public int isProvidingWeakPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
- return 0;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
- }
- return 0;
- }
-
- @Override
- public int isProvidingStrongPower(IBlockAccess aWorld, int aX, int aY, int aZ, int aSide) {
- if ((aSide < 0) || (aSide > 5)) {
- return 0;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getStrongOutputRedstoneSignal(GT_Utility.getOppositeSide(aSide));
- }
- return 0;
- }
-
- @Override
- public void dropBlockAsItemWithChance(World aWorld, int aX, int aY, int aZ, int par5, float chance, int par7) {
- if (!aWorld.isRemote) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && (chance < 1.0F)) {
- if (((tTileEntity instanceof BaseMetaTileEntityEx)) && (GregTech_API.sMachineNonWrenchExplosions)) {
- ((BaseMetaTileEntityEx) tTileEntity).doEnergyExplosion();
- }
- } else {
- super.dropBlockAsItemWithChance(aWorld, aX, aY, aZ, par5, chance, par7);
- }
- }
- }
-
- @Override
- public boolean isSideSolid(IBlockAccess aWorld, int aX, int aY, int aZ, ForgeDirection aSide) {
- if (aWorld.getBlockMetadata(aX, aY, aZ) == 0) {
- return true;
- }
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity != null) {
- if ((tTileEntity instanceof BaseMetaTileEntityEx)) {
- return true;
- }
- if (((tTileEntity instanceof BaseMetaPipeEntity)) && ((((BaseMetaPipeEntity) tTileEntity).mConnections & 0xFFFFFFC0) != 0)) {
- return true;
- }
- if (((tTileEntity instanceof ICoverable)) && (((ICoverable) tTileEntity).getCoverIDAtSide((byte) aSide.ordinal()) != 0)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public int getLightOpacity(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return 0;
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- return ((IGregTechTileEntity) tTileEntity).getLightOpacity();
- }
- return aWorld.getBlockMetadata(aX, aY, aZ) == 0 ? 255 : 0;
- }
-
- @Override
- public int getLightValue(IBlockAccess aWorld, int aX, int aY, int aZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntityEx)) {
- return ((BaseMetaTileEntityEx) tTileEntity).getLightValue();
- }
- return 0;
- }
-
- @Override //TODO
- public TileEntity createTileEntity(World aWorld, int aMeta) {
- if (aMeta < 4) {
- return Meta_GT_Proxy.constructBaseMetaTileEntity();
- }
- return new BaseMetaPipeEntity();
- }
-
- @Override
- public float getExplosionResistance(Entity par1Entity, World aWorld, int aX, int aY, int aZ, double explosionX, double explosionY, double explosionZ) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity != null) && ((tTileEntity instanceof IGregTechTileEntity))) {
- return ((IGregTechTileEntity) tTileEntity).getBlastResistance((byte) 6);
- }
- return 10.0F;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
- for (int i = 1; i < Meta_GT_Proxy.METATILEENTITIES.length; i++) {
- if (Meta_GT_Proxy.METATILEENTITIES[i] != null) {
- par3List.add(new ItemStack(par1, 1, i));
- }
- }
- }
-
- @Override
- public void onBlockPlacedBy(World aWorld, int aX, int aY, int aZ, EntityLivingBase aPlayer, ItemStack aStack) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if (tTileEntity == null) {
- return;
- }
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- IGregTechTileEntity var6 = (IGregTechTileEntity) tTileEntity;
- if (aPlayer == null) {
- var6.setFrontFacing((byte) 1);
- } else {
- int var7 = MathHelper.floor_double(aPlayer.rotationYaw * 4.0F / 360.0F + 0.5D) & 0x3;
- int var8 = Math.round(aPlayer.rotationPitch);
- if ((var8 >= 65) && (var6.isValidFacing((byte) 1))) {
- var6.setFrontFacing((byte) 1);
- } else if ((var8 <= -65) && (var6.isValidFacing((byte) 0))) {
- var6.setFrontFacing((byte) 0);
- } else {
- switch (var7) {
- case 0:
- var6.setFrontFacing((byte) 2);
- break;
- case 1:
- var6.setFrontFacing((byte) 5);
- break;
- case 2:
- var6.setFrontFacing((byte) 3);
- break;
- case 3:
- var6.setFrontFacing((byte) 4);
- }
- }
- }
- }
- }
-
- @Override
- public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aX, int aY, int aZ, int aLogLevel) {
- TileEntity tTileEntity = aPlayer.worldObj.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof BaseMetaTileEntityEx)) {
- return ((BaseMetaTileEntityEx) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
- }
- if ((tTileEntity instanceof BaseMetaPipeEntity)) {
- return ((BaseMetaPipeEntity) tTileEntity).getDebugInfo(aPlayer, aLogLevel);
- }
- return null;
- }
-
- @Override
- public boolean recolourBlock(World aWorld, int aX, int aY, int aZ, ForgeDirection aSide, int aColor) {
- TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ);
- if ((tTileEntity instanceof IGregTechTileEntity)) {
- if (((IGregTechTileEntity) tTileEntity).getColorization() == (byte) ((aColor ^ 0xFFFFFFFF) & 0xF)) {
- return false;
- }
- ((IGregTechTileEntity) tTileEntity).setColorization((byte) ((aColor ^ 0xFFFFFFFF) & 0xF));
- return true;
- }
- return false;
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java
deleted file mode 100644
index b150ea32cb..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java
+++ /dev/null
@@ -1,555 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_AdvancedWorkbench;
-import gtPlusPlus.xmod.gregtech.api.gui.GUI_AdvancedWorkbench;
-
-import java.util.ArrayList;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.nbt.NBTTagList;
-import net.minecraftforge.fluids.FluidStack;
-
-public class GT_MetaTileEntity_AdvancedCraftingTable
-extends GT_MetaTileEntity_BasicTank
-{
- public boolean mFlushMode = false;
-
- public GT_MetaTileEntity_AdvancedCraftingTable(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "WorkBench pro noSc0pe");
- }
-
- public GT_MetaTileEntity_AdvancedCraftingTable(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- Utils.LOG_INFO("Right Click on Block");
- if (aBaseMetaTileEntity.isClientSide()){
- Utils.LOG_INFO("MTE is ClientSide");
- return true;
- }
- Utils.LOG_INFO("MTE is not ClientSide");
- aBaseMetaTileEntity.openGUI(aPlayer);
- Utils.LOG_INFO("MTE is now has an open GUI");
- return true;
- }
-
- @Override
- public String[] getInfoData() {
-
- if (mFluid == null) {
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Workbench",
- "Stored Fluid:",
- "No Fluid",
- Integer.toString(0) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Workbench",
- "Stored Fluid:",
- mFluid.getLocalizedName(),
- Integer.toString(mFluid.amount) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L");
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- }
-
- @Override
- public boolean isTransformerUpgradable()
- {
- return true;
- }
-
- public boolean isBatteryUpgradable()
- {
- return true;
- }
-
- @Override
- public boolean isSimpleMachine()
- {
- return true;
- }
-
- @Override
- public boolean isValidSlot(int aIndex)
- {
- return (aIndex < 31) || (aIndex > 32);
- }
-
- @Override
- public boolean isFacingValid(byte aFacing)
- {
- return true;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer)
- {
- return true;
- }
-
- @Override
- public boolean isEnetInput()
- {
- return true;
- }
-
- @Override
- public boolean isInputFacing(byte aSide)
- {
- return true;
- }
-
- @Override
- public long maxEUInput()
- {
- return 128;
- }
-
- @Override
- public long maxEUStore()
- {
- return 128000;
- }
-
- public int getInvSize()
- {
- return 35;
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_AdvancedCraftingTable(mName, mTier, mDescription, mTextures);
- }
-
- public void onRightclick(EntityPlayer aPlayer)
- {
- getBaseMetaTileEntity().openGUI(aPlayer, 160);
- }
-
- public void onFirstTick()
- {
- getCraftingOutput();
- }
-
- @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;
- }
-
- public void onPostTick()
- {
- if (getBaseMetaTileEntity().isServerSide())
- {
- if (getBaseMetaTileEntity().hasInventoryBeenModified()) {
- getCraftingOutput();
- }
- fillLiquidContainers();
- if (this.mFlushMode)
- {
- this.mFlushMode = false;
- for (byte i = 21; i < 30; i = (byte)(i + 1)) {
- if (this.mInventory[i] != null) {
- if (this.mInventory[i].stackSize == 0)
- {
- this.mInventory[i] = null;
- }
- else
- {
- this.mFlushMode = true;
- break;
- }
- }
- }
- }
- }
- }
-
- public void sortIntoTheInputSlots()
- {
- for (byte i = 21; i < 30; i = (byte)(i + 1)) {
- if (this.mInventory[i] != null)
- {
- if (this.mInventory[i].stackSize == 0) {
- this.mInventory[i] = null;
- }
- if (this.mInventory[i] != null) {
- for (byte j = 0; j < 16; j = (byte)(j + 1)) {
- if (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])) {
- GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte)64, (byte)1, (byte)64, (byte)1);
- }
- }
- }
- if (this.mInventory[i] != null) {
- for (byte j = 0; j < 16; j = (byte)(j + 1)) {
- if (this.mInventory[j] == null) {
- GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte)64, (byte)1, (byte)64, (byte)1);
- }
- }
- }
- }
- }
- }
-
- private void fillLiquidContainers()
- {
- for (byte i = 16; (i < 21) && (this.mFluid != null); i = (byte)(i + 1))
- {
- ItemStack tOutput = GT_Utility.fillFluidContainer(this.mFluid, this.mInventory[i], true, true);
- if (tOutput != null)
- {
- if (this.mInventory[i].stackSize == 1)
- {
- this.mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount * tOutput.stackSize;
- this.mInventory[i] = tOutput;
- }
- else
- {
- for (byte j = 16; j < 21; j = (byte)(j + 1)) {
- if ((this.mInventory[j] == null) || ((GT_Utility.areStacksEqual(tOutput, this.mInventory[j])) && (this.mInventory[j].stackSize + tOutput.stackSize <= tOutput.getMaxStackSize())))
- {
- this.mFluid.amount -= GT_Utility.getFluidForFilledItem(tOutput, true).amount * tOutput.stackSize;
- getBaseMetaTileEntity().decrStackSize(i, 1);
- if (this.mInventory[j] == null)
- {
- this.mInventory[j] = tOutput; break;
- }
- this.mInventory[j].stackSize += 1;
-
- break;
- }
- }
- }
- if ((this.mFluid != null) && (this.mFluid.amount <= 0)) {
- this.mFluid = null;
- }
- }
- }
- if ((this.mFluid != null) && (this.mFluid.amount <= 0)) {
- this.mFluid = null;
- }
- }
-
- public void setBluePrint(ItemStack aStack)
- {
- if (aStack == null) {
- aStack = this.mInventory[30];
- }
- if ((this.mInventory[31] == null) || (aStack == null) /*|| (aStack.itemID != -2)*/ || (aStack.getItemDamage() != 0) || (aStack.stackSize != 1) || (aStack.hasTagCompound())) {
- return;
- }
- NBTTagCompound tNBT = new NBTTagCompound();
- NBTTagList tNBT_ItemList = new NBTTagList();
- for (int i = 0; i < 9; i++)
- {
- ItemStack tStack = this.mInventory[(i + 21)];
- if (tStack != null)
- {
- NBTTagCompound tag = new NBTTagCompound();
- tag.setByte("Slot", (byte)i);
- tStack.writeToNBT(tag);
- tNBT_ItemList.appendTag(tag);
- }
- }
- tNBT.setTag("Inventory", tNBT_ItemList);
- aStack.setTagCompound(tNBT);
- }
-
- public ItemStack getCraftingOutput()
- {
- if ((this.mInventory[30] != null) /*&& (this.mInventory[30].itemID == -2)*/ && (this.mInventory[30].getItemDamage() == 0) && (this.mInventory[30].hasTagCompound()))
- {
- NBTTagCompound tNBT = this.mInventory[30].getTagCompound();
- NBTTagList tNBT_ItemList = tNBT.getTagList("Blueprint", 10); //TODO
- for (int i = 0; (i < tNBT_ItemList.tagCount()) && (i < 9); i++)
- {
- NBTTagCompound tag = (NBTTagCompound)tNBT_ItemList.getCompoundTagAt(i);
- byte slot = tag.getByte("Slot");
- if ((slot >= 0) && (slot < 9) && (this.mInventory[(slot + 21)] == null))
- {
- this.mInventory[(slot + 21)] = GT_Utility.loadItem(tag);
- if (this.mInventory[(slot + 21)] != null) {
- this.mInventory[(slot + 21)].stackSize = 0;
- }
- }
- }
- }
- this.mInventory[31] = GT_ModHandler.getAllRecipeOutput(getBaseMetaTileEntity().getWorld(), new ItemStack[] { this.mInventory[21], this.mInventory[22], this.mInventory[23], this.mInventory[24], this.mInventory[25], this.mInventory[26], this.mInventory[27], this.mInventory[28], this.mInventory[29] });
- return this.mInventory[31];
- }
-
- public boolean canDoCraftingOutput()
- {
- if (this.mInventory[31] == null) {
- return false;
- }
- for (ItemStack tStack : recipeContent()) {
- if (tStack.stackSize > getAmountOf(tStack)) {
- return false;
- }
- }
- return true;
- }
-
- private int getAmountOf(ItemStack aStack)
- {
- int tAmount = 0;
- for (byte i = 0; (i < 30) && (tAmount < 9); i = (byte)(i + 1)) {
- if (GT_Utility.areStacksOrToolsEqual(aStack, this.mInventory[i])) {
- tAmount += this.mInventory[i].stackSize;
- }
- }
- return tAmount;
- }
-
- private ArrayList<ItemStack> recipeContent()
- {
- ArrayList<ItemStack> tList = new ArrayList();
- for (byte i = 21; i < 30; i = (byte)(i + 1)) {
- if (this.mInventory[i] != null)
- {
- boolean temp = false;
- for (byte j = 0; j < tList.size(); j = (byte)(j + 1)) {
- if (GT_Utility.areStacksOrToolsEqual(this.mInventory[i], (ItemStack)tList.get(j)))
- {
- ((ItemStack)tList.get(j)).stackSize += 1;
- temp = true;
- break;
- }
- }
- if (!temp) {
- tList.add(GT_Utility.copyAmount(1L, new Object[] { this.mInventory[i] }));
- }
- }
- }
- return tList;
- }
-
- public ItemStack consumeMaterials(EntityPlayer aPlayer, ItemStack aHoldStack)
- {
- if (this.mInventory[31] == null) {
- return aHoldStack;
- }
- if (aHoldStack != null)
- {
- if (!GT_Utility.areStacksEqual(aHoldStack, this.mInventory[31])) {
- return aHoldStack;
- }
- if (aHoldStack.stackSize + this.mInventory[31].stackSize > aHoldStack.getMaxStackSize()) {
- return aHoldStack;
- }
- }
- for (byte i = 21; i < 30; i = (byte)(i + 1)) {
- if (this.mInventory[i] != null) {
- for (byte j = 0; j <= i; j = (byte)(j + 1)) {
- if (((j < 21) || (j == i)) &&
- (GT_Utility.areStacksOrToolsEqual(this.mInventory[i], this.mInventory[j])) && (this.mInventory[j].stackSize > 0))
- {
- ItemStack tStack = GT_Utility.getContainerItem(this.mInventory[j], true);
- if ((tStack == null) || ((tStack.isItemStackDamageable()) && (tStack.getItemDamage() >= tStack.getMaxDamage())))
- {
- getBaseMetaTileEntity().decrStackSize(j, 1); break;
- }
- if (this.mInventory[j].stackSize == 1)
- {
- this.mInventory[j] = tStack; break;
- }
- getBaseMetaTileEntity().decrStackSize(j, 1);
- for (byte k = 0; k < 21; k = (byte)(k + 1))
- {
- if (this.mInventory[k] == null)
- {
- this.mInventory[k] = tStack;
- break;
- }
- if ((GT_Utility.areStacksEqual(tStack, this.mInventory[k])) &&
- (tStack.stackSize + this.mInventory[k].stackSize <= this.mInventory[k].getMaxStackSize()))
- {
- this.mInventory[k].stackSize += tStack.stackSize;
- break;
- }
- }
- break;
- }
- }
- }
- }
- if (aHoldStack == null)
- {
- aHoldStack = GT_Utility.copy(new Object[] { this.mInventory[31] });
- aHoldStack.onCrafting(getBaseMetaTileEntity().getWorld(), aPlayer, this.mInventory[31].stackSize);
- }
- else
- {
- aHoldStack.stackSize += this.mInventory[31].stackSize;
- aHoldStack.onCrafting(getBaseMetaTileEntity().getWorld(), aPlayer, this.mInventory[31].stackSize);
- }
- fillLiquidContainers();
-
- return aHoldStack;
- }
-
- @Override
- public long getInputTier()
- {
- return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage());
- }
-
- @Override
- public long getOutputTier()
- {
- return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage());
- }
-
- @Override
- public int rechargerSlotStartIndex()
- {
- return 16;
- }
-
- @Override
- public int rechargerSlotCount()
- {
- return 5;
- }
-
- public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone)
- {
- if (aSide == 0) {
- return 32;
- }
- if (aSide == 1) {
- return 290;
- }
- if ((aFacing == 0) || (aFacing == 1)) {
- return 222;
- }
- if ((aFacing == 2) || (aFacing == 3)) {
- return 223;
- }
- return 215;
- }
-
- @Override
- public String[] getDescription()
- {
- return new String[]{"For the very large Projects"};
- }
-
- public boolean allowPutStack(int aIndex, byte aSide, ItemStack aStack)
- {
- if (aIndex < 16)
- {
- for (byte i = 0; i < 16; i = (byte)(i + 1)) {
- if (GT_Utility.areStacksOrToolsEqual(aStack, this.mInventory[i])) {
- return aIndex == i;
- }
- }
- return true;
- }
- return false;
- }
-
- public boolean allowPullStack(int aIndex, byte aSide, ItemStack aStack)
- {
- return (aIndex == 33) || ((this.mFlushMode) && (aIndex >= 21) && (aIndex < 30));
- }
-
- @Override
- public int getCapacity()
- {
- return 64000;
- }
-
- @Override
- public int getTankPressure()
- {
- return -100;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new CONTAINER_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GUI_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return aSide == 1 ? new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CRAFTING)} : new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE), new GT_RenderedTexture(Textures.BlockIcons.VOID)};
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java
deleted file mode 100644
index d0f15c5da2..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
-
-import gregtech.api.GregTech_API;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntity;
-import gregtech.api.objects.GT_RenderedTexture;
-import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_BronzeWorkbench;
-import gtPlusPlus.xmod.gregtech.api.gui.GUI_BronzeWorkbench;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.InventoryPlayer;
-
-public class GT_MetaTileEntity_BronzeCraftingTable
-extends GT_MetaTileEntity_AdvancedCraftingTable
-{
- public GT_MetaTileEntity_BronzeCraftingTable(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier);
- }
-
- public GT_MetaTileEntity_BronzeCraftingTable(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aDescription, aTextures);
- }
- @Override
- public boolean isElectric()
- {
- return false;
- }
-
- @Override
- public boolean isPneumatic()
- {
- return false;
- }
-
- @Override
- public boolean isSteampowered()
- {
- return false;
- }
-
- @Override
- public boolean isTransformerUpgradable()
- {
- return false;
- }
-
- @Override
- public boolean isBatteryUpgradable()
- {
- return false;
- }
-
- @Override
- public boolean isEnetInput()
- {
- return false;
- }
-
- @Override
- public boolean isInputFacing(byte aSide)
- {
- return false;
- }
-
- @Override
- public long maxEUInput()
- {
- return 0;
- }
-
- @Override
- public long maxEUStore()
- {
- return 0;
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_BronzeCraftingTable(mName, mTier, mDescription, mTextures);
- }
-
- @Override
- public void onRightclick(EntityPlayer aPlayer)
- {
- getBaseMetaTileEntity().openGUI(aPlayer, 161);
- }
-
- @SuppressWarnings({ "static-method", "unused" })
- public boolean allowCoverOnSide(byte aSide, int aCoverID)
- {
- return GregTech_API.getCoverBehavior(aCoverID).isSimpleCover();
- }
-
- @Override
- public int rechargerSlotStartIndex()
- {
- return 0;
- }
-
- @Override
- public int rechargerSlotCount()
- {
- return 0;
- }
-
- @Override
- public int getTextureIndex(byte aSide, byte aFacing, boolean aActive, boolean aRedstone)
- {
- if (aSide == 0) {
- return 315;
- }
- if (aSide == 1) {
- return 317;
- }
- if ((aFacing == 0) || (aFacing == 1)) {
- return 318;
- }
- if ((aFacing == 2) || (aFacing == 3)) {
- return 319;
- }
- return 320;
- }
-
- @Override
- public String[] getDescription()
- {
- return new String[] {"For the smaller Projects"};
- }
-
- @Override
- public int getCapacity()
- {
- return 16000;
- }
-
- @Override
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new CONTAINER_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GUI_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return aSide == 1 ? new ITexture[]{ new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CRAFTING)} : new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZE_SIDE), new GT_RenderedTexture(Textures.BlockIcons.VOID)};
- }
-}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
index b0ea5cff3c..0c9a113070 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java
@@ -7,192 +7,179 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank;
import gregtech.api.objects.GT_RenderedTexture;
-import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.fluid.FluidUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
-public class GT_MetaTileEntity_TieredTank
- extends GT_MetaTileEntity_BasicTank {
-
- private NBTTagCompound mRecipeStuff = new NBTTagCompound();
-
- /*protected String fluidName = getFluidName();
- protected int fluidAmount = getInternalFluidAmount();*/
-
- /*private String getFluidName(){
- String x;
- if (internalTank != null){
- x = internalTank.getFluid().getName();
+public class GT_MetaTileEntity_TieredTank extends GT_MetaTileEntity_BasicTank {
+
+ private NBTTagCompound mRecipeStuff = new NBTTagCompound();
+ private String thisName = "";
+ private int thisAmount = 0;
+
+ public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid");
+ }
+
+ public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ NBTTagCompound dRecipeStuff = this.mRecipeStuff;
+ if (dRecipeStuff != null){
+ this.thisName = dRecipeStuff.getString("xFluidName");
+ this.thisAmount = dRecipeStuff.getInteger("xFluidAmount");
+ if (this.thisName.equals("")){
+ this.thisName = "Empty";
+ }
+ if (this.thisName == "Empty" && this.thisAmount == 0){
+ //Do Nothing
+ }
+ else {
+ return new String[] {mDescription, "Stored Fluid: "+this.thisName, "Stored Amount: "+this.thisAmount+"l", CORE.GT_Tooltip};
+ }
}
- else {
- x = "null";
+ return new String[] {mDescription, CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return new ITexture[0][0][0];
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)};
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ //Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L");
+ if (mFluid != null){
+ aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
+ mRecipeStuff.setString("xFluidName", mFluid.getFluid().getName());
+ mRecipeStuff.setInteger("xFluidAmount", mFluid.amount);
+ aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
+ this.thisName = mRecipeStuff.getString("xFluidName");
+ this.thisAmount = mRecipeStuff.getInteger("xFluidAmount");
}
- return x;
+
+
+
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
+ this.thisName = mRecipeStuff.getString("xFluidName");
+ this.thisAmount = mRecipeStuff.getInteger("xFluidAmount");
+ //mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
+ mFluid = FluidUtils.getFluidStack(mRecipeStuff.getString("xFluidName"), mRecipeStuff.getInteger("xFluidAmount"));
}
-
- private int getInternalFluidAmount(){
- int x;
- if (internalTank != null){
- x = internalTank.amount;
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()){
+ return true;
}
- else {
- x = 0;
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public final byte getUpdateData() {
+ return 0x00;
+ }
+
+ @Override
+ public boolean doesFillContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean doesEmptyContainers() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeFilled() {
+ return true;
+ }
+
+ @Override
+ public boolean canTankBeEmptied() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysItemStack() {
+ return true;
+ }
+
+ @Override
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ @Override
+ public String[] getInfoData() {
+
+ if (mFluid == null) {
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ "No Fluid",
+ Integer.toString(0) + "L",
+ Integer.toString(getCapacity()) + "L"};
}
- return x;
- }*/
-
- public GT_MetaTileEntity_TieredTank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid");
- }
-
- public GT_MetaTileEntity_TieredTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)};
- }
-
- /* @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- }*/
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L");
- if (mFluid != null){
- aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- mRecipeStuff.setString("xFluidName", mFluid.getFluid().getName());
- mRecipeStuff.setInteger("xFluidAmount", mFluid.amount);
- aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
- }
-
-
-
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mRecipeStuff = aNBT.getCompoundTag("GT.CraftingComponents");
- //mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- mFluid = FluidUtils.getFluidStack(mRecipeStuff.getString("xFluidName"), mRecipeStuff.getInteger("xFluidAmount"));
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- Utils.LOG_INFO("Right Click on Block");
- if (aBaseMetaTileEntity.isClientSide()){
- Utils.LOG_INFO("MTE is ClientSide");
- return true;
- }
- Utils.LOG_INFO("MTE is not ClientSide");
- aBaseMetaTileEntity.openGUI(aPlayer);
- Utils.LOG_INFO("MTE is now has an open GUI");
- return true;
- }
-
- @Override
- public boolean isSimpleMachine() {
- return true;
- }
-
- @Override
- public boolean isFacingValid(byte aFacing) {
- return true;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public final byte getUpdateData() {
- return 0x00;
- }
-
- @Override
- public boolean doesFillContainers() {
- return true;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return true;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public String[] getInfoData() {
-
- if (mFluid == null) {
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
- "Stored Fluid:",
- "No Fluid",
- Integer.toString(0) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
- "Stored Fluid:",
- mFluid.getLocalizedName(),
- Integer.toString(mFluid.amount) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures);
- }
-
- @Override
- public int getCapacity() {
- return (int) (Math.pow(2, mTier) * 32000);
- }
-
- @Override
- public int getTankPressure() {
- return 100;
- }
+ return new String[]{
+ GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
+ "Stored Fluid:",
+ mFluid.getLocalizedName(),
+ Integer.toString(mFluid.amount) + "L",
+ Integer.toString(getCapacity()) + "L"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TieredTank(mName, mTier, mDescription, mTextures);
+ }
+
+ @Override
+ public int getCapacity() {
+ this.thisName = mRecipeStuff.getString("xFluidName");
+ this.thisAmount = mRecipeStuff.getInteger("xFluidAmount");
+ return (int) (Math.pow(2, mTier) * 32000);
+ }
+
+ @Override
+ public int getTankPressure() {
+ return 100;
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java
deleted file mode 100644
index 77787cd2bf..0000000000
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_NBT_Tank.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
-
-import gregtech.api.enums.GT_Values;
-import gregtech.api.enums.Textures;
-import gregtech.api.interfaces.ITexture;
-import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.MetaTileEntityEx;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTankEx;
-import gregtech.api.objects.GT_RenderedTexture;
-import gtPlusPlus.core.util.Utils;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraftforge.fluids.FluidStack;
-
-public class GT_NBT_Tank
- extends GT_MetaTileEntity_BasicTankEx {
-
-
- /*protected String fluidName = getFluidName();
- protected int fluidAmount = getInternalFluidAmount();*/
-
- /*private String getFluidName(){
- String x;
- if (internalTank != null){
- x = internalTank.getFluid().getName();
- }
- else {
- x = "null";
- }
- return x;
- }
-
- private int getInternalFluidAmount(){
- int x;
- if (internalTank != null){
- x = internalTank.amount;
- }
- else {
- x = 0;
- }
- return x;
- }*/
-
- public GT_NBT_Tank(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Stores " + ((int) (Math.pow(2, aTier) * 32000)) + "L of fluid");
- }
-
- public GT_NBT_Tank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 3, aDescription, aTextures);
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- return new ITexture[0][0][0];
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER)};
- }
-
- /* @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- }*/
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- Utils.LOG_INFO("Dumping Fluid data. Name: "+mFluid.getFluid().getName()+" Amount: "+mFluid.amount+"L");
- if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound()));
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"));
- }
-
- @Override
- public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
- Utils.LOG_INFO("Right Click on Block");
- if (aBaseMetaTileEntity.isClientSide()){
- Utils.LOG_INFO("MTE is ClientSide");
- return true;
- }
- Utils.LOG_INFO("MTE is not ClientSide");
- aBaseMetaTileEntity.openGUI(aPlayer);
- Utils.LOG_INFO("MTE is now has an open GUI");
- return true;
- }
-
- @Override
- public boolean isSimpleMachine() {
- return true;
- }
-
- @Override
- public boolean isFacingValid(byte aFacing) {
- return true;
- }
-
- @Override
- public boolean isAccessAllowed(EntityPlayer aPlayer) {
- return true;
- }
-
- @Override
- public final byte getUpdateData() {
- return 0x00;
- }
-
- @Override
- public boolean doesFillContainers() {
- return true;
- }
-
- @Override
- public boolean doesEmptyContainers() {
- return true;
- }
-
- @Override
- public boolean canTankBeFilled() {
- return true;
- }
-
- @Override
- public boolean canTankBeEmptied() {
- return true;
- }
-
- @Override
- public boolean displaysItemStack() {
- return true;
- }
-
- @Override
- public boolean displaysStackSize() {
- return false;
- }
-
- @Override
- public String[] getInfoData() {
-
- if (mFluid == null) {
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
- "Stored Fluid:",
- "No Fluid",
- Integer.toString(0) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
- return new String[]{
- GT_Values.VOLTAGE_NAMES[mTier]+" Fluid Tank",
- "Stored Fluid:",
- mFluid.getLocalizedName(),
- Integer.toString(mFluid.amount) + "L",
- Integer.toString(getCapacity()) + "L"};
- }
-
- @Override
- public boolean isGivingInformation() {
- return true;
- }
-
- @Override
- public MetaTileEntityEx newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_NBT_Tank(mName, mTier, mDescription, mTextures);
- }
-
- @Override
- public int getCapacity() {
- return (int) (Math.pow(2, mTier) * 32000);
- }
-
- @Override
- public int getTankPressure() {
- return 100;
- }
-
- @Override
- public void sendSound(byte aIndex) {
-
- }
-
- @Override
- public void sendLoopStart(byte aIndex) {
-
- }
-
- @Override
- public void sendLoopEnd(byte aIndex) {
-
- }
-
-} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
index 5cda3ac867..8a92d34a8e 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/Gregtech_Blocks.java
@@ -1,6 +1,6 @@
package gtPlusPlus.xmod.gregtech.loaders;
-import gregtech.api.metatileentity.BaseMetaTileEntityEx;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
@@ -26,7 +26,7 @@ public class Gregtech_Blocks {
private static void registerDefailtGtTe(){
Utils.LOG_INFO("Registering new GT TileEntities.");
- BaseMetaTileEntityEx tBaseMetaTileEntity = Meta_GT_Proxy.constructBaseMetaTileEntity();
+ BaseMetaTileEntity tBaseMetaTileEntity = Meta_GT_Proxy.constructBaseMetaTileEntity();
Utils.LOG_INFO("Testing BaseMetaTileEntity.");
if (tBaseMetaTileEntity == null) {
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java
index 3d8f8ce61c..0b71b612f4 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java
@@ -5,8 +5,6 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator;
import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal;
-import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable;
-import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable;
public class Gregtech4Content
{
@@ -24,8 +22,8 @@ public class Gregtech4Content
private static void workbenches(){
//Gregtech 4 Workbenches
Utils.LOG_INFO("Gregtech 4 Content | Registering Workbenches.");
- GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L));
- GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L));
+ //Free //GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L));
+ //Free //GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L));
}
private static void tesseracts(){
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java
index 690ebcc0ec..d18e12a519 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java
@@ -4,22 +4,19 @@ import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList;
import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredTank;
-import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_NBT_Tank;
public class GregtechTieredFluidTanks
{
public static void run()
{
if (LoadedMods.Gregtech){
- Utils.LOG_INFO("Gregtech5u Content | Registering Fluid Tanks.");
+ Utils.LOG_INFO("Gregtech5u Content | Registering Portable Fluid Tanks.");
run1();
- //run2();
}
}
- private static void run1()
- {
+ private static void run1() {
int ID = 817;
GregtechItemList.GT_FluidTank_ULV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.00", "Ultra Low Voltage Fluid Tank", 0).getStackForm(1L));
GregtechItemList.GT_FluidTank_LV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.01", "Low Voltage Fluid Tank", 1).getStackForm(1L));
@@ -32,21 +29,4 @@ public class GregtechTieredFluidTanks
GregtechItemList.GT_FluidTank_UV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.08", "Ultimate Voltage Fluid Tank", 8).getStackForm(1L));
GregtechItemList.GT_FluidTank_MAX.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L));
}
-
- private static void run2()
- {
- int ID = 900;
- GregtechItemList.GT_FluidTank_ULV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.00", "Ultra Low Voltage Fluid Tank", 0).getStackForm(1L));
- GregtechItemList.GT_FluidTank_LV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.01", "Low Voltage Fluid Tank", 1).getStackForm(1L));
- GregtechItemList.GT_FluidTank_MV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.02", "Medium Voltage Fluid Tank", 2).getStackForm(1L));
- GregtechItemList.GT_FluidTank_HV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.03", "High Voltage Fluid Tank", 3).getStackForm(1L));
- GregtechItemList.GT_FluidTank_EV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.04", "Extreme Voltage Fluid Tank", 4).getStackForm(1L));
- GregtechItemList.GT_FluidTank_IV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.05", "Insane Voltage Fluid Tank", 5).getStackForm(1L));
- GregtechItemList.GT_FluidTank_LuV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.06", "Ludicrous Voltage Fluid Tank", 6).getStackForm(1L));
- GregtechItemList.GT_FluidTank_ZPM.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.07", "ZPM Voltage Fluid Tank", 7).getStackForm(1L));
- GregtechItemList.GT_FluidTank_UV.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.08", "Ultimate Voltage Fluid Tank", 8).getStackForm(1L));
- GregtechItemList.GT_FluidTank_MAX.set(new GT_NBT_Tank(ID++, "fluidtankEx.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L));
-
-
- }
}