Fix object block replacements on Paper 26.1.2

Paper 26.1.2 caches block data that names every state without the parsed
states BlockData#merge needs, so replacing blocks inside objects threw
on every placement. Such block data replaces the base completely, so
B.merge returns it directly.

Model used: Claude Opus 5.5
This commit is contained in:
piexel committed 2026-10-11 16:48:12 +02:00
1 parent b12b1ee304
commit bc7a530486
2 files changed
+10 -1

No files matched your search

@@ -966,7 +966,7 @@ public class IrisObject extends IrisRegistrant {
BlockData newData = j.getReplace(rng, i.getX() + x, i.getY() + y, i.getZ() + z, rdata).clone();
if (newData.getMaterial() == data.getMaterial() && !(newData instanceof IrisCustomData || data instanceof IrisCustomData))
data = data.merge(newData);
data = B.merge(data, newData);
else
data = newData;
@@ -358,6 +358,15 @@ public class B {
return true;
}
public static BlockData merge(BlockData base, BlockData overlay) {
// Paper 26.1 caches block data that names every state without the parsed states merge needs. Merging it would
// replace every state of the base anyway.
if (overlay.getAsString(true).equals(overlay.getAsString())) {
return overlay;
}
return base.merge(overlay);
}
public static boolean isFoliagePlantable(BlockData d) {
return d.getMaterial().equals(Material.GRASS_BLOCK)
|| d.getMaterial().equals(Material.MOSS_BLOCK)