Files
MiraiMC/patches/server/0006-reduce-allocs.patch
2021-12-29 17:29:54 +01:00

1626 lines
101 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Simon Gardling <titaniumtown@gmail.com>
Date: Tue, 9 Nov 2021 16:53:39 -0500
Subject: [PATCH] reduce allocs
Original code by CaffeineMC, licensed under GNU Lesser General Public License v3.0
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java b/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java
index 4a04eb6449d33d3f15c354b2ac98198f4ac12758..2ed244bc6926663468265b6f33a7d00b2c3f8822 100644
--- a/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java
+++ b/src/main/java/ca/spottedleaf/starlight/common/light/BlockStarLightEngine.java
@@ -120,8 +120,8 @@ public final class BlockStarLightEngine extends StarLightEngine {
// re-propagating neighbours (done by the decrease queue) will also account for opacity changes in this block
}
- protected final BlockPos.MutableBlockPos recalcCenterPos = new BlockPos.MutableBlockPos();
- protected final BlockPos.MutableBlockPos recalcNeighbourPos = new BlockPos.MutableBlockPos();
+ protected final BlockPos.MutableBlockPos recalcCenterPos = me.titaniumtown.Constants.MutableBlockPos;
+ protected final BlockPos.MutableBlockPos recalcNeighbourPos = me.titaniumtown.Constants.MutableBlockPos;
@Override
protected int calculateLightValue(final LightChunkGetter lightAccess, final int worldX, final int worldY, final int worldZ,
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/SkyStarLightEngine.java b/src/main/java/ca/spottedleaf/starlight/common/light/SkyStarLightEngine.java
index 5f771962afb44175d446f138c8e7453230f48c6c..74aaebc3efe33701982b478580ed30709dfc0c1f 100644
--- a/src/main/java/ca/spottedleaf/starlight/common/light/SkyStarLightEngine.java
+++ b/src/main/java/ca/spottedleaf/starlight/common/light/SkyStarLightEngine.java
@@ -288,8 +288,8 @@ public final class SkyStarLightEngine extends StarLightEngine {
);
}
- protected final BlockPos.MutableBlockPos recalcCenterPos = new BlockPos.MutableBlockPos();
- protected final BlockPos.MutableBlockPos recalcNeighbourPos = new BlockPos.MutableBlockPos();
+ protected final BlockPos.MutableBlockPos recalcCenterPos = me.titaniumtown.Constants.MutableBlockPos;
+ protected final BlockPos.MutableBlockPos recalcNeighbourPos = me.titaniumtown.Constants.MutableBlockPos;
@Override
protected int calculateLightValue(final LightChunkGetter lightAccess, final int worldX, final int worldY, final int worldZ,
diff --git a/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
index 1b0d92c68407cdb09ed8aac271b625d92db87017..c3bcb2465afcdaabf33b2845ab82602925111f8f 100644
--- a/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
+++ b/src/main/java/ca/spottedleaf/starlight/common/light/StarLightEngine.java
@@ -105,9 +105,9 @@ public abstract class StarLightEngine {
// index = x + (z * 5)
protected final boolean[][] emptinessMapCache = new boolean[5 * 5][];
- protected final BlockPos.MutableBlockPos mutablePos1 = new BlockPos.MutableBlockPos();
- protected final BlockPos.MutableBlockPos mutablePos2 = new BlockPos.MutableBlockPos();
- protected final BlockPos.MutableBlockPos mutablePos3 = new BlockPos.MutableBlockPos();
+ protected final BlockPos.MutableBlockPos mutablePos1 = me.titaniumtown.Constants.MutableBlockPos;
+ protected final BlockPos.MutableBlockPos mutablePos2 = me.titaniumtown.Constants.MutableBlockPos;
+ protected final BlockPos.MutableBlockPos mutablePos3 = me.titaniumtown.Constants.MutableBlockPos;
protected int encodeOffsetX;
protected int encodeOffsetY;
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index c0d123bff1825366c30aadd3ad8a7fde68ef74e4..5a7836a4d5d11b244f8ef7fe4b116a721f088e65 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -214,7 +214,7 @@ public class PaperCommand extends Command {
case "version":
Command ver = MinecraftServer.getServer().server.getCommandMap().getCommand("version");
if (ver != null) {
- ver.execute(sender, commandLabel, new String[0]);
+ ver.execute(sender, commandLabel, me.titaniumtown.Constants.EMPTY_string_arr);
break;
}
// else - fall through to default
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
index 0133ea6feb1ab88f021f66855669f58367e7420b..d2999686a93e2be7a156268e4cac63fbd18d1018 100644
--- a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java
@@ -17,9 +17,9 @@ public final class EntityList implements Iterable<Entity> {
this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
}
- protected static final Entity[] EMPTY_LIST = new Entity[0];
+ //protected static final Entity[] EMPTY_LIST = new Entity[0];
- protected Entity[] entities = EMPTY_LIST;
+ protected Entity[] entities = me.titaniumtown.Constants.EMPTY_entity_arr;
protected int count;
public int size() {
diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
index 277cfd9d1e8fff5d9b5e534b75c3c5162d58b0b7..e3a24429ccc7e56663a6ff4f0e967d7d2402f626 100644
--- a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
+++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java
@@ -20,7 +20,7 @@ public final class IBlockDataList {
this.map.defaultReturnValue(Long.MAX_VALUE);
}
- private static final long[] EMPTY_LIST = new long[0];
+ private static final long[] EMPTY_LIST = me.titaniumtown.Constants.EMPTY_long_arr;
private long[] byIndex = EMPTY_LIST;
private int size;
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
index 58629451977c89db2fa895bde946135784a0d8bc..07bf3c50b4d06a62c5b0311e1a7aeea061ab11fb 100644
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
@@ -424,7 +424,6 @@ public final class CollisionUtil {
final int minBlock = minSection << 4;
final int maxBlock = (maxSection << 4) | 15;
- BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();
CollisionContext collisionShape = null;
// special cases:
@@ -517,15 +516,15 @@ public final class CollisionUtil {
}
if ((edgeCount != 1 || blockData.shapeExceedsCube()) && (edgeCount != 2 || blockData.getBlock() == Blocks.MOVING_PISTON)) {
- mutablePos.set(blockX, blockY, blockZ);
+ me.titaniumtown.Constants.MutableBlockPos.set(blockX, blockY, blockZ);
if (collisionShape == null) {
collisionShape = new LazyEntityCollisionContext(entity);
}
- VoxelShape voxelshape2 = blockData.getCollisionShape(getter, mutablePos, collisionShape);
+ VoxelShape voxelshape2 = blockData.getCollisionShape(getter, me.titaniumtown.Constants.MutableBlockPos, collisionShape);
if (voxelshape2 != Shapes.empty()) {
VoxelShape voxelshape3 = voxelshape2.move((double)blockX, (double)blockY, (double)blockZ);
- if (predicate != null && !predicate.test(blockData, mutablePos)) {
+ if (predicate != null && !predicate.test(blockData, me.titaniumtown.Constants.MutableBlockPos)) {
continue;
}
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..86d27294a0f958a95c252b88c8eeab807e2a2da1 100644
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
@@ -63,7 +63,7 @@ public final class ChunkEntitySlices {
}
}
- return ret.toArray(new org.bukkit.entity.Entity[0]);
+ return ret.toArray(me.titaniumtown.Constants.EMPTY_bukkit_entity_arr);
}
// Paper end - optimise CraftChunk#getEntities
@@ -189,7 +189,7 @@ public final class ChunkEntitySlices {
protected static final class BasicEntityList<E extends Entity> {
- protected static final Entity[] EMPTY = new Entity[0];
+ //protected static final Entity[] EMPTY = new Entity[0];
protected static final int DEFAULT_CAPACITY = 4;
protected E[] storage;
@@ -200,7 +200,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.Constants.EMPTY_entity_arr : new Entity[cap]);
}
public boolean isEmpty() {
@@ -212,7 +212,7 @@ public final class ChunkEntitySlices {
}
private void resize() {
- if (this.storage == EMPTY) {
+ if (this.storage == me.titaniumtown.Constants.EMPTY_entity_arr) {
this.storage = (E[])new Entity[DEFAULT_CAPACITY];
} else {
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
diff --git a/src/main/java/me/titaniumtown/Constants.java b/src/main/java/me/titaniumtown/Constants.java
new file mode 100644
index 0000000000000000000000000000000000000000..bcc2da14b5c27e8bc96a4c6f67e467940bc78993
--- /dev/null
+++ b/src/main/java/me/titaniumtown/Constants.java
@@ -0,0 +1,22 @@
+package me.titaniumtown;
+
+import net.minecraft.core.Direction;
+import net.minecraft.world.entity.EquipmentSlot;
+import net.minecraft.core.BlockPos;
+
+public final class Constants {
+
+ public static final Direction[] ALL_Direction = Direction.values();
+ public static final Direction[] VERTICAL_Direction = {Direction.DOWN, Direction.UP};
+ public static final Direction[] HORIZONTAL_Direction = {Direction.WEST, Direction.EAST, Direction.NORTH, Direction.SOUTH};
+
+ public static final EquipmentSlot[] ALL_EquipmentSlot = EquipmentSlot.values();
+ public static final int[] EMPTY_int_arr = new int[0];
+ public static final int[] ZERO_int_arr = new int[]{0};
+ public static final byte[] EMPTY_byte_arr = new byte[0];
+ public static final String[] EMPTY_string_arr = new String[0];
+ public static final long[] EMPTY_long_arr = new long[0];
+ public static final org.bukkit.entity.Entity[] EMPTY_bukkit_entity_arr = new org.bukkit.entity.Entity[0];
+ public static final net.minecraft.world.entity.Entity[] EMPTY_entity_arr = new net.minecraft.world.entity.Entity[0];
+ public static final BlockPos.MutableBlockPos MutableBlockPos = new BlockPos.MutableBlockPos();
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 14610e6144ec144ebbec6fb0945c67bb0ea86795..c2d6b1800eb09a2ba321c3c2e54df29a3f59b997 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -267,7 +267,7 @@ public class BlockPos extends Vec3i {
int k = maxZ - minZ + 1;
return () -> {
return new AbstractIterator<BlockPos>() {
- final BlockPos.MutableBlockPos nextPos = new BlockPos.MutableBlockPos();
+ final BlockPos.MutableBlockPos nextPos = me.titaniumtown.Constants.MutableBlockPos;
int counter = count;
@Override
@@ -293,7 +293,7 @@ public class BlockPos extends Vec3i {
// Paper end
return () -> {
return new AbstractIterator<BlockPos>() {
- private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
+ private final BlockPos.MutableBlockPos cursor = me.titaniumtown.Constants.MutableBlockPos;
private int currentDepth;
private int maxX;
private int maxY;
@@ -383,7 +383,7 @@ public class BlockPos extends Vec3i {
int l = i * j * k;
return () -> {
return new AbstractIterator<BlockPos>() {
- private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos();
+ private final BlockPos.MutableBlockPos cursor = me.titaniumtown.Constants.MutableBlockPos;
private int index;
@Override
diff --git a/src/main/java/net/minecraft/nbt/ByteArrayTag.java b/src/main/java/net/minecraft/nbt/ByteArrayTag.java
index 3dd8a189c26f41759c59c3b9d0e5282038989a9f..6c72dd66cfc6cb9b1f538a7a181507f8e1531405 100644
--- a/src/main/java/net/minecraft/nbt/ByteArrayTag.java
+++ b/src/main/java/net/minecraft/nbt/ByteArrayTag.java
@@ -170,7 +170,7 @@ public class ByteArrayTag extends CollectionTag<ByteTag> {
}
public void clear() {
- this.data = new byte[0];
+ this.data = me.titaniumtown.Constants.EMPTY_byte_arr;
}
@Override
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 210f81e380cb38c2d5d69849e593d2fdb54e8856..b58d25426aff79d4936de2ff0d99dd6efcb0bfef 100644
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
@@ -365,7 +365,7 @@ public class CompoundTag implements Tag {
throw new ReportedException(this.createReport(key, ByteArrayTag.TYPE, var3));
}
- return new byte[0];
+ return me.titaniumtown.Constants.EMPTY_byte_arr;
}
public int[] getIntArray(String key) {
@@ -377,7 +377,7 @@ public class CompoundTag implements Tag {
throw new ReportedException(this.createReport(key, IntArrayTag.TYPE, var3));
}
- return new int[0];
+ return me.titaniumtown.Constants.EMPTY_int_arr;
}
public long[] getLongArray(String key) {
@@ -389,7 +389,7 @@ public class CompoundTag implements Tag {
throw new ReportedException(this.createReport(key, LongArrayTag.TYPE, var3));
}
- return new long[0];
+ return me.titaniumtown.Constants.EMPTY_long_arr;
}
public CompoundTag getCompound(String key) {
diff --git a/src/main/java/net/minecraft/nbt/IntArrayTag.java b/src/main/java/net/minecraft/nbt/IntArrayTag.java
index a14b01cee7a8d7022c4fa7264d349a76be143ba5..2804bb434afe276f942b90390dc1c0aafdea3bde 100644
--- a/src/main/java/net/minecraft/nbt/IntArrayTag.java
+++ b/src/main/java/net/minecraft/nbt/IntArrayTag.java
@@ -184,7 +184,7 @@ public class IntArrayTag extends CollectionTag<IntTag> {
}
public void clear() {
- this.data = new int[0];
+ this.data = me.titaniumtown.Constants.EMPTY_int_arr;
}
@Override
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
index ea68b26e506e48d8238b7ee4266e61b211d52bd2..661d75ceef9e298e251d0d927a4629c1888b8a03 100644
--- a/src/main/java/net/minecraft/nbt/ListTag.java
+++ b/src/main/java/net/minecraft/nbt/ListTag.java
@@ -221,7 +221,7 @@ public class ListTag extends CollectionTag<Tag> {
}
}
- return new int[0];
+ return me.titaniumtown.Constants.EMPTY_int_arr;
}
public long[] getLongArray(int index) {
@@ -232,7 +232,7 @@ public class ListTag extends CollectionTag<Tag> {
}
}
- return new long[0];
+ return me.titaniumtown.Constants.EMPTY_long_arr;
}
public double getDouble(int index) {
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index 0e75764c108c24b3e2c453f2b4f14e798add0eb4..4fca1ae9218dd7e0e71c590925cdae0e5c2f3063 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -131,7 +131,7 @@ public class ClientboundLevelChunkPacketData {
private void getBlockEntitiesTags(ClientboundLevelChunkPacketData.BlockEntityTagOutput consumer, int x, int z) {
int i = 16 * x;
int j = 16 * z;
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
for(ClientboundLevelChunkPacketData.BlockEntityInfo blockEntityInfo : this.blockEntitiesData) {
int k = i + SectionPos.sectionRelative(blockEntityInfo.packedXZ >> 4);
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
index 82ea4fabd5732052a286d50bcff8bbcc2c4aa7d7..09fd9dad2fdd111623ee34d95880814ac4eac3af 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSectionBlocksUpdatePacket.java
@@ -71,7 +71,7 @@ public class ClientboundSectionBlocksUpdatePacket implements Packet<ClientGamePa
}
public void runUpdates(BiConsumer<BlockPos, BlockState> biconsumer) {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int i = 0; i < this.positions.length; ++i) {
short short0 = this.positions[i];
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 406bfe20a7b8786bbc6bee46151be91dadec6180..00869dd65c994a26ff3d2124c03dfb9f006b443c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -76,6 +76,8 @@ public class ServerChunkCache extends ChunkSource {
final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock();
final Long2ObjectOpenHashMap<LevelChunk> loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f);
+ private final java.util.ArrayList<LevelChunk> cachedChunkList = new java.util.ArrayList<>(); // JettPack
+
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
public boolean firstRunSpawnCounts = true; // Pufferfish
@@ -933,6 +935,16 @@ public class ServerChunkCache extends ChunkSource {
this.clearCache();
}
+ // JettPack start - lithium: reduce allocs
+ private java.util.ArrayList<LevelChunk> redirectChunksListClone(int initialArraySize) {
+ java.util.ArrayList<LevelChunk> list = this.cachedChunkList;
+ list.clear(); // Ensure the list is empty before re-using it
+ list.ensureCapacity(initialArraySize);
+
+ return list;
+ }
+ // JettPack end
+
private void tickChunks() {
long i = this.level.getGameTime();
long j = i - this.lastInhabitedUpdate;
@@ -1028,7 +1040,7 @@ public class ServerChunkCache extends ChunkSource {
iterator1 = this.entityTickingChunks.iterator();
} else {
iterator1 = this.entityTickingChunks.unsafeIterator();
- List<LevelChunk> shuffled = Lists.newArrayListWithCapacity(this.entityTickingChunks.size());
+ java.util.ArrayList<LevelChunk> shuffled = this.redirectChunksListClone(this.entityTickingChunks.size()); // JettPack - reduce allocs
while (iterator1.hasNext()) {
shuffled.add(iterator1.next());
}
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index e80176708db486190dd527e3ade5fc690ceb39f7..4fa44b576404438d08085e1d8c82fa96206eae50 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -313,7 +313,7 @@ public class ServerEntity {
if (this.entity instanceof LivingEntity) {
List<Pair<EquipmentSlot, ItemStack>> list = Lists.newArrayList();
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c7229e120d601619d2ea869d7aa506fb3b78cde4..e6cd7716515d7eebb8b4bb30d4a80916322a7692 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -741,7 +741,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
}
// Paper start - optimise random block ticking
- private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos();
+ //private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos(); // JettPack
private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(); public java.util.Random getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - getter
// Paper end
@@ -755,7 +755,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
ProfilerFiller gameprofilerfiller = this.getProfiler();
gameprofilerfiller.push("thunder");
- final BlockPos.MutableBlockPos blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change
+ final BlockPos.MutableBlockPos blockposition = me.titaniumtown.Constants.MutableBlockPos; // Paper - use mutable to reduce allocation rate, final to force compile fail on change // JettPack
if (!this.paperConfig.disableThunder && flag && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0 && chunk.shouldDoLightning(this.random)) { // Spigot // Paper - disable thunder // Pufferfish - replace random with shouldDoLightning
blockposition.set(this.findLightningTargetAround(this.getBlockRandomPos(j, 0, k, 15))); // Paper
@@ -846,7 +846,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
BlockPos blockposition2 = blockposition.set(j + randomX, randomY, k + randomZ);
BlockState iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw);
- iblockdata.randomTick(this, blockposition2, this.randomTickRandom);
+ iblockdata.randomTick(this, blockposition2.immutable(), this.randomTickRandom); // JettPack - reduce allocs
// We drop the fluid tick since LAVA is ALREADY TICKED by the above method (See LiquidBlock).
// TODO CHECK ON UPDATE
}
@@ -1099,7 +1099,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
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.Constants.EMPTY_entity_arr : new Entity[] { ticking }); // JettPack
return ret;
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 3125af569ec2bb1cd613a9dd96c3a181d723006d..534c7a702e96523bd2e3cf0bc20c7c63929b4f07 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -220,7 +220,7 @@ public class ServerPlayerGameMode {
if (event.isCancelled()) {
// Let the client know the block still exists
// Paper start - brute force neighbor blocks for any attached blocks
- for (Direction dir : Direction.values()) {
+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack
this.player.connection.send(new ClientboundBlockUpdatePacket(level, pos.relative(dir)));
}
// Paper end
@@ -407,7 +407,7 @@ public class ServerPlayerGameMode {
this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos));
// Brute force all possible updates
- for (Direction dir : Direction.values()) {
+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack
this.player.connection.send(new ClientboundBlockUpdatePacket(this.level, pos.relative(dir)));
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 0f7f811510188f2b37443c5d2378a138dbf43b32..38bbc0d8cc844ab6b67a689fee95932537d42ebd 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -714,7 +714,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
int maxZ = Mth.floor(box.maxZ);
Level world = entity.level;
- BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos pos = me.titaniumtown.Constants.MutableBlockPos;
for (int y = minY; y <= maxY; ++y) {
for (int z = minZ; z <= maxZ; ++z) {
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 8982562721c3a5a5a3305e90bd8b5bc21585a425..08ec8433931fc4347b4e679b9359895ade82d7f6 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -95,7 +95,7 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
}
public String[] getUserList() {
- return (String[]) this.map.keySet().toArray(new String[0]);
+ return (String[]) this.map.keySet().toArray(me.titaniumtown.Constants.EMPTY_string_arr); // JettPack
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index 5d8e9bdf5538b19681f21949368d862fab8a89ad..97c744508cc535418eba65fa722859c81c22d647 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/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.Constants.EMPTY_long_arr; // JettPack
private final int size;
public ZeroBitStorage(int size) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 136ec7851f26c39b5b9a02ec791682fd5be2dbf1..8beecd901213cf026d10db0fdb16155fcee7b8f6 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -344,7 +344,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
// Paper end
// Pufferfish start
public int activatedPriority = gg.pufferfish.pufferfish.PufferfishConfig.maximumActivationPrio; // golf score
- public final BlockPos.MutableBlockPos cachedBlockPos = new BlockPos.MutableBlockPos(); // used where needed
+ public final BlockPos.MutableBlockPos cachedBlockPos = me.titaniumtown.Constants.MutableBlockPos; // used where needed // JettPack
// Pufferfish end
public float getBukkitYaw() {
@@ -1427,7 +1427,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
BlockPos blockposition1 = new BlockPos(axisalignedbb.maxX - 0.001D, axisalignedbb.maxY - 0.001D, axisalignedbb.maxZ - 0.001D);
if (this.level.hasChunksAt(blockposition, blockposition1)) {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int i = blockposition.getX(); i <= blockposition1.getX(); ++i) {
for (int j = blockposition.getY(); j <= blockposition1.getY(); ++j) {
@@ -3072,7 +3072,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
protected void moveTowardsClosestSpace(double x, double y, double z) {
BlockPos blockposition = new BlockPos(x, y, z);
Vec3 vec3d = new Vec3(x - (double) blockposition.getX(), y - (double) blockposition.getY(), z - (double) blockposition.getZ());
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Direction enumdirection = Direction.UP;
double d3 = Double.MAX_VALUE;
Direction[] aenumdirection = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST, Direction.UP};
@@ -3887,7 +3887,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, i
boolean flag1 = false;
Vec3 vec3d = Vec3.ZERO;
int k1 = 0;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
// Pufferfish start - based off CollisionUtil.getCollisionsForBlocksOrWorldBorder
final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this.level);
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index af9c58944b38e8aeeca5dca75c9f97e49f2895f2..33670ff2369962836783feb37804532bed7b2857 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3022,7 +3022,7 @@ public abstract class LivingEntity extends Entity {
@Nullable
private Map<EquipmentSlot, ItemStack> collectEquipmentChanges() {
Map<EquipmentSlot, ItemStack> map = null;
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // Jettpack
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 4e8b3f94dc990cd05d69e74db6c706e290dca702..7e0d653eaf459430459a1c19dc86a787ef12bd63 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1009,7 +1009,7 @@ public abstract class Mob extends LivingEntity {
@Override
protected void dropCustomDeathLoot(DamageSource source, int lootingMultiplier, boolean allowDrops) {
super.dropCustomDeathLoot(source, lootingMultiplier, allowDrops);
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs
int j = aenumitemslot.length;
for (int k = 0; k < j; ++k) {
@@ -1067,7 +1067,7 @@ public abstract class Mob extends LivingEntity {
}
boolean flag = true;
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs
int j = aenumitemslot.length;
for (int k = 0; k < j; ++k) {
@@ -1154,7 +1154,7 @@ public abstract class Mob extends LivingEntity {
float f = difficulty.getSpecialMultiplier();
this.enchantSpawnedWeapon(f);
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
@@ -1365,7 +1365,7 @@ public abstract class Mob extends LivingEntity {
t0.setInvulnerable(this.isInvulnerable());
if (flag) {
t0.setCanPickUpLoot(this.canPickUpLoot());
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 387d31e342cef73ae769d712ba62e6aabb364e98..929e5f61c0326751eb8d386660cdad741ea30f1d 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -112,7 +112,7 @@ public abstract class MoveToBlockGoal extends Goal {
int i = this.searchRange;
int j = this.verticalSearchRange;
BlockPos blockPos = this.mob.blockPosition();
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
for(int k = this.verticalSearchStart; k <= j; k = k > 0 ? -k : 1 - k) {
for(int l = 0; l < i; ++l) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 5a9d9926fb6fc356ee250d4e38f3bc303e280d45..9aa2820668e3ad8e8830950d3e45886e755e9304 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -860,7 +860,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
private Optional<BlockPos> findNearestBlock(Predicate<BlockState> predicate, double searchDistance) {
BlockPos blockposition = Bee.this.blockPosition();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int i = 0; (double) i <= searchDistance; i = i > 0 ? -i : 1 - i) {
for (int j = 0; (double) j < searchDistance; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index b0d3444c721765e10217474ca57f703531e69260..ac89bed7135035bdb0df75d332b7ff8843d9dd71 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -619,7 +619,7 @@ public class Cat extends TamableAnimal {
private void giveMorningGift() {
Random random = this.cat.getRandom();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
blockposition_mutableblockposition.set(this.cat.blockPosition());
this.cat.randomTeleport((double) (blockposition_mutableblockposition.getX() + random.nextInt(11) - 5), (double) (blockposition_mutableblockposition.getY() + random.nextInt(5) - 2), (double) (blockposition_mutableblockposition.getZ() + random.nextInt(11) - 5), false);
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index f9be50049325a1139d67ccf590caeeceadb2fd23..a83df6fe6fe057ef07ed8f1cf898bb6f8ea89b27 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -848,7 +848,7 @@ public class Panda extends Animal {
private boolean canFindBamboo() {
BlockPos blockposition = this.panda.blockPosition();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 8; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index dd80d9e0614445ba088c295784dc30584dedaa2b..6d1f5963d3e3ced8bb786a46e49c193311a4482c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -465,8 +465,8 @@ public class Parrot extends ShoulderRidingEntity implements FlyingAnimal {
@Nullable
private Vec3 getTreePos() {
BlockPos blockposition = this.mob.blockPosition();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- BlockPos.MutableBlockPos blockposition_mutableblockposition1 = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
+ BlockPos.MutableBlockPos blockposition_mutableblockposition1 = me.titaniumtown.Constants.MutableBlockPos;
Iterable<BlockPos> iterable = BlockPos.betweenClosed(Mth.floor(this.mob.getX() - 3.0D), Mth.floor(this.mob.getY() - 6.0D), Mth.floor(this.mob.getZ() - 3.0D), Mth.floor(this.mob.getX() + 3.0D), Mth.floor(this.mob.getY() + 6.0D), Mth.floor(this.mob.getZ() + 3.0D));
Iterator iterator = iterable.iterator();
diff --git a/src/main/java/net/minecraft/world/entity/animal/Pig.java b/src/main/java/net/minecraft/world/entity/animal/Pig.java
index f24b87ff18d4255289c8130f32fd205014ee2747..695e198db3cf93c0f307c759c80881a444b2375b 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Pig.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Pig.java
@@ -208,7 +208,7 @@ public class Pig extends Animal implements ItemSteerable, Saddleable {
} else {
int[][] aint = DismountHelper.offsetsForDirection(enumdirection);
BlockPos blockposition = this.blockPosition();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
UnmodifiableIterator unmodifiableiterator = passenger.getDismountPoses().iterator();
while (unmodifiableiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
index d5cd18c478bedaeed83de31d442d1a5b0f0f54cf..0aa6900672f6378b1315065edade338cf63d75c1 100644
--- a/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/goat/Goat.java
@@ -313,7 +313,7 @@ public class Goat extends Animal {
private static class GoatNodeEvaluator extends WalkNodeEvaluator {
- private final BlockPos.MutableBlockPos belowPos = new BlockPos.MutableBlockPos();
+ private final BlockPos.MutableBlockPos belowPos = me.titaniumtown.Constants.MutableBlockPos;
GoatNodeEvaluator() {}
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index a726006888bbbdb290bcda3ac4fd45d68ba51b79..700c187ee9e0d9b8aa7cf0eadb7ebc99208a7199 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -1078,7 +1078,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
double d0 = this.getX() + offset.x;
double d1 = this.getBoundingBox().minY;
double d2 = this.getZ() + offset.z;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
UnmodifiableIterator unmodifiableiterator = passenger.getDismountPoses().iterator();
while (unmodifiableiterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 2805ebfe4ffe769bcde778a1225b3101c91538d8..38a9584e4d6a8d8abda75f3947e582e4cd0b0ed9 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -152,7 +152,7 @@ public abstract class HangingEntity extends Entity {
int j = Math.max(1, this.getHeight() / 16);
BlockPos blockposition = this.pos.relative(this.direction.getOpposite());
Direction enumdirection = this.direction.getCounterClockWise();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int k = 0; k < i; ++k) {
for (int l = 0; l < j; ++l) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Shulker.java b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
index a9dfe190f46230077e2e1bf9aacbf5375651f216..431a07a8aa3c5c94eda582c37ef6afc56efdec45 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Shulker.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Shulker.java
@@ -355,7 +355,7 @@ public class Shulker extends AbstractGolem implements Enemy {
@Nullable
protected Direction findAttachableSurface(BlockPos pos) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java
index 0380f8800f87afa3f8ee2b4be508b5f08e35a6ac..d8cab64132edb37744b4ac5fa3f4e8dbd8847769 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Strider.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java
@@ -221,7 +221,7 @@ public class Strider extends Animal implements ItemSteerable, Saddleable {
Set<BlockPos> set = Sets.newLinkedHashSet();
double d0 = this.getBoundingBox().maxY;
double d1 = this.getBoundingBox().minY - 0.5D;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Vec3[] avec3d1 = avec3d;
int i = avec3d.length;
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index 415c8a8142867974dfc4722bac933257a28efc1b..3ed052fe24b833ec3c7c737908b5cacf2eb43425 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -226,7 +226,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
return;
}
// CraftBukkit end
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack - reduce allocs
int i = aenumitemslot.length;
for (int j = 0; j < i; ++j) {
@@ -280,7 +280,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
if (this.random.nextFloat() < 0.01F) {
int j = 0;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int k = (int) this.getX() - 4; k < (int) this.getX() + 4 && j < 14; ++k) {
for (int l = (int) this.getY() - 4; l < (int) this.getY() + 4 && j < 14; ++l) {
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raid.java b/src/main/java/net/minecraft/world/entity/raid/Raid.java
index 7131226de05bc57830f7a68ba545ebfd19d33a59..1090d706e9cc4e4655e68501452cfa05bd3d4f29 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raid.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raid.java
@@ -696,7 +696,7 @@ public class Raid {
@Nullable
private BlockPos findRandomSpawnPos(int proximity, int tries) {
int k = proximity == 0 ? 2 : 2 - proximity;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int l = 0; l < tries; ++l) {
float f = this.level.random.nextFloat() * 6.2831855F;
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index ad49dcc3473fbad306d21cbac4600574e80220a7..f27bb4febab36af1eda5c086d9815def18c9d654 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -171,7 +171,7 @@ public abstract class AbstractMinecart extends Entity {
} else {
int[][] aint = DismountHelper.offsetsForDirection(enumdirection);
BlockPos blockposition = this.blockPosition();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
ImmutableList<Pose> immutablelist = passenger.getDismountPoses();
UnmodifiableIterator unmodifiableiterator = immutablelist.iterator();
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index b967177cb10041f96831322c311579e409050e88..0fb1f3c36ad10632517a9e201d0f6bb337c8ecfa 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -534,7 +534,7 @@ public class Boat extends Entity {
int l = Mth.ceil(axisalignedbb.maxY - this.lastYd);
int i1 = Mth.floor(axisalignedbb.minZ);
int j1 = Mth.ceil(axisalignedbb.maxZ);
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
int k1 = k;
while (k1 < l) {
@@ -589,7 +589,7 @@ public class Boat extends Entity {
VoxelShape voxelshape = Shapes.create(axisalignedbb1);
float f = 0.0F;
int k1 = 0;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int l1 = i; l1 < j; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
@@ -625,7 +625,7 @@ public class Boat extends Entity {
boolean flag = false;
this.waterLevel = -1.7976931348623157E308D;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
@@ -657,7 +657,7 @@ public class Boat extends Entity {
int i1 = Mth.floor(axisalignedbb.minZ);
int j1 = Mth.ceil(axisalignedbb.maxZ);
boolean flag = false;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 66f808cabcf6a9a6584849b285f1c60133adc7b4..4d0f9131d1bad591b96b2156bd870447104b5a30 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -387,7 +387,7 @@ public final class ItemStack {
// Brute force all possible updates
BlockPos placedPos = ((CraftBlock) placeEvent.getBlock()).getPosition();
- for (Direction dir : Direction.values()) {
+ for (Direction dir : me.titaniumtown.Constants.ALL_Direction) { // JettPack
((ServerPlayer) entityhuman).connection.send(new ClientboundBlockUpdatePacket(world, placedPos.relative(dir)));
}
SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
@@ -946,7 +946,7 @@ public final class ItemStack {
int k;
if (ItemStack.shouldShowInTooltip(i, ItemStack.TooltipPart.MODIFIERS)) {
- EquipmentSlot[] aenumitemslot = EquipmentSlot.values();
+ EquipmentSlot[] aenumitemslot = me.titaniumtown.Constants.ALL_EquipmentSlot; // JettPack
k = aenumitemslot.length;
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
index 7baf8039c5cf2bd68ba79d4a095ed4b58a847081..64b4222d90ba98830b1c4797ad967f545667bc7d 100644
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -152,8 +152,8 @@ public class MapItem extends ComplexItem {
d1 = 100.0D;
} else {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- BlockPos.MutableBlockPos blockposition_mutableblockposition1 = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
+ BlockPos.MutableBlockPos blockposition_mutableblockposition1 = me.titaniumtown.Constants.MutableBlockPos;
for (int i4 = 0; i4 < i; ++i4) {
for (int j4 = 0; j4 < i; ++j4) {
diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
index 9e3f9099cc47e6c6e40d11ef6d6e83fbf19a3cf7..b9c1db394ee35ed1acead620f7e9e47c60fa1532 100644
--- a/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
+++ b/src/main/java/net/minecraft/world/item/crafting/ShapedRecipe.java
@@ -242,7 +242,7 @@ public class ShapedRecipe implements CraftingRecipe {
}
if (pattern.length == l) {
- return new String[0];
+ return me.titaniumtown.Constants.EMPTY_string_arr; // JettPack
} else {
String[] astring1 = new String[pattern.length - l - k];
diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
index ef36f0a9b1849dd3152c0a1c81cded5c4f06aa3c..31f36d9cff9407dbe1d20bffc9a76e940afbff34 100644
--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
+++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantments.java
@@ -42,8 +42,8 @@ public class Enchantments {
public static final Enchantment MULTISHOT = Enchantments.register("multishot", new MultiShotEnchantment(Enchantment.Rarity.RARE, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
public static final Enchantment QUICK_CHARGE = Enchantments.register("quick_charge", new QuickChargeEnchantment(Enchantment.Rarity.UNCOMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
public static final Enchantment PIERCING = Enchantments.register("piercing", new ArrowPiercingEnchantment(Enchantment.Rarity.COMMON, new EquipmentSlot[]{EquipmentSlot.MAINHAND}));
- public static final Enchantment MENDING = Enchantments.register("mending", new MendingEnchantment(Enchantment.Rarity.RARE, EquipmentSlot.values()));
- public static final Enchantment VANISHING_CURSE = Enchantments.register("vanishing_curse", new VanishingCurseEnchantment(Enchantment.Rarity.VERY_RARE, EquipmentSlot.values()));
+ public static final Enchantment MENDING = Enchantments.register("mending", new MendingEnchantment(Enchantment.Rarity.RARE, me.titaniumtown.Constants.ALL_EquipmentSlot)); // JettPack
+ public static final Enchantment VANISHING_CURSE = Enchantments.register("vanishing_curse", new VanishingCurseEnchantment(Enchantment.Rarity.VERY_RARE, me.titaniumtown.Constants.ALL_EquipmentSlot)); // JettPack
// CraftBukkit start
static {
diff --git a/src/main/java/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java b/src/main/java/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java
index 5fe4ed2213cf81e388b0c5da476d64cf6a24dac1..01d3bec60972f8aa3f80adee9d35503dbdcd2835 100644
--- a/src/main/java/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java
+++ b/src/main/java/net/minecraft/world/item/enchantment/FrostWalkerEnchantment.java
@@ -43,7 +43,7 @@ public class FrostWalkerEnchantment extends Enchantment {
if (entity.isOnGround()) {
BlockState iblockdata = Blocks.FROSTED_ICE.defaultBlockState();
float f = (float) Math.min(16, 2 + level);
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Iterator iterator = BlockPos.betweenClosed(blockPos.offset((double) (-f), -1.0D, (double) (-f)), blockPos.offset((double) f, -1.0D, (double) f)).iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java
index 120e1778f2bdd64ca19ee21dc5c5f2f382895470..fa0ee1ddb141c06ea51f497bfc425c15ac194781 100644
--- a/src/main/java/net/minecraft/world/level/BlockCollisions.java
+++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java
@@ -33,7 +33,7 @@ public class BlockCollisions extends AbstractIterator<VoxelShape> {
public BlockCollisions(CollisionGetter world, @Nullable Entity entity, AABB box, boolean forEntity) {
this.context = entity == null ? CollisionContext.empty() : CollisionContext.of(entity);
- this.pos = new BlockPos.MutableBlockPos();
+ this.pos = me.titaniumtown.Constants.MutableBlockPos;
this.entityShape = Shapes.create(box);
this.collisionGetter = world;
this.box = box;
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..aa565ab33700c92ca607463bdc0dcaef5a9accf1 100644
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
@@ -15,9 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
@Override
public Optional<Float> getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState).map((max) -> {
- return this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max);
- });
+ // JettPack start - lithium: reduce allocs
+ Optional<Float> optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
+ if (optionalBlastResistance.isPresent()) {
+ float blastResistance = optionalBlastResistance.get();
+ float effectiveExplosionResistance = this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, blastResistance);
+ if (effectiveExplosionResistance != blastResistance) {
+ return Optional.of(effectiveExplosionResistance);
+ }
+ }
+ return optionalBlastResistance;
+ // Jettpack end
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 90aa1d75b5c23e5ee27ceae9f6ef90de913a6601..fc0afbf95d62aeddf8fb513b18c32ebe434d4b37 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -111,7 +111,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public static final int MAX_LEVEL_SIZE = 30000000;
public static final int LONG_PARTICLE_CLIP_RANGE = 512;
public static final int SHORT_PARTICLE_CLIP_RANGE = 32;
- private static final Direction[] DIRECTIONS = Direction.values();
+ //private static final Direction[] DIRECTIONS = Direction.values();
public static final int MAX_BRIGHTNESS = 15;
public static final int TICKS_PER_DAY = 24000;
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
@@ -209,7 +209,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public org.bukkit.entity.Entity[] getChunkEntities(int chunkX, int chunkZ) {
io.papermc.paper.world.ChunkEntitySlices slices = this.entitySliceManager.getChunk(chunkX, chunkZ);
if (slices == null) {
- return new org.bukkit.entity.Entity[0];
+ return me.titaniumtown.Constants.EMPTY_bukkit_entity_arr; // JettPack
}
return slices.getChunkEntities();
}
@@ -1299,7 +1299,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public int getBestNeighborSignal(BlockPos pos) {
int i = 0;
- Direction[] aenumdirection = Level.DIRECTIONS;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
@@ -1520,7 +1520,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public BlockPos getBlockRandomPos(int x, int y, int z, int l) {
// Paper start - allow use of mutable pos
- BlockPos.MutableBlockPos ret = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos ret = me.titaniumtown.Constants.MutableBlockPos;
this.getRandomBlockPosition(x, y, z, l, ret);
return ret.immutable();
}
diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java
index aa76f45d18f23997af5a9508559817964ef5e23c..2daf7376ca03b630103bba3956de60071f5a2657 100644
--- a/src/main/java/net/minecraft/world/level/LevelReader.java
+++ b/src/main/java/net/minecraft/world/level/LevelReader.java
@@ -144,7 +144,7 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, BiomeM
int l = Mth.ceil(box.maxY);
int m = Mth.floor(box.minZ);
int n = Mth.ceil(box.maxZ);
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
for(int o = i; o < j; ++o) {
for(int p = k; p < l; ++p) {
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 387b8b158dfe7a3832dff84b0bde97fd4c3a863b..310dab2f83d6bab4a70cb80fc3d651a9f263a3c5 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -252,7 +252,7 @@ public final class NaturalSpawner {
int j = 0; // Paper - moved up
if (iblockdata != null && !iblockdata.isRedstoneConductor(chunk, pos)) { // Paper - don't load chunks for mob spawn
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
//int j = 0; // Paper - moved up
int k = 0;
diff --git a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index 4d1f94c576b65e067efce95d5ef8c0078453b494..ea6072a8ebc57bb2f4a223f5923361777247ccf8 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -191,7 +191,7 @@ public abstract class BaseFireBlock extends Block {
} else {
BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable();
boolean flag = false;
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java
index 20c0030d566012146021613325c6a979f392740e..938f6e76b66cfda05969a8dbbf3e9ba12135a4b5 100644
--- a/src/main/java/net/minecraft/world/level/block/BedBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java
@@ -314,7 +314,7 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock
}
private static Optional<Vec3> findStandUpPositionAtOffset(EntityType<?> type, CollisionGetter world, BlockPos pos, int[][] possibleOffsets, boolean ignoreInvalidPos) {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
int[][] aint1 = possibleOffsets;
int i = possibleOffsets.length;
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index ab5b9f00123e2ede2931ffc520684e482aac49b4..aaea96453fc18937d0276b0295b4e2c31a5e4388 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -170,7 +170,7 @@ public class Block extends BlockBehaviour implements ItemLike {
public static BlockState updateFromNeighbourShapes(BlockState state, LevelAccessor world, BlockPos pos) {
BlockState iblockdata1 = state;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Direction[] aenumdirection = Block.UPDATE_SHAPE_ORDER;
int i = aenumdirection.length;
diff --git a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
index 02fc3ede12eadbf72e26e31b1c475c7f5b2ad73a..1653e09e0cdc4d2b0db91194861bf5a91f99c10d 100644
--- a/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BuddingAmethystBlock.java
@@ -12,7 +12,7 @@ import net.minecraft.world.level.material.PushReaction;
public class BuddingAmethystBlock extends AmethystBlock {
public static final int GROWTH_CHANCE = 5;
- private static final Direction[] DIRECTIONS = Direction.values();
+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack
public BuddingAmethystBlock(BlockBehaviour.Properties settings) {
super(settings);
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
index fb8b8a9733ac50096d8406487ab1ae167ef5f7b1..3d0438dd6f51c399782b177b75f048064be58c12 100644
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
@@ -373,7 +373,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.Constants.ZERO_int_arr : me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack
}
@Override
@@ -422,7 +422,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.Constants.ZERO_int_arr : me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack
}
@Override
@@ -459,7 +459,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
@Override
public int[] getSlotsForFace(Direction side) {
- return new int[0];
+ return me.titaniumtown.Constants.EMPTY_int_arr; // Jettpack
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java b/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java
index 0ccdcf43d208e3d35b5e6fcd04245b29012d828c..290fd93bc21285b6a04558250b4afe93bcd1a3d7 100644
--- a/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/ConcretePowderBlock.java
@@ -67,7 +67,7 @@ public class ConcretePowderBlock extends FallingBlock {
private static boolean touchesLiquid(BlockGetter world, BlockPos pos) {
boolean flag = false;
BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable();
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/CoralBlock.java b/src/main/java/net/minecraft/world/level/block/CoralBlock.java
index 3b1dd57d266bdaa617ec4013b39ebbf608e08f1f..1590506e0fe98239a24f4c5df94ca35dbe6a52ef 100644
--- a/src/main/java/net/minecraft/world/level/block/CoralBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CoralBlock.java
@@ -46,7 +46,7 @@ public class CoralBlock extends Block {
}
protected boolean scanForWater(BlockGetter world, BlockPos pos) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java
index 9c764d2273d70b8dffcaa7f324544cb48f12acc3..14db3ab0eaa3b3a259366a6ca73026bf07ddfed8 100644
--- a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java
@@ -86,7 +86,7 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock {
dropResources(state, world, pos, tileentity);
world.removeBlock(pos, false);
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
index d8e4fda2d501545e5f891bca317e2aa5f9368f47..581845b291b7957cad8869ab8f5c55c6e595a71b 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -137,7 +137,7 @@ public class FireBlock extends BaseFireBlock {
if (!this.canBurn(iblockdata) && !iblockdata.isFaceSturdy(world, blockposition1, Direction.UP)) {
BlockState iblockdata1 = this.defaultBlockState();
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -212,7 +212,7 @@ public class FireBlock extends BaseFireBlock {
this.trySpread(world, pos.north(), 300 + k, random, i, pos);
this.trySpread(world, pos.south(), 300 + k, random, i, pos);
// CraftBukkit end
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int l = -1; l <= 1; ++l) {
for (int i1 = -1; i1 <= 1; ++i1) {
@@ -320,7 +320,7 @@ public class FireBlock extends BaseFireBlock {
}
private boolean isValidFireLocation(BlockGetter world, BlockPos pos) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -339,7 +339,7 @@ public class FireBlock extends BaseFireBlock {
return 0;
} else {
int i = 0;
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
diff --git a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
index 4f27969196fe21b38e81d070fe5c0a999dd320dc..320688c53275e7bb8b30e3ac471d6637e6a6efc7 100644
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -34,9 +34,9 @@ public class FrostedIceBlock extends IceBlock {
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) {
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
- for(Direction direction : Direction.values()) {
+ for(Direction direction : me.titaniumtown.Constants.ALL_Direction) { // JettPack - reduce allocs
mutableBlockPos.setWithOffset(pos, direction);
BlockState blockState = world.getBlockStateIfLoaded(mutableBlockPos); // Paper
if (blockState == null) { continue; } // Paper
@@ -72,9 +72,9 @@ public class FrostedIceBlock extends IceBlock {
private boolean fewerNeigboursThan(BlockGetter world, BlockPos pos, int maxNeighbors) {
int i = 0;
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
- for(Direction direction : Direction.values()) {
+ for(Direction direction : me.titaniumtown.Constants.ALL_Direction) { // JettPack - reduce allocs
mutableBlockPos.setWithOffset(pos, direction);
// Paper start
BlockState blockState = world.getBlockStateIfLoaded(mutableBlockPos);
diff --git a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java
index 0ce900235fd083545a208132079510b5ca3c9cab..77f60819a06347f73501cbabebc28e2745a7e12a 100644
--- a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java
@@ -83,8 +83,8 @@ public class LeavesBlock extends Block {
private static BlockState updateDistance(BlockState state, LevelAccessor world, BlockPos pos) {
int i = 7;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
- Direction[] aenumdirection = Direction.values();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
diff --git a/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java b/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java
index babffeec9aa8a1526767f2d9fcedd146fc8a2e05..bd81c822a0137460110b0c6f20c5166fd5db0811 100644
--- a/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MultifaceBlock.java
@@ -52,7 +52,7 @@ public class MultifaceBlock extends Block {
enummap.put(Direction.UP, MultifaceBlock.UP_AABB);
enummap.put(Direction.DOWN, MultifaceBlock.DOWN_AABB);
});
- protected static final Direction[] DIRECTIONS = Direction.values();
+ //protected static final Direction[] DIRECTIONS = Direction.values();
private final ImmutableMap<BlockState, VoxelShape> shapesCache;
private final boolean canRotate;
private final boolean canMirrorX;
@@ -73,7 +73,7 @@ public class MultifaceBlock extends Block {
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -99,7 +99,7 @@ public class MultifaceBlock extends Block {
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
boolean flag = false;
- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -185,7 +185,7 @@ public class MultifaceBlock extends Block {
private BlockState mapDirections(BlockState state, Function<Direction, Direction> mirror) {
BlockState iblockdata1 = state;
- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -200,7 +200,7 @@ public class MultifaceBlock extends Block {
}
public boolean spreadFromRandomFaceTowardRandomDirection(BlockState state, ServerLevel world, BlockPos pos, Random random) {
- List<Direction> list = Lists.newArrayList(MultifaceBlock.DIRECTIONS);
+ List<Direction> list = Lists.newArrayList(me.titaniumtown.Constants.ALL_Direction); // JettPack
Collections.shuffle(list);
return list.stream().filter((enumdirection) -> {
@@ -211,7 +211,7 @@ public class MultifaceBlock extends Block {
}
public boolean spreadFromFaceTowardRandomDirection(BlockState state, LevelAccessor world, BlockPos pos, Direction from, Random random, boolean postProcess) {
- List<Direction> list = Arrays.asList(MultifaceBlock.DIRECTIONS);
+ List<Direction> list = Arrays.asList(me.titaniumtown.Constants.ALL_Direction); // JettPack
Collections.shuffle(list, random);
return list.stream().anyMatch((enumdirection1) -> {
@@ -232,7 +232,7 @@ public class MultifaceBlock extends Block {
}
protected boolean canSpread(BlockState state, BlockGetter world, BlockPos pos, Direction from) {
- return Stream.of(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection1) -> {
+ return Stream.of(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection1) -> { // JettPack
return this.getSpreadFromFaceTowardDirection(state, world, pos, from, enumdirection1).isPresent();
});
}
@@ -330,7 +330,7 @@ public class MultifaceBlock extends Block {
private static VoxelShape calculateMultifaceShape(BlockState state) {
VoxelShape voxelshape = Shapes.empty();
- Direction[] aenumdirection = MultifaceBlock.DIRECTIONS;
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -345,13 +345,13 @@ public class MultifaceBlock extends Block {
}
protected static boolean hasAnyFace(BlockState state) {
- return Arrays.stream(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection) -> {
+ return Arrays.stream(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection) -> { // JettPack
return MultifaceBlock.hasFace(state, enumdirection);
});
}
private static boolean hasAnyVacantFace(BlockState state) {
- return Arrays.stream(MultifaceBlock.DIRECTIONS).anyMatch((enumdirection) -> {
+ return Arrays.stream(me.titaniumtown.Constants.ALL_Direction).anyMatch((enumdirection) -> { // JettPack
return !MultifaceBlock.hasFace(state, enumdirection);
});
}
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java
index 0bea8d5be72c08236841e7313e20751af8ddb83a..5d7ab3949033e29d88349623547b5ff65573d153 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneOreBlock.java
@@ -136,7 +136,7 @@ public class RedStoneOreBlock extends Block {
private static void spawnParticles(Level world, BlockPos pos) {
double d0 = 0.5625D;
Random random = world.random;
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
index 037330bcb10039c013b2ed5fd68dee16ede20fbe..17900fc38fa1fefc005f65944f3561c6b84ec0f2 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -190,7 +190,7 @@ public class RedStoneWireBlock extends Block {
@Override
public void updateIndirectNeighbourShapes(BlockState state, LevelAccessor world, BlockPos pos, int flags, int maxUpdateDepth) {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Iterator iterator = Direction.Plane.HORIZONTAL.iterator();
while (iterator.hasNext()) {
@@ -392,7 +392,7 @@ public class RedStoneWireBlock extends Block {
Set<BlockPos> set = Sets.newHashSet();
set.add(pos);
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
@@ -449,7 +449,7 @@ public class RedStoneWireBlock extends Block {
private void checkCornerChangeAt(Level world, BlockPos pos) {
if (world.getBlockState(pos).is((Block) this)) {
world.updateNeighborsAt(pos, this);
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -482,7 +482,7 @@ public class RedStoneWireBlock extends Block {
if (!moved && !state.is(newState.getBlock())) {
super.onRemove(state, world, pos, newState, moved);
if (!world.isClientSide) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
index 954b86bea345a8e0e3a8dd425f356db6f5cd496f..93a2dade36a08a17eae34181f087114eca706872 100644
--- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
@@ -34,7 +34,7 @@ public class RedstoneTorchBlock extends TorchBlock {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
@@ -48,7 +48,7 @@ public class RedstoneTorchBlock extends TorchBlock {
@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
if (!moved) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
index 07e893f1859abe3c2a765694c21309d60346ca82..a925811ea38c815c94101810a15a1925074d3337 100644
--- a/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RespawnAnchorBlock.java
@@ -172,7 +172,7 @@ public class RespawnAnchorBlock extends Block {
}
private static Optional<Vec3> findStandUpPosition(EntityType<?> entity, CollisionGetter world, BlockPos pos, boolean ignoreInvalidPos) {
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
for(Vec3i vec3i : RESPAWN_OFFSETS) {
mutableBlockPos.set(pos).move(vec3i);
diff --git a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
index 842997ea9f25a05d74a2e8300e44cc39a7e9cd96..d0401376198cbb595abb20ee0d63504fca3b00f9 100644
--- a/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/SpongeBlock.java
@@ -62,7 +62,7 @@ public class SpongeBlock extends Block {
Tuple<BlockPos, Integer> tuple = (Tuple) queue.poll();
BlockPos blockposition1 = (BlockPos) tuple.getA();
int j = (Integer) tuple.getB();
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int k = aenumdirection.length;
for (int l = 0; l < k; ++l) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index bc028de0ac71e69e8d714db5f65286f306544bf1..6278115e3511fe2176b29122e2c733498f31bb5a 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -363,7 +363,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
public int getParticleAmount() {
int i = 0;
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int j = aenumdirection.length;
for (int k = 0; k < j; ++k) {
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index c9c18cf84e4ee5c253bbc64a4b41e91f9f4c4bc7..6ec908eda3855b926958cd546acd9055fb8569b8 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -163,7 +163,7 @@ public class PistonBaseBlock extends DirectionalBlock {
}
private boolean getNeighborSignal(Level world, BlockPos pos, Direction pistonFace) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
int j;
@@ -180,7 +180,7 @@ public class PistonBaseBlock extends DirectionalBlock {
return true;
} else {
BlockPos blockposition1 = pos.above();
- Direction[] aenumdirection1 = Direction.values();
+ Direction[] aenumdirection1 = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
j = aenumdirection1.length;
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 05c46f3b3bce5225b819d86e6e06729a5093e092..3149f62b83240cd0a19c450ed1b717536250e873 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -922,7 +922,7 @@ public abstract class BlockBehaviour {
public final void updateNeighbourShapes(LevelAccessor world, BlockPos pos, int flags, int maxUpdateDepth) {
this.getBlock();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Direction[] aenumdirection = BlockBehaviour.UPDATE_SHAPE_ORDER;
int k = aenumdirection.length;
@@ -1080,7 +1080,7 @@ public abstract class BlockBehaviour {
private static final class Cache {
- private static final Direction[] DIRECTIONS = Direction.values();
+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
private static final int SUPPORT_TYPE_COUNT = SupportType.values().length;
protected final boolean solidRender;
final boolean propagatesSkylightDown;
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
index 3063a45e5d124d4405e940daff24877866165d3f..e9c3ef448719372387118db39cbf7521753c0868 100644
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
@@ -38,7 +38,7 @@ public class WorldBorder {
}
// Paper start
- private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos();
+ private final BlockPos.MutableBlockPos mutPos = me.titaniumtown.Constants.MutableBlockPos;
public boolean isBlockInBounds(int chunkX, int chunkZ) {
this.mutPos.set(chunkX, 64, chunkZ);
return this.isWithinBounds(this.mutPos);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index e4591c0b3c8547cc6f4e2a0891fc378ee4334d9e..10da0aa24b297ba24b29ba50086115440cfef515 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -201,7 +201,7 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
this.generateStrongholds();
BlockPos blockposition1 = null;
double d0 = Double.MAX_VALUE;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Iterator iterator = this.strongholdPositions.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
index 09d814317443a86210245ab3a7902f2078f08131..83d7f6dc51f22e8028648a1b757f2ff3fac8a4c6 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java
@@ -332,7 +332,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator {
Aquifer aquifer = noisechunk.aquifer();
noisechunk.initializeForFirstCellX();
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
NoiseSettings noisesettings = generatorsettingbase.noiseSettings();
int i1 = noisesettings.getCellWidth();
int j1 = noisesettings.getCellHeight();
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
index c03bf5bdb67b00c75f9fcfead882c4d944282244..a928364c39703d6ac9ab4d9d3f06361132538dc0 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java
@@ -76,7 +76,7 @@ public class SpikeFeature extends Feature<SpikeConfiguration> {
int j = -2;
int k = 2;
int l = 3;
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
for(int m = -2; m <= 2; ++m) {
for(int n = -2; n <= 2; ++n) {
diff --git a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
index 37d7165dfd17da03428f8dbbbf95aa8005be289c..b8b5138b0b9e00306b2a1e2767fa1b5363c44f98 100644
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
@@ -13,8 +13,8 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import org.apache.commons.lang3.mutable.MutableInt;
public final class BlockLightEngine extends LayerLightEngine<BlockLightSectionStorage.BlockDataLayerStorageMap, BlockLightSectionStorage> {
- private static final Direction[] DIRECTIONS = Direction.values();
- private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
+ private final BlockPos.MutableBlockPos pos = me.titaniumtown.Constants.MutableBlockPos;
private final MutableInt mutableInt = new MutableInt(); // Paper
public BlockLightEngine(LightChunkGetter chunkProvider) {
diff --git a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
index 4f7b63f2cc8a69fa8efb3a84f6abc3d3dcf05b49..fa7dac236d7456f152193743a17794c75a4cd0d9 100644
--- a/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/lighting/LayerLightSectionStorage.java
@@ -22,7 +22,7 @@ public abstract class LayerLightSectionStorage<M extends DataLayerStorageMap<M>>
protected static final int LIGHT_ONLY = 1;
protected static final int EMPTY = 2;
protected static final DataLayer EMPTY_DATA = new DataLayer();
- private static final Direction[] DIRECTIONS = Direction.values();
+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
private final LightLayer layer;
private final LightChunkGetter chunkSource;
protected final LongSet dataSectionSet = new LongOpenHashSet();
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
index d122475c1a9d340046c478087d3ff5bf1ff8932c..a8913009d873d8e646489ffde8ecc780d4b0df02 100644
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
@@ -12,7 +12,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import org.apache.commons.lang3.mutable.MutableInt;
public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> {
- private static final Direction[] DIRECTIONS = Direction.values();
+ private static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST};
private final MutableInt mutableInt = new MutableInt(); // Paper
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
index a02a5313db545a8694feec0e2504465426c39a6a..7d3de257d23be054f36c9d39d6e3110f0b52eca5 100644
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
@@ -75,7 +75,7 @@ public abstract class FlowingFluid extends Fluid {
public Vec3 getFlow(BlockGetter world, BlockPos pos, FluidState state) {
double d0 = 0.0D;
double d1 = 0.0D;
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
Iterator iterator = Direction.Plane.HORIZONTAL.iterator();
while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/world/level/material/LavaFluid.java b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
index 8e15976c83c71b8f335511e6747d56d3c8ff6856..657120ddfdc27094de6f38f47375bb281925b0bb 100644
--- a/src/main/java/net/minecraft/world/level/material/LavaFluid.java
+++ b/src/main/java/net/minecraft/world/level/material/LavaFluid.java
@@ -125,7 +125,7 @@ public abstract class LavaFluid extends FlowingFluid {
}
private boolean hasFlammableNeighbours(LevelReader world, BlockPos pos) {
- Direction[] aenumdirection = Direction.values();
+ Direction[] aenumdirection = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
int i = aenumdirection.length;
for (int j = 0; j < i; ++j) {
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
index 737d0405a195d322ffe9a57acadb9f6d645c03b8..d4aaa913be181053a34e21af9c94d8ae220235f7 100644
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
+++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
@@ -51,7 +51,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@Override
public Node getStart() {
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
int i = this.mob.getBlockY();
BlockState blockState = this.level.getBlockState(mutableBlockPos.set(this.mob.getX(), (double)i, this.mob.getZ()));
if (!this.mob.canStandOnFluid(blockState.getFluidState().getType())) {
@@ -221,7 +221,7 @@ public class WalkNodeEvaluator extends NodeEvaluator {
@Nullable
protected Node findAcceptedNode(int x, int y, int z, int maxYStep, double prevFeetY, Direction direction, BlockPathTypes nodeType) {
Node node = null;
- BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos mutableBlockPos = me.titaniumtown.Constants.MutableBlockPos;
double d = this.getFloorLevel(mutableBlockPos.set(x, y, z));
if (d - prevFeetY > 1.125D) {
return null;
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index 5d76674d5e181f012c0686e9915556bc93087706..9cd35365e7d53a5e0dc0416ef266eb544058c233 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -99,7 +99,7 @@ public class PortalShape {
}
private int getDistanceUntilEdgeAboveFrame(BlockPos pos, Direction direction) {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
for (int i = 0; i <= 21; ++i) {
blockposition_mutableblockposition.set(pos).move(direction, i);
@@ -125,7 +125,7 @@ public class PortalShape {
}
private int calculateHeight() {
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
+ BlockPos.MutableBlockPos blockposition_mutableblockposition = me.titaniumtown.Constants.MutableBlockPos;
int i = this.getDistanceUntilTop(blockposition_mutableblockposition);
return i >= 3 && i <= 21 && this.hasTopFrame(blockposition_mutableblockposition, i) ? i : 0;
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 331ed6aa983714d6fc3596526fc7df0ab993062c..061737d4cccc73471db063427ddc7545023c5fce 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -120,7 +120,7 @@ public class PlayerDataStorage {
String[] astring = this.playerDir.list();
if (astring == null) {
- astring = new String[0];
+ astring = me.titaniumtown.Constants.EMPTY_string_arr; // JettPack
}
for (int i = 0; i < astring.length; ++i) {