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 --- .../block/TFBlockFluidCryotheum.java | 178 +++++++++++++++++++ .../thermalfoundation/block/TFBlockFluidEnder.java | 61 +++++++ .../block/TFBlockFluidPyrotheum.java | 192 +++++++++++++++++++++ .../xmod/thermalfoundation/block/TFBlocks.java | 23 +++ .../block/TF_Block_Fluid_Cryotheum.java | 178 ------------------- .../block/TF_Block_Fluid_Ender.java | 61 ------- .../block/TF_Block_Fluid_Pyrotheum.java | 192 --------------------- .../xmod/thermalfoundation/block/TF_Blocks.java | 23 --- 8 files changed, 454 insertions(+), 454 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidCryotheum.java create mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidEnder.java create mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidPyrotheum.java create mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlocks.java delete mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java delete mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java delete mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java delete mode 100644 src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java (limited to 'src/main/java/gtPlusPlus/xmod/thermalfoundation/block') diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidCryotheum.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidCryotheum.java new file mode 100644 index 0000000000..0fefa79686 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidCryotheum.java @@ -0,0 +1,178 @@ +package gtPlusPlus.xmod.thermalfoundation.block; + +import static gregtech.api.enums.Mods.GTPlusPlus; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.material.MaterialLiquid; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntitySnowman; +import net.minecraft.entity.monster.EntityZombie; +import net.minecraft.init.Blocks; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +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.xmod.thermalfoundation.fluid.TFFluids; + +public class TFBlockFluidCryotheum extends BlockFluidInteractive { + + public static final Material materialFluidCryotheum = new MaterialLiquid(MapColor.iceColor); + private static boolean enableSourceFall = true; + private static boolean effect = true; + + public TFBlockFluidCryotheum() { + super(GTPlusPlus.ID, TFFluids.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); + + effect = true; + 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 TFFluids.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); + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidEnder.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidEnder.java new file mode 100644 index 0000000000..1f7c1fec93 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidEnder.java @@ -0,0 +1,61 @@ +package gtPlusPlus.xmod.thermalfoundation.block; + +import static gregtech.api.enums.Mods.GTPlusPlus; + +import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.Material; +import net.minecraft.block.material.MaterialLiquid; +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 cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.xmod.thermalfoundation.fluid.TFFluids; + +public class TFBlockFluidEnder extends BlockFluidCoFHBase { + + public static final Material materialFluidEnder = new MaterialLiquid(MapColor.greenColor); + private static boolean effect = true; + + public TFBlockFluidEnder() { + super(GTPlusPlus.ID, TFFluids.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"); + + 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); + } + } + } + + @Override + public int getLightValue(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) { + return TFFluids.fluidEnder.getLuminosity(); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidPyrotheum.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidPyrotheum.java new file mode 100644 index 0000000000..1014667355 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlockFluidPyrotheum.java @@ -0,0 +1,192 @@ +package gtPlusPlus.xmod.thermalfoundation.block; + +import static gregtech.api.enums.Mods.GTPlusPlus; + +import java.util.Random; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +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.xmod.thermalfoundation.fluid.TFFluids; + +public class TFBlockFluidPyrotheum extends BlockFluidInteractive { + + Random random = new Random(); + private static boolean effect = true; + private static boolean enableSourceFall = true; + + public TFBlockFluidPyrotheum() { + super(GTPlusPlus.ID, TFFluids.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 TFFluids.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/TFBlocks.java b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlocks.java new file mode 100644 index 0000000000..4e238ae5f5 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TFBlocks.java @@ -0,0 +1,23 @@ +package gtPlusPlus.xmod.thermalfoundation.block; + +import cofh.core.fluid.BlockFluidCoFHBase; + +public class TFBlocks { + + public static BlockFluidCoFHBase blockFluidPyrotheum; + public static BlockFluidCoFHBase blockFluidCryotheum; + public static BlockFluidCoFHBase blockFluidEnder; + + public static void preInit() { + blockFluidPyrotheum = new TFBlockFluidPyrotheum(); + blockFluidCryotheum = new TFBlockFluidCryotheum(); + blockFluidEnder = new TFBlockFluidEnder(); + blockFluidPyrotheum.preInit(); + blockFluidCryotheum.preInit(); + blockFluidEnder.preInit(); + } + + public static void init() {} + + public static void postInit() {} +} 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 deleted file mode 100644 index b48be445e5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Cryotheum.java +++ /dev/null @@ -1,178 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.block.material.MaterialLiquid; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.monster.EntityBlaze; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.monster.EntitySnowman; -import net.minecraft.entity.monster.EntityZombie; -import net.minecraft.init.Blocks; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -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.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Cryotheum extends BlockFluidInteractive { - - 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(GTPlusPlus.ID, 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); - - effect = true; - 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); - } - } - -} 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 deleted file mode 100644 index 9f89d01250..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Ender.java +++ /dev/null @@ -1,61 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import net.minecraft.block.material.MapColor; -import net.minecraft.block.material.Material; -import net.minecraft.block.material.MaterialLiquid; -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 cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Ender extends BlockFluidCoFHBase { - - public static final Material materialFluidEnder = new MaterialLiquid(MapColor.greenColor); - private static boolean effect = true; - - public TF_Block_Fluid_Ender() { - super(GTPlusPlus.ID, 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"); - - 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); - } - } - } - - @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 deleted file mode 100644 index 90c8be8bf7..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Block_Fluid_Pyrotheum.java +++ /dev/null @@ -1,192 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.entity.Entity; -import net.minecraft.entity.monster.EntityCreeper; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -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.xmod.thermalfoundation.fluid.TF_Fluids; - -public class TF_Block_Fluid_Pyrotheum extends BlockFluidInteractive { - - Random random = new Random(); - private static boolean effect = true; - private static boolean enableSourceFall = true; - - public TF_Block_Fluid_Pyrotheum() { - super(GTPlusPlus.ID, 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 deleted file mode 100644 index 38fed4c137..0000000000 --- a/src/main/java/gtPlusPlus/xmod/thermalfoundation/block/TF_Blocks.java +++ /dev/null @@ -1,23 +0,0 @@ -package gtPlusPlus.xmod.thermalfoundation.block; - -import cofh.core.fluid.BlockFluidCoFHBase; - -public class TF_Blocks { - - 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 init() {} - - public static void postInit() {} -} -- cgit