From 1b820de08a05070909a267e17f033fcf58ac8710 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 2 Sep 2024 23:17:17 +0200 Subject: 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 --- .../GT_MetaTileEntity_DieselGenerator.java | 278 ------- .../generators/GT_MetaTileEntity_GasTurbine.java | 207 ------ .../generators/GT_MetaTileEntity_LightningRod.java | 169 ----- .../GT_MetaTileEntity_MagicEnergyConverter.java | 173 ----- .../GT_MetaTileEntity_MagicalEnergyAbsorber.java | 805 --------------------- .../GT_MetaTileEntity_NaquadahReactor.java | 201 ----- .../GT_MetaTileEntity_PlasmaGenerator.java | 142 ---- .../generators/GT_MetaTileEntity_SteamTurbine.java | 238 ------ .../generators/MTEDieselGenerator.java | 278 +++++++ .../tileentities/generators/MTEGasTurbine.java | 201 +++++ .../tileentities/generators/MTELightningRod.java | 168 +++++ .../generators/MTEMagicEnergyConverter.java | 167 +++++ .../generators/MTEMagicalEnergyAbsorber.java | 803 ++++++++++++++++++++ .../generators/MTENaquadahReactor.java | 200 +++++ .../generators/MTEPlasmaGenerator.java | 142 ++++ .../tileentities/generators/MTESteamTurbine.java | 238 ++++++ 16 files changed, 2197 insertions(+), 2213 deletions(-) delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java delete mode 100644 src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTEDieselGenerator.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTEGasTurbine.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTELightningRod.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTEMagicEnergyConverter.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTEMagicalEnergyAbsorber.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTENaquadahReactor.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTEPlasmaGenerator.java create mode 100644 src/main/java/gregtech/common/tileentities/generators/MTESteamTurbine.java (limited to 'src/main/java/gregtech/common/tileentities/generators') diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java deleted file mode 100644 index 10138bdfc2..0000000000 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ /dev/null @@ -1,278 +0,0 @@ -package gregtech.common.tileentities.generators; - -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BACK; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BACK_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_SIDE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_TOP; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_TOP_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.ParticleFX; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; - -public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - - public GT_MetaTileEntity_DieselGenerator(int aID, String aName, String aNameRegional, int aTier) { - super( - aID, - aName, - aNameRegional, - aTier, - new String[] { "Requires liquid Fuel", - "Causes " - + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond - * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[aTier]) - + " Pollution per second" }); - onConfigLoad(); - } - - public GT_MetaTileEntity_DieselGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - public GT_MetaTileEntity_DieselGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_DieselGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); - } - - @Override - public RecipeMap getRecipeMap() { - return RecipeMaps.dieselFuels; - } - - @Override - public int getCapacity() { - return 16000; - } - - public void onConfigLoad() { - this.mEfficiency = (100 - this.mTier * 5); - } - - @Override - public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public int getFuelValue(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack) || getRecipeMap() == null) return 0; - long rValue = super.getFuelValue(aStack); - if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3L); - } - if (rValue > Integer.MAX_VALUE) { - throw new ArithmeticException("Integer LOOPBACK!"); - } - return (int) rValue; - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aTick % 100 == 0 && mFluid != null && mFluid.amount > this.getCapacity()) { - GT_Log.err.println( - "Dupe Abuse: " + aBaseMetaTileEntity.getOwnerName() - + " Coords: " - + aBaseMetaTileEntity.getXCoord() - + " " - + aBaseMetaTileEntity.getYCoord() - + " " - + aBaseMetaTileEntity.getZCoord()); - aBaseMetaTileEntity.setToFire(); - } - super.onPostTick(aBaseMetaTileEntity, aTick); - } - - /** - * Draws random smoke particles on top when active - * - * @param aBaseMetaTileEntity The entity that will handle the {@link Block#randomDisplayTick} - */ - @SideOnly(Side.CLIENT) - @Override - public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { - if (aBaseMetaTileEntity.isActive()) { - - if (aBaseMetaTileEntity.getCoverIDAtSide(ForgeDirection.UP) == 0 - && !aBaseMetaTileEntity.getOpacityAtSide(ForgeDirection.UP)) { - - final double x = aBaseMetaTileEntity.getOffsetX(ForgeDirection.UP, 1) + 2D / 16D - + XSTR_INSTANCE.nextFloat() * 14D / 16D; - final double y = aBaseMetaTileEntity.getOffsetY(ForgeDirection.UP, 1) + 1D / 32D; - final double z = aBaseMetaTileEntity.getOffsetZ(ForgeDirection.UP, 1) + 2D / 16D - + XSTR_INSTANCE.nextFloat() * 14D / 16D; - - new ParticleEventBuilder().setMotion(0D, 0D, 0D) - .setPosition(x, y, z) - .setWorld(getBaseMetaTileEntity().getWorld()) - .setIdentifier(ParticleFX.SMOKE) - .run(); - } - } - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_FRONT), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_FRONT_GLOW) - .glow() - .build()), - OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BACK), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_BACK_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BOTTOM), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_BOTTOM_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_TOP), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_TOP_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_SIDE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_SIDE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_FRONT_ACTIVE_GLOW) - .glow() - .build()), - OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_BACK_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_TOP_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE), - TextureFactory.builder() - .addIcon(DIESEL_GENERATOR_SIDE_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public int getPollution() { - return (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond - * GT_Mod.gregtechproxy.mPollutionDieselGeneratorReleasedByTier[mTier]); - } -} diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java deleted file mode 100644 index ca0a5d6958..0000000000 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ /dev/null @@ -1,207 +0,0 @@ -package gregtech.common.tileentities.generators; - -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BACK; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BACK_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BACK_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BACK_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BOTTOM; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BOTTOM_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BOTTOM_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_BOTTOM_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_SIDE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_SIDE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_TOP; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_TOP_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_TOP_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.GAS_TURBINE_TOP_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; - -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.GT_Mod; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.render.TextureFactory; - -public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - - public GT_MetaTileEntity_GasTurbine(int aID, String aName, String aNameRegional, int aTier, int mEfficiency) { - super( - aID, - aName, - aNameRegional, - aTier, - new String[] { "Requires flammable Gasses", - "Causes " - + (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond - * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[aTier]) - + " Pollution per second" }); - this.mEfficiency = mEfficiency; - } - - public GT_MetaTileEntity_GasTurbine(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures, - int mEfficiency) { - super(aName, aTier, aDescription, aTextures); - this.mEfficiency = mEfficiency; - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_GasTurbine( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures, - this.mEfficiency); - } - - @Override - public RecipeMap getRecipeMap() { - return RecipeMaps.gasTurbineFuels; - } - - @Override - public int getCapacity() { - return 16000; - } - - @Override - public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_FRONT), - TextureFactory.builder() - .addIcon(GAS_TURBINE_FRONT_GLOW) - .glow() - .build()), - OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BACK), - TextureFactory.builder() - .addIcon(GAS_TURBINE_BACK_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BOTTOM), - TextureFactory.builder() - .addIcon(GAS_TURBINE_BOTTOM_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_TOP), - TextureFactory.builder() - .addIcon(GAS_TURBINE_TOP_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_SIDE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_SIDE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_FRONT_ACTIVE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_FRONT_ACTIVE_GLOW) - .glow() - .build()), - OVERLAYS_ENERGY_OUT[this.mTier] }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BACK_ACTIVE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_BACK_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_BOTTOM_ACTIVE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_BOTTOM_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_TOP_ACTIVE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_TOP_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], - TextureFactory.of( - TextureFactory.of(GAS_TURBINE_SIDE_ACTIVE), - TextureFactory.builder() - .addIcon(GAS_TURBINE_SIDE_ACTIVE_GLOW) - .glow() - .build()) }; - } - - @Override - public int getPollution() { - return (int) (GT_Mod.gregtechproxy.mPollutionBaseGasTurbinePerSecond - * GT_Mod.gregtechproxy.mPollutionGasTurbineReleasedByTier[mTier]); - } -} diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java deleted file mode 100644 index 9809dba278..0000000000 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ /dev/null @@ -1,169 +0,0 @@ -package gregtech.common.tileentities.generators; - -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; - -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures.BlockIcons; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.render.TextureFactory; - -public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMachineBlock { - - public GT_MetaTileEntity_LightningRod(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 0, "Generates EU From Lightning Bolts"); - } - - public GT_MetaTileEntity_LightningRod(String aName, int aTier, int aInvSlotCount, String aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - public GT_MetaTileEntity_LightningRod(String aName, int aTier, int aInvSlotCount, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aInvSlotCount, aDescription, aTextures); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection sideDirection, - ForgeDirection facingDirection, int colorIndex, boolean active, boolean redstoneLevel) { - if (sideDirection != ForgeDirection.UP) { - return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], - BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] }; - } - if (!active) return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], - TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS) }; - return new ITexture[] { BlockIcons.MACHINE_CASINGS[mTier][colorIndex + 1], - TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), TextureFactory.builder() - .addIcon(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[][][] getTextureSet(ITexture[] aTextures) { - return null; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LightningRod( - this.mName, - this.mTier, - this.mInventory.length, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - World aWorld = aBaseMetaTileEntity.getWorld(); - if (!aWorld.isRemote) { - if (aBaseMetaTileEntity.getStoredEU() > 0) { - aBaseMetaTileEntity.setActive(true); - aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU() / 100 + 1, false); - } else { - aBaseMetaTileEntity.setActive(false); - } - - if (aTick % 256 == 0 && (aWorld.isThundering() || (aWorld.isRaining() && XSTR_INSTANCE.nextInt(10) == 0))) { - int aRodValue = 0; - boolean isRodValid = true; - int aX = aBaseMetaTileEntity.getXCoord(); - int aY = aBaseMetaTileEntity.getYCoord(); - int aZ = aBaseMetaTileEntity.getZCoord(); - - for (int i = aBaseMetaTileEntity.getYCoord() + 1; i < aWorld.getHeight() - 1; i++) { - if (isRodValid && aBaseMetaTileEntity.getBlock(aX, i, aZ) - .getUnlocalizedName() - .equals("blockFenceIron")) { - aRodValue++; - } else { - isRodValid = false; - if (aBaseMetaTileEntity.getBlock(aX, i, aZ) != Blocks.air) { - aRodValue = 0; - break; - } - } - } - if (!aWorld.isThundering() && ((aY + aRodValue) < 128)) aRodValue = 0; - if (XSTR_INSTANCE.nextInt(4 * aWorld.getHeight()) < (aRodValue * (aY + aRodValue))) { - aBaseMetaTileEntity - .increaseStoredEnergyUnits(maxEUStore() - aBaseMetaTileEntity.getStoredEU(), false); - aWorld.addWeatherEffect(new EntityLightningBolt(aWorld, aX, aY + aRodValue, aZ)); - // randomly break a rod - if (aWorld.isThundering()) { - aWorld.setBlockToAir(aX, aY + XSTR_INSTANCE.nextInt(aRodValue) + 1, aZ); - } - } - } - } - } - - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - return false; - } - - @Override - public boolean isSimpleMachine() { - return false; - } - - @Override - public boolean isFacingValid(ForgeDirection facing) { - return facing == ForgeDirection.UP; - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return true; - } - - @Override - public boolean isEnetOutput() { - return true; - } - - @Override - public boolean isEnetInput() { - return false; - } - - @Override - public long maxEUStore() { - return 50000000; - } - - @Override - public long maxEUOutput() { - return GT_Values.V[mTier]; - } - - @Override - public long maxAmperesOut() { - return 512; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) {} - - @Override - public void loadNBTData(NBTTagCompound aNBT) {} -} diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java deleted file mode 100644 index 647aa504e5..0000000000 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ /dev/null @@ -1,173 +0,0 @@ -package gregtech.common.tileentities.generators; - -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; - -import net.minecraftforge.common.util.ForgeDirection; - -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.render.TextureFactory; - -public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_BasicGenerator { - - public int mEfficiency; - - public GT_MetaTileEntity_MagicEnergyConverter(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Put your strange stuff in here"); - onConfigLoad(); - } - - public GT_MetaTileEntity_MagicEnergyConverter(String aName, int aTier, String aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - public GT_MetaTileEntity_MagicEnergyConverter(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MagicEnergyConverter( - this.mName, - this.mTier, - this.mDescriptionArray, - this.mTextures); - } - - @Override - public RecipeMap getRecipeMap() { - return RecipeMaps.magicFuels; - } - - @Override - public int getCapacity() { - return 16000; - } - - public void onConfigLoad() { - this.mEfficiency = 100 - this.mTier * 5; - } - - @Override - public int getEfficiency() { - return this.mEfficiency; - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build(), - OVERLAYS_ENERGY_OUT[mTier] }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build(), - OVERLAYS_ENERGY_OUT[mTier] }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public int getPollution() { - return 0; - } -} diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java deleted file mode 100644 index 3245607ac2..0000000000 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ /dev/null @@ -1,805 +0,0 @@ -package gregtech.common.tileentities.generators; - -import static gregtech.api.enums.GT_Values.V; -import static gregtech.api.enums.Mods.Thaumcraft; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_DRAGONEGG; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_DRAGONEGG_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_GLOW; -import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; -import static gregtech.api.objects.XSTR.XSTR_INSTANCE; -import static net.minecraft.util.EnumChatFormatting.GRAY; -import static net.minecraft.util.EnumChatFormatting.GREEN; -import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; -import static net.minecraft.util.EnumChatFormatting.RESET; -import static net.minecraft.util.EnumChatFormatting.UNDERLINE; -import static net.minecraft.util.EnumChatFormatting.YELLOW; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockDragonEgg; -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.entity.item.EntityEnderCrystal; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.ItemEnchantedBook; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraftforge.common.util.ForgeDirection; - -import com.google.common.base.Enums; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.enums.ParticleFX; -import gregtech.api.enums.TC_Aspects; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.recipe.RecipeMap; -import gregtech.api.recipe.RecipeMaps; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_LanguageManager; -import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Utility; -import gregtech.api.util.WorldSpawnedEventBuilder.ParticleEventBuilder; -import gregtech.common.config.machinestats.ConfigMachines; -import thaumcraft.api.aspects.Aspect; -import thaumcraft.api.aspects.AspectList; -import thaumcraft.api.aspects.AspectSourceHelper; -import thaumcraft.api.aspects.IAspectContainer; -import thaumcraft.api.visnet.VisNetHandler; - -interface MagicalEnergyBBListener { - - void onMagicalEnergyBBUpdate(); -} - -public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_BasicGenerator - implements MagicalEnergyBBListener { - - private static final ConcurrentHashMap sSubscribedCrystals = new ConcurrentHashMap<>( - 4); - private static final List sPrimalAspects = (Thaumcraft.isModLoaded()) ? Aspect.getPrimalAspects() - : new ArrayList<>(); - private static final Map sAspectsEnergy = new HashMap<>(); - private static boolean sAllowMultipleEggs = false; - private static GT_MetaTileEntity_MagicalEnergyAbsorber sActiveSiphon = null; - private static int sEnergyPerEndercrystal = 512; - private static int sEnergyFromVis = 20; - private static int sEnergyPerEssentia = 320; - private static int sDragonEggEnergyPerTick = 2048; - private static int sCreeperEggEnergyPerTick = 512; - private final MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); - private int mEfficiency; - private int mMaxVisPerDrain; - private long mNextGenerateTickRate = 1; - private int mNoGenerationTicks = 0; - private boolean mUsingEssentia = true; - - public GT_MetaTileEntity_MagicalEnergyAbsorber(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, "Feasts on magic close to it:"); - onConfigLoad(); - } - - private GT_MetaTileEntity_MagicalEnergyAbsorber(String aName, int aTier, String[] aDescription, - ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - onConfigLoad(); - } - - /** - * Populates static variables dependant on config settings - */ - private static void sharedConfigLoad() { - sAllowMultipleEggs = ConfigMachines.allowMultipleEggs; - if (Thaumcraft.isModLoaded()) { - for (Aspect tAspect : Aspect.aspects.values()) { - // noinspection UnstableApiUsage - sAspectsEnergy.put( - tAspect, - Enums.getIfPresent( - TC_Aspects.class, - tAspect.getTag() - .toUpperCase(Locale.ENGLISH)) - .or(TC_Aspects.AER).mValue * sEnergyPerEssentia); - } - } - } - - private static void setActiveSiphon(GT_MetaTileEntity_MagicalEnergyAbsorber aSiphon) { - sActiveSiphon = aSiphon; - } - - public void onConfigLoad() { - sharedConfigLoad(); - mEfficiency = 100 - mTier * 10; - mMaxVisPerDrain = (int) Math.round(Math.sqrt((double) (V[mTier] * 10000) / (sEnergyFromVis * getEfficiency()))); - if (Math.pow(mMaxVisPerDrain, 2) * sEnergyFromVis * getEfficiency() < V[mTier]) { - mMaxVisPerDrain += 1; - } - } - - @Override - public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aPlayer.isSneaking()) mMagicalEnergyBB.decreaseTier(); - else mMagicalEnergyBB.increaseTier(); - GT_Utility.sendChatToPlayer( - aPlayer, - String.format( - GT_LanguageManager.addStringLocalization( - "Interaction_DESCRIPTION_MagicalEnergyAbsorber_Screwdriver", - "Absorption range: %s blocks"), - mMagicalEnergyBB.getRange(), - true)); - mMagicalEnergyBB.update(); - } - - @Override - public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - if (!aBaseMetaTileEntity.isServerSide()) return; - mMagicalEnergyBB.update(); - } - - @Override - public void onRemoval() { - super.onRemoval(); - releaseEgg(); - unsubscribeCrystals(); - } - - private void releaseEgg() { - if (sActiveSiphon == this) { - setActiveSiphon(null); - } - } - - private void unsubscribeCrystals() { - for (UUID tCrystalID : sSubscribedCrystals.keySet()) { - sSubscribedCrystals.remove(tCrystalID, this); - } - } - - /** - * Call-back from the Bounding Box when its content is updated - */ - @Override - public void onMagicalEnergyBBUpdate() { - List tCrystalIDsInRange = mMagicalEnergyBB.getLivingCrystalIDs(); - // Release unreachable Crystals subscriptions - for (UUID tSubscribedCrystalID : sSubscribedCrystals.keySet()) { - if (!tCrystalIDsInRange.contains(tSubscribedCrystalID)) { - sSubscribedCrystals.remove(tSubscribedCrystalID, this); - } - } - // Subscribe to available and not already subscribed Crystals - for (UUID tCrystalID : tCrystalIDsInRange) { - sSubscribedCrystals.putIfAbsent(tCrystalID, this); - } - } - - @Override - public String[] getDescription() { - final String LI = "- %%%"; - final String EU_PER = "%%%EU per "; - List description = new ArrayList<>(); - description - .add(UNDERLINE + "Feasts on " + LIGHT_PURPLE + UNDERLINE + "magic" + GRAY + UNDERLINE + " close to it:"); - description.add( - LI + (sAllowMultipleEggs ? "A " : "An " + YELLOW + UNDERLINE + "EXCLUSIVE" + RESET) - + GRAY - + " " - + LIGHT_PURPLE - + "Dragon Egg" - + GRAY - + " atop"); - if (sEnergyPerEndercrystal > 0) { - description.add(LI + sEnergyPerEndercrystal + EU_PER + LIGHT_PURPLE + "Ender Crystal" + GRAY + " in range"); - } - if (Thaumcraft.isModLoaded()) { - description.add(LI + mMaxVisPerDrain + "%%%CV/t from an " + LIGHT_PURPLE + "Energised Node" + GRAY); - description.add( - LI + (sEnergyPerEssentia * getEfficiency()) / 100 - + EU_PER - + LIGHT_PURPLE - + "Essentia" - + GRAY - + " Aspect-Value from containers in range"); - } - description.add(" "); - description.add(UNDERLINE + "Lookup range (Use Screwdriver to change):"); - description.add("Default: %%%" + GREEN + mMagicalEnergyBB.getDefaultRange()); - description.add("Max: %%%" + GREEN + mMagicalEnergyBB.getMaxRange()); - description.add(" "); - description - .add(UNDERLINE + "Fuels on " + LIGHT_PURPLE + UNDERLINE + "enchantments" + GRAY + UNDERLINE + " input:"); - description.add( - "- Item: %%%" + (10000 * getEfficiency()) / 100 - + EU_PER - + LIGHT_PURPLE - + "enchant" - + GRAY - + " weight × level / max"); - description.add("- Book: %%%" + 10000 + EU_PER + LIGHT_PURPLE + "enchant" + GRAY + " weight × level / max"); - description.add(" "); - description.add("Efficiency: %%%" + GREEN + getEfficiency() + "%"); - return description.toArray(new String[0]); - } - - @Override - public ITexture[] getFront(byte aColor) { - return new ITexture[] { super.getFront(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build(), - OVERLAYS_ENERGY_OUT[mTier] }; - } - - @Override - public ITexture[] getBack(byte aColor) { - return new ITexture[] { super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getBottom(byte aColor) { - return new ITexture[] { super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getTop(byte aColor) { - return new ITexture[] { super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_DRAGONEGG) }; - } - - @Override - public ITexture[] getSides(byte aColor) { - return new ITexture[] { super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[] { super.getFrontActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build(), - OVERLAYS_ENERGY_OUT[mTier] }; - } - - @Override - public ITexture[] getBackActive(byte aColor) { - return new ITexture[] { super.getBackActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[] { super.getBottomActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getTopActive(byte aColor) { - return new ITexture[] { super.getTopActive(aColor)[0], TextureFactory.of(MACHINE_CASING_DRAGONEGG), - TextureFactory.builder() - .addIcon(MACHINE_CASING_DRAGONEGG_GLOW) - .glow() - .build() }; - } - - @Override - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[] { super.getSidesActive(aColor)[0], TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), - TextureFactory.builder() - .addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW) - .glow() - .build() }; - } - - @Override - public boolean isOutputFacing(ForgeDirection side) { - return side == getBaseMetaTileEntity().getFrontFacing(); - } - - @Override - public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 16000 + getMinimumStoredEU()); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isServerSide()) return; - if (!aBaseMetaTileEntity.isAllowedToWork()) return; - if ((aBaseMetaTileEntity.getUniversalEnergyStored() >= aBaseMetaTileEntity.getEUCapacity())) return; - - long tGeneratedEU; - - if (aTick % 100 == 0 && mUsingEssentia) mMagicalEnergyBB.update(); - - // Adaptive EU Generation Ticking - if (aTick % mNextGenerateTickRate == 0) { - tGeneratedEU = generateEU(); - if (tGeneratedEU > 0) { - mNoGenerationTicks = 0; - if (tGeneratedEU >= 2 * V[mTier]) - mNextGenerateTickRate = (long) (1.0D / ((2.0D * (double) (V[mTier])) / (double) tGeneratedEU)); - else mNextGenerateTickRate = 1; - mInventory[getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); - mInventory[getStackDisplaySlot()].setStackDisplayName("Generating: " + tGeneratedEU + " EU"); - } else { - mInventory[getStackDisplaySlot()] = null; - mNoGenerationTicks += 1; - } - if (mNoGenerationTicks > 20) { - mNoGenerationTicks = 0; - mNextGenerateTickRate = 20; - } - aBaseMetaTileEntity.increaseStoredEnergyUnits(tGeneratedEU, true); - aBaseMetaTileEntity.setActive( - aBaseMetaTileEntity.isAllowedToWork() - && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU()); - } - } - - /** - * Draws random portal particles on top when active with an egg on top - * - * @param aBaseMetaTileEntity The entity that will handle the {@link Block#randomDisplayTick} - */ - @SideOnly(Side.CLIENT) - @Override - public void onRandomDisplayTick(IGregTechTileEntity aBaseMetaTileEntity) { - - if (aBaseMetaTileEntity.isActive()) { - - if (isEgg(aBaseMetaTileEntity.getBlockAtSide(ForgeDirection.UP))) { - - final double oX = aBaseMetaTileEntity.getXCoord() + 8D / 16D; - final double oY = aBaseMetaTileEntity.getYCoord() + 17D / 32D; - final double oZ = aBaseMetaTileEntity.getZCoord() + 8D / 16D; - - final ParticleEventBuilder particleEventBuilder = new ParticleEventBuilder() - .setWorld(getBaseMetaTileEntity().getWorld()) - .setIdentifier(ParticleFX.PORTAL); - - for (int i = 0; i < 9; i++) { - final double dX = (XSTR_INSTANCE.nextFloat() - 0.5D) / 2D; - final double dY = XSTR_INSTANCE.nextFloat() * 1.5; - final double dZ = (XSTR_INSTANCE.nextFloat() - 0.5D) / 2D; - - final double x = oX + dX; - final double y = oY + dY; - final double z = oZ + dZ; - - final double mX = dX * 4D; - final double dXZ = Math.sqrt(dX * dX + dZ * dZ); - final double mY = -(dXZ * dY) / 4D; - final double mZ = dZ * 4D; - - particleEventBuilder.setMotion(mX, mY, mZ) - .setPosition(x, y, z) - .run(); - } - } - } - } - - @Override - public int getPollution() { - return 0; - } - - @Override - public RecipeMap getRecipeMap() { - return RecipeMaps.magicFuels; - } - - @Override - public int getEfficiency() { - return mEfficiency; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, - ItemStack aStack) { - // Restrict input to disenchantable items or enchanted books - return (isDisenchantableItem(aStack) || isEnchantedBook(aStack)); - } - - @Override - public int getCapacity() { - return 16000; - } - - private boolean isDisenchantableItem(ItemStack aStack) { - return ((aStack.isItemEnchanted()) && (aStack.getItem() - .getItemEnchantability() > 0)); - } - - private boolean isEnchantedBook(ItemStack aStack) { - return (aStack.getItem() instanceof ItemEnchantedBook); - } - - private long generateEU() { - long tEU; - - mUsingEssentia = false; - if ((tEU = absorbFromEgg()) > 0) return tEU; - if ((tEU = absorbFromEnderCrystals()) > 0) return tEU; - if ((tEU = absorbFromEnchantedItems()) > 0) return tEU; - if ((tEU = absorbFromVisNet()) > 0) return tEU; - mUsingEssentia = true; - if ((tEU = absorbFromEssentiaContainers()) > 0) return tEU; - return 0; - } - - private long absorbFromEnchantedItems() { - ItemStack tStack = getBaseMetaTileEntity().getStackInSlot(getInputSlot()); - if (tStack == null) return 0; - if (tStack.stackSize == 0) return 0; - if (!(isDisenchantableItem(tStack) || isEnchantedBook(tStack))) return 0; - long tEU = 0; - // Convert enchantments to their EU Value - Map tMap = EnchantmentHelper.getEnchantments(tStack); - for (Map.Entry e : tMap.entrySet()) { - if ((Integer) e.getKey() < Enchantment.enchantmentsList.length) { - Enchantment tEnchantment = Enchantment.enchantmentsList[(Integer) e.getKey()]; - Integer tLevel = (Integer) e.getValue(); - tEU += 1000000L * tLevel / tEnchantment.getMaxLevel() / tEnchantment.getWeight(); - } - } - - ItemStack tOutputStack = GT_Utility.copyAmount(1, tStack); - if (tOutputStack != null) { - if (isDisenchantableItem(tOutputStack)) { - tEU = tEU * getEfficiency() / 100; - EnchantmentHelper.setEnchantments(new HashMap<>(), tOutputStack); - } else if (isEnchantedBook(tOutputStack)) { - tOutputStack = new ItemStack(Items.book, 1); - } - } - - // Only consume input when it can store EU and push output - if ((getBaseMetaTileEntity().getStoredEU() + tEU) < getBaseMetaTileEntity().getEUCapacity() - && getBaseMetaTileEntity().addStackToSlot(getOutputSlot(), tOutputStack)) { - decrStackSize(getInputSlot(), 1); - } else { - tEU = 0; - } - return tEU; - } - - private boolean hasEgg() { - Block above = getBaseMetaTileEntity().getBlockOffset(0, 1, 0); - return isEgg(above); - } - - private long absorbFromEgg() { - if (!hasEgg()) return 0; - if (!sAllowMultipleEggs) { - if (sActiveSiphon != null && sActiveSiphon != this - && sActiveSiphon.getBaseMetaTileEntity() != null - && !sActiveSiphon.getBaseMetaTileEntity() - .isInvalidTileEntity() - && sActiveSiphon.isChunkLoaded() - && sActiveSiphon.hasEgg()) { - getBaseMetaTileEntity().doExplosion(Integer.MAX_VALUE); - } else { - setActiveSiphon(this); - } - } - Block egg = getBaseMetaTileEntity().getBlockOffset(0, 1, 0); - if (egg == Blocks.dragon_egg) { - return sDragonEggEnergyPerTick; - } else if (egg.getUnlocalizedName() - .contains("creeperEgg")) { - return sCreeperEggEnergyPerTick; - } - return 0; - } - - private long absorbFromEnderCrystals() { - if (sEnergyPerEndercrystal <= 0) return 0; - long tEU = 0; - for (GT_MetaTileEntity_MagicalEnergyAbsorber tSubscriber : sSubscribedCrystals.values()) { - if (tSubscriber == this) { // This Crystal is for me - tEU += sEnergyPerEndercrystal; - } - } - return tEU; - } - - private long absorbFromVisNet() { - if (!Thaumcraft.isModLoaded()) return 0; - - long tEU; - IGregTechTileEntity tBaseMetaTileEntity = getBaseMetaTileEntity(); - World tWorld = tBaseMetaTileEntity.getWorld(); - int tX = tBaseMetaTileEntity.getXCoord(); - int tY = tBaseMetaTileEntity.getYCoord(); - int tZ = tBaseMetaTileEntity.getZCoord(); - - // Attempt to drain as much Vis as needed for max EU/t, from all primal aspects. - int toDrain = mMaxVisPerDrain; - - for (int i = sPrimalAspects.size() - 1; i >= 0 && toDrain > 0; i--) { - toDrain -= VisNetHandler.drainVis(tWorld, tX, tY, tZ, sPrimalAspects.get(i), toDrain); - } - - int drained = mMaxVisPerDrain - toDrain; - tEU = (long) Math.min(maxEUOutput(), (Math.pow(drained, 2) * sEnergyFromVis * getEfficiency() / 10000)); - - return tEU; - } - - private long absorbFromEssentiaContainers() { - if (!Thaumcraft.isModLoaded()) return 0; - - long tEU = 0; - - long tEUtoGen = getBaseMetaTileEntity().getEUCapacity() - getBaseMetaTileEntity().getUniversalEnergyStored(); - List mAvailableEssentiaAspects = mMagicalEnergyBB.getAvailableAspects(); - - // try to drain 1 of whatever aspect available in containers within RANGE - for (int i = mAvailableEssentiaAspects.size() - 1; i >= 0 && tEUtoGen > 0; i--) { - Aspect aspect = mAvailableEssentiaAspects.get(i); - long tAspectEU = ((long) sAspectsEnergy.get(aspect) * getEfficiency()) / 100; - if (tAspectEU <= tEUtoGen && AspectSourceHelper.drainEssentia( - (TileEntity) getBaseMetaTileEntity(), - aspect, - ForgeDirection.UNKNOWN, - mMagicalEnergyBB.getRange())) { - tEUtoGen -= tAspectEU; - tEU += tAspectEU; - } - } - return tEU; - } - - private boolean isEgg(Block aBlock) { - if (aBlock == null) return false; - if (aBlock == Blocks.air) return false; - if (aBlock == Blocks.dragon_egg) return true; - if (aBlock instanceof BlockDragonEgg) return true; - return (aBlock.getUnlocalizedName() - .equals("tile.dragonEgg")); - } - - private boolean isChunkLoaded() { - IGregTechTileEntity tBaseMetaTileEntity = getBaseMetaTileEntity(); - int tX = tBaseMetaTileEntity.getXCoord(); - int tY = tBaseMetaTileEntity.getYCoord(); - World tWorld = tBaseMetaTileEntity.getWorld(); - Chunk tChunk = tWorld.getChunkFromBlockCoords(tX, tY); - return tChunk.isChunkLoaded; - } - - @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_MagicalEnergyAbsorber(mName, mTier, mDescriptionArray, mTextures); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("mMagicalEnergyBBTier", mMagicalEnergyBB.getTier()); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mMagicalEnergyBB.setTier(aNBT.getInteger("mMagicalEnergyBBTier")); - } - - /** - * Handles Bounding Box ranged operations for Magic sources - */ - static class MagicalEnergyBB { - - private final GT_MetaTileEntity_MagicalEnergyAbsorber mAbsorber; - private final MagicalEnergyBBListener mListener; - private final int mDefaultTier; - private int mTier; - private final int mMaxTier; - private final List mLivingCrystalIDs = new ArrayList<>(); - private List mAvailableAspects; - - /** - * @param aAbsorber user and subscriber for updated BB content - * @param aDefaultTier Initial tier value - * @param aMaxTier Maximum allowed tier - */ - MagicalEnergyBB(GT_MetaTileEntity_MagicalEnergyAbsorber aAbsorber, int aDefaultTier, int aMaxTier) { - mAbsorber = aAbsorber; - mListener = aAbsorber; - mMaxTier = Math.max(Math.max(aMaxTier, 0), Math.max(aDefaultTier, 0)); - mDefaultTier = Math.min(aDefaultTier, mMaxTier); - mTier = mDefaultTier; - if (Thaumcraft.isModLoaded()) mAvailableAspects = new ArrayList<>(Aspect.aspects.size()); - } - - int getTier() { - return mTier; - } - - /** - * Set Bounding Box Tier within allowed bounds - * - * @param aTier new tier value - * @return effective new tier - */ - int setTier(int aTier) { - if (aTier >= 0) { - mTier = Math.min(aTier, mMaxTier); - } else { -