|
|
|
|
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
|
|
|
index b3687f632bbf06c933a6ef04dc2236ccf3c030b8..8a4c00b978b289d162321a043efb0a5ca4c9ef4a 100644
|
|
|
|
|
index b3687f632bbf06c933a6ef04dc2236ccf3c030b8..c1e70d5f127804deabcf626b725390863e896d38 100644
|
|
|
|
|
--- a/build.gradle.kts
|
|
|
|
|
+++ b/build.gradle.kts
|
|
|
|
|
@@ -2,9 +2,12 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCach
|
|
|
|
|
@@ -46,18 +46,21 @@ index b3687f632bbf06c933a6ef04dc2236ccf3c030b8..8a4c00b978b289d162321a043efb0a5c
|
|
|
|
|
// Paper start
|
|
|
|
|
implementation("org.jline:jline-terminal-jansi:3.12.1")
|
|
|
|
|
implementation("net.minecrell:terminalconsoleappender:1.2.0")
|
|
|
|
|
@@ -65,6 +68,10 @@ dependencies {
|
|
|
|
|
@@ -65,6 +68,13 @@ dependencies {
|
|
|
|
|
implementation("org.quiltmc:tiny-mappings-parser:0.3.0") // Paper - needed to read mappings for stacktrace deobfuscation
|
|
|
|
|
implementation("com.velocitypowered:velocity-native:1.1.0-SNAPSHOT") // Paper
|
|
|
|
|
|
|
|
|
|
+ implementation("com.github.technove:AIR:fe3dbb4420") // Airplane - config
|
|
|
|
|
+ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.7.2") // Airplane - more config
|
|
|
|
|
+ implementation("org.yaml:snakeyaml:1.28")
|
|
|
|
|
+ implementation ("me.carleslc.Simple-YAML:Simple-Yaml:1.7.2") { // Airplane - more config
|
|
|
|
|
+ exclude(group="org.yaml", module="snakeyaml") // exclude snakeyaml dependency because its old (1.26)
|
|
|
|
|
+ } // Airplane - more config
|
|
|
|
|
+ implementation("com.github.technove:Flare:2c4a2114a0") // Airplane - flare
|
|
|
|
|
+
|
|
|
|
|
testImplementation("io.github.classgraph:classgraph:4.8.47") // Paper - mob goal test
|
|
|
|
|
testImplementation("junit:junit:4.13.1")
|
|
|
|
|
testImplementation("org.hamcrest:hamcrest-library:1.3")
|
|
|
|
|
@@ -83,6 +90,7 @@ tasks.jar {
|
|
|
|
|
@@ -83,6 +93,7 @@ tasks.jar {
|
|
|
|
|
"Main-Class" to "org.bukkit.craftbukkit.Main",
|
|
|
|
|
"Implementation-Title" to "CraftBukkit",
|
|
|
|
|
"Implementation-Version" to "git-Paper-$implementationVersion",
|
|
|
|
|
@@ -65,7 +68,7 @@ index b3687f632bbf06c933a6ef04dc2236ccf3c030b8..8a4c00b978b289d162321a043efb0a5c
|
|
|
|
|
"Implementation-Vendor" to date, // Paper
|
|
|
|
|
"Specification-Title" to "Bukkit",
|
|
|
|
|
"Specification-Version" to project.version,
|
|
|
|
|
@@ -140,6 +148,22 @@ relocation {
|
|
|
|
|
@@ -140,6 +151,22 @@ relocation {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -125,7 +128,7 @@ index 218f5bafeed8551b55b91c7fccaf6935c8b631ca..f5d01bce4d5547b4aeca96b7962b2090
|
|
|
|
|
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
|
|
|
|
Map<String, Map<String, Integer>> map = new HashMap<>();
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
index dcae40fde8087ce09ec8b9360f2abc860b88c975..0f0b0bbcc0e47b8fe3e1e5d4a4ef0eed389d020b 100644
|
|
|
|
|
index f421e6a2e43e0a673dbb8a9a2b4331387e523e02..3cb9e223c90f97aa106ee1e9512d33897a6bac1a 100644
|
|
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
|
|
|
@@ -202,16 +202,26 @@ public class PaperConfig {
|
|
|
|
|
@@ -1400,23 +1403,26 @@ index 0000000000000000000000000000000000000000..aa8467b9dda1f7707e41f50ac7b3e9d7
|
|
|
|
|
+}
|
|
|
|
|
diff --git a/src/main/java/gg/airplane/structs/ItemListWithBitset.java b/src/main/java/gg/airplane/structs/ItemListWithBitset.java
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000000000000000000000000000000000000..04565b596f7579eb22263ef844513aeba3437eb3
|
|
|
|
|
index 0000000000000000000000000000000000000000..1b7a4ee47f4445d7f2ac91d3a73ae113edbdddb2
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/src/main/java/gg/airplane/structs/ItemListWithBitset.java
|
|
|
|
|
@@ -0,0 +1,105 @@
|
|
|
|
|
@@ -0,0 +1,114 @@
|
|
|
|
|
+package gg.airplane.structs;
|
|
|
|
|
+
|
|
|
|
|
+import net.minecraft.core.NonNullList;
|
|
|
|
|
+import net.minecraft.world.item.ItemStack;
|
|
|
|
|
+import org.apache.commons.lang.Validate;
|
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
|
+import org.jetbrains.annotations.Nullable;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.AbstractList;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
|
|
+public class ItemListWithBitset extends NonNullList<ItemStack> {
|
|
|
|
|
+ public static ItemListWithBitset fromNonNullList(NonNullList<ItemStack> list) {
|
|
|
|
|
+ if (list instanceof ItemListWithBitset) {
|
|
|
|
|
+ return (ItemListWithBitset) list;
|
|
|
|
|
+public class ItemListWithBitset extends AbstractList<ItemStack> {
|
|
|
|
|
+ public static ItemListWithBitset fromList(List<ItemStack> list) {
|
|
|
|
|
+ if (list instanceof ItemListWithBitset ours) {
|
|
|
|
|
+ return ours;
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ItemListWithBitset(list);
|
|
|
|
|
+ }
|
|
|
|
|
@@ -1432,7 +1438,15 @@ index 0000000000000000000000000000000000000000..04565b596f7579eb22263ef844513aeb
|
|
|
|
|
+ private long bitSet = 0;
|
|
|
|
|
+ private final long allBits;
|
|
|
|
|
+
|
|
|
|
|
+ private ItemListWithBitset(NonNullList<ItemStack> list) {
|
|
|
|
|
+ private static class OurNonNullList extends NonNullList<ItemStack> {
|
|
|
|
|
+ protected OurNonNullList(List<ItemStack> delegate) {
|
|
|
|
|
+ super(delegate, ItemStack.EMPTY);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public final NonNullList<ItemStack> nonNullList = new OurNonNullList(this);
|
|
|
|
|
+
|
|
|
|
|
+ private ItemListWithBitset(List<ItemStack> list) {
|
|
|
|
|
+ this(list.size());
|
|
|
|
|
+
|
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
@@ -1441,8 +1455,6 @@ index 0000000000000000000000000000000000000000..04565b596f7579eb22263ef844513aeb
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public ItemListWithBitset(int size) {
|
|
|
|
|
+ super(null, ItemStack.EMPTY);
|
|
|
|
|
+
|
|
|
|
|
+ Validate.isTrue(size < Long.BYTES * 8, "size is too large");
|
|
|
|
|
+
|
|
|
|
|
+ this.items = createArray(size);
|
|
|
|
|
@@ -1659,15 +1671,15 @@ index 505546d32eea4682452dbac02311433157f6a30e..5c7b9ad379f3c272e15648dd16f4df92
|
|
|
|
|
|
|
|
|
|
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> futures) {
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
|
index 099db3a627c1d3c08f3b923bb02a1cb8a0a268ab..635ccc60d32333e178b28faae9c26de107b380d7 100644
|
|
|
|
|
index 1d7c26354eee1dff5e66b6234d408ed8f800415c..1415932d2005e25a155e07eb7ecb7246e2ea2439 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
|
@@ -1721,7 +1721,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
|
|
|
|
|
|
|
|
@DontObfuscate
|
|
|
|
|
public String getServerModName() {
|
|
|
|
|
- return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
|
|
|
+ return "Airplane"; // Airplane - Airplane > //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
|
|
|
- return "Paper"; // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
|
|
|
+ return "Airplane"; // Airplane - Airplane > // Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public SystemReport fillSystemReport(SystemReport details) {
|
|
|
|
|
@@ -1680,12 +1692,12 @@ index 099db3a627c1d3c08f3b923bb02a1cb8a0a268ab..635ccc60d32333e178b28faae9c26de1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
|
|
|
index 7b6c547e71230fbb3733f99a4597b3f5b51547b8..8242200f073aee40482b190c7c0aafd5320ac4fe 100644
|
|
|
|
|
index 1bf19965d12514dee34545235bfbadc0b74ddc8b..2a569d05edf0f5337afbcd6803c0513d338ca55e 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
|
|
|
|
@@ -223,6 +223,8 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
|
|
|
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
|
|
|
|
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // load mappings for stacktrace deobf and etc.
|
|
|
|
|
io.papermc.paper.brigadier.PaperBrigadierProviderImpl.INSTANCE.getClass(); // init PaperBrigadierProvider
|
|
|
|
|
// Paper end
|
|
|
|
|
+ gg.airplane.AirplaneConfig.load(); // Airplane - config
|
|
|
|
|
+ gg.airplane.commands.AirplaneCommands.init(); // Airplane - command
|
|
|
|
|
@@ -1693,7 +1705,7 @@ index 7b6c547e71230fbb3733f99a4597b3f5b51547b8..8242200f073aee40482b190c7c0aafd5
|
|
|
|
|
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
|
|
|
|
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
index 4386402e5e55438475c48b023c61bfb2dbe71a8f..2eacfbe3512f374169d96ac66c8be5a4f1561b6a 100644
|
|
|
|
|
index 4045b7999948710517259edf1cda7028a96cc4c9..961787473601fcddef98f321eb4fb5127c0f8ebc 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
|
|
|
|
@@ -2402,8 +2402,28 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially
|
|
|
|
|
@@ -1768,7 +1780,7 @@ index b7c9294fdd3d799d410afba4a1118aa371c98533..c71bc00973899feec0ec5530bf3d2379
|
|
|
|
|
this.wasOnGround = this.entity.isOnGround();
|
|
|
|
|
this.teleportDelay = 0;
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
index cebaf0fb8187335ca303621a2cb412bb22584e23..d743d50a9b3ad9502fc11adc6fe43e9a58d7a94b 100644
|
|
|
|
|
index 9e4ad810dd6348ad95c9a7e6d1bd63f6ec37c986..416f579560115caddadf6a400b80a4d1d6ebe04c 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
|
@@ -772,7 +772,20 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
|
|
|
@@ -2197,7 +2209,7 @@ index 42d466f7f162943886078eba3db18f2dfc2d7bee..32da2d3f87758bee359522769ebbee73
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
|
|
|
index f779f202985d34cb7e379b0f3d5690dd20f091ba..36b5d504cd864ab30cc239201d6a4a52c9d16b7d 100644
|
|
|
|
|
index a96831d5df2b88203aec8fe2a5909708764b38ee..441e2edd8357c4f11093b4dee2192780ac3f3579 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
|
|
|
|
|
@@ -49,9 +49,12 @@ public class GoalSelector {
|
|
|
|
|
@@ -2458,7 +2470,7 @@ index c7e16e96633e17b951f0681599c5b3efc3ce1e6c..8d329bca0818033df41fbd781028919c
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
|
|
|
index 37356b36f0ae12d55150f399318581fa77c30cee..008e3b769011df76697ad0abcdde5727cef05f64 100644
|
|
|
|
|
index 6339203bda5e569d5df241dd589eb36e7233704b..461173191361fdb0c2c950eacf03ba43693e1908 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
|
|
|
@@ -42,6 +42,36 @@ public abstract class Projectile extends Entity {
|
|
|
|
|
@@ -2499,39 +2511,50 @@ index 37356b36f0ae12d55150f399318581fa77c30cee..008e3b769011df76697ad0abcdde5727
|
|
|
|
|
if (entity != null) {
|
|
|
|
|
this.ownerUUID = entity.getUUID();
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
|
|
|
index f57864ce919ef4721cfb5913c636fe8903ce4cc1..4792d3d60e60202face2eb851c9f5b122dcfc19d 100644
|
|
|
|
|
index f57864ce919ef4721cfb5913c636fe8903ce4cc1..610d756b4a264deb58ea8144c951f652697805ee 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java
|
|
|
|
|
@@ -40,7 +40,7 @@ import org.bukkit.inventory.InventoryHolder;
|
|
|
|
|
@@ -40,7 +40,10 @@ import org.bukkit.inventory.InventoryHolder;
|
|
|
|
|
|
|
|
|
|
public abstract class AbstractMinecartContainer extends AbstractMinecart implements Container, MenuProvider {
|
|
|
|
|
|
|
|
|
|
- private NonNullList<ItemStack> itemStacks;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset itemStacks; // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
private NonNullList<ItemStack> itemStacks;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset itemStacksOptimized;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
@Nullable
|
|
|
|
|
public ResourceLocation lootTable;
|
|
|
|
|
public long lootTableSeed;
|
|
|
|
|
@@ -89,12 +89,12 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
|
|
|
|
@@ -89,12 +92,18 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
|
|
|
|
|
|
|
|
|
protected AbstractMinecartContainer(EntityType<?> type, Level world) {
|
|
|
|
|
super(type, world);
|
|
|
|
|
- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
|
|
|
|
|
+ this.itemStacks = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513 // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513
|
|
|
|
|
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected AbstractMinecartContainer(EntityType<?> type, double x, double y, double z, Level world) {
|
|
|
|
|
super(type, world, x, y, z);
|
|
|
|
|
- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513
|
|
|
|
|
+ this.itemStacks = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513 // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // CraftBukkit - SPIGOT-3513
|
|
|
|
|
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -217,7 +217,7 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
|
|
|
|
@@ -217,7 +226,10 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
|
|
|
|
protected void readAdditionalSaveData(CompoundTag nbt) {
|
|
|
|
|
super.readAdditionalSaveData(nbt);
|
|
|
|
|
this.lootableData.loadNbt(nbt); // Paper
|
|
|
|
|
- this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
|
|
|
|
+ this.itemStacks = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.itemStacksOptimized = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize());
|
|
|
|
|
+ this.itemStacks = this.itemStacksOptimized.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
if (nbt.contains("LootTable", 8)) {
|
|
|
|
|
this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
|
|
|
|
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
|
|
|
|
@@ -2864,19 +2887,21 @@ index 2b814006fa30dd233dcb345d1d20ce3bf6469053..b5c6b0bc307aef2835761cfa50413ceb
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
|
|
|
index 52de9852f87d346714a950b60a0004d386ac10f0..305a8f5ea917c7e242011fa98a3e161517afe9be 100644
|
|
|
|
|
index 52de9852f87d346714a950b60a0004d386ac10f0..86bbd9fcee5982cf901ef0480052025ccf57ccb4 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/ChestBlockEntity.java
|
|
|
|
|
@@ -32,7 +32,7 @@ import org.bukkit.entity.HumanEntity;
|
|
|
|
|
@@ -32,7 +32,10 @@ import org.bukkit.entity.HumanEntity;
|
|
|
|
|
public class ChestBlockEntity extends RandomizableContainerBlockEntity implements LidBlockEntity {
|
|
|
|
|
|
|
|
|
|
private static final int EVENT_SET_OPEN_COUNT = 1;
|
|
|
|
|
- private NonNullList<ItemStack> items;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset items; // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
private NonNullList<ItemStack> items;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset optimizedItems;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
public final ContainerOpenersCounter openersCounter;
|
|
|
|
|
private final ChestLidController chestLidController;
|
|
|
|
|
|
|
|
|
|
@@ -66,9 +66,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
@@ -66,9 +69,13 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
|
@@ -2884,88 +2909,102 @@ index 52de9852f87d346714a950b60a0004d386ac10f0..305a8f5ea917c7e242011fa98a3e1615
|
|
|
|
|
protected ChestBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
|
|
|
|
super(type, pos, state);
|
|
|
|
|
- this.items = NonNullList.withSize(27, ItemStack.EMPTY);
|
|
|
|
|
+ this.items = new gg.airplane.structs.ItemListWithBitset(27); // Airplane - use with bitset
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(27);
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
this.openersCounter = new ContainerOpenersCounter() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onOpen(Level world, BlockPos pos, BlockState state) {
|
|
|
|
|
@@ -99,6 +100,23 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
@@ -99,6 +106,23 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
this.chestLidController = new ChestLidController();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean hasEmptySlot(Direction enumdirection) {
|
|
|
|
|
+ return isNative ? !this.items.hasFullStacks() : super.hasEmptySlot(enumdirection);
|
|
|
|
|
+ return isNative ? !this.optimizedItems.hasFullStacks() : super.hasEmptySlot(enumdirection);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean isCompletelyFull(Direction enumdirection) {
|
|
|
|
|
+ return isNative ? this.items.hasFullStacks() && super.isCompletelyFull(enumdirection) : super.isCompletelyFull(enumdirection);
|
|
|
|
|
+ return isNative ? this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection) : super.isCompletelyFull(enumdirection);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean isCompletelyEmpty(Direction enumdirection) {
|
|
|
|
|
+ return isNative && this.items.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
|
|
|
|
+ return isNative && this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
|
|
|
|
+ }
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
+
|
|
|
|
|
public ChestBlockEntity(BlockPos pos, BlockState state) {
|
|
|
|
|
this(BlockEntityType.CHEST, pos, state);
|
|
|
|
|
}
|
|
|
|
|
@@ -116,7 +134,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
@@ -116,7 +140,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
@Override
|
|
|
|
|
public void load(CompoundTag nbt) {
|
|
|
|
|
super.load(nbt);
|
|
|
|
|
- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
|
|
|
|
+ this.items = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize());
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
if (!this.tryLoadLootTable(nbt)) {
|
|
|
|
|
ContainerHelper.loadAllItems(nbt, this.items);
|
|
|
|
|
}
|
|
|
|
|
@@ -189,7 +207,7 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
@@ -189,7 +216,10 @@ public class ChestBlockEntity extends RandomizableContainerBlockEntity implement
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setItems(NonNullList<ItemStack> list) {
|
|
|
|
|
- this.items = list;
|
|
|
|
|
+ this.items = gg.airplane.structs.ItemListWithBitset.fromNonNullList(list); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = gg.airplane.structs.ItemListWithBitset.fromList(list);
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
|
|
|
index d41851f9119c334cae3fc2c433d6450a3eed9096..ddf82e65d3ef1f53b72017bf5159b9f7b5484632 100644
|
|
|
|
|
index d41851f9119c334cae3fc2c433d6450a3eed9096..97061e93c4a3b6ffcd15f07284a31dd17739837c 100644
|
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
|
|
|
|
@@ -44,7 +44,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -44,7 +44,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
|
|
|
|
|
public static final int MOVE_ITEM_SPEED = 8;
|
|
|
|
|
public static final int HOPPER_CONTAINER_SIZE = 5;
|
|
|
|
|
- private NonNullList<ItemStack> items;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset items; // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
private NonNullList<ItemStack> items;
|
|
|
|
|
+ private gg.airplane.structs.ItemListWithBitset optimizedItems; // Airplane
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
private int cooldownTime;
|
|
|
|
|
private long tickedGameTime;
|
|
|
|
|
|
|
|
|
|
@@ -80,14 +80,31 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -80,14 +83,37 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
|
|
|
|
|
public HopperBlockEntity(BlockPos pos, BlockState state) {
|
|
|
|
|
super(BlockEntityType.HOPPER, pos, state);
|
|
|
|
|
- this.items = NonNullList.withSize(5, ItemStack.EMPTY);
|
|
|
|
|
+ this.items = new gg.airplane.structs.ItemListWithBitset(5); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(5);
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
this.cooldownTime = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean hasEmptySlot(Direction enumdirection) {
|
|
|
|
|
+ return !this.items.hasFullStacks();
|
|
|
|
|
+ public boolean hasEmptySlot(Direction enumdirection) {
|
|
|
|
|
+ return !this.optimizedItems.hasFullStacks();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean isCompletelyFull(Direction enumdirection) {
|
|
|
|
|
+ return this.items.hasFullStacks() && super.isCompletelyFull(enumdirection);
|
|
|
|
|
+ return this.optimizedItems.hasFullStacks() && super.isCompletelyFull(enumdirection);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean isCompletelyEmpty(Direction enumdirection) {
|
|
|
|
|
+ return this.items.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
|
|
|
|
+ return this.optimizedItems.isCompletelyEmpty() || super.isCompletelyEmpty(enumdirection);
|
|
|
|
|
+ }
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
+
|
|
|
|
|
@@ -2973,20 +3012,23 @@ index d41851f9119c334cae3fc2c433d6450a3eed9096..ddf82e65d3ef1f53b72017bf5159b9f7
|
|
|
|
|
public void load(CompoundTag nbt) {
|
|
|
|
|
super.load(nbt);
|
|
|
|
|
- this.items = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
|
|
|
|
+ this.items = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize()); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = new gg.airplane.structs.ItemListWithBitset(this.getContainerSize());
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
if (!this.tryLoadLootTable(nbt)) {
|
|
|
|
|
ContainerHelper.loadAllItems(nbt, this.items);
|
|
|
|
|
}
|
|
|
|
|
@@ -160,7 +177,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -160,7 +186,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
flag = HopperBlockEntity.a(world, pos, state, (Container) blockEntity, blockEntity); // CraftBukkit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (!blockEntity.inventoryFull()) {
|
|
|
|
|
+ if (!blockEntity.items.hasFullStacks() || !blockEntity.inventoryFull()) { // Airplane - use bitset first
|
|
|
|
|
+ if (!blockEntity.optimizedItems.hasFullStacks() || !blockEntity.inventoryFull()) { // Airplane - use bitset first
|
|
|
|
|
flag |= booleansupplier.getAsBoolean();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -199,7 +216,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -199,7 +225,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
skipPushModeEventFire = skipHopperEvents;
|
|
|
|
|
boolean foundItem = false;
|
|
|
|
|
for (int i = 0; i < hopper.getContainerSize(); ++i) {
|
|
|
|
|
@@ -2995,7 +3037,7 @@ index d41851f9119c334cae3fc2c433d6450a3eed9096..ddf82e65d3ef1f53b72017bf5159b9f7
|
|
|
|
|
if (!item.isEmpty()) {
|
|
|
|
|
foundItem = true;
|
|
|
|
|
ItemStack origItemStack = item;
|
|
|
|
|
@@ -403,12 +420,18 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -403,12 +429,18 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean isFullContainer(Container inventory, Direction direction) {
|
|
|
|
|
@@ -3016,7 +3058,7 @@ index d41851f9119c334cae3fc2c433d6450a3eed9096..ddf82e65d3ef1f53b72017bf5159b9f7
|
|
|
|
|
}
|
|
|
|
|
private static boolean allMatch(Container iinventory, Direction enumdirection, java.util.function.BiPredicate<ItemStack, Integer> test) {
|
|
|
|
|
if (iinventory instanceof WorldlyContainer) {
|
|
|
|
|
@@ -585,7 +608,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -585,7 +617,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
|
|
|
|
|
if (HopperBlockEntity.canPlaceItemInContainer(to, stack, slot, enumdirection)) {
|
|
|
|
|
boolean flag = false;
|
|
|
|
|
@@ -3025,12 +3067,15 @@ index d41851f9119c334cae3fc2c433d6450a3eed9096..ddf82e65d3ef1f53b72017bf5159b9f7
|
|
|
|
|
|
|
|
|
|
if (itemstack1.isEmpty()) {
|
|
|
|
|
// Spigot start - SPIGOT-6693, InventorySubcontainer#setItem
|
|
|
|
|
@@ -731,7 +754,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
@@ -731,7 +763,10 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setItems(NonNullList<ItemStack> list) {
|
|
|
|
|
- this.items = list;
|
|
|
|
|
+ this.items = gg.airplane.structs.ItemListWithBitset.fromNonNullList(list); // Airplane
|
|
|
|
|
+ // Airplane start
|
|
|
|
|
+ this.optimizedItems = gg.airplane.structs.ItemListWithBitset.fromList(list);
|
|
|
|
|
+ this.items = this.optimizedItems.nonNullList;
|
|
|
|
|
+ // Airplane end
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
|
|
|
|
|
|