Skip to content

Commit

Permalink
fix: make bedrock ores generate the correct amount again (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerooni authored Dec 19, 2023
1 parent eebaff3 commit 4f591d0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 26 deletions.
12 changes: 2 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# ChangeLog

Version: 1.0.18
Version: 1.0.18.a

* add preliminary second layer textures to ores, for better visibility
* fix crash on loading a world when GT is installed without other mods
* fix superscript 1
* fix EBF always using max overclock
* fix wrong ALL_TICK_INPUTS recipe key for KJS
* fix XEI compat
* improve ore generation KubeJS API

Note that if you have any custom ore veins in your modpack, you will need to make some changes to your KJS scripts.
* fix bedrock ores not generating
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public class GTOreDefinition {

private final InferredProperties inferredProperties = new InferredProperties();

@Getter @Setter
@Getter
private int clusterSize;
@Getter @Setter
@Getter
private float density;
@Getter @Setter
@Getter
private int weight;
@Getter @Setter
private IWorldGenLayer layer;
Expand Down Expand Up @@ -109,14 +109,6 @@ public GTOreDefinition(GTOreDefinition other) {
Set.copyOf(other.dimensionFilter), other.range, other.discardChanceOnAirExposure,
other.biomes, other.biomeWeightModifier, other.veinGenerator, List.copyOf(other.indicatorGenerators)
);

this.minimumYield = other.minimumYield;
this.maximumYield = other.maximumYield;
this.depletedYield = other.depletedYield;
this.depletionChance = other.depletionChance;
this.depletionAmount = other.depletionAmount;

this.bedrockVeinMaterial = List.copyOf(other.bedrockVeinMaterial);
}

public GTOreDefinition(int clusterSize, float density, int weight, IWorldGenLayer layer, Set<ResourceKey<Level>> dimensionFilter, HeightRangePlacement range, float discardChanceOnAirExposure, @Nullable Supplier<HolderSet<Biome>> biomes, @Nullable BiomeWeightModifier biomeWeightModifier, @Nullable VeinGenerator veinGenerator, @Nullable List<IndicatorGenerator> indicatorGenerators) {
Expand All @@ -132,10 +124,7 @@ public GTOreDefinition(int clusterSize, float density, int weight, IWorldGenLaye
this.veinGenerator = veinGenerator;
this.indicatorGenerators = Objects.requireNonNullElseGet(indicatorGenerators, ArrayList::new);

this.maximumYield = (int) (density * 100) * clusterSize;
this.minimumYield = this.maximumYield / 7;
this.depletedYield = (int) (clusterSize / density / 10);
this.depletionChance = (int) (weight * density / 5);
recomputeBedrockOres();
}

@HideFromJS
Expand All @@ -147,6 +136,34 @@ public void register(ResourceLocation id) {
}
}

private void recomputeBedrockOres() {
this.maximumYield = (int) (density * 100) * clusterSize;
this.minimumYield = this.maximumYield / 7;
this.depletedYield = (int) (clusterSize / density / 10);
this.depletionChance = (int) (weight * density / 5);
}

public GTOreDefinition clusterSize(int clusterSize) {
this.clusterSize = clusterSize;
recomputeBedrockOres();

return this;
}

public GTOreDefinition density(float density) {
this.density = density;
recomputeBedrockOres();

return this;
}

public GTOreDefinition weight(int weight) {
this.weight = weight;
recomputeBedrockOres();

return this;
}

public GTOreDefinition layer(IWorldGenLayer layer) {
this.layer = layer;
if (this.dimensionFilter == null || this.dimensionFilter.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs = -Xmx6G
# Mod Info
mod_id = gtceu
mod_name = GregTech
mod_version = 1.0.18
mod_version = 1.0.18.a
mod_description = GregTech CE Unofficial, ported from 1.12.2
mod_license = LGPL-3.0 license
mod_url = https://github.com/GregTechCEu/GregTech-Modern/
Expand Down

0 comments on commit 4f591d0

Please sign in to comment.