-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
structure predicate stuff + fix sunflower plains trees
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/main/java/com/terraforged/fm/structure/StructureManager.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,28 @@ | ||
package com.terraforged.fm.structure; | ||
|
||
import com.terraforged.fm.predicate.FeaturePredicate; | ||
import net.minecraft.world.gen.feature.structure.Structure; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class StructureManager { | ||
|
||
private final Map<String, FeaturePredicate> predicates = new HashMap<>(); | ||
|
||
public void register(Structure<?> structure, FeaturePredicate predicate) { | ||
register(structure.getStructureName(), predicate); | ||
} | ||
|
||
public void register(String structureName, FeaturePredicate predicate) { | ||
predicates.put(structureName, predicate); | ||
} | ||
|
||
public FeaturePredicate getPredicate(Structure<?> structure) { | ||
return getPredicate(structure.getStructureName()); | ||
} | ||
|
||
public FeaturePredicate getPredicate(String structureName) { | ||
return predicates.getOrDefault(structureName, FeaturePredicate.ALLOW); | ||
} | ||
} |