Skip to content

Commit

Permalink
the death of RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
HbmMods committed Jul 14, 2024
1 parent eaaa78c commit 7896c04
Show file tree
Hide file tree
Showing 19 changed files with 234 additions and 139 deletions.
20 changes: 19 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
* 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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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),\
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/com/hbm/blocks/machine/Floodlight.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

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;
Expand All @@ -19,6 +21,7 @@
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;
Expand Down Expand Up @@ -265,5 +268,30 @@ public void writeToNBT(NBTTagCompound nbt) {
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;
}
}
}
8 changes: 8 additions & 0 deletions src/main/java/com/hbm/blocks/machine/ReactorZirnox.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public int getOffset() {
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);
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/com/hbm/entity/projectile/EntityBullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,7 @@ public EntityBullet(World p_i1756_1_, EntityLivingBase p_i1756_2_, float p_i1756
}

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;
Expand Down
26 changes: 11 additions & 15 deletions src/main/java/com/hbm/inventory/recipes/AssemblerRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ public void registerDefaults() {
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);
Expand Down Expand Up @@ -860,21 +860,17 @@ public void registerDefaults() {
}, 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);
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/hbm/inventory/recipes/FusionRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@

public class FusionRecipes {

public static HashMap<FluidType, Integer> chances = new HashMap();
public static HashMap<FluidType, Integer> 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<FluidType, Integer> levels = new HashMap();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/hbm/lib/RefStrings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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
Expand Down
117 changes: 60 additions & 57 deletions src/main/java/com/hbm/particle/ParticleMukeFlash.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,96 +34,99 @@ public ParticleMukeFlash(TextureManager texman, World world, double x, double y,
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);
GL11.glDepthMask(false);
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);
}
}
3 changes: 3 additions & 0 deletions src/main/java/com/hbm/particle/ParticleRBMKFlame.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public int getFXLayer() {
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);
Expand Down Expand Up @@ -93,6 +95,7 @@ public void renderParticle(Tessellator tess, float interp, float x, float y, flo
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
if(fog) GL11.glEnable(GL11.GL_FOG);
}

protected ResourceLocation getTexture() {
Expand Down
Loading

0 comments on commit 7896c04

Please sign in to comment.