mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes:26c37d99d5create random seeds for features using SecureRandom589bf2f1bfUpgrade gson to 2.8.8 (Closes #6370)0a6103597bGet entity default attributes (#6449)40057019e0Correctly inflate villager activation bounding box (#6798)e5f9241d15Left handed API (#6775)40ee63496cAdd advancement display API (#6175)9d570042edAdd ItemFactory#getMonsterEgg API (#6772)55ca459515rename method to getSpawnEggbb397ba74cAdd critical damage API (#6275)f47aeafe00Add Horse Animation API (#5599)7a0886180fAT & Mapping fixes (#6809)5553432644docs: Update gradle instructions for Java 16 (#6811) [ci skip]a1f49e4c60Fix command suggestion leak (#6592)9472d38f3cFix method name for Critical damage (#6813)
47 lines
3.0 KiB
Diff
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);
|