mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Fix 1.18 datapack generation with caves (#521)
This commit is contained in:
@@ -4,6 +4,33 @@ Date: Tue, 20 Jul 2021 02:18:23 +0200
|
||||
Subject: [PATCH] Fix Important Issue Crash with Plugin or Datapack Generation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
index 2d102ea80d3f8e8aad0d57626450a7f30bb6c346..6b99c901d30d4334b1651a1853a79603d74e64bf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/DecoratedFeature.java
|
||||
@@ -24,12 +24,16 @@ public class DecoratedFeature extends Feature<DecoratedFeatureConfiguration> {
|
||||
Random random = getRnd(context.random(), net.pl3x.purpur.PurpurConfig.seedFeatureDecorated); // Purpur
|
||||
BlockPos blockPos = context.origin();
|
||||
ConfiguredFeature<?, ?> configuredFeature = decoratedFeatureConfiguration.feature.get();
|
||||
- decoratedFeatureConfiguration.decorator.getPositions(new DecorationContext(worldGenLevel, chunkGenerator), random, blockPos).forEach((blockPosx) -> {
|
||||
- if (configuredFeature.place(worldGenLevel, chunkGenerator, random, blockPosx)) {
|
||||
- mutableBoolean.setTrue();
|
||||
- }
|
||||
-
|
||||
- });
|
||||
+ // Purpur Start - Change forEach to Iterator for check with try catch error with caves 1.18
|
||||
+ java.util.Iterator<BlockPos> blockPosIterator = decoratedFeatureConfiguration.decorator.getPositions(new DecorationContext(worldGenLevel, chunkGenerator), random, blockPos).iterator();
|
||||
+ while (blockPosIterator.hasNext()) {
|
||||
+ try {
|
||||
+ if (configuredFeature.place(worldGenLevel, chunkGenerator, random, blockPosIterator.next())) {
|
||||
+ mutableBoolean.setTrue();
|
||||
+ }
|
||||
+ } catch (Exception ignored) {} // No need set false (Exception Possible : NullPointerException and RuntimeException
|
||||
+ }
|
||||
+ // Purpur End
|
||||
return mutableBoolean.isTrue();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
index 2f71e80f6c9d37a97d1d03b7a1d893c825b315fa..ba36676977cc3665a4ea20c556133d4faf06af3e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
|
||||
|
||||
Reference in New Issue
Block a user