From 158adc586990fd704cb5f99c1819b11d1328fabf Mon Sep 17 00:00:00 2001 From: William Blake Galbreath Date: Thu, 16 Sep 2021 14:22:46 -0500 Subject: [PATCH] Updated Upstream (Airplane) Upstream has released updates that appear to apply and compile correctly Airplane Changes: https://github.com/TECHNOVE/Airplane/commit/5e5ead869ec5dfa4720cee064b00c4f1d2059bd8 Properly count all liquids --- .../server/0001-Airplane-Server-Changes.patch | 47 +++++++++++++++++-- patches/server/0007-Ridables.patch | 4 +- .../0067-Add-canSaveToDisk-to-Entity.patch | 4 +- ...204-API-for-any-mob-to-burn-daylight.patch | 4 +- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/patches/server/0001-Airplane-Server-Changes.patch b/patches/server/0001-Airplane-Server-Changes.patch index 9aef7c878..bd50f8628 100644 --- a/patches/server/0001-Airplane-Server-Changes.patch +++ b/patches/server/0001-Airplane-Server-Changes.patch @@ -1949,7 +1949,7 @@ index 7437f01ca8f416e2c9150250e324af4725a4efb6..bdcd0e38a3ba904811112f41d8bfbfc0 int LARGE_MAX_STACK_SIZE = 64; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..29ddf0b12911fb46f260234e704f15f17d80d018 100644 +index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..598575b540752e050a94ca703a2b135adbb2018c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -338,6 +338,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -2043,7 +2043,7 @@ index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..29ddf0b12911fb46f260234e704f15f1 double d1 = 0.0D; boolean flag = this.isPushedByFluid(); boolean flag1 = false; -@@ -3826,14 +3852,61 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3826,14 +3852,62 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n int k1 = 0; BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); @@ -2091,7 +2091,7 @@ index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..29ddf0b12911fb46f260234e704f15f1 + for (int currY = minYIterate; currY <= maxYIterate; ++currY) { + net.minecraft.world.level.chunk.LevelChunkSection section = sections[(currY >> 4) - minSection]; + -+ if (section == null || section.isEmpty() || !section.isRandomlyTickingFluids()) { // if no ticking fluids, nothing in this section ++ if (section == null || section.isEmpty() || section.fluidStateCount == 0) { // if no fluids, nothing in this section + // empty + // skip to next section + currY = (currY & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one @@ -2107,11 +2107,12 @@ index 94857a736d2a16e8ade286c6f2ddf8bd798008eb..29ddf0b12911fb46f260234e704f15f1 if (fluid.is(tag)) { - double d2 = (double) ((float) i2 + fluid.getHeight(this.level, blockposition_mutableblockposition)); ++ blockposition_mutableblockposition.set((currChunkX << 4) + currX, currY, (currChunkZ << 4) + currZ); + double d2 = (double) ((float) currY + fluid.getHeight(this.level, blockposition_mutableblockposition)); if (d2 >= axisalignedbb.minY) { flag1 = true; -@@ -3850,9 +3923,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -3850,9 +3924,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n } } } @@ -3260,6 +3261,44 @@ index 86686c24b0b7de4b4bfadbc77419a8872a8e86ee..e265980f07d95a7912bf8873819033e5 } @Override +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +index 72e3264dc74822f746fb84fec0be400047d2d9f5..831e2dbe530daf63ac9e681a92af2740fa18ac8c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +@@ -18,6 +18,9 @@ public class LevelChunkSection { + short nonEmptyBlockCount; // Paper - package-private + private short tickingBlockCount; + private short tickingFluidCount; ++ // Airplane start ++ public short fluidStateCount; ++ // Airplane end + public final PalettedContainer states; // Paper - package-private // Paper - public + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + +@@ -88,6 +91,7 @@ public class LevelChunkSection { + + if (!fluidState.isEmpty()) { + --this.tickingFluidCount; ++ --this.fluidStateCount; // Airplane + } + + if (!state.isAir()) { +@@ -102,6 +106,7 @@ public class LevelChunkSection { + + if (!fluidState2.isEmpty()) { + ++this.tickingFluidCount; ++ ++this.fluidStateCount; // Airplane + } + + return blockState; +@@ -155,6 +160,7 @@ public class LevelChunkSection { + if (fluidState.isRandomlyTicking()) { + this.tickingFluidCount = (short)(this.tickingFluidCount + 1); // Paper + } ++ this.fluidStateCount++; // Airplane + } + + }); diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java index c9e942669458668a184aaec3bc0a5509dd6ab5f0..178e56ffc87ea2beb4d84d1f278f4acf90102379 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/patches/server/0007-Ridables.patch b/patches/server/0007-Ridables.patch index 77b66c4c4..dddca0f51 100644 --- a/patches/server/0007-Ridables.patch +++ b/patches/server/0007-Ridables.patch @@ -86,7 +86,7 @@ index 7a7ce8f3ad0bbcbf926718bd46e9dccee08a0778..88227a0882b4a667206891b2a26ad576 if ((entity instanceof AbstractFish && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { ServerGamePacketListenerImpl.this.send(new ClientboundAddMobPacket((AbstractFish) entity)); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 1afbc542b28b6e0b04b4a886ec6b735f09accd15..c268120fb85287f001c62faccbc9e464d2963096 100644 +index 033ef002588881985a22e9990adb09fa56b28106..530d3e8c0377593e973fad65b98f9f484e1ca3bd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -230,7 +230,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n @@ -135,7 +135,7 @@ index 1afbc542b28b6e0b04b4a886ec6b735f09accd15..c268120fb85287f001c62faccbc9e464 if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { this.passengers = ImmutableList.of(); } else { -@@ -4311,4 +4325,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -4312,4 +4326,41 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n return ((ServerChunkCache) level.getChunkSource()).isPositionTicking(this); } // Paper end diff --git a/patches/server/0067-Add-canSaveToDisk-to-Entity.patch b/patches/server/0067-Add-canSaveToDisk-to-Entity.patch index ab0646c76..03926fd78 100644 --- a/patches/server/0067-Add-canSaveToDisk-to-Entity.patch +++ b/patches/server/0067-Add-canSaveToDisk-to-Entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add canSaveToDisk to Entity diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4a236e87856b0ceb8802e851ec861bbecd6b2c10..06097dbb8df50d92c7480e4ce3478e7f5c6560b9 100644 +index 7c042280e3b462f2c3e2658e0ff944ffe83c55fa..33f26475b314f8480130ffa9ef091cb6ec37249e 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4362,5 +4362,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -4363,5 +4363,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public boolean processClick(InteractionHand hand) { return false; } diff --git a/patches/server/0204-API-for-any-mob-to-burn-daylight.patch b/patches/server/0204-API-for-any-mob-to-burn-daylight.patch index 6fba5bacc..6fcaff3b3 100644 --- a/patches/server/0204-API-for-any-mob-to-burn-daylight.patch +++ b/patches/server/0204-API-for-any-mob-to-burn-daylight.patch @@ -6,10 +6,10 @@ Subject: [PATCH] API for any mob to burn daylight Co-authored by: Encode42 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a7e67f87d0dabe40e01fb0a8ac5fc9dc995b505f..ecf5b42547162ac098c90335947f8de5bf303072 100644 +index 487fd05a2d5946b7f0325b81dce1f8acf28f0db4..4f23021c353c926f92d0403b9c9c383b7300db1c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -4375,5 +4375,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n +@@ -4376,5 +4376,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n public boolean canSaveToDisk() { return true; }