Files
Purpur/patches/server/0227-Fix-Important-Issue-Crash-with-Plugin-or-Datapack-Ge.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

47 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
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 ae11f1ecf23b38b84ab09f66796d1509a21bfbd8..0a4a0a3d81753a7dea6a6483f601254928c697fb 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 = context.random();
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 0be9ce0734e3ba72893a7349bb9f83a94f4af30c..f1a04ef36ee5e898529e99d98905b74607a16177 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/TreeFeature.java
@@ -147,7 +147,7 @@ public class TreeFeature extends Feature<TreeConfiguration> {
worldGenLevel.setBlock(pos, state, 19);
};
boolean bl = this.doPlace(worldGenLevel, random, blockPos, biConsumer, biConsumer2, treeConfiguration);
- if (bl && (!set.isEmpty() || !set2.isEmpty())) {
+ if (bl && !set.isEmpty() && !set2.isEmpty()) { // Purpur - Fix Paper#6068
if (!treeConfiguration.decorators.isEmpty()) {
List<BlockPos> list = Lists.newArrayList(set);
List<BlockPos> list2 = Lists.newArrayList(set2);