diff options
author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-09-02 23:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 23:17:17 +0200 |
commit | 1b820de08a05070909a267e17f033fcf58ac8710 (patch) | |
tree | 02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/bwcrossmod/tectech/tileentites | |
parent | afd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff) | |
download | GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2 GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip |
The Great Renaming (#3014)
* move kekztech to a single root dir
* move detrav to a single root dir
* move gtnh-lanthanides to a single root dir
* move tectech and delete some gross reflection in gt++
* remove more reflection inside gt5u
* delete more reflection in gt++
* fix imports
* move bartworks and bwcrossmod
* fix proxies
* move galactigreg and ggfab
* move gtneioreplugin
* try to fix gt++ bee loader
* apply the rename rules to BW
* apply rename rules to bwcrossmod
* apply rename rules to detrav scanner mod
* apply rename rules to galacticgreg
* apply rename rules to ggfab
* apply rename rules to goodgenerator
* apply rename rules to gtnh-lanthanides
* apply rename rules to gt++
* apply rename rules to kekztech
* apply rename rules to kubatech
* apply rename rules to tectech
* apply rename rules to gt
apply the rename rules to gt
* fix tt import
* fix mui hopefully
* fix coremod except intergalactic
* rename assline recipe class
* fix a class name i stumbled on
* rename StructureUtility to GTStructureUtility to prevent conflict with structurelib
* temporary rename of GTTooltipDataCache to old name
* fix gt client/server proxy names
Diffstat (limited to 'src/main/java/bwcrossmod/tectech/tileentites')
6 files changed, 744 insertions, 0 deletions
diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java new file mode 100644 index 0000000000..7dc3eca2f8 --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaser.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import tectech.mechanics.pipe.IConnectsToEnergyTunnel; +import tectech.thing.metaTileEntity.pipe.MTEPipeEnergy; + +public interface LowPowerLaser extends IMetaTileEntity, IConnectsToEnergyTunnel { + + boolean isSender(); + + boolean isReceiver(); + + boolean isTunnel(); + + default boolean isConnectedCorrectly(ForgeDirection side) { + return false; + } + + default void setEUVar(long aEnergy) {} + + default long getAMPERES() { + return -1; + } + + default long maxEUInput() { + return -1; + } + + default long maxEUOutput() { + return -1; + } + + default long maxEUStore() { + return -1; + } + + default long getTotalPower() { + return this.getAMPERES() * Math.max(this.maxEUOutput(), this.maxEUInput()) - this.getAMPERES() / 20; + } + + default void moveAroundLowPower(IGregTechTileEntity aBaseMetaTileEntity) { + byte color = this.getBaseMetaTileEntity() + .getColorization(); + if (color >= 0) { + ForgeDirection front = aBaseMetaTileEntity.getFrontFacing(); + ForgeDirection opposite = front.getOpposite(); + + for (short dist = 1; dist < 250; ++dist) { + IGregTechTileEntity tGTTileEntity = aBaseMetaTileEntity + .getIGregTechTileEntityAtSideAndDistance(front, dist); + if (tGTTileEntity == null || tGTTileEntity.getColorization() != color) { + return; + } + + IMetaTileEntity aMetaTileEntity = tGTTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return; + } + + if (aMetaTileEntity instanceof LowPowerLaser lowPowerLaser && lowPowerLaser.isReceiver() + && opposite == tGTTileEntity.getFrontFacing()) { + if (this.maxEUOutput() > lowPowerLaser.maxEUInput() + || this.getAMPERES() > lowPowerLaser.getAMPERES()) { + aMetaTileEntity.doExplosion(this.maxEUOutput()); + this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.maxEUOutput()); + return; + } + + if (this.maxEUOutput() == lowPowerLaser.maxEUInput()) { + long diff = Math.min( + this.getAMPERES() * 20L * this.maxEUOutput(), + Math.min( + lowPowerLaser.maxEUStore() - aMetaTileEntity.getBaseMetaTileEntity() + .getStoredEU(), + aBaseMetaTileEntity.getStoredEU())); + this.setEUVar(aBaseMetaTileEntity.getStoredEU() - diff); + lowPowerLaser.setEUVar( + aMetaTileEntity.getBaseMetaTileEntity() + .getStoredEU() + diff); + } + return; + } + + if ((!(aMetaTileEntity instanceof LowPowerLaser lowPowerLaser) || !lowPowerLaser.isTunnel()) + && !(aMetaTileEntity instanceof MTEPipeEnergy)) { + return; + } + + if (aMetaTileEntity instanceof MTEPipeEnergy tePipeEnergy) { + if (tePipeEnergy.connectionCount < 2) { + return; + } + tePipeEnergy.markUsed(); + return; + } + + if (aMetaTileEntity instanceof LowPowerLaser lowPowerLaser && lowPowerLaser.isTunnel() + && !lowPowerLaser.isConnectedCorrectly(front)) { + return; + } + } + } + } +} diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java new file mode 100644 index 0000000000..a4e21be96f --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/LowPowerLaserBase.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import java.util.Optional; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.enums.GTValues; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTETieredMachineBlock; + +public abstract class LowPowerLaserBase extends MTETieredMachineBlock implements LowPowerLaser { + + protected long AMPERES; + + public LowPowerLaserBase(int aID, String aName, String aNameRegional, int aTier, long aAmperes, int aInvSlotCount, + String aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); + this.AMPERES = aAmperes; + } + + public LowPowerLaserBase(int aID, String aName, String aNameRegional, int aTier, long aAmperes, int aInvSlotCount, + String[] aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription, aTextures); + this.AMPERES = aAmperes; + } + + public LowPowerLaserBase(String aName, int aTier, long aAmperes, int aInvSlotCount, String aDescription, + ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + this.AMPERES = aAmperes; + } + + public LowPowerLaserBase(String aName, int aTier, long aAmperes, int aInvSlotCount, String[] aDescription, + ITexture[][][] aTextures) { + super(aName, aTier, aInvSlotCount, aDescription, aTextures); + this.AMPERES = aAmperes; + } + + @Override + public long getAMPERES() { + return this.AMPERES; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, + ItemStack itemStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side, + ItemStack itemStack) { + return false; + } + + @Override + public boolean isInputFacing(ForgeDirection side) { + return true; + } + + @Override + public boolean isOutputFacing(ForgeDirection side) { + return true; + } + + @Override + public boolean shouldJoinIc2Enet() { + return true; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public void saveNBTData(NBTTagCompound nbtTagCompound) { + Optional.ofNullable(nbtTagCompound) + .ifPresent(tag -> tag.setLong("AMPERES", this.AMPERES)); + } + + @Override + public void loadNBTData(NBTTagCompound nbtTagCompound) { + if (nbtTagCompound != null && nbtTagCompound.hasKey("AMPERES")) { + this.AMPERES = nbtTagCompound.getLong("AMPERES"); + } + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(ForgeDirection facing) { + return true; + } + + @Override + public boolean isEnetInput() { + return false; + } + + @Override + public boolean isEnetOutput() { + return false; + } + + @Override + public long maxEUInput() { + return GTValues.V[this.mTier]; + } + + @Override + public long maxEUOutput() { + return GTValues.V[this.mTier]; + } + + @Override + public boolean isTeleporterCompatible() { + return false; + } + + @Override + public long getMinimumStoredEU() { + return GTValues.V[this.mTier + 1]; + } + + @Override + public long maxEUStore() { + return 512L + GTValues.V[this.mTier + 1] * 24L * this.AMPERES; + } +} diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java new file mode 100644 index 0000000000..e4eba7d464 --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserBox.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import bartworks.util.BWTooltipReference; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GTUtility; + +public class MTELowPowerLaserBox extends LowPowerLaserBase { + + public MTELowPowerLaserBox(int aID, String aName, String aNameRegional, int aTier, long aAmperes, + ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, aAmperes, 0, new String[0], aTextures); + } + + public MTELowPowerLaserBox(String aName, int aTier, long aAmperes, String[] aDescription, + ITexture[][][] aTextures) { + super(aName, aTier, aAmperes, 0, aDescription, aTextures); + } + + @Override + public boolean isSender() { + return this.getBaseMetaTileEntity() + .isAllowedToWork(); + } + + @Override + public boolean isReceiver() { + return !this.getBaseMetaTileEntity() + .isAllowedToWork(); + } + + @Override + public boolean isTunnel() { + return false; + } + + @Override + public long maxAmperesOut() { + return !this.getBaseMetaTileEntity() + .isAllowedToWork() ? this.AMPERES : 0; + } + + @Override + public long maxAmperesIn() { + return this.getBaseMetaTileEntity() + .isAllowedToWork() ? this.AMPERES + this.AMPERES / 4 : 0; + } + + @Override + public boolean hasAlternativeModeText() { + return true; + } + + @Override + public String getAlternativeModeText() { + return this.isReceiver() ? "Set to receiving mode" : "Set to sending mode"; + } + + @Override + public boolean isEnetInput() { + return this.getBaseMetaTileEntity() + .isAllowedToWork(); + } + + @Override + public boolean isEnetOutput() { + return !this.getBaseMetaTileEntity() + .isAllowedToWork(); + } + + @Override + public boolean canConnect(ForgeDirection side) { + return side == this.getBaseMetaTileEntity() + .getFrontFacing(); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MTELowPowerLaserBox(this.mName, this.mTier, this.AMPERES, this.mDescriptionArray, this.mTextures); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork()); + + byte Tick = (byte) (int) (aTick % 20L); + if (16 == Tick) { + if (aBaseMetaTileEntity.getStoredEU() > 0L) { + this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.AMPERES); + if (aBaseMetaTileEntity.getStoredEU() < 0L) { + this.setEUVar(0L); + } + } + if (this.getBaseMetaTileEntity() + .isAllowedToWork() && aBaseMetaTileEntity.getStoredEU() > this.getMinimumStoredEU()) { + this.moveAroundLowPower(aBaseMetaTileEntity); + } + } + } + } + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[12][17][]; + + for (byte i = -1; i < 16; ++i) { + rTextures[0][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; + rTextures[1][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; + rTextures[2][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_IN_MULTI[this.mTier] }; + rTextures[3][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] }; + rTextures[4][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] }; + rTextures[5][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_IN_LASER_TT[this.mTier] }; + rTextures[6][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; + rTextures[7][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; + rTextures[8][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] }; + rTextures[9][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] }; + rTextures[10][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] }; + rTextures[11][i + 1] = new ITexture[] { Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[this.mTier] }; + } + + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int aColorIndex, boolean aActive, boolean aRedstone) { + return this.mTextures[Math.min(2, side.ordinal()) + (side == facing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + + 1]; + } + + @Override + public String[] getDescription() { + return new String[] { "Like a transformer... but for LASERS!", + "Transfer rate: " + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(this.getTotalPower()) + + EnumChatFormatting.WHITE + + " EU/t", + BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; + } +} diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java new file mode 100644 index 0000000000..da3e3e4ac2 --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserDynamo.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import tectech.thing.metaTileEntity.hatch.MTEHatchDynamoTunnel; + +public class MTELowPowerLaserDynamo extends MTEHatchDynamoTunnel implements LowPowerLaser { + + public MTELowPowerLaserDynamo(int aID, String aName, String aNameRegional, int aTier, int aAmp) { + super(aID, aName, aNameRegional, aTier, aAmp); + } + + public MTELowPowerLaserDynamo(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aAmp, aDescription, aTextures); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new MTELowPowerLaserDynamo(this.mName, this.mTier, this.Amperes, this.mDescriptionArray, this.mTextures); + } + + @Override + public boolean isSender() { + return true; + } + + @Override + public boolean isReceiver() { + return false; + } + + @Override + public boolean isTunnel() { + return false; + } + + @Override + public long getAMPERES() { + return this.Amperes; + } + + @Override + public String[] getDescription() { + return mDescriptionArray; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + byte Tick = (byte) (int) (aTick % 20L); + if (16 == Tick && aBaseMetaTileEntity.getStoredEU() > 0L) { + this.setEUVar(aBaseMetaTileEntity.getStoredEU() - this.Amperes); + if (aBaseMetaTileEntity.getStoredEU() < 0L) { + this.setEUVar(0L); + } + } + if (aBaseMetaTileEntity.getStoredEU() > this.getMinimumStoredEU()) { + this.moveAroundLowPower(aBaseMetaTileEntity); + } + } + } +} diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java new file mode 100644 index 0000000000..b9fa9c14b6 --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserHatch.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import tectech.thing.metaTileEntity.hatch.MTEHatchEnergyTunnel; + +public class MTELowPowerLaserHatch extends MTEHatchEnergyTunnel implements LowPowerLaser { + + public MTELowPowerLaserHatch(int aID, String aName, String aNameRegional, int aTier, int aAmp) { + super(aID, aName, aNameRegional, aTier, aAmp); + } + + public MTELowPowerLaserHatch(String aName, int aTier, int aAmp, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aAmp, aDescription, aTextures); + } + + @Override + public String[] getDescription() { + return mDescriptionArray; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new MTELowPowerLaserHatch(this.mName, this.mTier, this.Amperes, this.mDescriptionArray, this.mTextures); + } + + @Override + public boolean isSender() { + return false; + } + + @Override + public boolean isReceiver() { + return true; + } + + @Override + public boolean isTunnel() { + return false; + } + + @Override + public long getAMPERES() { + return this.Amperes; + } +} diff --git a/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java new file mode 100644 index 0000000000..0a8ddb19d3 --- /dev/null +++ b/src/main/java/bwcrossmod/tectech/tileentites/tiered/MTELowPowerLaserPipe.java @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following + * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial + * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +package bwcrossmod.tectech.tileentites.tiered; + +import java.util.ArrayList; +import java.util.HashSet; + +import net.minecraft.block.Block; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import bartworks.util.BWTooltipReference; +import gregtech.api.enums.Materials; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.ICoverable; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTECable; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.CoverBehavior; +import gregtech.common.GTClient; +import ic2.core.Ic2Items; + +public class MTELowPowerLaserPipe extends MTECable implements LowPowerLaser { + + public MTELowPowerLaserPipe(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional, 0.25f, Materials.BorosilicateGlass, 0, 0, 0, false, false); + } + + public MTELowPowerLaserPipe(String aName, float aThickNess, Materials aMaterial, long aCableLossPerMeter, + long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) { + super(aName, aThickNess, aMaterial, aCableLossPerMeter, aAmperage, aVoltage, aInsulated, aCanShock); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { + return new MTELowPowerLaserPipe( + this.mName, + this.mThickNess, + this.mMaterial, + this.mCableLossPerMeter, + this.mAmperage, + this.mVoltage, + this.mInsulated, + this.mCanShock); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aTick % 20 == 13 && aBaseMetaTileEntity.isClientSide() && GTClient.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection siide, byte aConnections, + int aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[] { TextureFactory.of( + Block.getBlockFromItem(Ic2Items.glassFiberCableBlock.getItem()), + Ic2Items.glassFiberCableBlock.getItemDamage(), + siide) }; + } + + @Override + public String[] getDescription() { + return new String[] { "Primitive Laser Cable intended for Low Power Applications", "Does not auto-connect", + "Does not turn or bend", + EnumChatFormatting.WHITE + "Must be " + + EnumChatFormatting.YELLOW + + "c" + + EnumChatFormatting.RED + + "o" + + EnumChatFormatting.BLUE + + "l" + + EnumChatFormatting.DARK_PURPLE + + "o" + + EnumChatFormatting.GOLD + + "r" + + EnumChatFormatting.DARK_RED + + "e" + + EnumChatFormatting.DARK_GREEN + + "d" + + EnumChatFormatting.WHITE + + " in order to work", + BWTooltipReference.ADDED_BY_BARTIMAEUSNEK_VIA_BARTWORKS.get() }; + } + + @Override + public boolean isSender() { + return false; + } + + @Override + public boolean isReceiver() { + return false; + } + + @Override + public boolean isTunnel() { + return true; + } + + public boolean canConnect(ForgeDirection side) { + return true; + } + + @Override + public boolean isGivingInformation() { + return false; + } + + @Override + public boolean isConnectedCorrectly(ForgeDirection side) { + return this.isConnectedAtSide(side) && this.isConnectedAtSide(side.getOpposite()); + } + + @Override + public boolean shouldJoinIc2Enet() { + return false; + } + + @Override + public long injectEnergyUnits(ForgeDirection side, long aVoltage, long aAmperage) { + return 0L; + } + + @Override + @Deprecated + public long transferElectricity(ForgeDirection side, long aVoltage, long aAmperage, + ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + return 0L; + } + + @Override + public long transferElectricity(ForgeDirection side, long aVoltage, long aAmperage, + HashSet<TileEntity> aAlreadyPassedSet) { + return 0L; + } + + @Override + public boolean letsIn(CoverBehavior coverBehavior, ForgeDirection side, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { + return true; + } + + @Override + public boolean letsOut(CoverBehavior coverBehavior, ForgeDirection side, int aCoverID, int aCoverVariable, + ICoverable aTileEntity) { + return true; + } +} |