aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-18 15:27:09 +0100
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-10-18 15:27:09 +0100
commitf53caf47183769b5c39f65c3715715889db11718 (patch)
tree3dacc355a71c362d7ee9f266b9dc868fa4662cd3 /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
parent734e7a1498ef6ca48f95f075aaa66372639c9618 (diff)
downloadGT5-Unofficial-f53caf47183769b5c39f65c3715715889db11718.tar.gz
GT5-Unofficial-f53caf47183769b5c39f65c3715715889db11718.tar.bz2
GT5-Unofficial-f53caf47183769b5c39f65c3715715889db11718.zip
+ Added basework for XL Turbines.
$ Fixed issue where hatches/busses could be counted multiple times on multiblock structure checks. I now add them to a set as opposed to an arraylist.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java315
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java214
2 files changed, 463 insertions, 66 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
new file mode 100644
index 0000000000..d022bb60ce
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
@@ -0,0 +1,315 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import gregtech.api.GregTech_API;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.CONTAINER_1by1_Turbine;
+import gtPlusPlus.xmod.gregtech.api.gui.hatches.GUI_1by1_Turbine;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler;
+import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GregtechMetaTileEntity_LargerTurbineBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+
+public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
+
+ public boolean mHasController = false;
+ public boolean mUsingAnimation = true;
+ private String mControllerLocation;
+
+ public GT_MetaTileEntity_Hatch_Turbine(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 16, new String[]{
+ "Turbine Rotor holder for XL Turbines"});
+ }
+
+ public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 1, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 1, aDescription, aTextures);
+ }
+
+ @Override
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, getFrontFacingTurbineTexture()};
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[]{aBaseTexture, getFrontFacingTurbineTexture()};
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return aFacing > 1;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return false;
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Hatch_Turbine(mName, mTier, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide()) return true;
+ //aBaseMetaTileEntity.openGUI(aPlayer);
+ PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Using Animations? "+usingAnimations());
+ PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Has Controller? "+this.mHasController);
+ if (mHasController) {
+ PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Controller Location: "+BlockPos.generateBlockPos(mControllerLocation).getLocationString());
+ PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Controller Active? "+this.isControllerActive());
+ }
+ PlayerUtils.messagePlayer(aPlayer, "[Turbine Assembly Data] Is Active? "+this.getBaseMetaTileEntity().isActive());
+ return true;
+ }
+
+ @Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ default:
+ return new CONTAINER_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity);
+ }
+ }
+
+ @Override
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mTier) {
+ default:
+ return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Rotor Hatch");
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("mHasController", mHasController);
+ aNBT.setBoolean("mUsingAnimation", mUsingAnimation);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ mHasController = aNBT.getBoolean("mHasController");
+ mUsingAnimation = aNBT.getBoolean("mUsingAnimation");
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ);
+ this.mUsingAnimation = Utils.invertBoolean(mUsingAnimation);
+ if (this.mUsingAnimation) {
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Has Controller: "+this.mHasController);
+ if (mHasController) {
+ PlayerUtils.messagePlayer(aPlayer, "Controller Location: "+this.mControllerLocation);
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.mHasController) {
+ if (aTick % 20 == 0) {
+ if (isControllerActive()) {
+ this.getBaseMetaTileEntity().setActive(true);
+ }
+ else {
+ this.getBaseMetaTileEntity().setActive(false);
+ }
+ }
+ }
+ else if (!this.mHasController && this.mControllerLocation != null) {
+ //Weird Invalid State
+ if (setController(BlockPos.generateBlockPos(mControllerLocation))) {
+ //Valid
+ }
+ }
+ else {
+ //No Controller
+ }
+ }
+
+ public boolean isControllerActive() {
+ GregtechMetaTileEntity_LargerTurbineBase x = getController();
+ if (x != null) {
+ Logger.INFO("Checking Status of Controller.");
+ return x.isMachineRunning();
+ }
+ Logger.INFO("Status of Controller failed, controller is null.");
+ return false;
+ }
+
+ public GregtechMetaTileEntity_LargerTurbineBase getController() {
+ if (this.mHasController && this.mControllerLocation != null && this.mControllerLocation.length() > 0) {
+ BlockPos p = BlockPos.generateBlockPos(mControllerLocation);
+ if (p != null) {
+ //Logger.INFO(p.getLocationString());
+ IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos,
+ p.zPos);
+ if (tTileEntity != null && tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_LargerTurbineBase) {
+ return (GregtechMetaTileEntity_LargerTurbineBase) tTileEntity.getMetaTileEntity();
+ }
+ else {
+ if (tTileEntity == null) {
+ Logger.INFO("Controller MTE is null, somehow?");
+ }
+ else {
+ Logger.INFO("Controller is a different MTE to expected");
+ }
+ }
+ }
+ }
+ //Logger.INFO("Failed to Get Controller.");
+ return null;
+ }
+
+ public boolean canSetNewController() {
+ if ((mControllerLocation != null && mControllerLocation.length() > 0) || this.mHasController) {
+ return false;
+ }
+ return true;
+ }
+
+ public boolean setController(BlockPos aPos) {
+ clearController();
+ if (canSetNewController()) {
+ mControllerLocation = aPos.getUniqueIdentifier();
+ mHasController = true;
+ Logger.INFO("Successfully injected controller into this Turbine Assembly Hatch.");
+ }
+ return mHasController;
+ }
+
+ public void clearController() {
+ this.mControllerLocation = null;
+ this.mHasController = false;
+ }
+
+ public boolean usingAnimations() {
+ return mUsingAnimation;
+ }
+
+ private ITexture getFrontFacingTurbineTexture() {
+ if (!mHasController) {
+ return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LargeTurbineTextureHandler.frontFaceHPActive_4) : new GT_RenderedTexture(LargeTurbineTextureHandler.frontFace_4 );
+ }
+ else {
+ if (usingAnimations()) {
+ if (isControllerActive()) {
+ return getController().frontFaceActive;
+ }
+ }
+ return getController().frontFace;
+ }
+ }
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 0;
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int aIndex, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(int aSide) {
+ return new int[] {};
+ }
+
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ return false;
+ }
+
+ @Override
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
+ // TODO Auto-generated method stub
+ return super.onWrenchRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ);
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
+ //Do Super
+ boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ // Do Things
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem != null) {
+ if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) {
+ if (mControllerLocation != null && mControllerLocation.length() > 0) {
+ if (setController(BlockPos.generateBlockPos(mControllerLocation))) {
+ if (GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
+ String tChat = "Trying to Reset linked Controller";
+ IGregTechTileEntity g = this.getBaseMetaTileEntity();
+ GT_Utility.sendChatToPlayer(aPlayer, tChat);
+ GT_Utility.sendSoundToPlayers(g.getWorld(), GregTech_API.sSoundList.get(101), 1.0F, -1,
+ g.getXCoord(), g.getYCoord(), g.getZCoord());
+ }
+ }
+ }
+ }
+ }
+ }
+ return aSuper;
+ }
+
+ public void setActive(boolean b) {
+ this.getBaseMetaTileEntity().setActive(b);
+ }
+
+
+
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index c53ad80737..5641ba0c3f 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -22,17 +22,23 @@ import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords;
import gregtech.api.items.GT_MetaGenerated_Tool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
+import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase;
import gregtech.api.objects.GT_ItemStack;
+import gregtech.api.util.GT_ModHandler;
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 gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.recipe.common.CI;
@@ -505,7 +511,12 @@ GT_MetaTileEntity_MultiBlockBase {
}
log("Error generating recipe, returning null.");
return null;
-
+ }
+
+ public boolean isMachineRunning() {
+ boolean aRunning = this.getBaseMetaTileEntity().isActive();
+ Logger.INFO("Queried Multiblock is currently running: "+aRunning);
+ return aRunning;
}
@Override
@@ -638,10 +649,41 @@ GT_MetaTileEntity_MultiBlockBase {
}
return b;
}
+
+
+ public <E> boolean addToMachineListInternal(ArrayList<E> aList, final IMetaTileEntity aTileEntity,
+ final int aBaseCasingIndex) {
+ if (aList.isEmpty()) {
+ if (aTileEntity instanceof GT_MetaTileEntity_Hatch) {
+ Logger.INFO("Adding " + aTileEntity.getInventoryName() + " at " + new BlockPos(aTileEntity.getBaseMetaTileEntity()).getLocationString());
+ updateTexture(aTileEntity, aBaseCasingIndex);
+ return aList.add((E) aTileEntity);
+ }
+ } else {
+ IGregTechTileEntity aCur = aTileEntity.getBaseMetaTileEntity();
+ BlockPos aCurPos = new BlockPos(aCur);
+ boolean aExists = false;
+ for (E m : aList) {
+ IGregTechTileEntity b = ((IMetaTileEntity) m).getBaseMetaTileEntity();
+ BlockPos aPos = new BlockPos(b);
+ if (b != null && aPos != null) {
+ if (aCurPos.equals(aPos)) {
+ Logger.INFO("Found Duplicate "+b.getInventoryName()+" at " + aPos.getLocationString());
+ return false;
+ }
+ }
+ }
+ if (aTileEntity instanceof GT_MetaTileEntity_Hatch) {
+ Logger.INFO("Adding " + aCur.getInventoryName() + " at " + aCurPos.getLocationString());
+ updateTexture(aTileEntity, aBaseCasingIndex);
+ return aList.add((E) aTileEntity);
+ }
+ }
+ return false;
+ }
@Override
- public boolean addToMachineList(final IGregTechTileEntity aTileEntity,
- final int aBaseCasingIndex) {
+ public boolean addToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
}
@@ -649,65 +691,71 @@ GT_MetaTileEntity_MultiBlockBase {
if (aMetaTileEntity == null) {
return false;
}
-
+
+ //Use this to determine the correct value, then update the hatch texture after.
+ boolean aDidAdd = false;
+
+ //Handle Custom Hustoms
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {
log("Found GT_MetaTileEntity_Hatch_InputBattery");
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mChargeHatches.add(
- (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
+ aDidAdd = addToMachineListInternal(mChargeHatches, aMetaTileEntity, aBaseCasingIndex);
}
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
log("Found GT_MetaTileEntity_Hatch_OutputBattery");
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mDischargeHatches.add(
- (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
+ aDidAdd = addToMachineListInternal(mDischargeHatches, aMetaTileEntity, aBaseCasingIndex);
}
- if (LoadedMods.TecTech){
- if (isThisHatchMultiDynamo(aMetaTileEntity)) {
- log("Found isThisHatchMultiDynamo");
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mMultiDynamoHatches.add(
- (GT_MetaTileEntity_Hatch) aMetaTileEntity);
- }
+
+ //Handle TT Multi-A Dynamos
+ else if (LoadedMods.TecTech && isThisHatchMultiDynamo(aMetaTileEntity)) {
+ log("Found isThisHatchMultiDynamo");
+ aDidAdd = addToMachineListInternal(mMultiDynamoHatches, aMetaTileEntity, aBaseCasingIndex);
+ }
+
+ //Handle Fluid Hatches using seperate logic
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input)
+ aDidAdd = addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output)
+ aDidAdd = addToMachineListInternal(mOutputHatches, aMetaTileEntity, aBaseCasingIndex);
+
+ //Process Remaining hatches using Vanilla GT Logic
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus)
+ aDidAdd = addToMachineListInternal(mInputBusses, aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBus)
+ aDidAdd = addToMachineListInternal(mOutputBusses, aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy)
+ aDidAdd = addToMachineListInternal(mEnergyHatches, aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Dynamo)
+ aDidAdd = addToMachineListInternal(mDynamoHatches, aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance)
+ aDidAdd = addToMachineListInternal(mMaintenanceHatches, aMetaTileEntity, aBaseCasingIndex);
+ else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Muffler)
+ aDidAdd = addToMachineListInternal(mMufflerHatches, aMetaTileEntity, aBaseCasingIndex);
+
+ //return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ return aDidAdd;
+ }
+
+
- }
- return super.addToMachineList(aTileEntity, aBaseCasingIndex);
+ @Override
+ public boolean addMaintenanceToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
}
- public boolean addChargeableToMachineList(final IGregTechTileEntity aTileEntity,
- final int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBattery) {
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mChargeHatches.add(
- (GT_MetaTileEntity_Hatch_InputBattery) aMetaTileEntity);
- }
- return false;
+ @Override
+ public boolean addMufflerToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
}
- public boolean addDischargeableInputToMachineList(
- final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
- if (aTileEntity == null) {
- return false;
- }
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputBattery) {
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mDischargeHatches.add(
- (GT_MetaTileEntity_Hatch_OutputBattery) aMetaTileEntity);
- }
- return false;
+ @Override
+ public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
}
+ @Override
+ public boolean addOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
+ return addToMachineList(aTileEntity, aBaseCasingIndex);
+ }
public boolean addFluidInputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
if (aTileEntity == null) {
@@ -717,25 +765,17 @@ GT_MetaTileEntity_MultiBlockBase {
if (aMetaTileEntity == null) {
return false;
}
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
- updateTexture(aTileEntity, aBaseCasingIndex);
- ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap();
- return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity);
- }
- return false;
+ return addFluidInputToMachineList(aMetaTileEntity, aBaseCasingIndex);
}
- public boolean addFluidOutputToMachineList(final IGregTechTileEntity aTileEntity, final int aBaseCasingIndex) {
+ public boolean addFluidInputToMachineList(final IMetaTileEntity aTileEntity, final int aBaseCasingIndex) {
if (aTileEntity == null) {
return false;
}
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
- if (aMetaTileEntity == null) {
- return false;
- }
- if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) {
- updateTexture(aTileEntity, aBaseCasingIndex);
- return this.mOutputHatches.add((GT_MetaTileEntity_Hatch_Output) aMetaTileEntity);
+ final IMetaTileEntity aMetaTileEntity = aTileEntity;
+ if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) {
+ ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = this.getRecipeMap();
+ return addToMachineListInternal(mInputHatches, aMetaTileEntity, aBaseCasingIndex);
}
return false;
}
@@ -808,9 +848,22 @@ GT_MetaTileEntity_MultiBlockBase {
@SuppressWarnings("deprecation")
public boolean updateTexture(final IGregTechTileEntity aTileEntity, int aCasingID){
+ final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ if (aMetaTileEntity == null) {
+ return false;
+ }
+ return updateTexture(aMetaTileEntity, aCasingID);
+ }
+
+ /**
+ * Enable Texture Casing Support if found in GT 5.09
+ */
+
+ @SuppressWarnings("deprecation")
+ public boolean updateTexture(final IMetaTileEntity aTileEntity, int aCasingID){
try { //gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch.updateTexture(int)
- final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
+ final IMetaTileEntity aMetaTileEntity = aTileEntity;
if (aMetaTileEntity == null) {
return false;
}
@@ -828,7 +881,7 @@ GT_MetaTileEntity_MultiBlockBase {
log("Bad Method Call for updateTexture.");
if (GT_MetaTileEntity_Hatch.class.isInstance(aMetaTileEntity)){
if (aCasingID <= Byte.MAX_VALUE) {
- ((GT_MetaTileEntity_Hatch) aTileEntity.getMetaTileEntity()).mMachineBlock = (byte) aCasingID;
+ ((GT_MetaTileEntity_Hatch) aTileEntity).mMachineBlock = (byte) aCasingID;
log("Good Method Call for updateTexture. Used fallback method of setting mMachineBlock as casing id was <= 128.");
return true;
}
@@ -1120,6 +1173,35 @@ GT_MetaTileEntity_MultiBlockBase {
return mRecipeResult;
}
}
+
+
+
+
+
+
+ /**
+ * Custom Tool Handling
+ */
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
+ //Do Super
+ boolean aSuper = super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ // Do Things
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem != null) {
+ if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSoftHammerList)) {
+
+ }
+ }
+ }
+ return aSuper;
+ }
+
+
+