diff options
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity')
6 files changed, 0 insertions, 1101 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java deleted file mode 100644 index 0c4a66d890..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ /dev/null @@ -1,206 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Random; - -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; -import ic2.api.Direction; - -public class BaseCustomTileEntity extends BaseMetaTileEntity implements IBaseCustomMetaTileEntity { - - protected NBTTagCompound mRecipeStuff2; - private static final Field ENTITY_ITEM_HEALTH_FIELD_2; - - static { - Field f = null; - try { - f = EntityItem.class.getDeclaredField("field_70291_e"); - f.setAccessible(true); - } catch (Exception var4) { - try { - f = EntityItem.class.getDeclaredField("health"); - f.setAccessible(true); - } catch (Exception var3) { - var4.printStackTrace(); - var3.printStackTrace(); - } - } - - ENTITY_ITEM_HEALTH_FIELD_2 = f; - } - - public BaseCustomTileEntity() { - super(); - Logger.MACHINE_INFO("Created new BaseCustomTileEntity"); - } - - @Override - public boolean doesExplode() { - return true; - } - - @Override - public void writeToNBT(NBTTagCompound aNBT) { - try { - super.writeToNBT(aNBT); - } catch (Throwable arg7) { - GT_Log.err.println( - "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - arg7.printStackTrace(GT_Log.err); - } - - try { - if (!aNBT.hasKey("ModVersion")) aNBT.setString("ModVersion", CORE.VERSION); - } catch (Throwable arg6) { - GT_Log.err.println( - "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); - arg6.printStackTrace(GT_Log.err); - } - } - - @Override - public void doEnergyExplosion() { - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doEnergyExplosion]"); - return; - } - if (this.getUniversalEnergyCapacity() > 0L - && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { - this.doExplosion( - this.getOutput() * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 - : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); - GT_Mod arg9999 = GT_Mod.instance; - GT_Mod.achievements.issueAchievement( - this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), - "electricproblems"); - } - } - - @Override - public void doExplosion(long aAmount) { - - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); - return; - } - - if (this.canAccessData()) { - if (GregTech_API.sMachineWireFire && this.mMetaTileEntity.isElectric()) { - try { - this.mReleaseEnergy = true; - Util.emitEnergyToNetwork(GT_Values.V[5], Math.max(1L, this.getStoredEU() / GT_Values.V[5]), this); - } catch (Exception arg4) { - ; - } - } - - this.mReleaseEnergy = false; - this.mMetaTileEntity.onExplosion(); - int i; - - if (GT_Mod.gregtechproxy.mExplosionItemDrop) { - for (i = 0; i < this.getSizeInventory(); ++i) { - ItemStack tItem = this.getStackInSlot(i); - if (tItem != null && tItem.stackSize > 0 && this.isValidSlot(i)) { - this.dropItems(tItem); - this.setInventorySlotContents(i, (ItemStack) null); - } - } - } - - if (this.mRecipeStuff2 != null) { - for (i = 0; i < 9; ++i) { - this.dropItems(GT_Utility.loadItem(this.mRecipeStuff2, "Ingredient." + i)); - } - } - - PollutionUtils.addPollution(this, 100000); - this.mMetaTileEntity.doExplosion(aAmount); - } - } - - @Override - public void dropItems(ItemStack tItem) { - if (tItem != null) { - Random tRandom = new Random(); - EntityItem tItemEntity = new EntityItem( - this.worldObj, - (double) ((float) this.xCoord + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) this.yCoord + tRandom.nextFloat() * 0.8F + 0.1F), - (double) ((float) this.zCoord + 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; - tItemEntity.hurtResistantTime = 999999; - tItemEntity.lifespan = 60000; - - try { - if (ENTITY_ITEM_HEALTH_FIELD_2 != null) { - ENTITY_ITEM_HEALTH_FIELD_2.setInt(tItemEntity, 99999999); - } - } catch (Exception var5) { - ; - } - - this.worldObj.spawnEntityInWorld(tItemEntity); - tItem.stackSize = 0; - } - } - - @Override - public ArrayList<ItemStack> getDrops() { - ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); - ItemStack rStack = new ItemStack(GregTech_API.sBlockMachines, 1, this.getMetaTileID()); - // Currently not using my custom block. - // ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, - // this.getMetaTileID()); - boolean fail = true; - - ArrayList<ItemStack> aSuperDrops = super.getDrops(); - if (aSuperDrops != null && !aSuperDrops.isEmpty()) { - ItemStack aSuperStack = super.getDrops().get(0); - if (aSuperStack != null && aSuperStack.hasTagCompound()) { - NBTTagCompound aSuperNBT = aSuperStack.getTagCompound(); - if (aSuperNBT != null && !aSuperNBT.hasNoTags()) { - NBTTagCompound tNBT = (NBTTagCompound) aSuperNBT.copy(); - if (tNBT != null && !tNBT.hasNoTags()) { - if (this.hasValidMetaTileEntity()) { - this.mMetaTileEntity.setItemNBT(tNBT); - rStack.setTagCompound(tNBT); - fail = false; - aDrops.add(rStack); - } - } - } - } - } - if (fail) { - aDrops.add(rStack); - } - return aDrops; - } - - @Override - public boolean isTeleporterCompatible(Direction aSide) { - return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java deleted file mode 100644 index 079a9946d1..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ /dev/null @@ -1,291 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; -import ic2.api.Direction; - -public class BaseCustomPower_MTE extends BaseCustomTileEntity { - - public BaseCustomPower_MTE() { - super(); - Logger.INFO("Created new BaseCustomPower_MTE"); - } - - @Override - public boolean doesExplode() { - return false; - } - - public long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) { - if (mMetaTileEntity == null) { - Logger.INFO("Bad Tile"); - } - if (this.canAccessData() && this.mMetaTileEntity.isElectric() - && this.inputEnergyFrom(side) - && aAmperage > 0L - && aVoltage > 0L - && this.getStoredEU() < this.getEUCapacity() - && this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()) { - Logger.INFO("Injecting Energy Units"); - return super.injectEnergyUnits(side, aVoltage, aAmperage); - } else { - Logger.INFO("canAccessData(): " + canAccessData()); - Logger.INFO("isElectric(): " + this.mMetaTileEntity.isElectric()); - Logger.INFO("InputEnergyFromSide(" + side + "): " + this.inputEnergyFrom(side)); - Logger.INFO("aAmperage: " + aAmperage); - Logger.INFO("aVoltage: " + aVoltage); - Logger.INFO("this.getStoredEU() < this.getEUCapacity(): " + (this.getStoredEU() < this.getEUCapacity())); - Logger.INFO( - "this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: " - + (this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); - Logger.INFO("this.mMetaTileEntity.maxAmperesIn(): " + (this.mMetaTileEntity.maxAmperesIn())); - Logger.INFO("this.mAcceptedAmperes: " + (this.getInputAmperage())); - return 0L; - } - } - - public boolean drainEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) { - Logger.INFO("Draining Energy Units 4"); - if (this.canAccessData() && this.mMetaTileEntity.isElectric() - && this.outputsEnergyTo(side) - && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { - if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] - + aVoltage * aAmperage); - return true; - } else { - return false; - } - } else { - return false; - } - } - - @Override - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.INFO("Draining Energy Units 3"); - // TODO Auto-generated method stub - return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { - // TODO Auto-generated method stub - return super.increaseStoredEnergyUnits(aEnergy, aIgnoreTooMuchEnergy); - } - - @Override - public boolean inputEnergyFrom(ForgeDirection side) { - // TODO Auto-generated method stub - return super.inputEnergyFrom(side); - } - - @Override - public boolean outputsEnergyTo(ForgeDirection side) { - Logger.INFO("Draining Energy Units 2"); - // TODO Auto-generated method stub - return super.outputsEnergyTo(side); - } - - @Override - public long getOutputAmperage() { - // TODO Auto-generated method stub - return super.getOutputAmperage(); - } - - @Override - public long getOutputVoltage() { - // TODO Auto-generated method stub - return super.getOutputVoltage(); - } - - @Override - public long getInputAmperage() { - // TODO Auto-generated method stub - return super.getInputAmperage(); - } - - @Override - public long getInputVoltage() { - // TODO Auto-generated method stub - return super.getInputVoltage(); - } - - @Override - public long getUniversalEnergyStored() { - // TODO Auto-generated method stub - return super.getUniversalEnergyStored(); - } - - @Override - public long getUniversalEnergyCapacity() { - // TODO Auto-generated method stub - return super.getUniversalEnergyCapacity(); - } - - @Override - public long getStoredEU() { - // TODO Auto-generated method stub - return super.getStoredEU(); - } - - @Override - public long getEUCapacity() { - // TODO Auto-generated method stub - return super.getEUCapacity(); - } - - @Override - public boolean setStoredEU(long aEnergy) { - // TODO Auto-generated method stub - return super.setStoredEU(aEnergy); - } - - @Override - public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - Logger.INFO("Draining Energy Units 1"); - // TODO Auto-generated method stub - return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public boolean decreaseStoredSteam(long aEnergy, boolean aIgnoreTooLessEnergy) { - // TODO Auto-generated method stub - return super.decreaseStoredSteam(aEnergy, aIgnoreTooLessEnergy); - } - - @Override - public void doEnergyExplosion() { - // TODO Auto-generated method stub - super.doEnergyExplosion(); - } - - @Override - public void doExplosion(long aAmount) { - // TODO Auto-generated method stub - super.doExplosion(aAmount); - } - - @Override - public byte getLightValue() { - // TODO Auto-generated method stub - return super.getLightValue(); - } - - @Override - public long getAverageElectricInput() { - // TODO Auto-generated method stub - return super.getAverageElectricInput(); - } - - @Override - public long getAverageElectricOutput() { - // TODO Auto-generated method stub - return super.getAverageElectricOutput(); - } - - @Override - public double getOutputEnergyUnitsPerTick() { - // TODO Auto-generated method stub - return super.getOutputEnergyUnitsPerTick(); - } - - @Override - public double demandedEnergyUnits() { - // TODO Auto-generated method stub - return super.demandedEnergyUnits(); - } - - @Override - public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { - // TODO Auto-generated method stub - return super.injectEnergyUnits(aDirection, aAmount); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { - // TODO Auto-generated method stub - return super.acceptsEnergyFrom(aEmitter, aDirection); - } - - @Override - public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { - // TODO Auto-generated method stub - return super.emitsEnergyTo(aReceiver, aDirection); - } - - @Override - public double getOfferedEnergy() { - // TODO Auto-generated method stub - return super.getOfferedEnergy(); - } - - @Override - public void drawEnergy(double amount) { - // TODO Auto-generated method stub - super.drawEnergy(amount); - } - - @Override - public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { - // TODO Auto-generated method stub - return super.injectEnergy(aForgeDirection, aAmount); - } - - @Override - public int addEnergy(int aEnergy) { - // TODO Auto-generated method stub - return super.addEnergy(aEnergy); - } - - @Override - public boolean isAddedToEnergyNet() { - // TODO Auto-generated method stub - return super.isAddedToEnergyNet(); - } - - @Override - public int demandsEnergy() { - // TODO Auto-generated method stub - return super.demandsEnergy(); - } - - @Override - public int getMaxSafeInput() { - // TODO Auto-generated method stub - return super.getMaxSafeInput(); - } - - @Override - public int getMaxEnergyOutput() { - // TODO Auto-generated method stub - return super.getMaxEnergyOutput(); - } - - @Override - public int injectEnergy(Direction aDirection, int aAmount) { - // TODO Auto-generated method stub - return super.injectEnergy(aDirection, aAmount); - } - - @Override - public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { - // TODO Auto-generated method stub - return super.acceptsEnergyFrom(aReceiver, aDirection); - } - - @Override - public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { - // TODO Auto-generated method stub - return super.emitsEnergyTo(aReceiver, aDirection); - } - - @Override - public boolean isUniversalEnergyStored(long aEnergyAmount) { - // TODO Auto-generated method stub - return super.isUniversalEnergyStored(aEnergyAmount); - } -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java deleted file mode 100644 index 9a09ad6538..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ /dev/null @@ -1,96 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import static gregtech.api.enums.GT_Values.GT; - -import gregtech.api.interfaces.ITexture; -import gtPlusPlus.api.objects.data.AutoMap; - -public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPower { - - /** - * Value between [0 - 9] to describe the Tier of this Machine. - */ - public final byte mTier; - - /** - * A simple Description. - */ - public final String[] mDescriptionArray; - - /** - * Contains all Textures used by this Block. - */ - public final ITexture[][][] mTextures; - - public GTPP_MTE_TieredMachineBlock(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)); - mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; - // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); - else mTextures = null; - } - - public GTPP_MTE_TieredMachineBlock(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)); - mDescriptionArray = aDescription == null ? new String[0] : aDescription; - - // must always be the last call! - if (GT.isClientSide()) mTextures = getTextureSet(aTextures); - else mTextures = null; - } - - public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : new String[] { aDescription }; - mTextures = aTextures; - } - - public GTPP_MTE_TieredMachineBlock(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aInvSlotCount); - mTier = (byte) aTier; - mDescriptionArray = aDescription == null ? new String[0] : aDescription; - mTextures = aTextures; - } - - @Override - public byte getTileEntityBaseType() { - return 12; - } - - @Override - public long getInputTier() { - return mTier; - } - - @Override - public long getOutputTier() { - return mTier; - } - - @Override - public String[] getDescription() { - AutoMap<String> aTooltip = new AutoMap<String>(); - String[] s1 = null; - s1 = new String[aTooltip.size()]; - int u = 0; - for (String s : aTooltip) { - s1[u] = s; - } - return s1; - } - - /** - * 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); -} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java deleted file mode 100644 index 79975d3ac8..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ /dev/null @@ -1,92 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; - -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; - -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.SoundResource; -import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { - - public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { - super(aID, aBasicName, aRegionalName, aInvSlotCount); - this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); - this.getBaseMetaTileEntity().setMetaTileID((short) aID); - } - - public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) { - super(aStack, aInvSlotCount); - } - - @Override - public long getMinimumStoredEU() { - return 0L; - } - - public boolean doesExplode() { - return this.getBaseCustomMetaTileEntity().doesExplode(); - } - - @Override - public void doExplosion(long aExplosionPower) { - - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [doExplosion]"); - return; - } - - float tStrength = aExplosionPower - < GT_Values.V[0] - ? 1.0F - : (aExplosionPower < GT_Values.V[1] ? 2.0F - : (aExplosionPower < GT_Values.V[2] ? 3.0F - : (aExplosionPower < GT_Values.V[3] ? 4.0F - : (aExplosionPower < GT_Values.V[4] ? 5.0F - : (aExplosionPower < GT_Values.V[4] * 2L ? 6.0F - : (aExplosionPower < GT_Values.V[5] ? 7.0F - : (aExplosionPower < GT_Values.V[6] ? 8.0F - : (aExplosionPower < GT_Values.V[7] - ? 9.0F - : 10.0F)))))))); - int tX = this.getBaseMetaTileEntity().getXCoord(); - short tY = this.getBaseMetaTileEntity().getYCoord(); - int tZ = this.getBaseMetaTileEntity().getZCoord(); - World tWorld = this.getBaseMetaTileEntity().getWorld(); - GT_Utility.sendSoundToPlayers(tWorld, SoundResource.IC2_MACHINES_MACHINE_OVERLOAD, 1.0F, -1.0F, tX, tY, tZ); - tWorld.setBlock(tX, tY, tZ, Blocks.air); - if (GregTech_API.sMachineExplosions) { - tWorld.createExplosion( - (Entity) null, - (double) tX + 0.5D, - (double) tY + 0.5D, - (double) tZ + 0.5D, - tStrength, - true); - } - } - - @Override - public void onExplosion() { - if (!doesExplode()) { - Logger.INFO("Machine tried to explode, let's stop that. xo [onExplosion]"); - return; - } - super.onExplosion(); - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public long getEUVar() { - return super.getEUVar(); - } -} 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 deleted file mode 100644 index 3d78c7e6a6..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ /dev/null @@ -1,328 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraftforge.common.util.ForgeDirection; - -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.gui.modularui.GT_UIInfos; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.modularui.IAddUIWidgets; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.items.GT_MetaBase_Item; -import gregtech.api.util.GT_ModHandler; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_TieredMachineBlock; -import ic2.api.item.ElectricItem; -import ic2.api.item.IElectricItem; - -public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock implements IAddUIWidgets { - - public boolean mCharge = false; - public boolean mDecharge = false; - public int mBatteryCount = 0; - public int mChargeableCount = 0; - private long count = 0L; - private long mStored = 0L; - private long mMax = 0L; - - 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) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - public GT_MetaTileEntity_BasicBreaker(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - int aSlotCount) { - super(aName, aTier, aSlotCount, aDescription, aTextures); - } - - @Override - public String[] getDescription() { - 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.get(); - return desc; - } - - @Override - 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] }; - } - - return rTextures; - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, - int aColorIndex, boolean aActive, boolean aRedstone) { - return this.mTextures[side == facing ? 1 : 0][aColorIndex + 1]; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicBreaker( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures, - this.mInventory.length); - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isElectric() { - return true; - } - - @Override - public boolean isValidSlot(int aIndex) { - return true; - } - - public boolean isFacingValid(ForgeDirection facing) { - return true; - } - - @Override - public boolean isEnetInput() { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - public boolean isInputFacing(ForgeDirection side) { - return side != this.getBaseMetaTileEntity().getFrontFacing(); - } - - public boolean isOutputFacing(ForgeDirection side) { - return side == this.getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public boolean isTeleporterCompatible() { - return false; - } - - @Override - public long getMinimumStoredEU() { - return GT_Values.V[this.mTier] * 16L * 16; - } - - @Override - public long maxEUStore() { - return GT_Values.V[this.mTier] * 64L * 16; - } - - @Override - public long maxEUInput() { - return GT_Values.V[this.mTier] * 16; - } - - @Override - public long maxEUOutput() { - return GT_Values.V[this.mTier]; - } - - @Override - public long maxAmperesIn() { - return 16; - } - - @Override - public long maxAmperesOut() { - return 16; - } - - @Override - public int rechargerSlotStartIndex() { - return 0; - } - - @Override - public int dechargerSlotStartIndex() { - return 0; - } - - @Override - public int rechargerSlotCount() { - return 0; - } - - @Override - public int dechargerSlotCount() { - return 0; - } - - @Override - public int getProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyStored(); - } - - @Override - public int maxProgresstime() { - return (int) this.getBaseMetaTileEntity().getUniversalEnergyCapacity(); - } - - @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) {} - - @Override - public void loadNBTData(NBTTagCompound aNBT) {} - - @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer); - return true; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isServerSide()) { - /* - * this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; - * this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; - * this.mBatteryCount = 0; 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; } } - */ - } - } - - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return true; - } - - @Override - public int getInventoryStackLimit() { - return 1; - } - - public long[] getStoredEnergy() { - boolean scaleOverflow = false; - boolean storedOverflow = false; - long tScale = this.getBaseMetaTileEntity().getEUCapacity(); - long tStored = this.getBaseMetaTileEntity().getStoredEU(); - long tStep = 0L; - if (this.mInventory != null) { - ItemStack[] arg8 = this.mInventory; - int arg9 = arg8.length; - - for (int arg10 = 0; arg10 < arg9; ++arg10) { - ItemStack aStack = arg8[arg10]; - if (GT_ModHandler.isElectricItem(aStack)) { - if (aStack.getItem() instanceof GT_MetaBase_Item) { - Long[] stats = ((GT_MetaBase_Item) aStack.getItem()).getElectricStats(aStack); - if (stats != null) { - if (stats[0].longValue() > 4611686018427387903L) { - scaleOverflow = true; - } - - tScale += stats[0].longValue(); - tStep = ((GT_MetaBase_Item) aStack.getItem()).getRealCharge(aStack); - if (tStep > 4611686018427387903L) { - storedOverflow = true; - } - - tStored += tStep; - } - } else if (aStack.getItem() instanceof IElectricItem) { - tStored += (long) ElectricItem.manager.getCharge(aStack); - tScale += (long) ((IElectricItem) aStack.getItem()).getMaxCharge(aStack); - } - } - } - } - - if (scaleOverflow) { - tScale = Long.MAX_VALUE; - } - - if (storedOverflow) { - tStored = Long.MAX_VALUE; - } - - return new long[] { tStored, tScale }; - } - - @Override - public String[] getInfoData() { - return new String[] { "Tile Type: " + this.getTileEntityBaseType() }; - } - - @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public boolean doesExplode() { - return true; - } - - @Override - public boolean useModularUI() { - return true; - } - - @Override - public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { - getBaseMetaTileEntity().add4by4Slots(builder); - } -} 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 deleted file mode 100644 index f63a5f7688..0000000000 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ /dev/null @@ -1,88 +0,0 @@ -package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; - -import java.util.Locale; - -import net.minecraft.item.ItemStack; - -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.util.GT_LanguageManager; -import gtPlusPlus.xmod.gregtech.api.interfaces.IBaseCustomMetaTileEntity; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; - -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); - 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() != null) { - mBaseCustomMetaTileEntity.getMetaTileEntity().inValidate(); - mBaseCustomMetaTileEntity.setMetaTileEntity(null); - } - mBaseCustomMetaTileEntity = aBaseMetaTileEntity; - if (mBaseCustomMetaTileEntity != null) { - mBaseCustomMetaTileEntity.setMetaTileEntity(this); - } - } - - public CustomMetaTileBase(String aName, int aInvSlotCount) { - super(aName, aInvSlotCount); - } - - @Override - public ItemStack getStackForm(long aAmount) { - return new ItemStack(Meta_GT_Proxy.sBlockMachines, (int) aAmount, this.getBaseMetaTileEntity().getMetaTileID()); - } - - @Override - public String getLocalName() { - return GT_LanguageManager.getTranslation("gtpp.blockmachines." + this.mName + ".name"); - } - - /** - * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. - * <p/> - * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantlee 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle 2 = - * BaseMetaTileEntity, Wrench lvl 2 to dismantle 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle 4 = - * BaseMetaPipeEntity, Wrench lvl 0 to dismantle 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 6 = - * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle 8 = - * BaseMetaPipeEntity, Cutter lvl 0 to dismantle 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle 10 = - * BaseMetaPipeEntity, Cutter lvl 2 to dismantle 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle - * - * == Reserved for Alk now - * - * 12 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle 13 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle 14 = - * BaseMetaPipeEntity, Wrench lvl 2 to dismantle 15 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle - */ - @Override - public byte getTileEntityBaseType() { - return 12; - } -} |