aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-29 19:15:48 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2022-01-29 19:15:48 +0000
commitc0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1 (patch)
tree2b549b5dfe3f80421ae2d45e041f929ea46d59aa /src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations
parentb926dfb3bc67b74b53749a3e420a8a6ce0fba6a7 (diff)
parent0de849179b344dfddc68393aaa23b3b75b307670 (diff)
downloadGT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.tar.gz
GT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.tar.bz2
GT5-Unofficial-c0da5cc4ea19dfb2a05e64ce09d808b4efdc95b1.zip
Merge branch 'master' of https://github.com/GTNewHorizons/GTplusplus into St00f
# Conflicts: # .gitignore # dependencies.gradle # src/main/java/gtPlusPlus/core/config/ConfigHandler.java # src/main/java/gtPlusPlus/core/item/base/BaseItemComponent.java # src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java # src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java # src/main/resources/assets/miscutils/lang/en_US.lang
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations')
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java70
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java63
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java228
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java36
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java230
6 files changed, 400 insertions, 228 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java
index e6bf4b8486..3821b2a95c 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java
@@ -9,8 +9,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.GT_MetaBase_Item;
import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock;
import ic2.api.item.ElectricItem;
@@ -19,9 +17,10 @@ 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.util.EnumChatFormatting;
public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock {
-
+
public boolean mCharge = false;
public boolean mDecharge = false;
public int mBatteryCount = 0;
@@ -30,53 +29,50 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
private long mStored = 0L;
private long mMax = 0L;
- public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier,
- String aDescription, int aSlotCount) {
+ public GT_MetaTileEntity_BasicBreaker(int aID, String aName, String aNameRegional, int aTier, String aDescription, int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription, new ITexture[0]);
}
- public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures,
- int aSlotCount) {
+ public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, int aSlotCount) {
super(aName, aTier, aSlotCount, aDescription, aTextures);
}
- public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription,
- ITexture[][][] aTextures, int aSlotCount) {
+ public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, int aSlotCount) {
super(aName, aTier, aSlotCount, aDescription, aTextures);
}
public String[] getDescription() {
- String []s1 = super.getDescription();
- s1 = new String[0];
- return s1;
+ final String[] desc = new String[6];
+ int tTier = this.mTier;
+ desc[0] = "" + EnumChatFormatting.BOLD + "16 Fuse Slots";
+ desc[1] = "Per each fuse, you may insert " + EnumChatFormatting.YELLOW + (GT_Values.V[tTier]) + EnumChatFormatting.GRAY + " EU/t";
+ desc[2] = "However this " + EnumChatFormatting.ITALIC + EnumChatFormatting.RED + "MUST" + EnumChatFormatting.GRAY + " be in a single Amp";
+ desc[3] = "This machine can accept upto a single amp of " + GT_Values.VN[Math.min(tTier + 2, 15)] + " as a result";
+ desc[4] = "Breaker Loss: " + EnumChatFormatting.RED + "" + (GT_Values.V[tTier] / 16) + EnumChatFormatting.GRAY + " EU/t";
+ desc[5] = CORE.GT_Tooltip;
+ return desc;
}
public ITexture[][][] getTextureSet(ITexture[] aTextures) {
ITexture[][][] rTextures = new ITexture[2][17][];
for (byte i = -1; i < 16; ++i) {
- rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
- this.mInventory.length > 4
- ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)]
- : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)]};
-
- rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1],
- this.mInventory.length > 4
- ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]
- : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]};
+ rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i
+ + 1], this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)]};
+
+ rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i
+ + 1], this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]};
}
return rTextures;
}
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
- boolean aActive, boolean aRedstone) {
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
}
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_BasicBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures,
- this.mInventory.length);
+ return new GT_MetaTileEntity_BasicBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mInventory.length);
}
public boolean isSimpleMachine() {
@@ -132,11 +128,11 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
}
public long maxAmperesIn() {
- return (long) (1);
+ return 16;
}
public long maxAmperesOut() {
- return (long) 16;
+ return 16;
}
public int rechargerSlotStartIndex() {
@@ -176,7 +172,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
if (aBaseMetaTileEntity.isClientSide()) {
return true;
- } else {
+ }
+ else {
aBaseMetaTileEntity.openGUI(aPlayer);
return true;
}
@@ -199,14 +196,14 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
this.mChargeableCount = 0;
ItemStack[] arg3 = this.mInventory;
int arg4 = arg3.length;
-
+
for (int arg5 = 0; arg5 < arg4; ++arg5) {
ItemStack tStack = arg3[arg5];
if (GT_ModHandler.isElectricItem(tStack, this.mTier)) {
if (GT_ModHandler.isChargerItem(tStack)) {
++this.mBatteryCount;
}
-
+
++this.mChargeableCount;
}
}*/
@@ -254,7 +251,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
tStored += tStep;
}
- } else if (aStack.getItem() instanceof IElectricItem) {
+ }
+ else if (aStack.getItem() instanceof IElectricItem) {
tStored += (long) ElectricItem.manager.getCharge(aStack);
tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack);
}
@@ -273,11 +271,15 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock
return new long[]{tStored, tScale};
}
- public String[] getInfoData() {
- return new String[]{};
+ public String[] getInfoData() {
+ return new String[]{"Tile Type: " + this.getTileEntityBaseType()};
}
public boolean isGivingInformation() {
return true;
}
-} \ No newline at end of file
+
+ public boolean doesExplode() {
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
index a892346463..67a6fc7aeb 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_ElementalDataOrbHolder.java
@@ -2,8 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import java.util.ArrayList;
-import gregtech.api.gui.GT_Container_4by4;
-import gregtech.api.gui.GT_GUIContainer_4by4;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
@@ -11,7 +9,11 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_DataHatch;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_DataHatch;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -22,28 +24,30 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
public GT_Recipe_Map mRecipeMap = null;
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 16, new String[]{
+ super(aID, aName, aNameRegional, aTier, 17, new String[]{
"Holds Data Orbs for the Elemental Duplicator",
+ "Can insert/extract the circuit slot",
+ "Use Circuit to select a slot (1-16)",
CORE.GT_Tooltip
});
}
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 16, aDescription, aTextures);
+ super(aName, aTier, 17, aDescription, aTextures);
}
public GT_MetaTileEntity_Hatch_ElementalDataOrbHolder(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, 16, aDescription, aTextures);
+ super(aName, aTier, 17, aDescription, aTextures);
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Cyber_Interface)};
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)};
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Cyber_Interface)};
+ return new ITexture[]{aBaseTexture, new GT_RenderedTexture(TexturesGtBlock.Overlay_Hatch_Data_Orb)};
}
@Override
@@ -80,12 +84,12 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
+ return new CONTAINER_DataHatch(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository");
+ return new GUI_DataHatch(aPlayerInventory, aBaseMetaTileEntity, "Data Orb Repository");
}
@Override
@@ -96,13 +100,13 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
}
public void updateSlots() {
- for (int i = 0; i < mInventory.length; i++)
+ for (int i = 0; i < mInventory.length-1; i++)
if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
fillStacksIntoFirstSlots();
}
protected void fillStacksIntoFirstSlots() {
- for (int i = 0; i < mInventory.length; i++) {
+ for (int i = 0; i < mInventory.length-1; i++) {
if (mInventory[i] != null && mInventory[i].stackSize <= 0) {
mInventory[i] = null;
}
@@ -130,20 +134,47 @@ public class GT_MetaTileEntity_Hatch_ElementalDataOrbHolder extends GT_MetaTileE
@Override
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return true;
+ Logger.INFO("Checking if we can pull "+aStack.getDisplayName()+" from slot "+aIndex);
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return false;
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == getBaseMetaTileEntity().getFrontFacing() && (mRecipeMap == null || mRecipeMap.containsInput(aStack));
+ Logger.INFO("Checking if we can put "+aStack.getDisplayName()+" into slot "+aIndex);
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ return true;
+ }
+ return false;
}
public ArrayList<ItemStack> getInventory(){
ArrayList<ItemStack> aContents = new ArrayList<ItemStack>();
- for (int i=0;i<this.getSizeInventory();i++) {
- aContents.add(this.getStackInSlot(i));
- }
+ for (int i = getBaseMetaTileEntity().getSizeInventory() - 2; i >= 0; i--) {
+ if (getBaseMetaTileEntity().getStackInSlot(i) != null)
+ aContents.add(getBaseMetaTileEntity().getStackInSlot(i));
+ }
return aContents;
}
+ @Override
+ public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack) && aSide == getBaseMetaTileEntity().getFrontFacing()) {
+ Logger.INFO("Putting "+aStack.getDisplayName()+" into slot "+aIndex);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
+ if (aIndex == mInventory.length-1 && ItemUtils.isControlCircuit(aStack)) {
+ Logger.INFO("Pulling "+aStack.getDisplayName()+" from slot "+aIndex);
+ return true;
+ }
+ return false;
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
index a9cd179214..a4040c1c5e 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Turbine.java
@@ -1,18 +1,21 @@
-/*
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
import gregtech.api.GregTech_API;
+import gregtech.api.enums.Materials;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaGenerated_Tool;
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_ItemStack;
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.lib.CORE;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
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;
@@ -21,15 +24,16 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextu
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;
+@SuppressWarnings("deprecation")
public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
public boolean mHasController = false;
public boolean mUsingAnimation = true;
private String mControllerLocation;
+ public int mEUt = 0;
public GT_MetaTileEntity_Hatch_Turbine(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 16, "Turbine Rotor holder for XL Turbines");
@@ -42,6 +46,18 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Turbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
super(aName, aTier, 1, aDescription[0], aTextures);
}
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ this.mDescription,
+ "Right Click with a soldering iron to reset controller link",
+ "Right Click with a wrench to remove turbine",
+ "Right Click with a screwdriver for technical information",
+ "Sneak + Right Click with a wrench to rotate",
+ "Sneak + Right Click with a screwdriver to disable animations",
+ CORE.GT_Tooltip};
+ }
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
@@ -53,6 +69,14 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
return new ITexture[]{aBaseTexture, getFrontFacingTurbineTexture()};
}
+ public int getEU() {
+ return this.mEUt;
+ }
+
+ public void setEU(int aEU) {
+ this.mEUt = aEU;
+ }
+
@Override
public boolean isSimpleMachine() {
return true;
@@ -73,6 +97,31 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
return false;
}
+ public boolean hasTurbine() {
+ ItemStack aStack = this.mInventory[0];
+ boolean aIsValid = GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aStack);
+ return aIsValid;
+ }
+
+ public ItemStack getTurbine() {
+ if (hasTurbine()) {
+ return this.mInventory[0];
+ }
+ return null;
+ }
+
+ public boolean canWork() {
+ return hasTurbine();
+ }
+
+ public boolean insertTurbine(ItemStack aTurbine) {
+ if (GregtechMetaTileEntity_LargerTurbineBase.isValidTurbine(aTurbine)) {
+ this.mInventory[0] = aTurbine;
+ return true;
+ }
+ return false;
+ }
+
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new GT_MetaTileEntity_Hatch_Turbine(mName, mTier, StaticFields59.getDescriptionArray(this), mTextures);
@@ -80,32 +129,23 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
@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());
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ }
+ else {
+ aBaseMetaTileEntity.openGUI(aPlayer);
}
- 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);
- }
+ 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");
- }
+ return new GUI_1by1_Turbine(aPlayerInventory, aBaseMetaTileEntity, "Turbine Rotor Hatch");
}
@Override
@@ -122,6 +162,20 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
public int getInventoryStackLimit() {
return 1;
}
+
+ public void damageTurbine(int aEUt, int damageFactorLow, float damageFactorHigh) {
+ if (hasTurbine() && MathUtils.randInt(0, 1) == 0) {
+ ItemStack aTurbine = getTurbine();
+ ((GT_MetaGenerated_Tool) aTurbine.getItem()).doDamage(aTurbine, (long)getDamageToComponent(aTurbine) * (long) Math.min(aEUt / damageFactorLow, Math.pow(aEUt, damageFactorHigh)));
+ if (aTurbine.stackSize == 0) {
+ aTurbine = null;
+ }
+ }
+ }
+
+ private final int getDamageToComponent(ItemStack aStack) {
+ return 1;
+ }
@Override
public void saveNBTData(NBTTagCompound aNBT) {
@@ -138,22 +192,6 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
}
@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) {
@@ -180,10 +218,10 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
public boolean isControllerActive() {
GregtechMetaTileEntity_LargerTurbineBase x = getController();
if (x != null) {
- Logger.INFO("Checking Status of Controller.");
- return x.isMachineRunning();
+ //Logger.INFO("Checking Status of Controller. Running? "+(x.mEUt > 0));
+ return x.mEUt > 0;
}
- Logger.INFO("Status of Controller failed, controller is null.");
+ //Logger.INFO("Status of Controller failed, controller is null.");
return false;
}
@@ -239,7 +277,7 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
private ITexture getFrontFacingTurbineTexture() {
if (!mHasController) {
- return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LargeTurbineTextureHandler.frontFaceHPActive_4) : new GT_RenderedTexture(LargeTurbineTextureHandler.frontFace_4 );
+ return this.getBaseMetaTileEntity().isActive() ? new GT_RenderedTexture(LargeTurbineTextureHandler.OVERLAY_LP_TURBINE_ACTIVE[4] ) : new GT_RenderedTexture(LargeTurbineTextureHandler.OVERLAY_LP_TURBINE[4] );
}
else {
if (usingAnimations()) {
@@ -271,46 +309,98 @@ public class GT_MetaTileEntity_Hatch_Turbine extends GT_MetaTileEntity_Hatch {
return false;
}
+ public void setActive(boolean b) {
+ this.getBaseMetaTileEntity().setActive(b);
+ }
+
+ @Override
+ public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (!aPlayer.isSneaking()) {
+ PlayerUtils.messagePlayer(aPlayer, "Using Animations? "+usingAnimations());
+ PlayerUtils.messagePlayer(aPlayer, "Has Controller? "+this.mHasController);
+ if (mHasController) {
+ PlayerUtils.messagePlayer(aPlayer, "Controller Location: "+BlockPos.generateBlockPos(mControllerLocation).getLocationString());
+ PlayerUtils.messagePlayer(aPlayer, "Controller Active? "+this.isControllerActive());
+ }
+ PlayerUtils.messagePlayer(aPlayer, "Active? "+this.getBaseMetaTileEntity().isActive());
+ PlayerUtils.messagePlayer(aPlayer, "Has Turbine inserted? "+this.hasTurbine());
+ if (this.hasTurbine()) {
+ Materials aMat = GT_MetaGenerated_Tool.getPrimaryMaterial(getTurbine());
+ String aSize = GregtechMetaTileEntity_LargerTurbineBase.getTurbineSizeString(GregtechMetaTileEntity_LargerTurbineBase.getTurbineSize(getTurbine()));
+ PlayerUtils.messagePlayer(aPlayer, "Using: "+aMat.mLocalizedName+" "+aSize);
+ }
+ }
+ else {
+ this.mUsingAnimation = Utils.invertBoolean(mUsingAnimation);
+ if (this.mUsingAnimation) {
+ PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture.");
+ }
+ else {
+ PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture.");
+ }
+ }
+ }
+
@Override
- public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
- float aZ) {
- // TODO Auto-generated method stub
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ if (this.getBaseMetaTileEntity().isServerSide() && !aPlayer.isSneaking()) {
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem != null) {
+ if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) {
+ return onToolClick(tCurrentItem, aPlayer, aWrenchingSide);
+ }
+ }
+ }
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
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
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());
- }
- }
+ if (tCurrentItem != null) {
+ if (tCurrentItem.getItem() instanceof GT_MetaGenerated_Tool) {
+ return onToolClick(tCurrentItem, aPlayer, aWrenchingSide);
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean onToolClick(ItemStack tCurrentItem, EntityPlayer aPlayer, byte aSide) {
+ if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sWrenchList)) {
+ boolean aHasTurbine = this.hasTurbine();
+ if (aPlayer.inventory.getFirstEmptyStack() >= 0 && aHasTurbine) {
+ if (PlayerUtils.isCreative(aPlayer) || GT_ModHandler.damageOrDechargeItem(tCurrentItem, 1, 1000, aPlayer)) {
+ aPlayer.inventory.addItemStackToInventory((this.getTurbine()));
+ this.mInventory[0] = null;
+ GT_Utility.sendChatToPlayer(aPlayer, "Removed turbine with wrench.");
+ return true;
+ }
+ }
+ else {
+ GT_Utility.sendChatToPlayer(aPlayer, aHasTurbine ? "Cannot remove turbine, no free inventory space." : "No turbine to remove.");
+ }
+ }
+ else if (GT_Utility.isStackInList(tCurrentItem, GregTech_API.sSolderingToolList)) {
+ if (mControllerLocation != null && mControllerLocation.length() > 0) {
+ if (setController(BlockPos.generateBlockPos(mControllerLocation))) {
+ if (PlayerUtils.isCreative(aPlayer) || 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 true;
}
}
}
}
- return aSuper;
+ return false;
}
- public void setActive(boolean b) {
- this.getBaseMetaTileEntity().setActive(b);
- }
-
-
-
-
-
-}*/
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java
index 422837fa46..fdc8a7777b 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java
@@ -2,20 +2,52 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base;
import java.util.Locale;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.util.GT_LanguageManager;
-import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import net.minecraft.item.ItemStack;
public abstract class CustomMetaTileBase extends MetaTileEntity {
+
+ private IBaseCustomMetaTileEntity mBaseCustomMetaTileEntity2;
+
+ /**
+ * accessibility to this Field is no longer given, see below
+ */
+ private IGregTechTileEntity mBaseCustomMetaTileEntity;
+
public CustomMetaTileBase(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) {
super(aID, aBasicName, aRegionalName, aInvSlotCount);
GT_LanguageManager.addStringLocalization("gtpp.blockmachines." + aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH) + ".name", aRegionalName);
this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity());
- this.getBaseMetaTileEntity().setMetaTileID((short) aID);
+ this.getBaseMetaTileEntity().setMetaTileID((short) aID);
+ mBaseCustomMetaTileEntity2 = (IBaseCustomMetaTileEntity) getBaseMetaTileEntity();
}
+
+ @Override
+ public IGregTechTileEntity getBaseMetaTileEntity() {
+ return mBaseCustomMetaTileEntity;
+ }
+
+ public IBaseCustomMetaTileEntity getBaseCustomMetaTileEntity() {
+ return mBaseCustomMetaTileEntity2;
+ }
+
+ @Override
+ public void setBaseMetaTileEntity(IGregTechTileEntity aBaseMetaTileEntity) {
+ super.setBaseMetaTileEntity(aBaseMetaTileEntity);
+ if (mBaseCustomMetaTileEntity != null && aBaseMetaTileEntity == null) {
+ mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate();
+ mBaseCustomMetaTileEntity.setMetaTileEntity(null);
+ }
+ mBaseCustomMetaTileEntity = aBaseMetaTileEntity;
+ if (mBaseCustomMetaTileEntity != null) {
+ mBaseCustomMetaTileEntity.setMetaTileEntity(this);
+ }
+ }
public CustomMetaTileBase(String aName, int aInvSlotCount) {
super(aName, aInvSlotCount);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
index 768a57f8b2..d0021f8358 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java
@@ -87,6 +87,7 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer
public String[] getDescription() {
return new String[] { this.mDescription,
"Accepts 4A and outputs 16A",
+ "Toggle 2A/8A half-mode with Screwdriver",
CORE.GT_Tooltip};
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
index 356f96f7cc..1232166baa 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java
@@ -40,7 +40,6 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEn
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput;
-import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -94,7 +93,6 @@ public abstract class GregtechMeta_MultiBlockBase<T extends GT_MetaTileEntity_En
private static final Method findRecipe09;
public GT_Recipe mLastR