Skip to content

Commit 1897020

Browse files
committed
fix: simplify frequency logic
1 parent 110d59f commit 1897020

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/main/java/rootenginear/leavesalwaysfalling/LeavesAlwaysFalling.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ public class LeavesAlwaysFalling implements ModInitializer {
1111
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
1212

1313
public static int getLeavesRandomBound() {
14-
int freq = ((ILeavesSettings) Minecraft.getMinecraft(Minecraft.class).gameSettings).bta_rootenginear_mods$getFrequency().value;
15-
if (freq == 0) return 0;
16-
return (int) Math.round(1.0 / freq * 100);
14+
return ((ILeavesSettings) Minecraft.getMinecraft(Minecraft.class).gameSettings).bta_rootenginear_mods$getFrequency().value;
1715
}
1816

1917
@Override

src/main/java/rootenginear/leavesalwaysfalling/mixin/GenericLeavesParticleMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void randomDisplayTick(World world, int x, int y, int z, Random rand, Cal
2222
ci.cancel();
2323
return;
2424
}
25-
if (rand.nextInt(randomBound) == 0) {
25+
if (rand.nextInt(100) < randomBound) {
2626
world.spawnParticle("fallingleaf", x, (float) y - 0.1f, z, 0.0, 0.0, 0.0);
2727
}
2828
ci.cancel();

src/main/java/rootenginear/leavesalwaysfalling/mixin/SeasonalLeavesParticleMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void randomDisplayTick(World world, int x, int y, int z, Random rand, Cal
2222
ci.cancel();
2323
return;
2424
}
25-
if (rand.nextInt(randomBound) == 0) {
25+
if (rand.nextInt(100) < randomBound) {
2626
world.spawnParticle("fallingleaf", x, (float) y - 0.1f, z, 0.0, 0.0, 0.0);
2727
}
2828
ci.cancel();

0 commit comments

Comments
 (0)