Skip to content

Commit

Permalink
fix: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepalesque committed Jan 5, 2025
1 parent 12fa68b commit 989fa14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.debug=false


# Version
mod_version=1.2.13
mod_version=1.2.14

# Mod
mod_id=zenith
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ExtendableStateList(int weightForDefaults, int weightForOthers, SimpleWei
}

public BlockState calculate(RandomSource random, WorldGenLevel level, BlockPos pos) {
if (this.totalWeight == 0) return Blocks.AIR.defaultBlockState();
if (this.totalWeight <= 0) return Blocks.AIR.defaultBlockState();

int i = random.nextInt(totalWeight);
if (i < this.weightForDefaults) return calculateDefaults(random, level, pos);
Expand All @@ -46,9 +46,12 @@ private BlockState calculateDefaults(RandomSource random, WorldGenLevel level, B
}

private BlockState calculateOther(RandomSource random, WorldGenLevel level, BlockPos pos) {
int length = this.entries.size();
int index = random.nextInt(length);
return this.entries.get(index).calculate(random, level, pos);
if (!this.entries.isEmpty()) {
int length = this.entries.size();
int index = random.nextInt(length);
return this.entries.get(index).calculate(random, level, pos);
}
return Blocks.AIR.defaultBlockState()
}

public record Entry(ExtendableStateList list, Optional<Map<ResourceKey<Biome>, SimpleWeightedRandomList<BlockState>>> byBiome, Optional<SimpleWeightedRandomList<BlockState>> fallback) {
Expand Down

0 comments on commit 989fa14

Please sign in to comment.