mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 08:59:23 +00:00
* Init 1.21.6
* Finish API patches
* Apply purpur patches & all paper server patches
* Apply some
* Apply all
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@6aafe29e 1.21.6 dev
PaperMC/Paper@ae7c74ec tweak mob goal keys, generate missing api
PaperMC/Paper@9ea1460b Revert "fix sponge-absorb deleting chest content (#12647)"
Purpur Changes:
PurpurMC/Purpur@eb0ba67d Updated Upstream (Paper)
PurpurMC/Purpur@7c6502dc Updated Upstream (Paper)
PurpurMC/Purpur@aa289e2c Updated Upstream (Paper)
PurpurMC/Purpur@b1d412fb Updated Upstream (Paper)
PurpurMC/Purpur@293e28a0 use empty registryaccess where context is not needed, closes #1676
PurpurMC/Purpur@452bb319 port PaperMC/Paper#12654, closes #1665
PurpurMC/Purpur@849bc79c register test subcommands used for debugging, closes #1675
* Fix build & diff
* Update vanilla attribute size
* [ci/skip] Forget to remove this
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@a24f9b20 1.21.6 dev
PaperMC/Paper@457a0a69 Bump version string and protocol version to 1.21.6 release
PaperMC/Paper@245b5473 Update base to 1.21.6
PaperMC/Paper@b28d77b3 Update Moonrise to 1.21.6
PaperMC/Paper@8318dcb7 Update DataConverter to 1.21.6-rc1
Purpur Changes:
PurpurMC/Purpur@b228e316 Updated Upstream (Paper)
PurpurMC/Purpur@d6562a57 make happy ghast takes-damage-from-water and always-drop-exp options work
PurpurMC/Purpur@08d989b6 inline import
PurpurMC/Purpur@61d7f559 Updated Upstream (Paper)
PurpurMC/Purpur@469a4de5 Merge branch 'ver/1.21.5' into ver/1.21.6
* Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@d2b1158e Set correct world access on BSL snapshots
* Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@023e6c29 Ensure waypoints are per world
PaperMC/Paper@40d5d31c Fix recursively converting JSON Text Components
* Update spigot mapping to remap reobf mapping to mojamp for plugins
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@1fcc4162 Implement FeatureHooks#isChunkSent for Moonrise chunk system
PaperMC/Paper@e4d7178a Implement WaypointTransmitter#isChunkVisible
PaperMC/Paper@8980ead7 Directly walk text component after converting from JSON
PaperMC/Paper@5613ed6d Provide env environment variable and copy spigots sys prop for overriding default repository
PaperMC/Paper@62b7f86d Avoid and discourage use of Maven Central as a CDN (#12689)
PaperMC/Paper@f5534cb7 [ci/skip] Run generators (#12691)
PaperMC/Paper@4781d28b Re-add Log4j Javadocs (#12693)
PaperMC/Paper@74fbcce5 Check type of Material in get/set stats (#12607)
PaperMC/Paper@4b3f967e Improve Fix MC-44654 (#12703)
PaperMC/Paper@a7dd2635 Enable spigot obfuscation support (#12695)
PaperMC/Paper@6a51c44e Cleanup Primed TNT Fix (#12704)
PaperMC/Paper@839c6a18 Fix #11169 (#12706)
PaperMC/Paper@c77d5f99 Fix MC-297591
PaperMC/Paper@219f86ee Implement chunk unload delay config option
PaperMC/Paper@e4eb69b8 Do not allow ticket level decreases to be processed asynchronously
PaperMC/Paper@71b0c768 Adds support for vanilla negative explosions (#12705)
PaperMC/Paper@3750927a [ci/skip] Fix PermissionManager#clearPermissions() docs bad wording (#12657)
PaperMC/Paper@d61a51e8 Add ItemType#getBurnDuration() (#12604)
PaperMC/Paper@29fc8532 Allow empty paths in namespaced keys (#12687)
PaperMC/Paper@4419afb9 fix: Safely handle nanosecond overflow in ClickCallback (#12686)
PaperMC/Paper@56528821 Add `isProxyEnabled` method to ServerConfiguration (#12664)
PaperMC/Paper@c0dda0ea Add `isForceDefaultGameMode` method (#12673)
PaperMC/Paper@e714de63 Fix excess slot updates
PaperMC/Paper@6d0821d2 [ci/skip] Fix docs for Spawner class and cleanup (#12710)
PaperMC/Paper@cceffe3d Release ItemType and BlockType (#12708)
PaperMC/Paper@186e9e33 Relocate CommandMap#registerServerAliases() call to after lifecycle events have been run (#12601)
PaperMC/Paper@5edcf6dd Cleanup/command dispatching (#12713)
Purpur Changes:
PurpurMC/Purpur@baa196f5 Updated Upstream (Paper)
PurpurMC/Purpur@fdd1e980 Updated Upstream (Paper)
PurpurMC/Purpur@439f15db Updated Upstream (Paper)
PurpurMC/Purpur@46a28b93 [ci/skip] update version in README
PurpurMC/Purpur@162bd288 Updated Upstream (Paper)
PurpurMC/Purpur@afcdf9bb Updated Upstream (Paper)
* fix random tick order
Signed-off-by: hayanesuru <hayanesuru@outlook.jp>
* update optimize random tick
* fix mob spawning over limit
* optimize mob spawning
* fix FastBitRadixSort memory leak
* optimize brain collections
* [ci/skip] update comments
* Revert "fix FastBitRadixSort memory leak"
This reverts commit bdea683525.
* optimize brain collections
* fix async mob spawning data race
* [ci/skip] cleanup
* remove hash lookup in optimize random tick
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@803baf0b Support hidden entities in Waypoints (#12715)
PaperMC/Paper@1814d8b4 build: publish to fill (#12717)
PaperMC/Paper@e454fef4 Add support for private constructors in plugin main classes (#12652)
PaperMC/Paper@d0e808f4 Move player to correct position in vehicle move packet handler
PaperMC/Paper@46b4b0b8 Improve keepalive ping system
PaperMC/Paper@38c1ddb5 Add and use FeatureHooks.getAllEntities
PaperMC/Paper@2f083acb Ensure player entity schedulers are ticked when they are dead
PaperMC/Paper@7c90c7c4 Optimise EntityScheduler ticking
PaperMC/Paper@aa6ee44a Re-add global region scheduler tick erroneously removed in last commit
PaperMC/Paper@d7510efc Fix #12722 (#12726)
PaperMC/Paper@0caf75f8 Fix #12721 (#12725)
PaperMC/Paper@bee28792 Adventure 4.23.0 (#12690)
PaperMC/Paper@692e93a9 Fix MC-299110
PaperMC/Paper@ea10fa4a Don't mutate the position of Items for MC-4 Fix (#12702)
PaperMC/Paper@aa6cd74c Remove unnecesary item check for ServerboundPlayerActionPacket RELEASE_USE_ITEM (#12668)
PaperMC/Paper@c9e89f49 Expose arrow velocity in EntityShootBowEvent for mobs (#12688)
PaperMC/Paper@7ec3174a Jump out of experimental phase
PaperMC/Paper@4e1a2555 Update try catch for command handling
PaperMC/Paper@e382e687 Fix 0 yield on explosion events
PaperMC/Paper@35b2c6ec Use dropped item for stats info (#12747)
PaperMC/Paper@bd79e20c [ci/skip] PluginManager#getPlugin and PluginManager#isPluginEnabled are case-insensitive (#12723)
Purpur Changes:
PurpurMC/Purpur@4a5974cf Updated Upstream (Paper)
PurpurMC/Purpur@3893bba0 this is important...
PurpurMC/Purpur@47e758fb Updated Upstream (Paper)
* Update PWT patch
* cleanup
* fix playermobcaps command
* fix Didn't fill chunk buffer in async chunk sending
* cleanup
* fix HurtByTargetGoal npe
* optimize collectSpawningChunks (#382)
* optimize collectSpawningChunks
* add bit set
* cleanup
* cleanup
* cleanup
* cleanup
* Updated Upstream (Paper/Purpur)
Upstream has released updates that appear to apply and compile correctly
Paper Changes:
PaperMC/Paper@57c202e0 Allow adventure nbt codec to parse all tags
Purpur Changes:
PurpurMC/Purpur@a4776d7b Updated Upstream (Paper)
PurpurMC/Purpur@dfd8a7ad Fix phantom going at high speed when ridden (#1680)
* Fix diff
---------
Signed-off-by: hayanesuru <hayanesuru@outlook.jp>
Co-authored-by: hayanesuru <hayanesuru@outlook.jp>
391 lines
24 KiB
Diff
391 lines
24 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Martijn Muijsers <martijnmuijsers@live.nl>
|
|
Date: Sat, 26 Nov 2022 11:25:45 +0100
|
|
Subject: [PATCH] Reduce array allocations
|
|
|
|
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
Gale - https://galemc.org
|
|
|
|
This patch is based on the following patch:
|
|
"reduce allocs"
|
|
By: Simon Gardling <titaniumtown@gmail.com>
|
|
As part of: JettPack (https://gitlab.com/Titaniumtown/JettPack)
|
|
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
|
|
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
|
index b2bcfb3557a0326fd7ec1059f95d6da4568dfd80..fee4a7452178c274eb835d758b718d8e874d79d0 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
|
@@ -400,7 +400,6 @@ public final class ChunkEntitySlices {
|
|
|
|
private static final class BasicEntityList<E extends Entity> {
|
|
|
|
- private static final Entity[] EMPTY = new Entity[0];
|
|
private static final int DEFAULT_CAPACITY = 4;
|
|
|
|
private E[] storage;
|
|
@@ -411,7 +410,7 @@ public final class ChunkEntitySlices {
|
|
}
|
|
|
|
public BasicEntityList(final int cap) {
|
|
- this.storage = (E[])(cap <= 0 ? EMPTY : new Entity[cap]);
|
|
+ this.storage = (E[])(cap <= 0 ? me.titaniumtown.ArrayConstants.emptyEntityArray : new Entity[cap]);// Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
@@ -423,7 +422,7 @@ public final class ChunkEntitySlices {
|
|
}
|
|
|
|
private void resize() {
|
|
- if (this.storage == EMPTY) {
|
|
+ if (this.storage == me.titaniumtown.ArrayConstants.emptyEntityArray) { // Gale - JettPack - reduce array allocations
|
|
this.storage = (E[])new Entity[DEFAULT_CAPACITY];
|
|
} else {
|
|
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
|
index 82824ae7ffbced513a8bcace684af94916135e84..47a600204ae1a1e7f166284dc26a1a7afc1dbecc 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
|
|
@@ -19,10 +19,8 @@ import net.minecraft.world.level.entity.LevelCallback;
|
|
|
|
public final class ServerEntityLookup extends EntityLookup {
|
|
|
|
- private static final Entity[] EMPTY_ENTITY_ARRAY = new Entity[0];
|
|
-
|
|
private final ServerLevel serverWorld;
|
|
- public final ReferenceList<Entity> trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
|
|
+ public final ReferenceList<Entity> trackerEntities = new ReferenceList<>(me.titaniumtown.ArrayConstants.emptyEntityArray); // Moonrise - entity tracker // Gale - JettPack - reduce array allocations
|
|
|
|
// Vanilla does not increment ticket timeouts if the chunk is progressing in generation. They made this change in 1.21.6 so that the ender pearl
|
|
// ticket does not expire if the chunk fails to generate before the timeout expires. Rather than blindly adjusting the entire system behavior
|
|
diff --git a/net/minecraft/nbt/ByteArrayTag.java b/net/minecraft/nbt/ByteArrayTag.java
|
|
index 6fbb131b472a3093b137d8ced9889777a133bd5b..cecfd48f57bc11b84c18b4e5a723228fd3c18e23 100644
|
|
--- a/net/minecraft/nbt/ByteArrayTag.java
|
|
+++ b/net/minecraft/nbt/ByteArrayTag.java
|
|
@@ -144,7 +144,7 @@ public final class ByteArrayTag implements CollectionTag {
|
|
|
|
@Override
|
|
public void clear() {
|
|
- this.data = new byte[0];
|
|
+ this.data = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/nbt/IntArrayTag.java b/net/minecraft/nbt/IntArrayTag.java
|
|
index a8ea2aeb5a02903a37376fb78b49c10745147411..e50bbf1318e9f16f83723eab1389c189baf840a2 100644
|
|
--- a/net/minecraft/nbt/IntArrayTag.java
|
|
+++ b/net/minecraft/nbt/IntArrayTag.java
|
|
@@ -151,7 +151,7 @@ public final class IntArrayTag implements CollectionTag {
|
|
|
|
@Override
|
|
public void clear() {
|
|
- this.data = new int[0];
|
|
+ this.data = me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/nbt/LongArrayTag.java b/net/minecraft/nbt/LongArrayTag.java
|
|
index c90024aecb4b2424b3ef37194b0686734ab43db9..fd8a4bfe065698ea320800bc2b22474b1c5c4ca9 100644
|
|
--- a/net/minecraft/nbt/LongArrayTag.java
|
|
+++ b/net/minecraft/nbt/LongArrayTag.java
|
|
@@ -150,7 +150,7 @@ public final class LongArrayTag implements CollectionTag {
|
|
|
|
@Override
|
|
public void clear() {
|
|
- this.data = new long[0];
|
|
+ this.data = me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/network/CipherBase.java b/net/minecraft/network/CipherBase.java
|
|
index 121685cacef111fbec0057d386f748497bc3a36d..b4a4fafec1a8e279ec1e31e58fee2d5d34fb8289 100644
|
|
--- a/net/minecraft/network/CipherBase.java
|
|
+++ b/net/minecraft/network/CipherBase.java
|
|
@@ -7,8 +7,8 @@ import javax.crypto.ShortBufferException;
|
|
|
|
public class CipherBase {
|
|
private final Cipher cipher;
|
|
- private byte[] heapIn = new byte[0];
|
|
- private byte[] heapOut = new byte[0];
|
|
+ private byte[] heapIn = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations
|
|
+ private byte[] heapOut = me.titaniumtown.ArrayConstants.emptyByteArray; // Gale - JettPack - reduce array allocations
|
|
|
|
protected CipherBase(Cipher cipher) {
|
|
this.cipher = cipher;
|
|
diff --git a/net/minecraft/network/chat/contents/TranslatableContents.java b/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
index 8ef16f98996b1ec0c9c3f158248ac95f1b07328f..6780b2493d625603b74e635c4996bb8303ce5b9a 100644
|
|
--- a/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
+++ b/net/minecraft/network/chat/contents/TranslatableContents.java
|
|
@@ -29,7 +29,7 @@ import net.minecraft.util.ExtraCodecs;
|
|
import net.minecraft.world.entity.Entity;
|
|
|
|
public class TranslatableContents implements ComponentContents {
|
|
- public static final Object[] NO_ARGS = new Object[0];
|
|
+ public static final Object[] NO_ARGS = me.titaniumtown.ArrayConstants.emptyObjectArray; // Gale - JettPack - reduce array allocations
|
|
private static final Codec<Object> PRIMITIVE_ARG_CODEC = ExtraCodecs.JAVA.validate(TranslatableContents::filterAllowedArguments);
|
|
private static final Codec<Object> ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, ComponentSerialization.CODEC)
|
|
.xmap(
|
|
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
|
|
index 5df8ee3955593e70f0e67e91431e464d177bdeeb..b7581796dda77bca66c03e421f2a83a920f44ef1 100644
|
|
--- a/net/minecraft/server/level/ServerEntity.java
|
|
+++ b/net/minecraft/server/level/ServerEntity.java
|
|
@@ -366,7 +366,7 @@ public class ServerEntity {
|
|
if (this.entity instanceof LivingEntity livingEntityx) {
|
|
List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
|
|
|
|
- for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) {
|
|
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
ItemStack itemBySlot = livingEntityx.getItemBySlot(equipmentSlot);
|
|
if (!itemBySlot.isEmpty()) {
|
|
list.add(Pair.of(equipmentSlot, itemBySlot.copy()));
|
|
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
|
|
index a9c2f419200483673f6743ed94af110a8e875e71..617eb1b9d30d499124576c5d7cb5152571cc6b84 100644
|
|
--- a/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/net/minecraft/server/level/ServerLevel.java
|
|
@@ -1228,7 +1228,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
|
|
|
|
public static List<Entity> getCurrentlyTickingEntities() {
|
|
Entity ticking = currentlyTickingEntity.get();
|
|
- List<Entity> ret = java.util.Arrays.asList(ticking == null ? new Entity[0] : new Entity[] { ticking });
|
|
+ List<Entity> ret = java.util.Arrays.asList(ticking == null ? me.titaniumtown.ArrayConstants.emptyEntityArray : new Entity[] { ticking }); // Gale - JettPack - reduce array allocations
|
|
|
|
return ret;
|
|
}
|
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
|
index 45e4a7356e51e9c50d440782b55d1cbfc4b76f96..f752dceea48ed8264ae4cb60fdf2390f0e5019e1 100644
|
|
--- a/net/minecraft/server/level/ServerPlayer.java
|
|
+++ b/net/minecraft/server/level/ServerPlayer.java
|
|
@@ -1166,7 +1166,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
|
|
this.getInventory().getNonEquipmentItems().set(i, net.minecraft.world.item.ItemStack.EMPTY);
|
|
}
|
|
}
|
|
- for (final EquipmentSlot value : EquipmentSlot.VALUES) {
|
|
+ for (final EquipmentSlot value : EquipmentSlot.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
if (this.getInventory().equipment.has(value) && !shouldKeepDeathEventItem(event, this.getInventory().equipment.get(value))) {
|
|
this.getInventory().equipment.set(value, net.minecraft.world.item.ItemStack.EMPTY);
|
|
}
|
|
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
index f953fa6adb112bc9da34cfb72045975f87c5f021..a07310aebd8406af27864358e15715fcc7694329 100644
|
|
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -2784,7 +2784,7 @@ public class ServerGamePacketListenerImpl
|
|
// SPIGOT-7136 - Allays
|
|
if (target instanceof net.minecraft.world.entity.animal.allay.Allay || target instanceof net.minecraft.world.entity.animal.horse.AbstractHorse) { // Paper - Fix horse armor desync
|
|
ServerGamePacketListenerImpl.this.send(new net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket(
|
|
- target.getId(), java.util.Arrays.stream(net.minecraft.world.entity.EquipmentSlot.values())
|
|
+ target.getId(), java.util.Arrays.stream(net.minecraft.world.entity.EquipmentSlot.VALUES_ARRAY) // Gale - JettPack - reduce array allocations
|
|
.map((slot) -> com.mojang.datafixers.util.Pair.of(slot, ((LivingEntity) target).getItemBySlot(slot).copy()))
|
|
.collect(Collectors.toList()), true)); // Paper - sanitize
|
|
}
|
|
diff --git a/net/minecraft/server/players/StoredUserList.java b/net/minecraft/server/players/StoredUserList.java
|
|
index d445e8f126f077d8419c52fa5436ea963a1a42a4..39483f7b453d6faedeccc1ab1eda76669395ea5a 100644
|
|
--- a/net/minecraft/server/players/StoredUserList.java
|
|
+++ b/net/minecraft/server/players/StoredUserList.java
|
|
@@ -70,7 +70,7 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
|
|
}
|
|
|
|
public String[] getUserList() {
|
|
- return this.map.keySet().toArray(new String[0]);
|
|
+ return this.map.keySet().toArray(me.titaniumtown.ArrayConstants.emptyStringArray); // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java
|
|
index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..5c1103ef028e5ffe6ce0eadc861dd3b2c8f3ed9f 100644
|
|
--- a/net/minecraft/util/ZeroBitStorage.java
|
|
+++ b/net/minecraft/util/ZeroBitStorage.java
|
|
@@ -5,7 +5,7 @@ import java.util.function.IntConsumer;
|
|
import org.apache.commons.lang3.Validate;
|
|
|
|
public class ZeroBitStorage implements BitStorage {
|
|
- public static final long[] RAW = new long[0];
|
|
+ public static final long[] RAW = me.titaniumtown.ArrayConstants.emptyLongArray; // Gale - JettPack - reduce array allocations
|
|
private final int size;
|
|
|
|
public ZeroBitStorage(int size) {
|
|
diff --git a/net/minecraft/world/entity/ConversionType.java b/net/minecraft/world/entity/ConversionType.java
|
|
index 3eea236bd1fd401fefdf7c5cc553a3db335029c7..3739272cbc73b7c4f15a2fbe874905cf06175f64 100644
|
|
--- a/net/minecraft/world/entity/ConversionType.java
|
|
+++ b/net/minecraft/world/entity/ConversionType.java
|
|
@@ -37,7 +37,7 @@ public enum ConversionType {
|
|
}
|
|
|
|
if (conversionParams.keepEquipment()) {
|
|
- for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) {
|
|
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
ItemStack itemBySlot = oldMob.getItemBySlot(equipmentSlot);
|
|
if (!itemBySlot.isEmpty()) {
|
|
newMob.setItemSlot(equipmentSlot, itemBySlot.copyAndClear());
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 31a939facfd4b506a2cff3cee6e4b86a12b1d343..e8cd21863aff0aa37b2e6c23a3c60335a3d279cb 100644
|
|
--- a/net/minecraft/world/entity/Entity.java
|
|
+++ b/net/minecraft/world/entity/Entity.java
|
|
@@ -3077,7 +3077,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
}
|
|
|
|
private boolean attemptToShearEquipment(Player player, InteractionHand hand, ItemStack stack, Mob mob) {
|
|
- for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES) {
|
|
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
ItemStack itemBySlot = mob.getItemBySlot(equipmentSlot);
|
|
Equippable equippable = itemBySlot.get(DataComponents.EQUIPPABLE);
|
|
if (equippable != null
|
|
diff --git a/net/minecraft/world/entity/EquipmentSlot.java b/net/minecraft/world/entity/EquipmentSlot.java
|
|
index 0e44397c9d53ff30a96c9e8e392a363fa9ae0c55..dbf31389f0e9796c80afbffddf6a20cbaf184e6e 100644
|
|
--- a/net/minecraft/world/entity/EquipmentSlot.java
|
|
+++ b/net/minecraft/world/entity/EquipmentSlot.java
|
|
@@ -20,9 +20,12 @@ public enum EquipmentSlot implements StringRepresentable {
|
|
SADDLE(EquipmentSlot.Type.SADDLE, 0, 1, 7, "saddle");
|
|
|
|
public static final int NO_COUNT_LIMIT = 0;
|
|
- public static final List<EquipmentSlot> VALUES = List.of(values());
|
|
- public static final IntFunction<EquipmentSlot> BY_ID = ByIdMap.continuous(equipmentSlot -> equipmentSlot.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
|
|
- public static final StringRepresentable.EnumCodec<EquipmentSlot> CODEC = StringRepresentable.fromEnum(EquipmentSlot::values);
|
|
+ // Gale start - JettPack - reduce array allocations
|
|
+ public static final EquipmentSlot[] VALUES_ARRAY = values();
|
|
+ public static final List<EquipmentSlot> VALUES = List.of(VALUES_ARRAY);
|
|
+ public static final IntFunction<EquipmentSlot> BY_ID = ByIdMap.continuous(equipmentSlot -> equipmentSlot.id, VALUES_ARRAY, ByIdMap.OutOfBoundsStrategy.ZERO);
|
|
+ public static final StringRepresentable.EnumCodec<EquipmentSlot> CODEC = StringRepresentable.fromEnum(() -> VALUES_ARRAY);
|
|
+ // Gale end - JettPack - reduce array allocations
|
|
public static final StreamCodec<ByteBuf, EquipmentSlot> STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, equipmentSlot -> equipmentSlot.id);
|
|
private final EquipmentSlot.Type type;
|
|
private final int index;
|
|
diff --git a/net/minecraft/world/entity/EquipmentSlotGroup.java b/net/minecraft/world/entity/EquipmentSlotGroup.java
|
|
index 381e0a1c0af7e339713ed1df1c2f21121c1bbd0f..1ebcab2ee9898a618ad76b18491be19859629192 100644
|
|
--- a/net/minecraft/world/entity/EquipmentSlotGroup.java
|
|
+++ b/net/minecraft/world/entity/EquipmentSlotGroup.java
|
|
@@ -24,6 +24,7 @@ public enum EquipmentSlotGroup implements StringRepresentable, Iterable<Equipmen
|
|
BODY(9, "body", EquipmentSlot.BODY),
|
|
SADDLE(10, "saddle", EquipmentSlot.SADDLE);
|
|
|
|
+ public static final EquipmentSlotGroup[] VALUES_ARRAY = EquipmentSlotGroup.values(); // Gale - JettPack - reduce array allocations
|
|
public static final IntFunction<EquipmentSlotGroup> BY_ID = ByIdMap.continuous(
|
|
equipmentSlotGroup -> equipmentSlotGroup.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO
|
|
);
|
|
@@ -38,7 +39,7 @@ public enum EquipmentSlotGroup implements StringRepresentable, Iterable<Equipmen
|
|
this.id = id;
|
|
this.key = key;
|
|
this.predicate = predicate;
|
|
- this.slots = EquipmentSlot.VALUES.stream().filter(predicate).toList();
|
|
+ this.slots = EquipmentSlot.VALUES.stream().filter(predicate).toList(); // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
private EquipmentSlotGroup(final int id, final String key, final EquipmentSlot slot) {
|
|
diff --git a/net/minecraft/world/entity/EquipmentTable.java b/net/minecraft/world/entity/EquipmentTable.java
|
|
index b383836c200ca9f7bd84639367aa81b57868fb25..3af4a6dcc81afaf2860325fe5852c9a941f216d4 100644
|
|
--- a/net/minecraft/world/entity/EquipmentTable.java
|
|
+++ b/net/minecraft/world/entity/EquipmentTable.java
|
|
@@ -30,7 +30,7 @@ public record EquipmentTable(ResourceKey<LootTable> lootTable, Map<EquipmentSlot
|
|
}
|
|
|
|
private static Map<EquipmentSlot, Float> createForAllSlots(float dropChance) {
|
|
- return createForAllSlots(List.of(EquipmentSlot.values()), dropChance);
|
|
+ return createForAllSlots(List.of(EquipmentSlot.VALUES_ARRAY), dropChance); // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
private static Map<EquipmentSlot, Float> createForAllSlots(List<EquipmentSlot> equipmentSlots, float dropChance) {
|
|
diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java
|
|
index cf283389d9263ba29720bf296a778be9eaf308a7..8803c03846828b532bd2b6e164c589995907c96b 100644
|
|
--- a/net/minecraft/world/item/ItemStack.java
|
|
+++ b/net/minecraft/world/item/ItemStack.java
|
|
@@ -1153,7 +1153,7 @@ public final class ItemStack implements DataComponentHolder {
|
|
|
|
private void addAttributeTooltips(Consumer<Component> tooltipAdder, TooltipDisplay tooltipDisplay, @Nullable Player player) {
|
|
if (tooltipDisplay.shows(DataComponents.ATTRIBUTE_MODIFIERS)) {
|
|
- for (EquipmentSlotGroup equipmentSlotGroup : EquipmentSlotGroup.values()) {
|
|
+ for (EquipmentSlotGroup equipmentSlotGroup : EquipmentSlotGroup.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
MutableBoolean mutableBoolean = new MutableBoolean(true);
|
|
this.forEachModifier(
|
|
equipmentSlotGroup,
|
|
diff --git a/net/minecraft/world/item/crafting/ShapedRecipePattern.java b/net/minecraft/world/item/crafting/ShapedRecipePattern.java
|
|
index bfda76974ea8d4397e2c2ebf5bdcb5d7e5f0bab5..cabbc93409ca99180d115e2f23419ee1824d5801 100644
|
|
--- a/net/minecraft/world/item/crafting/ShapedRecipePattern.java
|
|
+++ b/net/minecraft/world/item/crafting/ShapedRecipePattern.java
|
|
@@ -121,7 +121,7 @@ public final class ShapedRecipePattern {
|
|
}
|
|
|
|
if (pattern.size() == i3) {
|
|
- return new String[0];
|
|
+ return me.titaniumtown.ArrayConstants.emptyStringArray; // Gale - JettPack - reduce array allocations
|
|
} else {
|
|
String[] strings = new String[pattern.size() - i3 - i2];
|
|
|
|
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
|
|
index b62ee276e2176da439ac2f4da4501861da746004..97d227249405c8648b8b5e9bcca5a3f202f7b903 100644
|
|
--- a/net/minecraft/world/level/Level.java
|
|
+++ b/net/minecraft/world/level/Level.java
|
|
@@ -1825,7 +1825,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
|
public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) {
|
|
ca.spottedleaf.moonrise.patches.chunk_system.level.entity.ChunkEntitySlices slices = ((ServerLevel)this).moonrise$getEntityLookup().getChunk(chunkX, chunkZ);
|
|
if (slices == null) {
|
|
- return new org.bukkit.entity.Entity[0];
|
|
+ return me.titaniumtown.ArrayConstants.emptyBukkitEntityArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
List<org.bukkit.entity.Entity> ret = new java.util.ArrayList<>();
|
|
@@ -1836,7 +1836,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
|
|
}
|
|
}
|
|
|
|
- return ret.toArray(new org.bukkit.entity.Entity[0]);
|
|
+ return ret.toArray(me.titaniumtown.ArrayConstants.emptyBukkitEntityArray); // Gale - JettPack - reduce array allocations
|
|
}
|
|
// Paper end - rewrite chunk system
|
|
|
|
diff --git a/net/minecraft/world/level/block/ComposterBlock.java b/net/minecraft/world/level/block/ComposterBlock.java
|
|
index a647d76d365a60b95a3eb7927ac426bf70d417f3..7977ecd013c55359f179b4b7f895099b7eb02294 100644
|
|
--- a/net/minecraft/world/level/block/ComposterBlock.java
|
|
+++ b/net/minecraft/world/level/block/ComposterBlock.java
|
|
@@ -419,7 +419,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(Direction side) {
|
|
- return new int[0];
|
|
+ return me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
@@ -454,7 +454,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(Direction side) {
|
|
- return side == Direction.UP ? new int[]{0} : new int[0];
|
|
+ return side == Direction.UP ? me.titaniumtown.ArrayConstants.zeroSingletonIntArray : me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
@@ -505,7 +505,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
|
|
@Override
|
|
public int[] getSlotsForFace(Direction side) {
|
|
- return side == Direction.DOWN ? new int[]{0} : new int[0];
|
|
+ return side == Direction.DOWN ? me.titaniumtown.ArrayConstants.zeroSingletonIntArray : me.titaniumtown.ArrayConstants.emptyIntArray; // Gale - JettPack - reduce array allocations
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
index 36a72a11d28f99bfe85868461925b778cc01478e..ca2cab797fc16f0961ce994fcb45029589b3c370 100644
|
|
--- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
+++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
|
@@ -44,7 +44,7 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
|
protected static final int SLOT_FUEL = 1;
|
|
protected static final int SLOT_RESULT = 2;
|
|
public static final int DATA_LIT_TIME = 0;
|
|
- private static final int[] SLOTS_FOR_UP = new int[]{0};
|
|
+ private static final int[] SLOTS_FOR_UP = me.titaniumtown.ArrayConstants.zeroSingletonIntArray; // Gale - JettPack - reduce array allocations
|
|
private static final int[] SLOTS_FOR_DOWN = new int[]{2, 1};
|
|
private static final int[] SLOTS_FOR_SIDES = new int[]{1};
|
|
public static final int DATA_LIT_DURATION = 1;
|
|
diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
index c8f23011a8942a5be970c606f67142cbd202b97e..98971a07757d29d6926a0aa05f229b8020af42b6 100644
|
|
--- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
+++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
|
@@ -258,7 +258,7 @@ public class MapItemSavedData extends SavedData {
|
|
}
|
|
|
|
private static boolean hasMapInvisibilityItemEquipped(Player player) {
|
|
- for (EquipmentSlot equipmentSlot : EquipmentSlot.values()) {
|
|
+ for (EquipmentSlot equipmentSlot : EquipmentSlot.VALUES_ARRAY) { // Gale - JettPack - reduce array allocations
|
|
if (equipmentSlot != EquipmentSlot.MAINHAND
|
|
&& equipmentSlot != EquipmentSlot.OFFHAND
|
|
&& player.getItemBySlot(equipmentSlot).is(ItemTags.MAP_INVISIBILITY_EQUIPMENT)) {
|