From fc1a2f15a4dccb5f683efc9d7b65604fa0b05838 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 19 Sep 2021 20:30:16 +0200 Subject: [PATCH] Fixes, particles for cooling towers --- src/main/java/com/hbm/items/ModItems.java | 2 +- src/main/java/com/hbm/lib/RefStrings.java | 2 +- src/main/java/com/hbm/main/ClientProxy.java | 9 ++ .../java/com/hbm/main/CraftingManager.java | 1 - .../hbm/particle/ParticleCoolingTower.java | 119 ++++++++++++++++++ .../machine/TileEntityCondenser.java | 12 ++ .../machine/TileEntityTowerLarge.java | 26 +++- .../machine/TileEntityTowerSmall.java | 25 ++++ .../machine/rbmk/TileEntityRBMKRod.java | 7 +- .../turret/TileEntityTurretFritz.java | 12 ++ src/main/resources/assets/hbm/lang/de_DE.lang | 1 + src/main/resources/assets/hbm/lang/en_US.lang | 1 + src/main/resources/mcmod.info | 2 +- 13 files changed, 208 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/hbm/particle/ParticleCoolingTower.java diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 47739e8b4..82c8d2068 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -2461,7 +2461,7 @@ public class ModItems { ingot_u235 = new ItemHazard(ItemHazard.u235 * ItemHazard.ingot).setUnlocalizedName("ingot_u235").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_u235"); ingot_u238 = new ItemHazard(ItemHazard.u238 * ItemHazard.ingot).setUnlocalizedName("ingot_u238").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_u238"); ingot_u238m2 = new ItemUnstable(350, 200).setUnlocalizedName("ingot_u238m2").setCreativeTab(null).setTextureName(RefStrings.MODID + ":ingot_u238m2"); - ingot_plutonium = new ItemHazard(ItemHazard.pu * ItemHazard.ingot).setUnlocalizedName("ingot_plutonium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_plutonium"); + ingot_plutonium = new ItemHazard().setUnlocalizedName("ingot_plutonium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_plutonium"); ingot_pu238 = new ItemHazard(ItemHazard.pu238 * ItemHazard.ingot, true).setUnlocalizedName("ingot_pu238").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_pu238"); ingot_pu239 = new ItemHazard(ItemHazard.pu239 * ItemHazard.ingot).setUnlocalizedName("ingot_pu239").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_pu239"); ingot_pu240 = new ItemHazard(ItemHazard.pu240 * ItemHazard.ingot).setUnlocalizedName("ingot_pu240").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":ingot_pu240"); diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index f0d56bf94..39e6d5240 100644 --- a/src/main/java/com/hbm/lib/RefStrings.java +++ b/src/main/java/com/hbm/lib/RefStrings.java @@ -3,7 +3,7 @@ package com.hbm.lib; public class RefStrings { public static final String MODID = "hbm"; public static final String NAME = "Hbm's Nuclear Tech Mod"; - public static final String VERSION = "1.0.27 BETA (3991)"; + public static final String VERSION = "1.0.27 BETA (3997)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index bb0b088c2..00e57f29c 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -1364,6 +1364,15 @@ public class ClientProxy extends ServerProxy { Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRBMKMush(man, world, x, y, z, scale)); } + if("tower".equals(type)) { + ParticleCoolingTower fx = new ParticleCoolingTower(man, world, x, y, z); + fx.setLift(data.getFloat("lift")); + fx.setBaseScale(data.getFloat("base")); + fx.setMaxScale(data.getFloat("max")); + fx.setLife(data.getInteger("life")); + Minecraft.getMinecraft().effectRenderer.addEffect(fx); + } + if("anim".equals(type)) { if("crucible".equals(data.getString("mode")) && player.getHeldItem() != null) { diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 28f1c15e4..248902f9b 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -813,7 +813,6 @@ public class CraftingManager { GameRegistry.addRecipe(new ItemStack(ModItems.rag, 4), new Object[] { "SW", "WS", 'S', Items.string, 'W', Blocks.wool }); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.machine_condenser), new Object[] { "SIS", "ICI", "SIS", 'S', "ingotSteel", 'I', "plateIron", 'C', ModItems.board_copper })); - GameRegistry.addRecipe(new ItemStack(ModBlocks.machine_tower_large), new Object[] { "C C", "C C", "DDD", 'C', ModBlocks.concrete_smooth, 'D', ModBlocks.machine_condenser }); if(GeneralConfig.enableBabyMode) { GameRegistry.addShapelessRecipe(new ItemStack(ModItems.cordite, 3), new Object[] { ModItems.ballistite, Items.gunpowder, new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE) }); diff --git a/src/main/java/com/hbm/particle/ParticleCoolingTower.java b/src/main/java/com/hbm/particle/ParticleCoolingTower.java new file mode 100644 index 000000000..8da75475d --- /dev/null +++ b/src/main/java/com/hbm/particle/ParticleCoolingTower.java @@ -0,0 +1,119 @@ +package com.hbm.particle; + +import org.lwjgl.opengl.GL11; + +import com.hbm.lib.RefStrings; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.texture.TextureManager; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +@SideOnly(Side.CLIENT) +public class ParticleCoolingTower extends EntityFX { + + private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/particle_base.png"); + private TextureManager theRenderEngine; + private float baseScale = 1.0F; + private float maxScale = 1.0F; + private float lift = 0.3F; + + public ParticleCoolingTower(TextureManager texman, World world, double x, double y, double z) { + super(world, x, y, z); + this.particleRed = this.particleGreen = this.particleBlue = 0.9F + world.rand.nextFloat() * 0.05F; + this.theRenderEngine = texman; + this.noClip = true; + } + + public void setBaseScale(float f) { + this.baseScale = f; + } + + public void setMaxScale(float f) { + this.maxScale = f; + } + + public void setLift(float f) { + this.lift = f; + } + + public void setLife(int i) { + this.particleMaxAge = i; + } + + public void onUpdate() { + + this.prevPosX = this.posX; + this.prevPosY = this.posY; + this.prevPosZ = this.posZ; + + float ageScale = (float) this.particleAge / (float) this.particleMaxAge; + + this.particleAlpha = 0.25F - ageScale * 0.25F; + this.particleScale = baseScale + (float)Math.pow((maxScale * ageScale - baseScale), 2); + + this.particleAge++; + + if(this.motionY < this.lift) { + this.motionY += 0.01F; + } + + this.motionX += rand.nextGaussian() * 0.075D * ageScale; + this.motionZ += rand.nextGaussian() * 0.075D * ageScale; + + this.motionX += 0.02 * ageScale; + this.motionX -= 0.01 * ageScale; + + if(this.particleAge == this.particleMaxAge) { + this.setDead(); + } + + this.moveEntity(this.motionX, this.motionY, this.motionZ); + + motionX *= 0.925; + motionY *= 0.925; + motionZ *= 0.925; + } + + public int getFXLayer() { + return 3; + } + + public void renderParticle(Tessellator tess, float interp, float fX, float fY, float fZ, float sX, float sZ) { + + this.theRenderEngine.bindTexture(texture); + + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_BLEND); + GL11.glAlphaFunc(GL11.GL_GREATER, 0F); + GL11.glDepthMask(false); + OpenGlHelper.glBlendFunc(770, 771, 1, 0); + RenderHelper.disableStandardItemLighting(); + + tess.startDrawingQuads(); + + tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); + tess.setNormal(0.0F, 1.0F, 0.0F); + + float scale = this.particleScale; + float pX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX); + float pY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY); + float pZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ); + + tess.addVertexWithUV((double) (pX - fX * scale - sX * scale), (double) (pY - fY * scale), (double) (pZ - fZ * scale - sZ * scale), 1, 1); + tess.addVertexWithUV((double) (pX - fX * scale + sX * scale), (double) (pY + fY * scale), (double) (pZ - fZ * scale + sZ * scale), 1, 0); + tess.addVertexWithUV((double) (pX + fX * scale + sX * scale), (double) (pY + fY * scale), (double) (pZ + fZ * scale + sZ * scale), 0, 0); + tess.addVertexWithUV((double) (pX + fX * scale - sX * scale), (double) (pY - fY * scale), (double) (pZ + fZ * scale - sZ * scale), 0, 1); + tess.draw(); + + GL11.glPolygonOffset(0.0F, 0.0F); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); + } +} diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java index 3a2b9f345..aa9909d26 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java @@ -21,6 +21,8 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I public FluidTank[] tanks; public List list = new ArrayList(); + public int waterTimer = 0; + public TileEntityCondenser() { tanks = new FluidTank[2]; tanks[0] = new FluidTank(FluidType.SPENTSTEAM, 100, 0); @@ -37,11 +39,21 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I age = 0; } + this.tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + int convert = Math.min(tanks[0].getFill(), tanks[1].getMaxFill() - tanks[1].getFill()); tanks[0].setFill(tanks[0].getFill() - convert); tanks[1].setFill(tanks[1].getFill() + convert); fillFluidInit(tanks[1].getTankType()); + + } else { + + if(tanks[0].getFill() > 0) { + this.waterTimer = 20; + } else if(this.waterTimer > 0){ + this.waterTimer--; + } } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityTowerLarge.java b/src/main/java/com/hbm/tileentity/machine/TileEntityTowerLarge.java index f465ee304..782bbf914 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityTowerLarge.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityTowerLarge.java @@ -2,10 +2,11 @@ package com.hbm.tileentity.machine; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.inventory.FluidTank; +import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; @@ -16,6 +17,29 @@ public class TileEntityTowerLarge extends TileEntityCondenser { tanks[0] = new FluidTank(FluidType.SPENTSTEAM, 10000, 0); tanks[1] = new FluidTank(FluidType.WATER, 10000, 1); } + + @Override + public void updateEntity() { + super.updateEntity(); + + if(worldObj.isRemote) { + + if(this.waterTimer > 0) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "tower"); + data.setFloat("lift", 0.5F); + data.setFloat("base", 1F); + data.setFloat("max", 10F); + data.setInteger("life", 750 + worldObj.rand.nextInt(250)); + + data.setDouble("posX", xCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5); + data.setDouble("posZ", zCoord + 0.5 + worldObj.rand.nextDouble() * 3 - 1.5); + data.setDouble("posY", yCoord + 1); + + MainRegistry.proxy.effectNT(data); + } + } + } @Override public void fillFluidInit(FluidType type) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityTowerSmall.java b/src/main/java/com/hbm/tileentity/machine/TileEntityTowerSmall.java index 8f049fb0f..e89828676 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityTowerSmall.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityTowerSmall.java @@ -2,9 +2,11 @@ package com.hbm.tileentity.machine; import com.hbm.handler.FluidTypeHandler.FluidType; import com.hbm.inventory.FluidTank; +import com.hbm.main.MainRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; import net.minecraftforge.common.util.ForgeDirection; @@ -15,6 +17,29 @@ public class TileEntityTowerSmall extends TileEntityCondenser { tanks[0] = new FluidTank(FluidType.SPENTSTEAM, 1000, 0); tanks[1] = new FluidTank(FluidType.WATER, 1000, 1); } + + @Override + public void updateEntity() { + super.updateEntity(); + + if(worldObj.isRemote) { + + if(this.waterTimer > 0) { + NBTTagCompound data = new NBTTagCompound(); + data.setString("type", "tower"); + data.setFloat("lift", 1F); + data.setFloat("base", 0.5F); + data.setFloat("max", 4F); + data.setInteger("life", 250 + worldObj.rand.nextInt(250)); + + data.setDouble("posX", xCoord + 0.5); + data.setDouble("posZ", zCoord + 0.5); + data.setDouble("posY", yCoord + 18); + + MainRegistry.proxy.effectNT(data); + } + } + } @Override public void fillFluidInit(FluidType type) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java index 710d0eb38..03746744e 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKRod.java @@ -152,12 +152,7 @@ public class TileEntityRBMKRod extends TileEntityRBMKSlottedBase implements IRBM ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, (float) (flux * 0.05F)); if(base.isModerated()) { - - if(this.stream != NType.SLOW) { - //flux *= 0.85D; - } else { - this.stream = NType.SLOW; - } + this.stream = NType.SLOW; } } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java index 5f2b5b79a..756a13f0a 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretFritz.java @@ -114,6 +114,18 @@ public class TileEntityTurretFritz extends TileEntityTurretBaseNT implements IFl } } } + + @Override + public void readFromNBT(NBTTagCompound nbt) { + super.readFromNBT(nbt); + this.tank.readFromNBT(nbt, "diesel"); + } + + @Override + public void writeToNBT(NBTTagCompound nbt) { + super.writeToNBT(nbt); + this.tank.writeToNBT(nbt, "diesel"); + } @Override public int[] getAccessibleSlotsFromSide(int side) { diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 0777b1c08..8be42812f 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -2702,6 +2702,7 @@ tile.block_mox_fuel.name=MOX-Kernbrennstoffblock tile.block_neptunium.name=Neptuniumblock tile.block_niter.name=Salpeterblock tile.block_niter_reinforced.name=Sprengsicherer Salpeterblock +tile.block_niobium.name=Niobblock tile.block_plutonium.name=Plutoniumblock tile.block_plutonium_fuel.name=Plutoniumkernbrennstoffblock tile.block_polonium.name=Polonium-210-Block diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 521d4b111..1c1dcdbaa 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -2769,6 +2769,7 @@ tile.block_mox_fuel.name=Block of MOX Fuel tile.block_neptunium.name=Block of Neptunium tile.block_niter.name=Block of Niter tile.block_niter_reinforced.name=Reinforced Block of Niter +tile.block_niobium.name=Block of Niobium tile.block_plutonium.name=Block of Plutonium tile.block_plutonium_fuel.name=Block of Plutonium Fuel tile.block_polonium.name=Block of Polonium-210 diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index ea15b3cae..15609373c 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "hbm", "name": "Hbm's Nuclear Tech", "description": "A mod that adds weapons, nuclear themed stuff and machines", - "version":"1.0.27_X3991", + "version":"1.0.27_X3997", "mcversion": "1.7.10", "url": "", "updateUrl": "",