-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix rubber tree config crashing with some specific values (#1538)
Co-authored-by: YoungOnion <[email protected]>
- Loading branch information
1 parent
f6ca8fd
commit 528fdc7
Showing
9 changed files
with
41 additions
and
93 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
src/generated/resources/assets/gtceu/compass/nodes/tools/mallet.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/generated/resources/assets/gtceu/compass/nodes/tools/plunger.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
src/main/java/com/gregtechceu/gtceu/common/data/GTIntProviderTypes.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 0 additions & 61 deletions
61
src/main/java/com/gregtechceu/gtceu/common/worldgen/RubberTreeChanceWeightedListInt.java
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/main/java/com/gregtechceu/gtceu/common/worldgen/modifier/RubberTreeChancePlacement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.gregtechceu.gtceu.common.worldgen.modifier; | ||
|
||
import com.gregtechceu.gtceu.GTCEu; | ||
import com.gregtechceu.gtceu.api.registry.GTRegistries; | ||
import com.gregtechceu.gtceu.config.ConfigHolder; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType; | ||
import net.minecraft.world.level.levelgen.placement.RepeatingPlacement; | ||
|
||
import com.mojang.serialization.Codec; | ||
|
||
public class RubberTreeChancePlacement extends RepeatingPlacement { | ||
|
||
public static final PlacementModifierType<RubberTreeChancePlacement> RUBBER_TREE_CHANCE_PLACEMENT = GTRegistries | ||
.register( | ||
BuiltInRegistries.PLACEMENT_MODIFIER_TYPE, GTCEu.id("rubber_tree_chance"), | ||
() -> RubberTreeChancePlacement.CODEC); | ||
|
||
public static final RubberTreeChancePlacement INSTANCE = new RubberTreeChancePlacement(); | ||
public static final Codec<RubberTreeChancePlacement> CODEC = Codec.unit(INSTANCE); | ||
|
||
@Override | ||
protected int count(RandomSource random, BlockPos pos) { | ||
return random.nextFloat() < ConfigHolder.INSTANCE.worldgen.rubberTreeSpawnChance ? 1 : 0; | ||
} | ||
|
||
@Override | ||
public PlacementModifierType<?> type() { | ||
return RUBBER_TREE_CHANCE_PLACEMENT; | ||
} | ||
} |