forked from DynamicTreesTeam/DynamicTrees-PHC2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c301b7a
commit 71d85e3
Showing
21 changed files
with
686 additions
and
633 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
modName=DynamicTreesPHC2 | ||
modId=dtphc2 | ||
modVersion=1.0.0 | ||
modVersion=1.1.0 | ||
group=maxhyper.dtphc2 | ||
|
||
mcVersion=1.18.2 | ||
|
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
37 changes: 37 additions & 0 deletions
37
src/main/java/maxhyper/dtphc2/canceller/DTPHC2TreeFeatureCanceller.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,37 @@ | ||
package maxhyper.dtphc2.canceller; | ||
|
||
import com.ferreusveritas.dynamictrees.api.worldgen.FeatureCanceller; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature; | ||
import net.minecraft.world.level.levelgen.feature.Feature; | ||
import net.minecraft.world.level.levelgen.feature.WeightedPlacedFeature; | ||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.feature.configurations.RandomFeatureConfiguration; | ||
import net.minecraft.world.level.levelgen.placement.PlacedFeature; | ||
|
||
import java.util.Objects; | ||
import java.util.Set; | ||
|
||
public class DTPHC2TreeFeatureCanceller extends FeatureCanceller { | ||
|
||
private final Class<?>[] treeFeatureClasses; | ||
|
||
public DTPHC2TreeFeatureCanceller(final ResourceLocation registryName, Class<?>... treeFeatureClass) { | ||
super(registryName); | ||
this.treeFeatureClasses = treeFeatureClass; | ||
} | ||
|
||
@Override | ||
public boolean shouldCancel(ConfiguredFeature<?, ?> configuredFeature, Set<String> namespaces) { | ||
Feature<?> feature = configuredFeature.feature(); | ||
if (namespaces.contains(Objects.requireNonNull(feature.getRegistryName()).getNamespace())) { | ||
for (Class<?> treeFeatureClass : treeFeatureClasses){ | ||
if (treeFeatureClass.isInstance(feature)) | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.