diff options
author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2022-08-29 16:04:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 16:04:28 +0200 |
commit | 7d1f51a8937e0a86486267437d444696e81e8aa0 (patch) | |
tree | a5b145e7271998f7b4b968a2212ed487e54a92b5 /src/main/java/gtPlusPlus/xmod/thermalfoundation | |
parent | 5267969156d30b4bb5f4cb2279ebb49db6bd40e2 (diff) | |
download | GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.gz GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.tar.bz2 GT5-Unofficial-7d1f51a8937e0a86486267437d444696e81e8aa0.zip |
Buildscript + Spotless (#318)
* Convert AES.java to readable class
* Buildscript
* Spotless
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/thermalfoundation')
8 files changed, 680 insertions, 662 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java index fe9a82c6b5..0ad922942b 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/HANDLER_TF.java @@ -7,37 +7,37 @@ import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; import gtPlusPlus.xmod.thermalfoundation.recipe.TF_Gregtech_Recipes; -public class HANDLER_TF{ +public class HANDLER_TF { - public static void preInit(){ - if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ - TF_Fluids.preInit(); - TF_Items.preInit(); - TF_Blocks.preInit(); - if (LoadedMods.Gregtech){ - if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ - //mGregMatLoader.enableMaterial(Materials.Enderium); - } - } - } - } + public static void preInit() { + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation) { + TF_Fluids.preInit(); + TF_Items.preInit(); + TF_Blocks.preInit(); + if (LoadedMods.Gregtech) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + // mGregMatLoader.enableMaterial(Materials.Enderium); + } + } + } + } - public static void init(){ - if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ - TF_Fluids.init(); - TF_Blocks.init(); - TF_Items.init(); - } - } + public static void init() { + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation) { + TF_Fluids.init(); + TF_Blocks.init(); + TF_Items.init(); + } + } - public static void postInit(){ - if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation){ - TF_Fluids.postInit(); - TF_Items.postInit(); - TF_Blocks.postInit(); - if(LoadedMods.Gregtech){ - TF_Gregtech_Recipes.run(); - } - } - } + public static void postInit() { + if (LoadedMods.CoFHCore && !LoadedMods.ThermalFoundation) { + TF_Fluids.postInit(); + TF_Items.postInit(); + TF_Blocks.postInit(); + if (LoadedMods.Gregtech) { + TF_Gregtech_Recipes.run(); + } + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java index a0480e907e..2118df699a 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java @@ -1,9 +1,13 @@ package gtPlusPlus.xmod.thermalfoundation.block; -import java.util.Random; - +import cofh.core.fluid.BlockFluidInteractive; +import cofh.lib.util.BlockWrapper; +import cofh.lib.util.helpers.DamageHelper; +import cofh.lib.util.helpers.ServerHelper; import cpw.mods.fml.common.registry.GameRegistry; - +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -16,176 +20,169 @@ import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; - -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.DamageHelper; -import cofh.lib.util.helpers.ServerHelper; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraftforge.common.util.ForgeDirection; -public class TF_Block_Fluid_Cryotheum -extends BlockFluidInteractive -{ - Random random = new Random(); - public static final int LEVELS = 5; - public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); - private static boolean enableSourceFall = true; - private static boolean effect = true; - - public TF_Block_Fluid_Cryotheum() - { - super(CORE.MODID, TF_Fluids.fluidCryotheum, materialFluidCryotheum, "cryotheum"); - this.setQuantaPerBlock(5); - this.setTickRate(15); - - this.setHardness(1000.0F); - this.setLightOpacity(1); - this.setParticleColor(0.15F, 0.7F, 1.0F); - } - - @Override - public boolean preInit() - { - GameRegistry.registerBlock(this, "FluidCryotheum"); - - this.addInteraction(Blocks.grass, Blocks.dirt); - this.addInteraction(Blocks.water, 0, Blocks.ice); - this.addInteraction(Blocks.water, Blocks.snow); - this.addInteraction(Blocks.flowing_water, 0, Blocks.ice); - this.addInteraction(Blocks.flowing_water, Blocks.snow); - this.addInteraction(Blocks.lava, 0, Blocks.obsidian); - this.addInteraction(Blocks.lava, Blocks.stone); - this.addInteraction(Blocks.flowing_lava, 0, Blocks.obsidian); - this.addInteraction(Blocks.flowing_lava, Blocks.stone); - this.addInteraction(Blocks.leaves, Blocks.air); - this.addInteraction(Blocks.tallgrass, Blocks.air); - this.addInteraction(Blocks.fire, Blocks.air); - //addInteraction(TFBlocks.blockFluidGlowstone, 0, Blocks.glowstone); - - final String str1 = "Fluid.Cryotheum"; - String str2 = "Enable this for Fluid Cryotheum to be worse than lava, except cold."; - effect = true; - - str2 = "Enable this for Fluid Cryotheum Source blocks to gradually fall downwards."; - enableSourceFall = true; - - return true; - } - - @Override - public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Entity paramEntity) - { - paramEntity.extinguish(); - if (!effect) { - return; - } - if ((paramEntity.motionY < -0.05D) || (paramEntity.motionY > 0.05D)) { - paramEntity.motionY *= 0.05D; - } - if ((paramEntity.motionZ < -0.05D) || (paramEntity.motionZ > 0.05D)) { - paramEntity.motionZ *= 0.05D; - } - if ((paramEntity.motionX < -0.05D) || (paramEntity.motionX > 0.05D)) { - paramEntity.motionX *= 0.05D; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if ((paramWorld.getTotalWorldTime() % 8L) != 0L) { - return; - } - if (((paramEntity instanceof EntityZombie)) || ((paramEntity instanceof EntityCreeper))) - { - final EntitySnowman localEntitySnowman = new EntitySnowman(paramWorld); - localEntitySnowman.setLocationAndAngles(paramEntity.posX, paramEntity.posY, paramEntity.posZ, paramEntity.rotationYaw, paramEntity.rotationPitch); - paramWorld.spawnEntityInWorld(localEntitySnowman); - - paramEntity.setDead(); - } - else if (/*((paramEntity instanceof EntityBlizz)) ||*/((paramEntity instanceof EntitySnowman))) - { - ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 120, 0)); - ((EntityLivingBase)paramEntity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 120, 0)); - } - else if ((paramEntity instanceof EntityBlaze)) - { - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 10.0F); - } - else - { - final boolean bool = paramEntity.velocityChanged; - paramEntity.attackEntityFrom(DamageHelper.cryotheum, 2.0F); - paramEntity.velocityChanged = bool; - } - } - - @Override - public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) - { - return TF_Fluids.fluidCryotheum.getLuminosity(); - } - - @Override - public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Random paramRandom) - { - if (effect) { - this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) - { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if ((localBlock == this) && (i != 0)) - { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) - { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) - { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - this.interactWithBlock(paramWorld, i, j, k); - } - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) - { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (this.hasInteraction(localBlock, i)) - { - final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - } - else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) - { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.snow_layer, 0, 3); - } - } - - protected void triggerInteractionEffects(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) {} +public class TF_Block_Fluid_Cryotheum extends BlockFluidInteractive { + Random random = new Random(); + public static final int LEVELS = 5; + public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); + private static boolean enableSourceFall = true; + private static boolean effect = true; + + public TF_Block_Fluid_Cryotheum() { + super(CORE.MODID, TF_Fluids.fluidCryotheum, materialFluidCryotheum, "cryotheum"); + this.setQuantaPerBlock(5); + this.setTickRate(15); + + this.setHardness(1000.0F); + this.setLightOpacity(1); + this.setParticleColor(0.15F, 0.7F, 1.0F); + } + + @Override + public boolean preInit() { + GameRegistry.registerBlock(this, "FluidCryotheum"); + + this.addInteraction(Blocks.grass, Blocks.dirt); + this.addInteraction(Blocks.water, 0, Blocks.ice); + this.addInteraction(Blocks.water, Blocks.snow); + this.addInteraction(Blocks.flowing_water, 0, Blocks.ice); + this.addInteraction(Blocks.flowing_water, Blocks.snow); + this.addInteraction(Blocks.lava, 0, Blocks.obsidian); + this.addInteraction(Blocks.lava, Blocks.stone); + this.addInteraction(Blocks.flowing_lava, 0, Blocks.obsidian); + this.addInteraction(Blocks.flowing_lava, Blocks.stone); + this.addInteraction(Blocks.leaves, Blocks.air); + this.addInteraction(Blocks.tallgrass, Blocks.air); + this.addInteraction(Blocks.fire, Blocks.air); + // addInteraction(TFBlocks.blockFluidGlowstone, 0, Blocks.glowstone); + + final String str1 = "Fluid.Cryotheum"; + String str2 = "Enable this for Fluid Cryotheum to be worse than lava, except cold."; + effect = true; + + str2 = "Enable this for Fluid Cryotheum Source blocks to gradually fall downwards."; + enableSourceFall = true; + + return true; + } + + @Override + public void onEntityCollidedWithBlock( + final World paramWorld, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final Entity paramEntity) { + paramEntity.extinguish(); + if (!effect) { + return; + } + if ((paramEntity.motionY < -0.05D) || (paramEntity.motionY > 0.05D)) { + paramEntity.motionY *= 0.05D; + } + if ((paramEntity.motionZ < -0.05D) || (paramEntity.motionZ > 0.05D)) { + paramEntity.motionZ *= 0.05D; + } + if ((paramEntity.motionX < -0.05D) || (paramEntity.motionX > 0.05D)) { + paramEntity.motionX *= 0.05D; + } + if (ServerHelper.isClientWorld(paramWorld)) { + return; + } + if ((paramWorld.getTotalWorldTime() % 8L) != 0L) { + return; + } + if (((paramEntity instanceof EntityZombie)) || ((paramEntity instanceof EntityCreeper))) { + final EntitySnowman localEntitySnowman = new EntitySnowman(paramWorld); + localEntitySnowman.setLocationAndAngles( + paramEntity.posX, + paramEntity.posY, + paramEntity.posZ, + paramEntity.rotationYaw, + paramEntity.rotationPitch); + paramWorld.spawnEntityInWorld(localEntitySnowman); + + paramEntity.setDead(); + } else if ( + /*((paramEntity instanceof EntityBlizz)) ||*/ ((paramEntity instanceof EntitySnowman))) { + ((EntityLivingBase) paramEntity).addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 120, 0)); + ((EntityLivingBase) paramEntity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 120, 0)); + } else if ((paramEntity instanceof EntityBlaze)) { + paramEntity.attackEntityFrom(DamageHelper.cryotheum, 10.0F); + } else { + final boolean bool = paramEntity.velocityChanged; + paramEntity.attackEntityFrom(DamageHelper.cryotheum, 2.0F); + paramEntity.velocityChanged = bool; + } + } + + @Override + public int getLightValue( + final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) { + return TF_Fluids.fluidCryotheum.getLuminosity(); + } + + @Override + public void updateTick( + final World paramWorld, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final Random paramRandom) { + if (effect) { + this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); + } + if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); + if ((localBlock == this) && (i != 0)) { + paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); + paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); + return; + } + } + super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); + } + + protected void checkForInteraction( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) { + if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { + return; + } + int i = paramInt1; + int j = paramInt2; + int k = paramInt3; + for (int m = 0; m < 6; m++) { + i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; + j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; + k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; + + this.interactWithBlock(paramWorld, i, j, k); + } + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); + } + + protected void interactWithBlock( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); + if ((localBlock == Blocks.air) || (localBlock == this)) { + return; + } + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); + if (this.hasInteraction(localBlock, i)) { + final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); + paramWorld.setBlock( + paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); + } else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) + && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) { + paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.snow_layer, 0, 3); + } + } + + protected void triggerInteractionEffects( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) {} } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java index 513fe51fd9..5b2894c0fc 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java @@ -1,7 +1,10 @@ package gtPlusPlus.xmod.thermalfoundation.block; +import cofh.core.fluid.BlockFluidCoFHBase; +import cofh.core.util.CoreUtils; import cpw.mods.fml.common.registry.GameRegistry; - +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialLiquid; @@ -9,60 +12,49 @@ import net.minecraft.entity.Entity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import cofh.core.fluid.BlockFluidCoFHBase; -import cofh.core.util.CoreUtils; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; +public class TF_Block_Fluid_Ender extends BlockFluidCoFHBase { + public static final int LEVELS = 4; + public static final Material materialFluidEnder = new MaterialLiquid(MapColor.greenColor); + private static boolean effect = true; -public class TF_Block_Fluid_Ender - extends BlockFluidCoFHBase -{ - public static final int LEVELS = 4; - public static final Material materialFluidEnder = new MaterialLiquid(MapColor.greenColor); - private static boolean effect = true; - - public TF_Block_Fluid_Ender() - { - super(CORE.MODID, TF_Fluids.fluidEnder, materialFluidEnder, "ender"); - setQuantaPerBlock(4); - setTickRate(20); - - setHardness(2000.0F); - setLightOpacity(7); - setParticleColor(0.05F, 0.2F, 0.2F); - } - - @Override -public boolean preInit() - { - GameRegistry.registerBlock(this, "FluidEnder"); - - String str1 = "Fluid.Ender"; - String str2 = "Enable this for Fluid Ender to randomly teleport entities on contact."; - - return true; - } - - @Override -public void onEntityCollidedWithBlock(World paramWorld, int paramInt1, int paramInt2, int paramInt3, Entity paramEntity) - { - if ((!effect) || (paramWorld.isRemote)) { - return; + public TF_Block_Fluid_Ender() { + super(CORE.MODID, TF_Fluids.fluidEnder, materialFluidEnder, "ender"); + setQuantaPerBlock(4); + setTickRate(20); + + setHardness(2000.0F); + setLightOpacity(7); + setParticleColor(0.05F, 0.2F, 0.2F); + } + + @Override + public boolean preInit() { + GameRegistry.registerBlock(this, "FluidEnder"); + + String str1 = "Fluid.Ender"; + String str2 = "Enable this for Fluid Ender to randomly teleport entities on contact."; + + return true; + } + + @Override + public void onEntityCollidedWithBlock( + World paramWorld, int paramInt1, int paramInt2, int paramInt3, Entity paramEntity) { + if ((!effect) || (paramWorld.isRemote)) { + return; + } + if (paramWorld.getTotalWorldTime() % 8L == 0L) { + int i = paramInt1 - 8 + paramWorld.rand.nextInt(17); + int j = paramInt2 + paramWorld.rand.nextInt(8); + int k = paramInt3 - 8 + paramWorld.rand.nextInt(17); + if (!paramWorld.getBlock(i, j, k).getMaterial().isSolid()) { + CoreUtils.teleportEntityTo(paramEntity, i, j, k); + } + } } - if (paramWorld.getTotalWorldTime() % 8L == 0L) - { - int i = paramInt1 - 8 + paramWorld.rand.nextInt(17); - int j = paramInt2 + paramWorld.rand.nextInt(8); - int k = paramInt3 - 8 + paramWorld.rand.nextInt(17); - if (!paramWorld.getBlock(i, j, k).getMaterial().isSolid()) { - CoreUtils.teleportEntityTo(paramEntity, i, j, k); - } + + @Override + public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) { + return TF_Fluids.fluidEnder.getLuminosity(); } - } - - @Override -public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) - { - return TF_Fluids.fluidEnder.getLuminosity(); - } } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java index 5444e8d5ad..637fefb2ea 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java @@ -1,9 +1,12 @@ package gtPlusPlus.xmod.thermalfoundation.block; -import java.util.Random; - +import cofh.core.fluid.BlockFluidInteractive; +import cofh.lib.util.BlockWrapper; +import cofh.lib.util.helpers.ServerHelper; import cpw.mods.fml.common.registry.GameRegistry; - +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; +import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.MapColor; import net.minecraft.block.material.Material; @@ -14,178 +17,201 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; - -import cofh.core.fluid.BlockFluidInteractive; -import cofh.lib.util.BlockWrapper; -import cofh.lib.util.helpers.ServerHelper; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; import net.minecraftforge.common.util.ForgeDirection; -public class TF_Block_Fluid_Pyrotheum -extends BlockFluidInteractive -{ - Random random = new Random(); - public static final int LEVELS = 5; - public static final Material materialFluidPyrotheum = new MaterialLiquid(MapColor.tntColor); - private static boolean effect = true; - private static boolean enableSourceFall = true; - - public TF_Block_Fluid_Pyrotheum() - { - super(CORE.MODID, TF_Fluids.fluidPyrotheum, Material.lava, "pyrotheum"); - this.setQuantaPerBlock(5); - this.setTickRate(10); - - this.setHardness(1000.0F); - this.setLightOpacity(1); - this.setParticleColor(1.0F, 0.7F, 0.15F); - } - - @Override - public boolean preInit() - { - GameRegistry.registerBlock(this, "FluidPyrotheum"); - - this.addInteraction(Blocks.cobblestone, Blocks.stone); - this.addInteraction(Blocks.grass, Blocks.dirt); - this.addInteraction(Blocks.sand, Blocks.glass); - this.addInteraction(Blocks.water, Blocks.stone); - this.addInteraction(Blocks.flowing_water, Blocks.stone); - this.addInteraction(Blocks.clay, Blocks.hardened_clay); - this.addInteraction(Blocks.ice, Blocks.stone); - this.addInteraction(Blocks.snow, Blocks.air); - this.addInteraction(Blocks.snow_layer, Blocks.air); - for (int i = 0; i < 8; i++) { - this.addInteraction(Blocks.stone_stairs, i, Blocks.stone_brick_stairs, i); - } - final String str1 = "Fluid.Pyrotheum"; - String str2 = "Enable this for Fluid Pyrotheum to be worse than lava."; - effect = true; - - str2 = "Enable this for Fluid Pyrotheum Source blocks to gradually fall downwards."; - enableSourceFall = true; - - return true; - } - - @Override - public void onEntityCollidedWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Entity paramEntity) - { - if (!effect) { - return; - } - if (ServerHelper.isClientWorld(paramWorld)) { - return; - } - if (!(paramEntity instanceof EntityPlayer)) { - if ((paramEntity instanceof EntityCreeper)) - { - paramWorld.createExplosion(paramEntity, paramEntity.posX, paramEntity.posY, paramEntity.posZ, 6.0F, paramEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); - paramEntity.setDead(); - } - } - } - - @Override - public int getLightValue(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) - { - return TF_Fluids.fluidPyrotheum.getLuminosity(); - } - - @Override - public int getFireSpreadSpeed(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) - { - return effect ? 800 : 0; - } - - @Override - public int getFlammability(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) - { - return 0; - } - - @Override - public boolean isFlammable(final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) - { - return (effect) && (paramForgeDirection.ordinal() > ForgeDirection.UP.ordinal()) && (paramIBlockAccess.getBlock(paramInt1, paramInt2 - 1, paramInt3) != this); - } - - @Override - public boolean isFireSource(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final ForgeDirection paramForgeDirection) - { - return effect; - } - - @Override - public void updateTick(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3, final Random paramRandom) - { - if (effect) { - this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); - } - if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) - { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); - if (((localBlock == this) && (i != 0)) || (localBlock.isFlammable(paramWorld, paramInt1, paramInt2 + this.densityDir, paramInt3, ForgeDirection.UP))) - { - paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); - paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); - return; - } - } - super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); - } - - protected void checkForInteraction(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) - { - if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { - return; - } - int i = paramInt1; - int j = paramInt2; - int k = paramInt3; - for (int m = 0; m < 6; m++) - { - i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; - j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; - k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; - - this.interactWithBlock(paramWorld, i, j, k); - } - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); - this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); - } - - protected void interactWithBlock(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) - { - final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); - if ((localBlock == Blocks.air) || (localBlock == this)) { - return; - } - final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); - if (this.hasInteraction(localBlock, i)) - { - final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); - this.triggerInteractionEffects(paramWorld, paramInt1, paramInt2, paramInt3); - } - else if (localBlock.isFlammable(paramWorld, paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) - { - paramWorld.setBlock(paramInt1, paramInt2, paramInt3, Blocks.fire); - } - else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) - { - paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.fire, 0, 3); - } - } - - protected void triggerInteractionEffects(final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) - { - if (this.random.nextInt(16) == 0) { - paramWorld.playSoundEffect(paramInt1 + 0.5F, paramInt2 + 0.5F, paramInt3 + 0.5F, "random.fizz", 0.5F, 2.2F + ((paramWorld.rand.nextFloat() - paramWorld.rand.nextFloat()) * 0.8F)); - } - } +public class TF_Block_Fluid_Pyrotheum extends BlockFluidInteractive { + Random random = new Random(); + public static final int LEVELS = 5; + public static final Material materialFluidPyrotheum = new MaterialLiquid(MapColor.tntColor); + private static boolean effect = true; + private static boolean enableSourceFall = true; + + public TF_Block_Fluid_Pyrotheum() { + super(CORE.MODID, TF_Fluids.fluidPyrotheum, Material.lava, "pyrotheum"); + this.setQuantaPerBlock(5); + this.setTickRate(10); + + this.setHardness(1000.0F); + this.setLightOpacity(1); + this.setParticleColor(1.0F, 0.7F, 0.15F); + } + + @Override + public boolean preInit() { + GameRegistry.registerBlock(this, "FluidPyrotheum"); + + this.addInteraction(Blocks.cobblestone, Blocks.stone); + this.addInteraction(Blocks.grass, Blocks.dirt); + this.addInteraction(Blocks.sand, Blocks.glass); + this.addInteraction(Blocks.water, Blocks.stone); + this.addInteraction(Blocks.flowing_water, Blocks.stone); + this.addInteraction(Blocks.clay, Blocks.hardened_clay); + this.addInteraction(Blocks.ice, Blocks.stone); + this.addInteraction(Blocks.snow, Blocks.air); + this.addInteraction(Blocks.snow_layer, Blocks.air); + for (int i = 0; i < 8; i++) { + this.addInteraction(Blocks.stone_stairs, i, Blocks.stone_brick_stairs, i); + } + final String str1 = "Fluid.Pyrotheum"; + String str2 = "Enable this for Fluid Pyrotheum to be worse than lava."; + effect = true; + + str2 = "Enable this for Fluid Pyrotheum Source blocks to gradually fall downwards."; + enableSourceFall = true; + + return true; + } + + @Override + public void onEntityCollidedWithBlock( + final World paramWorld, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final Entity paramEntity) { + if (!effect) { + return; + } + if (ServerHelper.isClientWorld(paramWorld)) { + return; + } + if (!(paramEntity instanceof EntityPlayer)) { + if ((paramEntity instanceof EntityCreeper)) { + paramWorld.createExplosion( + paramEntity, + paramEntity.posX, + paramEntity.posY, + paramEntity.posZ, + 6.0F, + paramEntity.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")); + paramEntity.setDead(); + } + } + } + + @Override + public int getLightValue( + final IBlockAccess paramIBlockAccess, final int paramInt1, final int paramInt2, final int paramInt3) { + return TF_Fluids.fluidPyrotheum.getLuminosity(); + } + + @Override + public int getFireSpreadSpeed( + final IBlockAccess paramIBlockAccess, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final ForgeDirection paramForgeDirection) { + return effect ? 800 : 0; + } + + @Override + public int getFlammability( + final IBlockAccess paramIBlockAccess, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final ForgeDirection paramForgeDirection) { + return 0; + } + + @Override + public boolean isFlammable( + final IBlockAccess paramIBlockAccess, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final ForgeDirection paramForgeDirection) { + return (effect) + && (paramForgeDirection.ordinal() > ForgeDirection.UP.ordinal()) + && (paramIBlockAccess.getBlock(paramInt1, paramInt2 - 1, paramInt3) != this); + } + + @Override + public boolean isFireSource( + final World paramWorld, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final ForgeDirection paramForgeDirection) { + return effect; + } + + @Override + public void updateTick( + final World paramWorld, + final int paramInt1, + final int paramInt2, + final int paramInt3, + final Random paramRandom) { + if (effect) { + this.checkForInteraction(paramWorld, paramInt1, paramInt2, paramInt3); + } + if ((enableSourceFall) && (paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3) == 0)) { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2 + this.densityDir, paramInt3); + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2 + this.densityDir, paramInt3); + if (((localBlock == this) && (i != 0)) + || (localBlock.isFlammable( + paramWorld, paramInt1, paramInt2 + this.densityDir, paramInt3, ForgeDirection.UP))) { + paramWorld.setBlock(paramInt1, paramInt2 + this.densityDir, paramInt3, this, 0, 3); + paramWorld.setBlockToAir(paramInt1, paramInt2, paramInt3); + return; + } + } + super.updateTick(paramWorld, paramInt1, paramInt2, paramInt3, paramRandom); + } + + protected void checkForInteraction( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) { + if (paramWorld.getBlock(paramInt1, paramInt2, paramInt3) != this) { + return; + } + int i = paramInt1; + int j = paramInt2; + int k = paramInt3; + for (int m = 0; m < 6; m++) { + i = paramInt1 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][0]; + j = paramInt2 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][1]; + k = paramInt3 + cofh.lib.util.helpers.BlockHelper.SIDE_COORD_MOD[m][2]; + + this.interactWithBlock(paramWorld, i, j, k); + } + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 - 1, paramInt2, paramInt3 + 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 - 1); + this.interactWithBlock(paramWorld, paramInt1 + 1, paramInt2, paramInt3 + 1); + } + + protected void interactWithBlock( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) { + final Block localBlock = paramWorld.getBlock(paramInt1, paramInt2, paramInt3); + if ((localBlock == Blocks.air) || (localBlock == this)) { + return; + } + final int i = paramWorld.getBlockMetadata(paramInt1, paramInt2, paramInt3); + if (this.hasInteraction(localBlock, i)) { + final BlockWrapper localBlockWrapper = this.getInteraction(localBlock, i); + paramWorld.setBlock( + paramInt1, paramInt2, paramInt3, localBlockWrapper.block, localBlockWrapper.metadata, 3); + this.triggerInteractionEffects(paramWorld, paramInt1, paramInt2, paramInt3); + } else if (localBlock.isFlammable(paramWorld, paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) { + paramWorld.setBlock(paramInt1, paramInt2, paramInt3, Blocks.fire); + } else if ((paramWorld.isSideSolid(paramInt1, paramInt2, paramInt3, ForgeDirection.UP)) + && (paramWorld.isAirBlock(paramInt1, paramInt2 + 1, paramInt3))) { + paramWorld.setBlock(paramInt1, paramInt2 + 1, paramInt3, Blocks.fire, 0, 3); + } + } + + protected void triggerInteractionEffects( + final World paramWorld, final int paramInt1, final int paramInt2, final int paramInt3) { + if (this.random.nextInt(16) == 0) { + paramWorld.playSoundEffect( + paramInt1 + 0.5F, + paramInt2 + 0.5F, + paramInt3 + 0.5F, + "random.fizz", + 0.5F, + 2.2F + ((paramWorld.rand.nextFloat() - paramWorld.rand.nextFloat()) * 0.8F)); + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java index 6b56262b1a..38fed4c137 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java @@ -2,28 +2,22 @@ package gtPlusPlus.xmod.thermalfoundation.block; import cofh.core.fluid.BlockFluidCoFHBase; -public class TF_Blocks -{ +public class TF_Blocks { - public static BlockFluidCoFHBase blockFluidPyrotheum; - public static BlockFluidCoFHBase blockFluidCryotheum; - public static BlockFluidCoFHBase blockFluidEnder; + public static BlockFluidCoFHBase blockFluidPyrotheum; + public static BlockFluidCoFHBase blockFluidCryotheum; + public static BlockFluidCoFHBase blockFluidEnder; + public static void preInit() { + blockFluidPyrotheum = new TF_Block_Fluid_Pyrotheum(); + blockFluidCryotheum = new TF_Block_Fluid_Cryotheum(); + blockFluidEnder = new TF_Block_Fluid_Ender(); + blockFluidPyrotheum.preInit(); + blockFluidCryotheum.preInit(); + blockFluidEnder.preInit(); + } - public static void preInit() - { - blockFluidPyrotheum = new TF_Block_Fluid_Pyrotheum(); - blockFluidCryotheum = new TF_Block_Fluid_Cryotheum(); - blockFluidEnder = new TF_Block_Fluid_Ender(); - blockFluidPyrotheum.preInit(); - blockFluidCryotheum.preInit(); - blockFluidEnder.preInit(); - } + public static void init() {} - public static void init() {} - - public static void postInit() - { - - } + public static void postInit() {} } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java index 6ebae64384..bd4467c7b0 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/fluid/TF_Fluids.java @@ -1,79 +1,85 @@ package gtPlusPlus.xmod.thermalfoundation.fluid; -import net.minecraft.block.BlockDispenser; -import net.minecraft.init.Items; -import net.minecraft.item.EnumRarity; - import cofh.core.util.fluid.DispenserEmptyBucketHandler; import cofh.core.util.fluid.DispenserFilledBucketHandler; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; +import net.minecraft.block.BlockDispenser; +import net.minecraft.init.Items; +import net.minecraft.item.EnumRarity; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -public class TF_Fluids -{ - public static Fluid fluidPyrotheum; - public static Fluid fluidCryotheum; - public static Fluid fluidEnder; +public class TF_Fluids { + public static Fluid fluidPyrotheum; + public static Fluid fluidCryotheum; + public static Fluid fluidEnder; + + public static void preInit() { + if (!LoadedMods.ThermalFoundation) { + Logger.INFO("Adding in our own versions of Thermal Foundation Fluids - Non-GT"); + final Fluid pyrotheum = FluidRegistry.getFluid("pyrotheum"); + final Fluid cryotheum = FluidRegistry.getFluid("cryotheum"); + final Fluid ender = FluidRegistry.getFluid("ender"); - public static void preInit() - { - if (!LoadedMods.ThermalFoundation){ - Logger.INFO("Adding in our own versions of Thermal Foundation Fluids - Non-GT"); - final Fluid pyrotheum = FluidRegistry.getFluid("pyrotheum"); - final Fluid cryotheum = FluidRegistry.getFluid("cryotheum"); - final Fluid ender = FluidRegistry.getFluid("ender"); + if (pyrotheum == null) { + Logger.INFO("Registering Blazing Pyrotheum as it does not exist."); + fluidPyrotheum = new Fluid("pyrotheum") + .setLuminosity(15) + .setDensity(2000) + .setViscosity(1200) + .setTemperature(4000) + .setRarity(EnumRarity.rare); + registerFluid(fluidPyrotheum, "pyrotheum"); + } else { + Logger.INFO("Registering Blazing Pyrotheum as it is an already existing Fluid."); + fluidPyrotheum = pyrotheum; + } + if (cryotheum == null) { + Logger.INFO("Registering Gelid Cryotheum as it does not exist."); + fluidCryotheum = new Fluid("cryotheum") + .setLuminosity(0) + .setDensity(4000) + .setViscosity(3000) + .setTemperature(50) + .setRarity(EnumRarity.rare); + registerFluid(fluidCryotheum, "cryotheum"); + } else { + Logger.INFO("Registering Gelid Cryotheum as it is an already existing Fluid."); + fluidCryotheum = cryotheum; + } - if (pyrotheum == null){ - Logger.INFO("Registering Blazing Pyrotheum as it does not exist."); - fluidPyrotheum = new Fluid("pyrotheum").setLuminosity(15).setDensity(2000).setViscosity(1200).setTemperature(4000).setRarity(EnumRarity.rare); - registerFluid(fluidPyrotheum, "pyrotheum"); - } - else { - Logger.INFO("Registering Blazing Pyrotheum as it is an already existing Fluid."); - fluidPyrotheum = pyrotheum; - } - if (cryotheum == null){ - Logger.INFO("Registering Gelid Cryotheum as it does not exist."); - fluidCryotheum = new Fluid("cryotheum").setLuminosity(0).setDensity(4000).setViscosity(3000).setTemperature(50).setRarity(EnumRarity.rare); - registerFluid(fluidCryotheum, "cryotheum"); - } - else { - Logger.INFO("Registering Gelid Cryotheum as it is an already existing Fluid."); - fluidCryotheum = cryotheum; - } - - if (ender == null){ - Logger.INFO("Registering Resonant Ender as it does not exist."); - fluidEnder = new Fluid("ender").setLuminosity(3).setDensity(4000).setViscosity(3000).setTemperature(300).setRarity(EnumRarity.uncommon); - registerFluid(fluidEnder, "ender"); - } - else { - Logger.INFO("Registering Resonant Ender as it is an already existing Fluid."); - fluidEnder = ender; - } - } - else { - Logger.INFO("Thermal Foundation is already loaded, no need to add our own Cryotheum/Pyrotheum."); - } - } + if (ender == null) { + Logger.INFO("Registering Resonant Ender as it does not exist."); + fluidEnder = new Fluid("ender") + .setLuminosity(3) + .setDensity(4000) + .setViscosity(3000) + .setTemperature(300) + .setRarity(EnumRarity.uncommon); + registerFluid(fluidEnder, "ender"); + } else { + Logger.INFO("Registering Resonant Ender as it is an already existing Fluid."); + fluidEnder = ender; + } + } else { + Logger.INFO("Thermal Foundation is already loaded, no need to add our own Cryotheum/Pyrotheum."); + } + } - public static void init() {} + public static void init() {} - public static void postInit() {} + public static void postInit() {} - public static void registerFluid(final Fluid paramFluid, final String paramString) - { - if (!FluidRegistry.isFluidRegistered(paramString)) { - FluidRegistry.registerFluid(paramFluid); - } - } + public static void registerFluid(final Fluid paramFluid, final String paramString) { + if (!FluidRegistry.isFluidRegistered(paramString)) { + FluidRegistry.registerFluid(paramFluid); + } + } - public static void registerDispenserHandlers() - { - BlockDispenser.dispenseBehaviorRegistry.putObject(TF_Items.itemBucket, new DispenserFilledBucketHandler()); - BlockDispenser.dispenseBehaviorRegistry.putObject(Items.bucket, new DispenserEmptyBucketHandler()); - } + public static void registerDispenserHandlers() { + BlockDispenser.dispenseBehaviorRegistry.putObject(TF_Items.itemBucket, new DispenserFilledBucketHandler()); + BlockDispenser.dispenseBehaviorRegistry.putObject(Items.bucket, new DispenserEmptyBucketHandler()); + } } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java index a628b9c5b6..2ed0f07f36 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/item/TF_Items.java @@ -1,10 +1,5 @@ package gtPlusPlus.xmod.thermalfoundation.item; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - -import gregtech.api.enums.GT_Values; - import cofh.core.item.ItemBase; import cofh.core.item.ItemBucket; import cofh.core.util.energy.FurnaceFuelHandler; @@ -16,73 +11,79 @@ import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.thermalfoundation.block.TF_Blocks; import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; public class TF_Items { - public static ItemBase itemMaterial; - public static ItemStack rodBlizz; - public static ItemStack dustBlizz; - public static ItemStack dustPyrotheum; - public static ItemStack dustCryotheum; - public static ItemBucket itemBucket; - public static ItemStack bucketPyrotheum; - public static ItemStack bucketCryotheum; - public static ItemStack bucketEnder; - - public static ItemStack itemDustBlizz; - public static ItemStack itemDustPyrotheum; - public static ItemStack itemDustCryotheum; - public static ItemStack itemRodBlizz; - - public static void preInit(){ - - - itemBucket = (ItemBucket)new ItemBucket("MiscUtils").setUnlocalizedName("bucket").setCreativeTab(AddToCreativeTab.tabMisc); - itemMaterial = (ItemBase)new ItemBase("MiscUtils").setUnlocalizedName("material").setCreativeTab(AddToCreativeTab.tabMisc); - - - bucketPyrotheum = itemBucket.addOreDictItem(1, "bucketPyrotheum"); - bucketCryotheum = itemBucket.addOreDictItem(2, "bucketCryotheum"); - bucketEnder = itemBucket.addOreDictItem(3, "bucketEnder", 1); - rodBlizz = itemMaterial.addOreDictItem(1, "rodBlizz"); - dustBlizz = itemMaterial.addOreDictItem(2, "dustBlizz"); - dustPyrotheum = itemMaterial.addOreDictItem(3, "dustPyrotheum"); - dustCryotheum = itemMaterial.addOreDictItem(4, "dustCryotheum"); - - if (ReflectionUtils.doesClassExist("cofh.core.util.energy.FurnaceFuelHandler")){ - FurnaceFuelHandler.registerFuel(dustPyrotheum, 2400); //cofh.core.util.energy.FurnaceFuelHandler.registerFuel(ItemStack, int) - } - - ItemUtils.addItemToOreDictionary(rodBlizz, "stickBlizz"); - - itemRodBlizz = ItemUtils.simpleMetaStack(itemMaterial, 1, 1); - itemDustBlizz = ItemUtils.simpleMetaStack(itemMaterial, 2, 1); - itemDustPyrotheum = ItemUtils.simpleMetaStack(itemMaterial, 3, 1); - itemDustCryotheum = ItemUtils.simpleMetaStack(itemMaterial, 4, 1); - - - - } - - public static void init(){ - - BucketHandler.registerBucket(TF_Blocks.blockFluidPyrotheum, 0, bucketPyrotheum); - BucketHandler.registerBucket(TF_Blocks.blockFluidCryotheum, 0, bucketCryotheum); - BucketHandler.registerBucket(TF_Blocks.blockFluidEnder, 0, bucketEnder); - FluidContainerRegistry.registerFluidContainer(TF_Fluids.fluidPyrotheum, bucketPyrotheum, FluidContainerRegistry.EMPTY_BUCKET); - FluidContainerRegistry.registerFluidContainer(TF_Fluids.fluidCryotheum, bucketCryotheum, FluidContainerRegistry.EMPTY_BUCKET); - FluidContainerRegistry.registerFluidContainer(TF_Fluids.fluidEnder, bucketEnder, FluidContainerRegistry.EMPTY_BUCKET); - - - } - - public static void postInit(){ - if (!CORE.GTNH) { - ItemHelper.addRecipe(ItemHelper.ShapelessRecipe(ItemHelper.cloneStack(dustPyrotheum, 1), new Object[] { "dustCoal", "dustSulfur", "dustRedstone", "dustBlaze" })); - ItemHelper.addRecipe(ItemHelper.ShapelessRecipe(ItemHelper.cloneStack(dustCryotheum, 1), new Object[] { Items.snowball, "dustSaltpeter", "dustRedstone", "dustBlizz" })); - ItemHelper.addRecipe(ItemHelper.ShapelessRecipe(ItemHelper.cloneStack(dustCryotheum, 1), new Object[] { Items.snowball, "dustNitor", "dustRedstone", "dustBlizz" })); - } - } - + public static ItemBase itemMaterial; + public static ItemStack rodBlizz; + public static ItemStack dustBlizz; + public static ItemStack dustPyrotheum; + public static ItemStack dustCryotheum; + public static ItemBucket itemBucket; + public static ItemStack bucketPyrotheum; + public static ItemStack bucketCryotheum; + public static ItemStack bucketEnder; + + public static ItemStack itemDustBlizz; + public static ItemStack itemDustPyrotheum; + public static ItemStack itemDustCryotheum; + public static ItemStack itemRodBlizz; + + public static void preInit() { + + itemBucket = (ItemBucket) + new ItemBucket("MiscUtils").setUnlocalizedName("bucket").setCreativeTab(AddToCreativeTab.tabMisc); + itemMaterial = (ItemBase) + new ItemBase("MiscUtils").setUnlocalizedName("material").setCreativeTab(AddToCreativeTab.tabMisc); + + bucketPyrotheum = itemBucket.addOreDictItem(1, "bucketPyrotheum"); + bucketCryotheum = itemBucket.addOreDictItem(2, "bucketCryotheum"); + bucketEnder = itemBucket.addOreDictItem(3, "bucketEnder", 1); + rodBlizz = itemMaterial.addOreDictItem(1, "rodBlizz"); + dustBlizz = itemMaterial.addOreDictItem(2, "dustBlizz"); + dustPyrotheum = itemMaterial.addOreDictItem(3, "dustPyrotheum"); + dustCryotheum = itemMaterial.addOreDictItem(4, "dustCryotheum"); + + if (ReflectionUtils.doesClassExist("cofh.core.util.energy.FurnaceFuelHandler")) { + FurnaceFuelHandler.registerFuel( + dustPyrotheum, 2400); // cofh.core.util.energy.FurnaceFuelHandler.registerFuel(ItemStack, int) + } + + ItemUtils.addItemToOreDictionary(rodBlizz, "stickBlizz"); + + itemRodBlizz = ItemUtils.simpleMetaStack(itemMaterial, 1, 1); + itemDustBlizz = ItemUtils.simpleMetaStack(itemMaterial, 2, 1); + itemDustPyrotheum = ItemUtils.simpleMetaStack(itemMaterial, 3, 1); + itemDustCryotheum = ItemUtils.simpleMetaStack(itemMaterial, 4, 1); + } + + public static void init() { + + BucketHandler.registerBucket(TF_Blocks.blockFluidPyrotheum, 0, bucketPyrotheum); + BucketHandler.registerBucket(TF_Blocks.blockFluidCryotheum, 0, bucketCryotheum); + BucketHandler.registerBucket(TF_Blocks.blockFluidEnder, 0, bucketEnder); + FluidContainerRegistry.registerFluidContainer( + TF_Fluids.fluidPyrotheum, bucketPyrotheum, FluidContainerRegistry.EMPTY_BUCKET); + FluidContainerRegistry.registerFluidContainer( + TF_Fluids.fluidCryotheum, bucketCryotheum, FluidContainerRegistry.EMPTY_BUCKET); + FluidContainerRegistry.registerFluidContainer( + TF_Fluids.fluidEnder, bucketEnder, FluidContainerRegistry.EMPTY_BUCKET); + } + + public static void postInit() { + if (!CORE.GTNH) { + ItemHelper.addRecipe(ItemHelper.ShapelessRecipe( + ItemHelper.cloneStack(dustPyrotheum, 1), + new Object[] {"dustCoal", "dustSulfur", "dustRedstone", "dustBlaze"})); + ItemHelper.addRecipe(ItemHelper.ShapelessRecipe( + ItemHelper.cloneStack(dustCryotheum, 1), + new Object[] {Items.snowball, "dustSaltpeter", "dustRedstone", "dustBlizz"})); + ItemHelper.addRecipe(ItemHelper.ShapelessRecipe( + ItemHelper.cloneStack(dustCryotheum, 1), + new Object[] {Items.snowball, "dustNitor", "dustRedstone", "dustBlizz"})); + } + } } diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java index 85485b5565..5391df38f1 100644 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/recipe/TF_Gregtech_Recipes.java @@ -1,101 +1,103 @@ package gtPlusPlus.xmod.thermalfoundation.recipe; -import net.minecraft.init.Items; -import net.minecraft.item.ItemStack; - +import cofh.lib.util.helpers.ItemHelper; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; - -import cofh.lib.util.helpers.ItemHelper; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.thermalfoundation.item.TF_Items; -import net.minecraftforge.fluids.FluidRegistry; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class TF_Gregtech_Recipes { - public static void run(){ - start(); - } + public static void run() { + start(); + } + + private static void start() { + // Get Items to work with + final ItemStack dust_Cryotheum = ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1); + final ItemStack dust_Pyrotheum = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Pyrotheum, 1L); + final ItemStack dust_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 1); + final ItemStack dust_Blizz3 = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 3); + final ItemStack rod_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1); - private static void start(){ - //Get Items to work with - final ItemStack dust_Cryotheum = ItemUtils.getItemStackOfAmountFromOreDict("dustCryotheum", 1); - final ItemStack dust_Pyrotheum = GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Pyrotheum, 1L); - final ItemStack dust_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 1); - final ItemStack dust_Blizz3 = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 3); - final ItemStack rod_Blizz = ItemUtils.getItemStackOfAmountFromOreDict("stickBlizz", 1); - - final FluidStack moltenBlaze = getFluidStack("molten.blaze", 1440); + final FluidStack moltenBlaze = getFluidStack("molten.blaze", 1440); - //Gelid Cryotheum - GT_Values.RA.addChemicalBathRecipe((GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), getFluidStack("cryotheum", 144), GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), GT_Values.NI, GT_Values.NI, null, 400, 30); + // Gelid Cryotheum + GT_Values.RA.addChemicalBathRecipe( + (GT_OreDictUnificator.get(OrePrefixes.ore, Materials.Cinnabar, 1L)), + getFluidStack("cryotheum", 144), + GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Cinnabar, 3L), + GT_Values.NI, + GT_Values.NI, + null, + 400, + 30); - //Blizz Powder - GT_Values.RA.addChemicalBathRecipe(new ItemStack(Items.snowball, 4), moltenBlaze, dust_Blizz, GT_Values.NI, GT_Values.NI, null, 400, 240); + // Blizz Powder + GT_Values.RA.addChemicalBathRecipe( + new ItemStack(Items.snowball, 4), moltenBlaze, dust_Blizz, GT_Values.NI, GT_Values.NI, null, 400, 240); - //Blizz Rod - GT_Values.RA.addVacuumFreezerRecipe(new ItemStack(Items.blaze_rod), rod_Blizz, (int) Math.max((Materials.Blaze.getMass()*4) * 3L, 1L)); - GT_ModHandler.addPulverisationRecipe(rod_Blizz, dust_Blizz3, new ItemStack(Items.snowball, 1), 50, false); + // Blizz Rod + GT_Values.RA.addVacuumFreezerRecipe( + new ItemStack(Items.blaze_rod), rod_Blizz, (int) Math.max((Materials.Blaze.getMass() * 4) * 3L, 1L)); + GT_ModHandler.addPulverisationRecipe(rod_Blizz, dust_Blizz3, new ItemStack(Items.snowball, 1), 50, false); - ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); - ItemStack dustSulfur = ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1); - ItemStack dustRedstone = ItemUtils.getItemStackOfAmountFromOreDict("dustRedstone", 1); - ItemStack dustBlaze = ItemUtils.getItemStackOfAmountFromOreDict("dustBlaze", 1); - ItemStack dustSaltpeter = ItemUtils.getItemStackOfAmountFromOreDict("dustSaltpeter", 1); - ItemStack dustSnow = ItemUtils.getItemStackOfAmountFromOreDict("dustSnow", 1); - ItemStack dustBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 1); - ItemStack dustNiter = ItemUtils.getItemStackOfAmountFromOreDict("dustNiter", 1); - - if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustCoal, dustSulfur, dustRedstone, dustBlaze})) { - GT_Values.RA.addMixerRecipe( - dustCoal, - dustSulfur, - dustRedstone, - dustBlaze, //Input - null, //F in - null, //F out - ItemHelper.cloneStack(dust_Pyrotheum, 1), //Output - 20*8, - 120); - } + ItemStack dustCoal = ItemUtils.getItemStackOfAmountFromOreDict("dustCoal", 1); + ItemStack dustSulfur = ItemUtils.getItemStackOfAmountFromOreDict("dustSulfur", 1); + ItemStack dustRedstone = ItemUtils.getItemStackOfAmountFromOreDict("dustRedstone", 1); + ItemStack dustBlaze = ItemUtils.getItemStackOfAmountFromOreDict("dustBlaze", 1); + ItemStack dustSaltpeter = ItemUtils.getItemStackOfAmountFromOreDict("dustSaltpeter", 1); + ItemStack dustSnow = ItemUtils.getItemStackOfAmountFromOreDict("dustSnow", 1); + ItemStack dustBlizz = ItemUtils.getItemStackOfAmountFromOreDict("dustBlizz", 1); + ItemStack dustNiter = ItemUtils.getItemStackOfAmountFromOreDict("dustNiter", 1); - if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustSaltpeter, dustSnow, dustRedstone, dustBlizz})) { - GT_Values.RA.addMixerRecipe( - dustSaltpeter, - dustSnow, - dustRedstone, - dustBlizz, //Input - null, //F in - null, //F out - ItemHelper.cloneStack(dust_Cryotheum, 1), //Output - 20*8, - 120); - } - - if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustNiter, dustSnow, dustRedstone, dustBlizz})) { - GT_Values.RA.addMixerRecipe( - dustNiter, - dustSnow, - dustRedstone, - dustBlizz, //Input - null, //F in - null, //F out - ItemHelper.cloneStack(dust_Cryotheum, 1), //Output - 20*8, - 120); - } + if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustCoal, dustSulfur, dustRedstone, dustBlaze})) { + GT_Values.RA.addMixerRecipe( + dustCoal, + dustSulfur, + dustRedstone, + dustBlaze, // Input + null, // F in + null, // F out + ItemHelper.cloneStack(dust_Pyrotheum, 1), // Output + 20 * 8, + 120); + } - } + if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustSaltpeter, dustSnow, dustRedstone, dustBlizz})) { + GT_Values.RA.addMixerRecipe( + dustSaltpeter, + dustSnow, + dustRedstone, + dustBlizz, // Input + null, // F in + null, // F out + ItemHelper.cloneStack(dust_Cryotheum, 1), // Output + 20 * 8, + 120); + } - private static FluidStack getFluidStack(final String fluidName, final int amount){ - return FluidUtils.getFluidStack(fluidName, amount); - } + if (ItemUtils.checkForInvalidItems(new ItemStack[] {dustNiter, dustSnow, dustRedstone, dustBlizz})) { + GT_Values.RA.addMixerRecipe( + dustNiter, + dustSnow, + dustRedstone, + dustBlizz, // Input + null, // F in + null, // F out + ItemHelper.cloneStack(dust_Cryotheum, 1), // Output + 20 * 8, + 120); + } + } + private static FluidStack getFluidStack(final String fluidName, final int amount) { + return FluidUtils.getFluidStack(fluidName, amount); + } } |