From 7896c0443a5bdd27975ecd849559c79177287122 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 14 Jul 2024 20:48:35 +0200 Subject: [PATCH] the death of RNG --- changelog | 20 ++- gradle.properties | 2 +- .../com/hbm/blocks/machine/Floodlight.java | 28 +++++ .../com/hbm/blocks/machine/ReactorZirnox.java | 8 ++ .../hbm/entity/projectile/EntityBullet.java | 3 +- .../inventory/recipes/AssemblerRecipes.java | 26 ++-- .../hbm/inventory/recipes/FusionRecipes.java | 20 +-- src/main/java/com/hbm/lib/RefStrings.java | 2 +- .../com/hbm/particle/ParticleMukeFlash.java | 117 +++++++++--------- .../com/hbm/particle/ParticleRBMKFlame.java | 3 + .../render/tileentity/RenderFloodlight.java | 28 ++++- .../tileentity/machine/TileEntityITER.java | 43 ++----- .../tileentity/machine/TileEntitySILEX.java | 25 +++- .../machine/rbmk/TileEntityRBMKBase.java | 2 +- .../network/TileEntityConverterHeRf.java | 20 +-- .../network/TileEntityConverterRfHe.java | 20 +-- .../turret/TileEntityTurretBaseNT.java | 4 +- src/main/resources/assets/hbm/lang/de_DE.lang | 1 + src/main/resources/assets/hbm/lang/en_US.lang | 1 + 19 files changed, 234 insertions(+), 139 deletions(-) diff --git a/changelog b/changelog index 35ded0f7d..701632f26 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +## Added +* Powered Floodlight + * Uses 100HE/t to create light + * Casts 15 rays in a wide beam with a maximum length of 64 blocks, each beam creates a spot with light level 15 + * Floodlight can be mounted on any side and angled in any direction, angles snap to 5° increments + * Angles can be adjusted after placing with a screwdriver + ## Changed * Changed bedrock ore processing time in the electrolyzer to 60 ticks * RF converters have been reworked @@ -7,9 +14,20 @@ * The loss only takes effect once the input buffer can no longer empty into the output buffer, i.e. when energy demand is too low for the input * The buffer also fixes a bug where the HE to RF converter often behaves weirdly with certain mods, either outright destroying energy ot creating infinite energy * HE to RF converters now by default have the connection priority of LOW, only feeding into RF networks when all other energy consumers are sufficiently supplied. This can still be changed by using diodes + * Converters now have configurable conversion rates as well as input decay per tick +* The SILEX is now fully deterministic + * Output is no longer random, instead there is now a "recipe index" which is incremented after each operation, choosing a new next output + * This means that the order of outputs for any given input is fixed, and outputs are guaranteed to happen based on the recipe's total weight (most recipes have a total output weight of 100 for simplicity's sake, meaning after 100 operations the output pattern repeats, and all outputs are guaranteed to be picked) +* Simplified the assembler recipes for the SILEX, FEL and all energy storage blocks (no more random wires and single ingots, fewer duplicate materials) +* Turrets will now only lock onto missiles if they are descending (i.e. negative Y speed), which means that launching a missile close to a turret will not cause the turret to immediately shoot it +* The fusion reactor's byproducts are now created by delay and not by chance, making the output predictable +* Tritium-based fusion fuels now have a higher byproduct output rate (900 ticks instead of 1200) ## Fixed * Fixed issue where the NEI universal handler can not correctly display more than 4 outputs (now supports up to 8, which should cover all possible electrolyzer cases too) * Fixed the metal electrolysis duration variable not being part of the config * Removed the global energy transfer cap (only per-machine caps apply now), fixing issues where FENSUs in buffer mode would not charge past 10THE, and constantly void energy if above that threshold -* Fixed a bug where the power transfer would sometimes have leftovers due to rounding errors which are send but not used up, effectively creating small amounts of energy out of nothing \ No newline at end of file +* Fixed a bug where the power transfer would sometimes have leftovers due to rounding errors which are send but not used up, effectively creating small amounts of energy out of nothing +* Fixed ZIRNOX space checks omitting the top portion +* Fixed RBMK flames and mini nuke flashes being affected by fog, turning them into glowing squares when viewed at a distance +* Fixed crash caused by brimstone mines being launched from dispensers \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 15c0ea27c..9e002c1f0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_version=1.0.27 # Empty build number makes a release type -mod_build_number=5020 +mod_build_number=5026 credits=HbMinecraft,\ \ rodolphito (explosion algorithms),\ diff --git a/src/main/java/com/hbm/blocks/machine/Floodlight.java b/src/main/java/com/hbm/blocks/machine/Floodlight.java index 95c898ec5..af04665b7 100644 --- a/src/main/java/com/hbm/blocks/machine/Floodlight.java +++ b/src/main/java/com/hbm/blocks/machine/Floodlight.java @@ -7,6 +7,8 @@ import com.hbm.util.fauxpointtwelve.BlockPos; import api.hbm.block.IToolable; import api.hbm.energymk2.IEnergyReceiverMK2; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -19,6 +21,7 @@ import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.util.Vec3; import net.minecraft.world.World; @@ -265,5 +268,30 @@ public class Floodlight extends BlockContainer implements IToolable { private boolean isLoaded = true; @Override public boolean isLoaded() { return isLoaded; } @Override public void onChunkUnload() { this.isLoaded = false; } + + AxisAlignedBB bb = null; + + @Override + public AxisAlignedBB getRenderBoundingBox() { + + if(bb == null) { + bb = AxisAlignedBB.getBoundingBox( + xCoord - 1, + yCoord - 1, + zCoord - 1, + xCoord + 2, + yCoord + 2, + zCoord + 2 + ); + } + + return bb; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() { + return 65536.0D; + } } } diff --git a/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java b/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java index 409925e53..b9b448ef5 100644 --- a/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java +++ b/src/main/java/com/hbm/blocks/machine/ReactorZirnox.java @@ -62,6 +62,14 @@ public class ReactorZirnox extends BlockDummyable { return 2; } + @Override + protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) { + return super.checkRequirement(world, x, y, z, dir, o) && + MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -2, 1, 1, 1, 1}, x, y, z, dir) && + MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -2, 0, 0, 2, -2}, x, y, z, dir) && + MultiblockHandlerXR.checkSpace(world, x + dir.offsetX * o, y + dir.offsetY * o, z + dir.offsetZ * o, new int[] {4, -2, 0, 0, -2, 2}, x, y, z, dir); + } + @Override protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) { super.fillSpace(world, x, y, z, dir, o); diff --git a/src/main/java/com/hbm/entity/projectile/EntityBullet.java b/src/main/java/com/hbm/entity/projectile/EntityBullet.java index 6924b0f3a..51b68c5e9 100644 --- a/src/main/java/com/hbm/entity/projectile/EntityBullet.java +++ b/src/main/java/com/hbm/entity/projectile/EntityBullet.java @@ -175,8 +175,7 @@ public class EntityBullet extends Entity implements IProjectile { } this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, - p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch); + if(p_i1756_2_ != null) this.setLocationAndAngles(p_i1756_2_.posX, p_i1756_2_.posY + p_i1756_2_.getEyeHeight(), p_i1756_2_.posZ, p_i1756_2_.rotationYaw, p_i1756_2_.rotationPitch); this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; diff --git a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java index 2464b3b7e..c2fdad08d 100644 --- a/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java @@ -126,10 +126,10 @@ public class AssemblerRecipes extends SerializableRecipe { makeRecipe(new ComparableStack(ModBlocks.machine_rtg_furnace_off, 1), new AStack[] {new ComparableStack(Blocks.furnace, 1), new ComparableStack(ModItems.rtg_unit, 3), new OreDictStack(PB.plate528(), 6), new OreDictStack(OreDictManager.getReflector(), 4), new OreDictStack(CU.plate(), 2), },150); makeRecipe(new ComparableStack(ModBlocks.machine_diesel, 1), new AStack[] {new OreDictStack(STEEL.shell(), 1), new ComparableStack(ModItems.piston_selenium, 1), new OreDictStack(STEEL.plateCast(), 1), new ComparableStack(ModItems.coil_copper, 4), }, 60); makeRecipe(new ComparableStack(ModBlocks.machine_rtg_grey, 1), new AStack[] {new ComparableStack(ModItems.rtg_unit, 3), new OreDictStack(STEEL.plate528(), 4), new OreDictStack(MINGRADE.wireFine(), 4), new OreDictStack(ANY_PLASTIC.ingot(), 3), },200); - makeRecipe(new ComparableStack(ModBlocks.machine_battery, 1), new AStack[] {new OreDictStack(STEEL.plateWelded(), 1), new OreDictStack(S.dust(), 12), new OreDictStack(PB.dust(), 12), new OreDictStack(MINGRADE.ingot(), 2), new OreDictStack(MINGRADE.wireFine(), 4), },200); - makeRecipe(new ComparableStack(ModBlocks.machine_lithium_battery, 1), new AStack[] {new OreDictStack(ANY_PLASTIC.ingot(), 4), new OreDictStack(CO.dust(), 12), new OreDictStack(LI.dust(), 12), new OreDictStack(ALLOY.ingot(), 2), new OreDictStack(MINGRADE.wireFine(), 4), },400); - makeRecipe(new ComparableStack(ModBlocks.machine_schrabidium_battery, 1), new AStack[] {new OreDictStack(DESH.ingot(), 4), new OreDictStack(NP237.dust(), 12), new OreDictStack(SA326.dust(), 12), new OreDictStack(SA326.ingot(), 2), new OreDictStack(SA326.wireFine(), 4), },800); - makeRecipe(new ComparableStack(ModBlocks.machine_dineutronium_battery, 1), new AStack[] {new OreDictStack(DNT.ingot(), 24), new ComparableStack(ModItems.powder_spark_mix, 12), new ComparableStack(ModItems.battery_spark_cell_1000, 1), new OreDictStack(CMB.ingot(), 32), new ComparableStack(ModItems.coil_magnetized_tungsten, 8), },1600); + makeRecipe(new ComparableStack(ModBlocks.machine_battery, 1), new AStack[] {new OreDictStack(STEEL.plateWelded(), 1), new OreDictStack(S.dust(), 12), new OreDictStack(PB.dust(), 12) },100); + makeRecipe(new ComparableStack(ModBlocks.machine_lithium_battery, 1), new AStack[] {new OreDictStack(ANY_PLASTIC.ingot(), 8), new OreDictStack(CO.dust(), 12), new OreDictStack(LI.dust(), 12) },100); + makeRecipe(new ComparableStack(ModBlocks.machine_schrabidium_battery, 1), new AStack[] {new OreDictStack(DESH.ingot(), 16), new OreDictStack(NP237.dust(), 12), new OreDictStack(SA326.dust(), 12) },200); + makeRecipe(new ComparableStack(ModBlocks.machine_dineutronium_battery, 1), new AStack[] {new OreDictStack(DNT.ingot(), 24), new ComparableStack(ModItems.powder_spark_mix, 12), new ComparableStack(ModItems.battery_spark_cell_1000, 1), new OreDictStack(CMB.ingot(), 32) }, 300); makeRecipe(new ComparableStack(ModBlocks.machine_shredder, 1), new AStack[] {new OreDictStack(STEEL.plate528(), 8), new ComparableStack(ModItems.motor, 2), new ComparableStack(ModBlocks.steel_beam, 2), new ComparableStack(Blocks.iron_bars, 2) },200); makeRecipe(new ComparableStack(ModBlocks.machine_well, 1), new AStack[] {new ComparableStack(ModBlocks.steel_scaffold, 20), new ComparableStack(ModItems.tank_steel, 2), new ComparableStack(ModItems.motor, 1), new ComparableStack(ModItems.pipes_steel, 1), new ComparableStack(ModItems.drill_titanium, 1) }, 200); makeRecipe(new ComparableStack(ModBlocks.machine_pumpjack, 1), new AStack[] {new ComparableStack(ModBlocks.steel_scaffold, 8), new OreDictStack(STEEL.plateWelded(), 8), new ComparableStack(ModItems.pipes_steel, 4), new ComparableStack(ModItems.tank_steel, 4), new OreDictStack(STEEL.plate(), 32), new ComparableStack(ModItems.drill_titanium, 1), new ComparableStack(ModItems.motor_desh) }, 400); @@ -860,21 +860,17 @@ public class AssemblerRecipes extends SerializableRecipe { }, 100); makeRecipe(new ComparableStack(ModBlocks.machine_silex, 1), new AStack[] { - new ComparableStack(Blocks.glass, 12), - new ComparableStack(ModItems.motor, 2), - new OreDictStack(DURA.ingot(), 4), - !exp ? new OreDictStack(STEEL.plate528(), 8) : new OreDictStack(STEEL.heavyComp(), 1), - new OreDictStack(DESH.ingot(), 2), - new ComparableStack(ModItems.tank_steel, 1), - new OreDictStack(STEEL.pipe(), 12), - new ComparableStack(ModItems.crystal_diamond, 1) + new ComparableStack(ModBlocks.glass_quartz, 16), + !exp ? new OreDictStack(STEEL.plateCast(), 8) : new OreDictStack(STEEL.heavyComp(), 1), + new OreDictStack(DESH.ingot(), 4), + new OreDictStack(RUBBER.ingot(), 8), + new OreDictStack(STEEL.pipe(), 8), }, 400); makeRecipe(new ComparableStack(Item.getItemFromBlock(ModBlocks.machine_fel), 1), new AStack[] { - new ComparableStack(ModBlocks.machine_lithium_battery, 2), + new ComparableStack(ModBlocks.machine_lithium_battery, 1), new OreDictStack(ALLOY.wireDense(), 64), - !exp ? new OreDictStack(STEEL.plate528(), 24) : new OreDictStack(STEEL.heavyComp(), 1), + !exp ? new OreDictStack(STEEL.plateCast(), 12) : new OreDictStack(STEEL.heavyComp(), 1), new OreDictStack(ANY_PLASTIC.ingot(), 16), - new ComparableStack(ModItems.coil_advanced_torus, 16), new ComparableStack(ModItems.circuit, 16, EnumCircuitType.CAPACITOR), new ComparableStack(ModItems.circuit, 4, EnumCircuitType.BASIC) }, 400); diff --git a/src/main/java/com/hbm/inventory/recipes/FusionRecipes.java b/src/main/java/com/hbm/inventory/recipes/FusionRecipes.java index e32ea7ee2..9b857cc88 100644 --- a/src/main/java/com/hbm/inventory/recipes/FusionRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/FusionRecipes.java @@ -11,19 +11,19 @@ import net.minecraft.item.ItemStack; public class FusionRecipes { - public static HashMap chances = new HashMap(); + public static HashMap delays = new HashMap(); static { - chances.put(Fluids.PLASMA_DT, 1200); - chances.put(Fluids.PLASMA_DH3, 600); - chances.put(Fluids.PLASMA_HD, 1200); - chances.put(Fluids.PLASMA_HT, 1200); - chances.put(Fluids.PLASMA_XM, 1200); - chances.put(Fluids.PLASMA_BF, 150); + delays.put(Fluids.PLASMA_DT, 900); + delays.put(Fluids.PLASMA_DH3, 600); + delays.put(Fluids.PLASMA_HD, 1200); + delays.put(Fluids.PLASMA_HT, 900); + delays.put(Fluids.PLASMA_XM, 1200); + delays.put(Fluids.PLASMA_BF, 150); } - public static int getByproductChance(FluidType plasma) { - Integer chance = chances.get(plasma); - return chance != null ? chance : 0; + public static int getByproductDelay(FluidType plasma) { + Integer delay = delays.get(plasma); + return delay != null ? delay : 0; } public static HashMap levels = new HashMap(); diff --git a/src/main/java/com/hbm/lib/RefStrings.java b/src/main/java/com/hbm/lib/RefStrings.java index 19435dc12..3f559f879 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 (5020)"; + public static final String VERSION = "1.0.27 BETA (5026)"; //HBM's Beta Naming Convention: //V T (X) //V -> next release version diff --git a/src/main/java/com/hbm/particle/ParticleMukeFlash.java b/src/main/java/com/hbm/particle/ParticleMukeFlash.java index 9510c5e47..407439029 100644 --- a/src/main/java/com/hbm/particle/ParticleMukeFlash.java +++ b/src/main/java/com/hbm/particle/ParticleMukeFlash.java @@ -21,9 +21,9 @@ public class ParticleMukeFlash extends EntityFX { private static final ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/particle/flare.png"); private TextureManager theRenderEngine; - + boolean bf; - + public ParticleMukeFlash(TextureManager texman, World world, double x, double y, double z, boolean bf) { super(world, x, y, z); this.theRenderEngine = texman; @@ -34,55 +34,57 @@ public class ParticleMukeFlash extends EntityFX { public int getFXLayer() { return 3; } - - public void onUpdate() { - super.onUpdate(); - - if(this.particleAge == 15) { - - //Stem - for(double d = 0.0D; d <= 1.8D; d += 0.1) { - ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY, posZ, rand.nextGaussian() * 0.05, d + rand.nextGaussian() * 0.02, rand.nextGaussian() * 0.05); - Minecraft.getMinecraft().effectRenderer.addEffect(cloud); - } - - //Ground - for(int i = 0; i < 100; i++) { - ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY + 0.5, posZ, rand.nextGaussian() * 0.5, rand.nextInt(5) == 0 ? 0.02 : 0, rand.nextGaussian() * 0.5); - Minecraft.getMinecraft().effectRenderer.addEffect(cloud); - } - - //Mush - for(int i = 0; i < 75; i++) { - double x = rand.nextGaussian() * 0.5; - double z = rand.nextGaussian() * 0.5; - - if(x * x + z * z > 1.5) { - x *= 0.5; - z *= 0.5; - } - - double y = 1.8 + (rand.nextDouble() * 3 - 1.5) * (0.75 - (x * x + z * z)) * 0.5; - - ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY, posZ, x, y + rand.nextGaussian() * 0.02, z); - Minecraft.getMinecraft().effectRenderer.addEffect(cloud); - } - } - } - - private ParticleMukeCloud getCloud(TextureManager texman, World world, double x, double y, double z, double mx, double my, double mz) { - - if(this.bf) { - return new ParticleMukeCloudBF(theRenderEngine, world, x, y, z, mx, my, mz); - } else { - return new ParticleMukeCloud(theRenderEngine, world, x, y, z, mx, my, mz); - } - } + + public void onUpdate() { + super.onUpdate(); + + if(this.particleAge == 15) { + + // Stem + for(double d = 0.0D; d <= 1.8D; d += 0.1) { + ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY, posZ, rand.nextGaussian() * 0.05, d + rand.nextGaussian() * 0.02, rand.nextGaussian() * 0.05); + Minecraft.getMinecraft().effectRenderer.addEffect(cloud); + } + + // Ground + for(int i = 0; i < 100; i++) { + ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY + 0.5, posZ, rand.nextGaussian() * 0.5, rand.nextInt(5) == 0 ? 0.02 : 0, rand.nextGaussian() * 0.5); + Minecraft.getMinecraft().effectRenderer.addEffect(cloud); + } + + // Mush + for(int i = 0; i < 75; i++) { + double x = rand.nextGaussian() * 0.5; + double z = rand.nextGaussian() * 0.5; + + if(x * x + z * z > 1.5) { + x *= 0.5; + z *= 0.5; + } + + double y = 1.8 + (rand.nextDouble() * 3 - 1.5) * (0.75 - (x * x + z * z)) * 0.5; + + ParticleMukeCloud cloud = getCloud(theRenderEngine, worldObj, posX, posY, posZ, x, y + rand.nextGaussian() * 0.02, z); + Minecraft.getMinecraft().effectRenderer.addEffect(cloud); + } + } + } + + private ParticleMukeCloud getCloud(TextureManager texman, World world, double x, double y, double z, double mx, double my, double mz) { + + if(this.bf) { + return new ParticleMukeCloudBF(theRenderEngine, world, x, y, z, mx, my, mz); + } else { + return new ParticleMukeCloud(theRenderEngine, world, x, y, z, mx, my, mz); + } + } public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) { - + this.theRenderEngine.bindTexture(texture); - + boolean fog = GL11.glIsEnabled(GL11.GL_FOG); + if(fog) GL11.glDisable(GL11.GL_FOG); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); @@ -90,40 +92,41 @@ public class ParticleMukeFlash extends EntityFX { GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); RenderHelper.disableStandardItemLighting(); - + tess.startDrawingQuads(); - + tess.setNormal(0.0F, 1.0F, 0.0F); tess.setBrightness(240); - - this.particleAlpha = 1 - (((float)this.particleAge + interp) / (float)this.particleMaxAge); + + this.particleAlpha = 1 - (((float) this.particleAge + interp) / (float) this.particleMaxAge); float scale = (this.particleAge + interp) * 3F + 1F; - + tess.setColorRGBA_F(1.0F, 0.9F, 0.75F, this.particleAlpha * 0.5F); float dX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) interp - interpPosX); float dY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) interp - interpPosY); float dZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) interp - interpPosZ); - + Random rand = new Random(); for(int i = 0; i < 24; i++) { - + rand.setSeed(i * 31 + 1); float pX = (float) (dX + rand.nextDouble() * 15 - 7.5); float pY = (float) (dY + rand.nextDouble() * 7.5 - 3.75); float pZ = (float) (dZ + rand.nextDouble() * 15 - 7.5); - + tess.addVertexWithUV((double) (pX - x * scale - tx * scale), (double) (pY - y * scale), (double) (pZ - z * scale - tz * scale), 1, 1); tess.addVertexWithUV((double) (pX - x * scale + tx * scale), (double) (pY + y * scale), (double) (pZ - z * scale + tz * scale), 1, 0); tess.addVertexWithUV((double) (pX + x * scale + tx * scale), (double) (pY + y * scale), (double) (pZ + z * scale + tz * scale), 0, 0); tess.addVertexWithUV((double) (pX + x * scale - tx * scale), (double) (pY - y * scale), (double) (pZ + z * scale - tz * scale), 0, 1); } tess.draw(); - + GL11.glPolygonOffset(0.0F, 0.0F); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glEnable(GL11.GL_LIGHTING); + if(fog) GL11.glEnable(GL11.GL_FOG); } } diff --git a/src/main/java/com/hbm/particle/ParticleRBMKFlame.java b/src/main/java/com/hbm/particle/ParticleRBMKFlame.java index 262e407cc..c3452431e 100644 --- a/src/main/java/com/hbm/particle/ParticleRBMKFlame.java +++ b/src/main/java/com/hbm/particle/ParticleRBMKFlame.java @@ -34,6 +34,8 @@ public class ParticleRBMKFlame extends EntityFX { public void renderParticle(Tessellator tess, float interp, float x, float y, float z, float tx, float tz) { this.theRenderEngine.bindTexture(getTexture()); + boolean fog = GL11.glIsEnabled(GL11.GL_FOG); + if(fog) GL11.glDisable(GL11.GL_FOG); GL11.glPushMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); @@ -93,6 +95,7 @@ public class ParticleRBMKFlame extends EntityFX { GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glPopMatrix(); + if(fog) GL11.glEnable(GL11.GL_FOG); } protected ResourceLocation getTexture() { diff --git a/src/main/java/com/hbm/render/tileentity/RenderFloodlight.java b/src/main/java/com/hbm/render/tileentity/RenderFloodlight.java index ada6cf507..bed0b0fd6 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFloodlight.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFloodlight.java @@ -2,16 +2,20 @@ package com.hbm.render.tileentity; import org.lwjgl.opengl.GL11; +import com.hbm.blocks.ModBlocks; import com.hbm.blocks.machine.Floodlight.TileEntityFloodlight; import com.hbm.lib.RefStrings; +import com.hbm.render.item.ItemRenderBase; import com.hbm.render.loader.HFRWavefrontObject; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.IModelCustom; -public class RenderFloodlight extends TileEntitySpecialRenderer { +public class RenderFloodlight extends TileEntitySpecialRenderer implements IItemRendererProvider { public static final IModelCustom floodlight = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/blocks/floodlight.obj")); public static final ResourceLocation tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/floodlight.png"); @@ -62,4 +66,26 @@ public class RenderFloodlight extends TileEntitySpecialRenderer { GL11.glPopMatrix(); } + @Override + public Item getItemForRenderer() { + return Item.getItemFromBlock(ModBlocks.floodlight); + } + + @Override + public IItemRenderer getRenderer() { + return new ItemRenderBase( ) { + public void renderInventory() { + GL11.glTranslated(0, -1.5, 0); + GL11.glScaled(6.5, 6.5, 6.5); + } + public void renderCommon() { + bindTexture(tex); + floodlight.renderPart("Base"); + GL11.glTranslated(0, 0.5, 0); + GL11.glRotatef(-30, 0, 0, 1); + GL11.glTranslated(0, -0.5, 0); + floodlight.renderPart("Lights"); + floodlight.renderPart("Lamps"); + }}; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java index 64c6fe31d..fde17186d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityITER.java @@ -65,6 +65,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece public int progress; public static final int duration = 100; + public long totalRuntime; @SideOnly(Side.CLIENT) public int blanket; @@ -121,11 +122,9 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece power -= powerReq; if(plasma.getFill() > 0) { - - int chance = FusionRecipes.getByproductChance(plasma.getTankType()); - - if(chance > 0 && worldObj.rand.nextInt(chance) == 0) - produceByproduct(); + this.totalRuntime++; + int delay = FusionRecipes.getByproductDelay(plasma.getTankType()); + if(delay > 0 && totalRuntime % delay == 0) produceByproduct(); } if(plasma.getFill() > 0 && this.getShield() != 0) { @@ -402,34 +401,14 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece @Override public void handleButtonPacket(int value, int meta) { - - if(meta == 0) { - this.isOn = !this.isOn; - } + if(meta == 0) this.isOn = !this.isOn; } - public long getPowerScaled(long i) { - return (power * i) / maxPower; - } - - public long getProgressScaled(long i) { - return (progress * i) / duration; - } - - @Override - public void setPower(long i) { - this.power = i; - } - - @Override - public long getPower() { - return power; - } - - @Override - public long getMaxPower() { - return maxPower; - } + public long getPowerScaled(long i) { return (power * i) / maxPower; } + public long getProgressScaled(long i) { return (progress * i) / duration; } + @Override public void setPower(long i) { this.power = i; } + @Override public long getPower() { return power; } + @Override public long getMaxPower() { return maxPower; } @Override public void setFillForSync(int fill, int index) { @@ -539,6 +518,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece this.power = nbt.getLong("power"); this.isOn = nbt.getBoolean("isOn"); + this.totalRuntime = nbt.getLong("totalRuntime"); tanks[0].readFromNBT(nbt, "water"); tanks[1].readFromNBT(nbt, "steam"); @@ -551,6 +531,7 @@ public class TileEntityITER extends TileEntityMachineBase implements IEnergyRece nbt.setLong("power", this.power); nbt.setBoolean("isOn", isOn); + nbt.setLong("totalRuntime", this.totalRuntime); tanks[0].writeToNBT(nbt, "water"); tanks[1].writeToNBT(nbt, "steam"); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntitySILEX.java b/src/main/java/com/hbm/tileentity/machine/TileEntitySILEX.java index 21acbc542..d2c9c04ea 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntitySILEX.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntitySILEX.java @@ -32,7 +32,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; @@ -237,15 +236,33 @@ public class TileEntitySILEX extends TileEntityMachineBase implements IFluidAcce if(progress >= processTime) { currentFill -= recipe.fluidConsumed; + + int totalWeight = 0; + for(WeightedRandomObject weighted : recipe.outputs) totalWeight += weighted.itemWeight; + this.recipeIndex %= Math.max(totalWeight, 1); + + int weight = 0; + + for(WeightedRandomObject weighted : recipe.outputs) { + weight += weighted.itemWeight; + + if(this.recipeIndex < weight) { + slots[4] = weighted.asStack().copy(); + break; + } + } - ItemStack out = ((WeightedRandomObject) WeightedRandom.getRandomItem(worldObj.rand, recipe.outputs)).asStack(); - slots[4] = out.copy(); progress = 0; this.markDirty(); + + this.recipeIndex += PRIME; } return true; } + + public static final int PRIME = 137; + public int recipeIndex = 0; private void dequeue() { @@ -295,6 +312,7 @@ public class TileEntitySILEX extends TileEntityMachineBase implements IFluidAcce super.readFromNBT(nbt); this.tank.readFromNBT(nbt, "tank"); this.currentFill = nbt.getInteger("fill"); + this.recipeIndex = nbt.getInteger("recipeIndex"); this.mode = EnumWavelengths.valueOf(nbt.getString("mode")); if(this.currentFill > 0) { @@ -307,6 +325,7 @@ public class TileEntitySILEX extends TileEntityMachineBase implements IFluidAcce super.writeToNBT(nbt); this.tank.writeToNBT(nbt, "tank"); nbt.setInteger("fill", this.currentFill); + nbt.setInteger("recipeIndex", this.recipeIndex); nbt.setString("mode", mode.toString()); if(this.current != null) { diff --git a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java index b57598ff6..44703c013 100644 --- a/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java +++ b/src/main/java/com/hbm/tileentity/machine/rbmk/TileEntityRBMKBase.java @@ -128,7 +128,7 @@ public abstract class TileEntityRBMKBase extends TileEntityLoadedBase implements double availableWater = this.water; double availableSpace = this.maxSteam - this.steam; - int processedWater = (int)Math.floor(Math.min(availableHeat, Math.min(availableWater, availableSpace)) * RBMKDials.getReaSimBoilerSpeed(worldObj)); + int processedWater = (int) Math.floor(Math.min(availableHeat, Math.min(availableWater, availableSpace)) * RBMKDials.getReaSimBoilerSpeed(worldObj)); this.water -= processedWater; this.steam += processedWater; diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityConverterHeRf.java b/src/main/java/com/hbm/tileentity/network/TileEntityConverterHeRf.java index 3955af84a..f154fe94d 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityConverterHeRf.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityConverterHeRf.java @@ -22,7 +22,9 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn public long power; public final long maxPower = 5_000_000; - public static long ratio = 5; + public static long heInput = 1; + public static long rfOutput = 5; + public static double inputDecay = 0.05; public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000); @Override @@ -30,10 +32,10 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn if (!worldObj.isRemote) { - long rfCreated = Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), power / ratio); - this.power -= rfCreated * ratio; + long rfCreated = Math.min(storage.getMaxEnergyStored() - storage.getEnergyStored(), power / rfOutput * heInput); + this.power -= rfCreated * rfOutput / heInput; this.storage.setEnergyStored((int) (storage.getEnergyStored() + rfCreated)); - if(power > 0) this.power *= 0.95; + if(power > 0) this.power *= (1D - inputDecay); if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { @@ -84,16 +86,20 @@ public class TileEntityConverterHeRf extends TileEntityLoadedBase implements IEn @Override public String getConfigName() { - return "He->RfConverter"; + return "HEToRFConverter"; } @Override public void readIfPresent(JsonObject obj) { - ratio = IConfigurableMachine.grab(obj, "L:Rf/He ratio", ratio); + heInput = IConfigurableMachine.grab(obj, "L:HEUsed", heInput); + rfOutput = IConfigurableMachine.grab(obj, "L:RFCreated", rfOutput); + inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay); } @Override public void writeConfig(JsonWriter writer) throws IOException { - writer.name("L:Rf/He ratio").value(ratio); + writer.name("L:HEUsed").value(heInput); + writer.name("L:RFCreated").value(rfOutput); + writer.name("D:inputDecay").value(inputDecay); } } diff --git a/src/main/java/com/hbm/tileentity/network/TileEntityConverterRfHe.java b/src/main/java/com/hbm/tileentity/network/TileEntityConverterRfHe.java index 67f242c54..41c7ea769 100644 --- a/src/main/java/com/hbm/tileentity/network/TileEntityConverterRfHe.java +++ b/src/main/java/com/hbm/tileentity/network/TileEntityConverterRfHe.java @@ -17,7 +17,9 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn public long power; public final long maxPower = 5_000_000; - public static long ratio = 5; + public static long rfInput = 5; + public static long heOutput = 1; + public static double inputDecay = 0.05; public EnergyStorage storage = new EnergyStorage(1_000_000, 1_000_000, 1_000_000); @@ -26,10 +28,10 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn if (!worldObj.isRemote) { - long rfCreated = Math.min(storage.getEnergyStored(), (maxPower - power) / ratio); + long rfCreated = Math.min(storage.getEnergyStored(), (maxPower - power) * heOutput / rfInput); storage.setEnergyStored((int) (storage.getEnergyStored() - rfCreated)); - power += rfCreated * ratio; - if(storage.getEnergyStored() > 0) storage.extractEnergy((int) Math.ceil(storage.getEnergyStored() * 0.05), false); + power += rfCreated * rfInput / heOutput; + if(storage.getEnergyStored() > 0) storage.extractEnergy((int) Math.ceil(storage.getEnergyStored() * inputDecay), false); if(rfCreated > 0) this.worldObj.markTileEntityChunkModified(this.xCoord, this.yCoord, this.zCoord, this); for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { @@ -66,16 +68,20 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn @Override public String getConfigName() { - return "Rf->HeConverter"; + return "RFToHEConverter"; } @Override public void readIfPresent(JsonObject obj) { - ratio = IConfigurableMachine.grab(obj, "L:Rf/He ratio", ratio); + rfInput = IConfigurableMachine.grab(obj, "L:RFUsed", rfInput); + heOutput = IConfigurableMachine.grab(obj, "L:HECreated", heOutput); + inputDecay = IConfigurableMachine.grab(obj, "D:inputDecay", inputDecay); } @Override public void writeConfig(JsonWriter writer) throws IOException { - writer.name("L:Rf/He ratio").value(ratio); + writer.name("L:RFUsed").value(rfInput); + writer.name("L:HECreated").value(heOutput); + writer.name("D:inputDecay").value(inputDecay); } } diff --git a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java index bbb6783ee..2ec8a6b26 100644 --- a/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java +++ b/src/main/java/com/hbm/tileentity/turret/TileEntityTurretBaseNT.java @@ -651,8 +651,8 @@ public abstract class TileEntityTurretBaseNT extends TileEntityMachineBase imple if(targetMachines) { if(e instanceof IRadarDetectableNT && !((IRadarDetectableNT)e).canBeSeenBy(this)) return false; - if(e instanceof EntityMissileBaseNT) return true; - if(e instanceof EntityMissileCustom) return true; + if(e instanceof EntityMissileBaseNT) return e.motionY < 0; + if(e instanceof EntityMissileCustom) return e.motionY < 0; if(e instanceof EntityMinecart) return true; if(e instanceof EntityRailCarBase) return true; if(e instanceof EntityBomber) return true; diff --git a/src/main/resources/assets/hbm/lang/de_DE.lang b/src/main/resources/assets/hbm/lang/de_DE.lang index 17d08929e..28d16305c 100644 --- a/src/main/resources/assets/hbm/lang/de_DE.lang +++ b/src/main/resources/assets/hbm/lang/de_DE.lang @@ -4080,6 +4080,7 @@ tile.fireworks.color=Farbe: %s tile.fissure_bomb.name=Geofissur-Bombe tile.flame_war.name=Flamewar aus der Box tile.float_bomb.name=Schwebebombe +tile.floodlight.name=Elektrischer Scheinwerfer tile.fluid_duct.name=Universelles Flüssigkeitsrohr (Veraltet) tile.fluid_duct_box.name=Universelles Flüssigkeitsrohr (Boxrohr) tile.fluid_duct_exhaust.name=Abgasrohr diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 81114bd5a..9dcb7aa53 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -5151,6 +5151,7 @@ tile.fireworks.color=Color: %s tile.fissure_bomb.name=Fissure Bomb tile.flame_war.name=Flame War in a Box tile.float_bomb.name=Levitation Bomb +tile.floodlight.name=Powered Floodlight tile.fluid_duct.name=Universal Fluid Duct (Deprecated) tile.fluid_duct_box.name=Universal Fluid Duct (Boxduct) tile.fluid_duct_exhaust.name=Exhaust Pipe