-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
In 1.21.1, without any season mod, I get an exception when maples tick for syrup:
Description: Exception ticking world
java.lang.NullPointerException: Cannot invoke "java.lang.Float.floatValue()" because the return value of "com.dtteam.dynamictrees.systems.season.SeasonHelper.getSeasonValue(com.dtteam.dynamictrees.api.worldgen.LevelContext, net.minecraft.core.BlockPos)" is null
at TRANSFORMER/dtphc2@1.4.0-BETA01/maxhyper.dtphc2.genfeatures.SyrupGenFeature.seasonalFruitProductionFactor(SyrupGenFeature.java:78) ~[dtphc2-1.4.0-BETA01.jar%23188!/:?] {re:classloading}
at TRANSFORMER/dtphc2@1.4.0-BETA01/maxhyper.dtphc2.genfeatures.SyrupGenFeature.getSyrupChance(SyrupGenFeature.java:69) ~[dtphc2-1.4.0-BETA01.jar%23188!/:?] {re:classloading}
Since it looks like SeasonHelper.getSeasonValue is expected to return null values when there is no season support, I believe the fix is to modify SyrupGenFeature.seasonalFruitProductionFactor to something like this:
public float seasonalFruitProductionFactor(LevelContext levelContext, BlockPos pos, GenFeatureConfiguration config) {
Float season = SeasonHelper.getSeasonValue(levelContext, pos);
return season != null && config.getAsOptional(SEASONAL_OFFSET).isPresent() ? SeasonHelper.globalSeasonalFruitProductionFactor(levelContext, new BlockPos(0,(int)(season*64),-1), -config.get(SEASONAL_OFFSET), true) : 1.0F;
}
Metadata
Metadata
Assignees
Labels
No labels