diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-04-14 17:40:50 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-04-14 17:40:50 +1000 |
commit | f09983f7b7348e89fcc73e865cd11be048e45ba9 (patch) | |
tree | 2317b034af56f7a246f52a2188a6a370bff3090e /src/Java | |
parent | be88e9009e66ef27d9bccd27cce7fd13ae3b06cd (diff) | |
download | GT5-Unofficial-f09983f7b7348e89fcc73e865cd11be048e45ba9.tar.gz GT5-Unofficial-f09983f7b7348e89fcc73e865cd11be048e45ba9.tar.bz2 GT5-Unofficial-f09983f7b7348e89fcc73e865cd11be048e45ba9.zip |
+ Made Energy Buffers Portable.
+ Allowed reconfiguration of Amperage on Energy Buffers.
+ Added Hellish Bauble to remove most nether enemies.
+ Basework for Heat Exchange Pipes.
+ Interfaces for Heat Sinks and Heat Entities.
Diffstat (limited to 'src/Java')
9 files changed, 668 insertions, 17 deletions
diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java index d779e60975..c6fcc83d01 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -8,8 +8,12 @@ import gtPlusPlus.core.item.general.ItemCloakingDevice; import gtPlusPlus.core.item.general.ItemHealingDevice; import gtPlusPlus.core.item.general.ItemSlowBuildingRing; import gtPlusPlus.core.lib.LoadedMods; +import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntityZombie; @@ -41,11 +45,12 @@ public class COMPAT_Baubles { t.printStackTrace(); } - ModItems.itemAmuletMonsterKiller_Zombie = new MonsterKillerBaseBauble(new Class[] {EntityZombie.class}, "Zombie", 6); - ModItems.itemAmuletMonsterKiller_Skeleton = new MonsterKillerBaseBauble(new Class[] {EntitySkeleton.class}, "Skeleton", 6); - ModItems.itemAmuletMonsterKiller_Spider = new MonsterKillerBaseBauble(new Class[] {EntitySpider.class}, "Spider", 6); - ModItems.itemAmuletMonsterKiller_Creeper = new MonsterKillerBaseBauble(new Class[] {EntityCreeper.class}, "Creeper", 6); - ModItems.itemAmuletMonsterKiller_Enderman = new MonsterKillerBaseBauble(new Class[] {EntityEnderman.class}, "Enderman", 6); + ModItems.itemAmuletMonsterKiller_Zombie = new MonsterKillerBaseBauble(new Class[] {EntityZombie.class}, "Zombie", 3); + ModItems.itemAmuletMonsterKiller_Skeleton = new MonsterKillerBaseBauble(new Class[] {EntitySkeleton.class}, "Skeleton", 3); + ModItems.itemAmuletMonsterKiller_Spider = new MonsterKillerBaseBauble(new Class[] {EntitySpider.class}, "Spider", 3); + ModItems.itemAmuletMonsterKiller_Creeper = new MonsterKillerBaseBauble(new Class[] {EntityCreeper.class}, "Creeper", 4); + ModItems.itemAmuletMonsterKiller_Enderman = new MonsterKillerBaseBauble(new Class[] {EntityEnderman.class}, "Enderman", 4); + ModItems.itemAmuletMonsterKiller_Nether = new MonsterKillerBaseBauble(new Class[] {EntityPigZombie.class, EntityGhast.class, EntityMagmaCube.class, EntityBlaze.class}, "Hellish", 6); if (LoadedMods.PlayerAPI){ ModItems.itemSlowBuildingRing = new ItemSlowBuildingRing(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 83abe22568..5231344263 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -530,6 +530,11 @@ public enum GregtechItemList implements GregtechItemContainer { //Block that enables uplink to a superconductor network SuperConductorInputNode, + + //Heat Pipes + HeatPipe_Tier_1, + HeatPipe_Tier_2, + HeatPipe_Tier_3, //Chemical Dehydrators for nuclear fuels diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java new file mode 100644 index 0000000000..824bb258d8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import ic2.api.energy.tile.IHeatSource; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IHeatEntity extends IHeatSource, IHeatSink { + + public int getHeatBuffer(); + + public void setHeatBuffer(int HeatBuffer); + + public void addtoHeatBuffer(int heat); + + public int getTransmitHeat(); + + public int fillHeatBuffer(int maxAmount); + + public int getMaxHeatEmittedPerTick(); + + public void updateHeatEntity(); + + public int maxrequestHeatTick(ForgeDirection directionFrom); + + public int requestHeat(ForgeDirection directionFrom, int requestheat); + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java new file mode 100644 index 0000000000..80adcf0d51 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import net.minecraftforge.common.util.ForgeDirection; + +public interface IHeatSink { + + + int maxHeatInPerTick(ForgeDirection var1); + + int addHeat(ForgeDirection var1, int var2); + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java new file mode 100644 index 0000000000..770f249648 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java @@ -0,0 +1,14 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import java.util.ArrayList; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.tileentity.TileEntity; + +public interface IMetaTileEntityHeatPipe extends IMetaTileEntity { + + + long transferHeat(byte var1, long var2, long var4, ArrayList<TileEntity> var6); + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java new file mode 100644 index 0000000000..68ec0ba0c9 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java @@ -0,0 +1,532 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import java.util.ArrayList; +import java.util.Arrays; + +import gregtech.GT_Mod; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IEnergyConnected; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.interfaces.IHeatEntity; +import gtPlusPlus.xmod.gregtech.api.interfaces.IMetaTileEntityHeatPipe; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import ic2.api.energy.tile.IEnergySink; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class GT_MetaPipeEntity_Heat extends MetaPipeEntity implements IMetaTileEntityHeatPipe, IHeatEntity { + + public final Materials mMaterial; + public final long mHeatLossPerMeter, mAmperage, mMaxTemp; + public final boolean mInsulated, mCanShock; + public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0; + public short mOverheat; + + private boolean mCheckConnections; + public byte mDisableInput; + + public GT_MetaPipeEntity_Heat(int aID, String aName, String aNameRegional, Materials aMaterial, long aMaxTemp) { + super(aID, aName, aNameRegional, 0); + mMaterial = aMaterial; + mAmperage = 1; + mMaxTemp = aMaxTemp; + mInsulated = false; + mCanShock = true; + mHeatLossPerMeter = aMaxTemp/1000; + } + + public GT_MetaPipeEntity_Heat(String aName, Materials aMaterial, long aMaxTemp) { + super(aName, 0); + mMaterial = aMaterial; + mAmperage = 1; + mMaxTemp = aMaxTemp; + mInsulated = false; + mCanShock = true; + mHeatLossPerMeter = aMaxTemp/1000; + } + + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaPipeEntity_Heat(mName, mMaterial, mMaxTemp); + } + + @Override + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { + if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) + GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @Override + public final boolean renderInside(byte aSide) { + return false; + } + + @Override + public int getProgresstime() { + return (int) mTransferredAmperage * 64; + } + + @Override + public int maxProgresstime() { + return (int) mAmperage * 64; + } + + @Override + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) + return 0; + return transferHeat(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity()))); + } + + @Override + public long transferHeat(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + if (!this.isConnectedAtSide(aSide) && aSide != 6) { + return 0L; + } else { + long rUsedAmperes = 0L; + aVoltage -= this.mHeatLossPerMeter; + if (aVoltage > 0L) { + for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; ++i) { + if (i != aSide && this.isConnectedAtSide(i) + && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, + this.getBaseMetaTileEntity().getCoverIDAtSide(i), + this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { + TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); + if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { + aAlreadyPassedTileEntityList.add(tTileEntity); + if (tTileEntity instanceof IEnergyConnected) { + if (this.getBaseMetaTileEntity().getColorization() >= 0) { + byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); + if (tColor >= 0 && tColor != this.getBaseMetaTileEntity().getColorization()) { + continue; + } + } + + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() instanceof IMetaTileEntityHeatPipe + && ((IGregTechTileEntity) tTileEntity) + .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)) + .letsEnergyIn(GT_Utility.getOppositeSide(i), + ((IGregTechTileEntity) tTileEntity) + .getCoverIDAtSide(GT_Utility.getOppositeSide(i)), + ((IGregTechTileEntity) tTileEntity) + .getCoverDataAtSide(GT_Utility.getOppositeSide(i)), + (IGregTechTileEntity) tTileEntity)) { + if (((IGregTechTileEntity) tTileEntity).getTimer() > 50L) { + rUsedAmperes += ((IMetaTileEntityHeatPipe) ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity()).transferHeat(GT_Utility.getOppositeSide(i), + aVoltage, aAmperage - rUsedAmperes, + aAlreadyPassedTileEntityList); + } + } else { + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( + GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); + } + } else { + ForgeDirection tDirection; + + if (tTileEntity instanceof IEnergySink) { + tDirection = ForgeDirection.getOrientation(i).getOpposite(); + if (((IEnergySink) tTileEntity) + .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection) + && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0.0D + && ((IEnergySink) tTileEntity).injectEnergy(tDirection, (double) aVoltage, + (double) aVoltage) < (double) aVoltage) { + ++rUsedAmperes; + } + } + } + } + } + } + } + + this.mTransferredAmperage += rUsedAmperes; + this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); + this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); + if (aVoltage <= this.mMaxTemp && this.mTransferredAmperage <= this.mAmperage) { + return rUsedAmperes; + } else { + if (this.mOverheat > GT_Mod.gregtechproxy.mWireHeatingTicks * 100) { + //this.getBaseMetaTileEntity().setToFire(); + } else { + this.mOverheat = (short) (this.mOverheat + 100); + } + + return aAmperage; + } + } + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + this.mTransferredAmperage = 0L; + if (this.mOverheat > 0) { + --this.mOverheat; + } + + if (aTick % 20L == 0L) { + this.mTransferredVoltageLast20 = 0L; + this.mTransferredAmperageLast20 = 0L; + + for (byte tSide = 0; tSide < 6; ++tSide) { + IGregTechTileEntity tBaseMetaTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide); + byte uSide = GT_Utility.getOppositeSide(tSide); + if ((this.mCheckConnections || this.isConnectedAtSide(tSide) + || aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, + aBaseMetaTileEntity.getCoverIDAtSide(tSide), + aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity) + || tBaseMetaTileEntity != null && tBaseMetaTileEntity.getCoverBehaviorAtSide(uSide) + .alwaysLookConnected(uSide, tBaseMetaTileEntity.getCoverIDAtSide(uSide), + tBaseMetaTileEntity.getCoverDataAtSide(uSide), tBaseMetaTileEntity)) + && this.connect(tSide) == 0) { + this.disconnect(tSide); + } + } + + if (isGT6Pipes()) { + this.mCheckConnections = false; + } + } + } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + + } + + @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 String[] getDescription() { + return new String[]{ + "Max Voltage: " + EnumChatFormatting.GOLD + mMaxTemp + "C" + EnumChatFormatting.GRAY, + "Loss: " + EnumChatFormatting.RED + mHeatLossPerMeter + EnumChatFormatting.GRAY + " HU per meter", + CORE.GT_Tooltip + }; + } + + @Override + public float getThickNess() { + return 1; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("HeatBuffer", this.HeatBuffer); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + this.HeatBuffer = aNBT.getInteger("HeatBuffer"); + } + + + + + + + + + + + + + + protected int transmitHeat; + protected int maxHeatEmitpeerTick; + protected int HeatBuffer; + + + + + public byte getTileEntityBaseType() { + return 4; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { + float tThickNess = this.getThickNess(); + if (this.mDisableInput == 0) { + return new ITexture[]{(ITexture) (aConnected + ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) + : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa)))}; + } else { + byte tMask = 0; + byte[][] sRestrictionArray = new byte[][]{{2, 3, 5, 4}, {2, 3, 4, 5}, {1, 0, 4, 5}, {1, 0, 4, 5}, + {1, 0, 2, 3}, {1, 0, 2, 3}}; + if (aSide >= 0 && aSide < 6) { + for (byte i = 0; i < 4; ++i) { + if (this.isInputDisabledAtSide(sRestrictionArray[aSide][i])) { + tMask = (byte) (tMask | 1 << i); + } + } + } + + return new ITexture[]{ + (ITexture) (aConnected + ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) + : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa))), + getRestrictorTexture(tMask)}; + } + } + + protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, + byte aColorIndex) { + if (aPipeAmount >= 9) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aPipeAmount >= 4) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.124F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.374F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.499F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.749F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else { + return aThickNess < 0.874F + ? new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)) + : new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } + } + + protected static final ITexture getRestrictorTexture(byte aMask) { + switch (aMask) { + case 1 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UP); + case 2 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DOWN); + case 3 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UD); + case 4 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LEFT); + case 5 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UL); + case 6 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DL); + case 7 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NR); + case 8 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_RIGHT); + case 9 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UR); + case 10 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DR); + case 11 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NL); + case 12 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LR); + case 13 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_ND); + case 14 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NU); + case 15 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR); + default : + return null; + } + } + + + public final boolean isGT6Pipes() { + return StaticFields59.mGT6StylePipes; + } + + public void updateHeatEntity() { + int amount = this.getMaxHeatEmittedPerTick() - this.HeatBuffer; + if (amount > 0) { + this.addtoHeatBuffer(this.fillHeatBuffer(amount)); + } + } + + public boolean facingMatchesDirection(ForgeDirection direction) { + return true; + } + + public int maxrequestHeatTick(ForgeDirection directionFrom) { + return this.getMaxHeatEmittedPerTick(); + } + + public int requestHeat(ForgeDirection directionFrom, int requestheat) { + if (this.facingMatchesDirection(directionFrom)) { + int heatbuffertemp = this.getHeatBuffer(); + if (this.getHeatBuffer() >= requestheat) { + this.setHeatBuffer(this.getHeatBuffer() - requestheat); + this.transmitHeat = requestheat; + return requestheat; + } else { + this.transmitHeat = heatbuffertemp; + this.setHeatBuffer(0); + return heatbuffertemp; + } + } else { + return 0; + } + } + + + public int getHeatBuffer() { + return this.HeatBuffer; + } + + public void setHeatBuffer(int HeatBuffer) { + this.HeatBuffer = HeatBuffer; + } + + public void addtoHeatBuffer(int heat) { + this.setHeatBuffer(this.getHeatBuffer() + heat); + } + + + public int fillHeatBuffer(int maxAmount) { + return maxAmount >= this.getMaxHeatEmittedPerTick() ? this.getMaxHeatEmittedPerTick() : maxAmount; + } + + public int getMaxHeatEmittedPerTick() { + return (int) (this.mMaxTemp/1000); + } + + + public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { + if (isGT6Pipes()) { + byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + byte tMask = (byte) (1 << tSide); + if (aPlayer.isSneaking()) { + if (this.isInputDisabledAtSide(tSide)) { + this.mDisableInput = (byte) (this.mDisableInput & ~tMask); + GT_Utility.sendChatToPlayer(aPlayer, this.trans("212", "Input enabled")); + if (!this.isConnectedAtSide(tSide)) { + this.connect(tSide); + } + } else { + this.mDisableInput |= tMask; + GT_Utility.sendChatToPlayer(aPlayer, this.trans("213", "Input disabled")); + } + } else if (!this.isConnectedAtSide(tSide)) { + if (this.connect(tSide) > 0) { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("214", "Connected")); + } + } else { + this.disconnect(tSide); + GT_Utility.sendChatToPlayer(aPlayer, this.trans("215", "Disconnected")); + } + + return true; + } else { + return false; + } + } + + public boolean isInputDisabledAtSide(int aSide) { + return (this.mDisableInput & 1 << aSide) != 0; + } + + + + + @Override + public int maxHeatInPerTick(ForgeDirection var1) { + return (int) (this.mMaxTemp/500); + } + + @Override + public int addHeat(ForgeDirection var1, int var2) { + + + + /*ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing()); + TileEntity te = this.getBaseMetaTileEntity().getWorld().getTileEntity(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, + this.zCoord + dir.offsetZ); + if (te instanceof IHeatSource) { + int heatbandwith = ((IHeatSource) te).maxrequestHeatTick(dir.getOpposite()); + double freeEUstorage = (double) this.maxEUStorage - this.EUstorage; + if (freeEUstorage >= this.productionpeerheat * (double) heatbandwith) { + this.receivedheat = ((IHeatSource) te).requestHeat(dir.getOpposite(), heatbandwith); + if (this.receivedheat != 0) { + this.production = (double) this.receivedheat * this.productionpeerheat; + this.EUstorage += this.production; + return true; + } + } + } + + this.production = 0.0D; + this.receivedheat = 0;*/ + + + return 0; + } + + @Override + public int getTransmitHeat() { + return this.transmitHeat; + } + + + + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 1604cc5acd..2287d7964c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -26,6 +26,9 @@ import net.minecraft.item.ItemStack; public class StaticFields59 { + + public static final boolean mGT6StylePipes; + public static final Field mGtBlockCasings5; public static final Field mPreventableComponents; public static final Field mDisabledItems; @@ -45,6 +48,9 @@ public class StaticFields59 { static { Logger.INFO("[SH] Creating Static Helper for various fields which require reflective access."); + + mGT6StylePipes = (boolean) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "gt6Pipe"); + mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5"); Logger.INFO("[SH] Got Field: sBlockCasings5"); mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index b77529220f..9674871477 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -26,10 +26,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { - /* - * public GregtechMetaEnergyBuffer() { super.this - * setCreativeTab(GregTech_API.TAB_GREGTECH); } - */ + private byte aCurrentOutputAmperage = 4; public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); @@ -41,7 +38,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Accepts/Outputs 4Amp",}; + return new String[] {this.mDescription, "Defaults 4A In/Out", "Change output Amperage with a screwdriver", "Now Portable!", CORE.GT_Tooltip}; } @Override @@ -200,12 +197,12 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public long maxAmperesIn() { - return 4; + return aCurrentOutputAmperage; } @Override public long maxAmperesOut() { - return 4; + return aCurrentOutputAmperage; } @Override public int rechargerSlotStartIndex() {return 0;} @Override public int dechargerSlotStartIndex() {return 0;} @@ -216,13 +213,25 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} @Override - public void saveNBTData(final NBTTagCompound aNBT) { - // + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + long aEU = this.getBaseMetaTileEntity().getStoredEU(); + if (aEU > 0){ + aNBT.setLong("aStoredEU", aEU); + if (aNBT.hasKey("aStoredEU")) { + Logger.WARNING("Set aStoredEU to NBT."); + } + } + } } @Override - public void loadNBTData(final NBTTagCompound aNBT) { - // + public void loadNBTData(final NBTTagCompound aNBT) { + aCurrentOutputAmperage = aNBT.getByte("aCurrentOutputAmperage"); + if (aNBT.hasKey("aStoredEU")) { + this.setEUVar(aNBT.getLong("aStoredEU")); + } } @Override @@ -373,6 +382,35 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { return false; + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); + long aEU = this.getBaseMetaTileEntity().getStoredEU(); + if (aEU > 0){ + aNBT.setLong("aStoredEU", aEU); + if (aNBT.hasKey("aStoredEU")) { + Logger.WARNING("Set aStoredEU to NBT."); + } + } + } } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + byte aTest = (byte) (aCurrentOutputAmperage + 1); + if (aTest > 16 || aTest <= 0 ) { + aTest = 1; + } + aCurrentOutputAmperage = aTest; + PlayerUtils.messagePlayer(aPlayer, "Now handling "+aCurrentOutputAmperage+" Amps."); + } + + + + + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index 94104ab0d5..cff9be3ab4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -18,9 +18,12 @@ import gtPlusPlus.core.material.*; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Heat; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntityFluid; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_Cable; +import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -94,7 +97,16 @@ public class GregtechConduits { Logger.INFO("Failed during Hexadecuple pipe generation. [Ecx]"); e.printStackTrace(); } - } + } + + + //Generate Heat Pipes + GregtechItemList.HeatPipe_Tier_1.set(new GT_MetaPipeEntity_Heat(27550, "gtpp.pipe.heat.basic.01", "Basic Heat Pipe (500C)", Materials.Lead, 500).getStackForm(1L)); + GregtechItemList.HeatPipe_Tier_2.set(new GT_MetaPipeEntity_Heat(27551, "gtpp.pipe.heat.basic.02", "Basic Heat Pipe (500C)", Materials.Iron, 500).getStackForm(1L)); + GregtechItemList.HeatPipe_Tier_3.set(new GT_MetaPipeEntity_Heat(27552, "gtpp.pipe.heat.basic.03", "Basic Heat Pipe (750C)", Materials.Thorium, 750).getStackForm(1L)); + + + } private static void generateFluidMultiPipes(Constructor<GT_MetaPipeEntity_Fluid> aClazz, Materials aMaterial, String name, String displayName, int startID, int baseCapacity, int heatCapacity, boolean gasProof){ |