diff --git a/PATCHES.md b/PATCHES.md index 526e660f5..fb8d75f4d 100644 --- a/PATCHES.md +++ b/PATCHES.md @@ -172,7 +172,6 @@ This is an overview over all patches that are currently used. | server | Fix Bukkit.createInventory() with type LECTERN | willies952002 | | | server | Fix IndexOutOfBoundsException when sending too many changes | Ivan Pekov | | | server | Fix LightEngineThreaded memory leak | Ivan Pekov | | -| server | Fix NPE in ControllerLookWASD and ControllerMoveWASD | ishland | | | server | Fix PlayerEditBookEvent not saving new book | BillyGalbreath | | | server | Fix cow rotation when shearing mooshroom | William Blake Galbreath | | | server | Fix death message colors | William Blake Galbreath | | diff --git a/patches/Airplane/patches/server/0016-Reduce-memory-allocations.patch b/patches/Airplane/patches/server/0016-Reduce-memory-allocations.patch index 9316759da..c43e4581f 100644 --- a/patches/Airplane/patches/server/0016-Reduce-memory-allocations.patch +++ b/patches/Airplane/patches/server/0016-Reduce-memory-allocations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reduce memory allocations diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -index 7b29d47dfdef7611db58068af285f76d92a9f12a..7009586430649a87722f6c73cd5a311d7c977196 100644 +index 7b29d47dfdef7611db58068af285f76d92a9f12a..6c5d96853d47850b81ce85e56a516c554819ef25 100644 --- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java @@ -43,8 +43,14 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { @@ -15,7 +15,7 @@ index 7b29d47dfdef7611db58068af285f76d92a9f12a..7009586430649a87722f6c73cd5a311d + // Airplane start - use mutable position + BlockPosition.MutableBlockPosition blockposition1 = new BlockPosition.MutableBlockPosition(); for (int i = 0; i < 4; ++i) { -+ blockposition1.setValues(blockposition).add(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); ++ blockposition1.setValues(blockposition).addValues(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + /* BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); + */ @@ -23,6 +23,25 @@ index 7b29d47dfdef7611db58068af285f76d92a9f12a..7009586430649a87722f6c73cd5a311d if (worldserver.getType(blockposition1).a(Blocks.DIRT) && c(iblockdata1, (IWorldReader) worldserver, blockposition1)) { org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, (IBlockData) iblockdata1.set(BlockDirtSnowSpreadable.a, worldserver.getType(blockposition1.up()).a(Blocks.SNOW))); // CraftBukkit +diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +index bc61aaff65a7dc1e7534452b285953b83adb7000..f38382cc681f03d9a6a0efa85f045e3770398739 100644 +--- a/src/main/java/net/minecraft/server/BlockPosition.java ++++ b/src/main/java/net/minecraft/server/BlockPosition.java +@@ -438,6 +438,14 @@ public class BlockPosition extends BaseBlockPosition { + public BlockPosition b(int i, int j, int k) { + return super.b(i, j, k).immutableCopy(); + } ++ // Airplane start - version of b that doesn't copy ++ public BlockPosition addValues(int x, int y, int z) { ++ ((BaseBlockPosition)this).a += x; ++ ((BaseBlockPosition)this).b += y; ++ ((BaseBlockPosition)this).e += z; ++ return this; ++ } ++ // Airplane end + + @Override + public BlockPosition shift(EnumDirection enumdirection, int i) { diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java index 631eb682e81e30d2a937fd1eafccd8a9ab82d21e..dc07376845f84ea949a2153cb75d2cd9d46a419e 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java diff --git a/patches/server/0027-Highly-optimize-VillagePlace-filtering.patch b/patches/server/0027-Highly-optimize-VillagePlace-filtering.patch index 740fa31a6..1b15804ba 100644 --- a/patches/server/0027-Highly-optimize-VillagePlace-filtering.patch +++ b/patches/server/0027-Highly-optimize-VillagePlace-filtering.patch @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..e647624f4c9afe8bc603792ad88c807e + } +} diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index bc61aaff65a7dc1e7534452b285953b83adb7000..7fddef0afbcf1f9f391c540b8fce1bebf8faa452 100644 +index f38382cc681f03d9a6a0efa85f045e3770398739..97b0aee82e080a1225454317cbf0191ef8b14fca 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -341,6 +341,16 @@ public class BlockPosition extends BaseBlockPosition { diff --git a/patches/server/0029-Nuke-streams-off-BlockPosition.patch b/patches/server/0029-Nuke-streams-off-BlockPosition.patch index e24c80321..9c9fce720 100644 --- a/patches/server/0029-Nuke-streams-off-BlockPosition.patch +++ b/patches/server/0029-Nuke-streams-off-BlockPosition.patch @@ -17,7 +17,7 @@ index 8724ad342bec7c733b3c825bd62dbfa5c28c06dd..9907047028b754fe0e314a7d5c5238ce return this.getBlock().a(tag); } diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 7fddef0afbcf1f9f391c540b8fce1bebf8faa452..f13b4e6ec815792c2f2b49193707da94df427424 100644 +index 97b0aee82e080a1225454317cbf0191ef8b14fca..c4dd89d9bae1960d25b64e2a715a83adde65719a 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -318,7 +318,15 @@ public class BlockPosition extends BaseBlockPosition { diff --git a/patches/server/0064-Fix-NPE-in-ControllerLookWASD-and-ControllerMoveWASD.patch b/patches/server/0064-Fix-NPE-in-ControllerLookWASD-and-ControllerMoveWASD.patch deleted file mode 100644 index 4a9571c53..000000000 --- a/patches/server/0064-Fix-NPE-in-ControllerLookWASD-and-ControllerMoveWASD.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: ishland -Date: Mon, 1 Feb 2021 20:16:36 +0800 -Subject: [PATCH] Fix NPE in ControllerLookWASD and ControllerMoveWASD - - -diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java -index 0b16a7b6345ff42ea0f42ca79155a50e2fe4926b..13f54cdda27fb92dcb72f386cefdee457dc86076 100644 ---- a/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java -+++ b/src/main/java/net/pl3x/purpur/controller/ControllerLookWASD.java -@@ -19,8 +19,11 @@ public class ControllerLookWASD extends ControllerLook { - // tick - @Override - public void a() { -- if (entity.hasRider()) { -- tick(entity.getRider()); -+ // Yatopia start - better null check - fix NPE with some plugins -+ final EntityHuman rider = entity.getRider(); -+ if (rider != null) { -+ tick(rider); -+ // Yatopia end - } else { - tick(); - } -diff --git a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java -index 426688b3a6dc197b41ddc4d1efed0405614f0f3b..66d87e39f42cac1b3e3142ea1ebfee60788d5251 100644 ---- a/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java -+++ b/src/main/java/net/pl3x/purpur/controller/ControllerMoveWASD.java -@@ -30,8 +30,11 @@ public class ControllerMoveWASD extends ControllerMove { - // tick - @Override - public void a() { -- if (entity.hasRider()) { -- tick(entity.getRider()); -+ // Yatopia start - better null check - fix NPE with some plugins -+ final EntityHuman rider = entity.getRider(); -+ if (rider != null) { -+ tick(rider); -+ // Yatopia end - } else { - tick(); - } diff --git a/upstreamCommits/Airplane b/upstreamCommits/Airplane index 206f7b9a7..ba5cd5b4e 100644 --- a/upstreamCommits/Airplane +++ b/upstreamCommits/Airplane @@ -1 +1 @@ -e71967b87c76de81d85dd9750719f3110669d52f \ No newline at end of file +8703980b48dc20f7266c77bcbdf51f376eed6204 \ No newline at end of file