mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Fix possible NPE on painting creation (#9391)
This commit is contained in:
parent
3114e253ce
commit
d606a559a4
1 changed files with 28 additions and 0 deletions
28
patches/server/Fix-possible-NPE-on-painting-creation.patch
Normal file
28
patches/server/Fix-possible-NPE-on-painting-creation.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||
@@ -0,0 +0,0 @@ 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();
|
||||
@@ -0,0 +0,0 @@ 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);
|
Loading…
Reference in a new issue