Skip to content

Commit 808e25f

Browse files
authored
Fix #76: TreeGrowthEvent is triggered by world gen needlessly (#77)
1 parent a3ead18 commit 808e25f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/net/swedz/tesseract/neoforge/compat/tyg/mixin/TYGTreeGrowthEventMixin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.common.collect.Lists;
44
import com.llamalad7.mixinextras.sugar.Local;
55
import net.minecraft.core.BlockPos;
6+
import net.minecraft.server.level.WorldGenRegion;
67
import net.minecraft.world.level.LevelAccessor;
78
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
89
import net.neoforged.neoforge.common.NeoForge;
@@ -32,6 +33,10 @@ private void onTreeGrowth(FeaturePlaceContext context,
3233
@Local(name = "decorationPositions") Set<BlockPos> decorationPositions)
3334
{
3435
LevelAccessor level = context.level();
36+
if(level instanceof WorldGenRegion)
37+
{
38+
return;
39+
}
3540
BlockPos origin = context.origin();
3641

3742
List<BlockPos> positions = Lists.newArrayList();

src/main/java/net/swedz/tesseract/neoforge/mixin/event/TreeGrowthEventMixin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.google.common.collect.Lists;
44
import com.llamalad7.mixinextras.sugar.Local;
55
import net.minecraft.core.BlockPos;
6+
import net.minecraft.server.level.WorldGenRegion;
67
import net.minecraft.world.level.LevelAccessor;
78
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
89
import net.minecraft.world.level.levelgen.feature.TreeFeature;
@@ -36,6 +37,10 @@ private void onTreeGrowth(FeaturePlaceContext<TreeConfiguration> context,
3637
@Local(ordinal = 3) Set<BlockPos> decoratorPositions)
3738
{
3839
LevelAccessor level = context.level();
40+
if(level instanceof WorldGenRegion)
41+
{
42+
return;
43+
}
3944
BlockPos origin = context.origin();
4045

4146
List<BlockPos> positions = Lists.newArrayList();

0 commit comments

Comments
 (0)