geforkt von Mirrors/Paper
7c2dc4b342
* finish implementing all adventure components in codecs * add some initial tests * Add round trip tests for text and translatable components * Add more round trip test data (score component is failing) * Add more round trip test data * Fix SCORE_COMPONENT_MAP_CODEC * Improve test failure messages * Add failure cases * Add a couple more test data * Make use of AdventureCodecs * Update patches after rebase * Squash changes into adventure patch * Fix AT formatting * update comment --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
29 Zeilen
2.3 KiB
Diff
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 866fd29fe52d7eec4e72db400a05645eb8984a2b..de015e675b40fa391bb7d03d30c86dc3dd72cb13 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
|
@@ -951,6 +951,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();
|
|
@@ -977,7 +978,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);
|