Paper/patches/server/0986-Fix-possible-NPE-on-painting-creation.patch
Noah van der Aa b8edb0e130
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9648)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
6b34da8f SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender

CraftBukkit Changes:
db4ba2897 SPIGOT-7467: Add getAddress to RemoteConsoleCommandSender
4f7ff4dec PR-1246: Add missing AbstractTestingBase to tests which need them
f70a7b68d SPIGOT-7465, MC-264979: Fresh installations print NoSuchFileException for server.properties
8ef7afef6 PR-1240: Call BlockGrowEvent for vines that are growing on additional sides of an existing vine block

Spigot Changes:
d2eba2c8 Rebuild patches
2023-08-28 13:05:48 +02:00

29 Zeilen
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 24 Jun 2023 09:42:53 -0700
Subject: [PATCH] Fix possible NPE on painting creation
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index b86abf25c8e51f8133ae5d58c31d2362d895d947..602b09323e0f1fda64ced1c285bfe2dbd854bb54 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -916,6 +916,7 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
AABB bb = (ItemFrame.class.isAssignableFrom(clazz))
? net.minecraft.world.entity.decoration.ItemFrame.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height)
: HangingEntity.calculateBoundingBox(null, pos, CraftBlock.blockFaceToNotch(dir).getOpposite(), width, height);
+ if (!this.getHandle().noCollision(bb)) continue; // Paper - add collision check
List<net.minecraft.world.entity.Entity> list = (List<net.minecraft.world.entity.Entity>) this.getHandle().getEntities(null, bb);
for (Iterator<net.minecraft.world.entity.Entity> it = list.iterator(); !taken && it.hasNext(); ) {
net.minecraft.world.entity.Entity e = it.next();
@@ -942,7 +943,8 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
if (Painting.class.isAssignableFrom(clazz)) {
if (this.isNormalWorld() && randomizeData) {
entity = net.minecraft.world.entity.decoration.Painting.create(world, pos, dir).orElse(null);
- } else {
+ } // Paper
+ if (entity == null) { // Paper - if randomizeData fails, force it
entity = new net.minecraft.world.entity.decoration.Painting(net.minecraft.world.entity.EntityType.PAINTING, this.getHandle().getMinecraftWorld());
entity.absMoveTo(x, y, z, yaw, pitch);
((net.minecraft.world.entity.decoration.Painting) entity).setDirection(dir);