Bugfix update + Upstream (Pufferfish)

Closes #11
This commit is contained in:
etil2jz
2022-02-14 17:37:45 +01:00
parent f984ae6023
commit 3665db2de1
116 changed files with 215 additions and 1487 deletions

View File

@@ -33,9 +33,6 @@ subprojects {
tasks.withType<JavaCompile> { tasks.withType<JavaCompile> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()
options.release.set(17) options.release.set(17)
options.compilerArgs = listOf(
"--add-modules", "jdk.incubator.vector"
)
} }
tasks.withType<Javadoc> { tasks.withType<Javadoc> {
options.encoding = Charsets.UTF_8.name() options.encoding = Charsets.UTF_8.name()

View File

@@ -2,7 +2,7 @@ group=wtf.etil.mirai
version=1.18.1-R0.1-SNAPSHOT version=1.18.1-R0.1-SNAPSHOT
mcVersion=1.18.1 mcVersion=1.18.1
packageVersion=1_18_R1 packageVersion=1_18_R1
pufferfishRef=bcbaf3e4dec81c89a226508984da4c1beb1f9e74 pufferfishRef=22f20b245fa30e93d3e0ff695b8e719d201c88c2
org.gradle.caching=true org.gradle.caching=true
org.gradle.caching.debug=false org.gradle.caching.debug=false

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2c860ef4c 100644 index 46348c1673366ab096051020817bf35adcf79320..78904d037f3a871ead92e4b478471bd20bb48334 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
@@ -26,7 +26,7 @@ index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2
implementation("org.ow2.asm:asm:9.2") implementation("org.ow2.asm:asm:9.2")
implementation("org.ow2.asm:asm-commons:9.2") implementation("org.ow2.asm:asm-commons:9.2")
@@ -94,6 +96,10 @@ tasks.jar { @@ -101,6 +103,10 @@ tasks.jar {
} }
} }
@@ -38,7 +38,7 @@ index 129c5b41b410b57952fedf90c1ea713ba1c36470..2c33800e7a49804a29f64fd5e6fde7d2
inputs.files(apiAndDocs) inputs.files(apiAndDocs)
.ignoreEmptyDirectories() .ignoreEmptyDirectories()
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index 5a4884db36d448c885e49c965ae329a0638dd628..ce86d0d58182466dc1b2dbf1851e5bff42f7013f 100644 index 049c36807d2a970842442c1b7517c06f3f150041..8bc45dcb8b739045cf4d867f2ea34488a4f59281 100644
--- a/src/main/java/org/bukkit/Chunk.java --- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java
@@ -283,4 +283,16 @@ public interface Chunk extends PersistentDataHolder { @@ -283,4 +283,16 @@ public interface Chunk extends PersistentDataHolder {
@@ -90,7 +90,7 @@ index 3b10fcc13893403b29f0260b8605144679e89b82..1e9a96d8b08cc396acf73dc420830093
+ // Yatopia end + // Yatopia end
} }
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 51ec2e4ec4239659272bba3d6ba2ad73926ebb88..6e7e2000c015484c4416c474fc1a4bd82da7f3e6 100644 index c2c45a93887f99466a8ac4275355ac75c7f901c4..520865c7ea629848fda50f7589d56018d7b1acd1 100644
--- a/src/main/java/org/bukkit/entity/Entity.java --- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -190,6 +190,28 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @@ -190,6 +190,28 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -123,7 +123,7 @@ index 51ec2e4ec4239659272bba3d6ba2ad73926ebb88..6e7e2000c015484c4416c474fc1a4bd8
* Returns a list of entities within a bounding box centered around this * Returns a list of entities within a bounding box centered around this
* entity * entity
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index 56072cb4d32ca8a09023be08a5a832c2c108379a..aebcc6d749e135445b7e779fc2f6412db91e591a 100644 index 7dfc84c77d8e185bb0513d9f9c603ce1b501a5e0..eeab6b554b40e8c84e496ba62163f56d6696d705 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java --- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java +++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -587,6 +587,44 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor @@ -587,6 +587,44 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, net.kyor

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Mirai Branding Changes
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 0f194168f5fca8eb768bca3ce953f28097fed578..6a8786790cfeb4373d23d7e743f06b19efa45c35 100644 index 86548210e50879504f646ef3aa46927998f2d775..e7f677cb5abb24c52b10087837f44c865140635c 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -18,7 +18,7 @@ repositories { @@ -18,7 +18,7 @@ repositories {
@@ -17,7 +17,7 @@ index 0f194168f5fca8eb768bca3ce953f28097fed578..6a8786790cfeb4373d23d7e743f06b19
// Pufferfish start // Pufferfish start
implementation("io.papermc.paper:paper-mojangapi:1.18.1-R0.1-SNAPSHOT") { implementation("io.papermc.paper:paper-mojangapi:1.18.1-R0.1-SNAPSHOT") {
exclude("io.papermc.paper", "paper-api") exclude("io.papermc.paper", "paper-api")
@@ -80,7 +80,7 @@ tasks.jar { @@ -87,7 +87,7 @@ tasks.jar {
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit", "Implementation-Title" to "CraftBukkit",

View File

@@ -29,7 +29,7 @@ index 6d883db5c04cbcf454952c0f361029ecbfe4f037..8f0d53a1abe148382df6a8133ccbd5c0
public static Direction getNearest(double x, double y, double z) { public static Direction getNearest(double x, double y, double z) {
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..706ac70115a28e8f97ac4c5a10f7339fe61c8de8 100644 index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..dfbc871cd3474346b8d83f0b55b4f5f9665e4386 100644
--- a/src/main/java/net/minecraft/world/phys/AABB.java --- a/src/main/java/net/minecraft/world/phys/AABB.java
+++ b/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java
@@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos; @@ -6,6 +6,7 @@ import net.minecraft.core.BlockPos;
@@ -49,7 +49,7 @@ index 68cc6f2a78a06293a29317fda72ab3ee79b3533a..706ac70115a28e8f97ac4c5a10f7339f
+ assert Direction.Axis.X.ordinal() == 0; + assert Direction.Axis.X.ordinal() == 0;
+ assert Direction.Axis.Y.ordinal() == 1; + assert Direction.Axis.Y.ordinal() == 1;
+ assert Direction.Axis.Z.ordinal() == 2; + assert Direction.Axis.Z.ordinal() == 2;
+ assert me.titaniumtown.Constants.ALL_AXIS_Direction.length == 3; + assert Direction.Axis.values().length == 3;
+ } + }
+ // JettPack end + // JettPack end
+ +

View File

@@ -1,971 +0,0 @@
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/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index c0d123bff1825366c30aadd3ad8a7fde68ef74e4..7764b1f86aca33dc227bf4357c20839b8820eb67 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); // JettPack
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..cd5499e750764eaa5e361e73eb581bfce7f9f7c1 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]; // JettPack
- protected Entity[] entities = EMPTY_LIST;
+ protected Entity[] entities = me.titaniumtown.Constants.EMPTY_entity_arr; // JettPack
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..27b6dc17a38f80abad2f959c90ffa5ef81635e1a 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; // JettPack
private long[] byIndex = EMPTY_LIST;
private int size;
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
index 47b5f75d9f27cf3ab947fd1f69cbd609fb9f2749..a919e8a2aa10ba01d7f389985591a0681c1b4426 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); // JettPack
}
// 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]; // JettPack
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]); // JettPack
}
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) { // JettPack
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..9ede2f067eacc1d418a8d6223f4052b81410d3b3
--- /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 Direction.Axis[] ALL_AXIS_Direction = Direction.Axis.values();
+
+ 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];
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/nbt/ByteArrayTag.java b/src/main/java/net/minecraft/nbt/ByteArrayTag.java
index 3dd8a189c26f41759c59c3b9d0e5282038989a9f..147beddf8ef369cdae4b1ed2dcd0d7b2fd865315 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; // JettPack
}
@Override
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
index 210f81e380cb38c2d5d69849e593d2fdb54e8856..bf2faf02785689e2296f9bae146f8865fc105c66 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; // JettPack
}
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; // JettPack
}
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; // JettPack
}
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..44f441d6c102fa5bd50071cae991a8a6ba0ec713 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; // JettPack
}
@Override
diff --git a/src/main/java/net/minecraft/nbt/ListTag.java b/src/main/java/net/minecraft/nbt/ListTag.java
index ea68b26e506e48d8238b7ee4266e61b211d52bd2..5d7d160a1e575903999c00da9faf5359949ce1cb 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; // JettPack
}
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; // JettPack
}
public double getDouble(int index) {
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index e2c8f716af55ebb7e4233c2a3d6515f8f4a239fa..2f5c021b6849acb81064d55418707921424b649b 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -76,7 +76,7 @@ public class Main {
OptionSpec<Void> optionspec6 = optionparser.accepts("safeMode", "Loads level with vanilla datapack only");
OptionSpec<Void> optionspec7 = optionparser.accepts("help").forHelp();
OptionSpec<String> optionspec8 = optionparser.accepts("singleplayer").withRequiredArg();
- OptionSpec<String> optionspec9 = optionparser.accepts("universe").withRequiredArg().defaultsTo(".", new String[0]);
+ OptionSpec<String> optionspec9 = optionparser.accepts("universe").withRequiredArg().defaultsTo(".", me.titaniumtown.Constants.EMPTY_string_arr); // JettPack
OptionSpec<String> optionspec10 = optionparser.accepts("world").withRequiredArg();
OptionSpec<Integer> optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1, new Integer[0]);
OptionSpec<String> optionspec12 = optionparser.accepts("serverId").withRequiredArg();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index addf249717b5271b664f4a9d28dd6cc177db5688..99a86acedeed4aede7e7afc7e9ee122b78201c7e 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -77,6 +77,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 - reduce allocs
+
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
public boolean firstRunSpawnCounts = true; // Pufferfish
@@ -928,6 +930,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;
@@ -1019,7 +1031,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 59d57108f38f38e03cd8b69a53c3e9d40179599a..a0857991d64d89874fea552a5459a45f14529034 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -849,7 +849,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
}
@@ -1102,7 +1102,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/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/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3236a1dc51c394b784d3f42b78e76bf7c2f69c37..3556586c8cd24827bf7b1018c426e258f0f6444d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3020,7 +3020,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 35ff7abd8251b0af6c23fbb63804db632ec5b85d..def1aadb3002441b34bebb24cf727b1b91a688ba 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1011,7 +1011,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) {
@@ -1069,7 +1069,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) {
@@ -1156,7 +1156,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) {
@@ -1367,7 +1367,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/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/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index 5c6b2bc734c4f49395856975ff77bfbae2b0e85a..dc5c38973cffc3c13ce8f5a83cf9a3d88cecd96a 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) {
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/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/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 a98d115b7dccd836fa2c0f50333730db6f388aff..33dfda7f4b03c4782cfcf4cc9f36dc26b64fd6d5 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -111,7 +111,6 @@ 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();
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 +208,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();
}
@@ -1304,7 +1303,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) {
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/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..ee47460d66156d9629435bfcaa40d32b61ff4093 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) {
@@ -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..81368e748037733c75b48fa0e0157ec773e1e3e4 100644
--- a/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FrostedIceBlock.java
@@ -36,7 +36,7 @@ public class FrostedIceBlock extends IceBlock {
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();
- 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
@@ -74,7 +74,7 @@ public class FrostedIceBlock extends IceBlock {
int i = 0;
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.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..1afd59499a71d07222c08ccbc6248e30c24b31bb 100644
--- a/src/main/java/net/minecraft/world/level/block/LeavesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LeavesBlock.java
@@ -84,7 +84,7 @@ 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();
+ 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..390e9b1f76a6fbbd34c638b4135c31d088901c13 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,6 @@ 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();
private final ImmutableMap<BlockState, VoxelShape> shapesCache;
private final boolean canRotate;
private final boolean canMirrorX;
@@ -73,7 +72,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 +98,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 +184,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 +199,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 +210,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 +231,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 +329,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 +344,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..ec89c162ad7de9d1647934efd02b2581b4689a6d 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -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/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 eac017fc521bfd1391e75db8628f42b28329d681..101763868fcfa8f0e428b3b7f36983d21d20f9ff 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
@@ -1115,7 +1115,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;
@@ -1155,7 +1155,7 @@ public abstract class BlockBehaviour {
if (!this.collisionShape.isEmpty() && block.getOffsetType() != BlockBehaviour.OffsetType.NONE) {
throw new IllegalStateException(String.format("%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", Registry.BLOCK.getKey(block)));
} else {
- this.largeCollisionShape = Arrays.stream(Direction.Axis.values()).anyMatch((enumdirection_enumaxis) -> {
+ this.largeCollisionShape = Arrays.stream(me.titaniumtown.Constants.ALL_AXIS_Direction).anyMatch((enumdirection_enumaxis) -> {
return this.collisionShape.min(enumdirection_enumaxis) < 0.0D || this.collisionShape.max(enumdirection_enumaxis) > 1.0D;
});
this.faceSturdy = new boolean[BlockBehaviour.BlockStateBase.Cache.DIRECTIONS.length * BlockBehaviour.BlockStateBase.Cache.SUPPORT_TYPE_COUNT];
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..3994fbc9c81ecec1864f16f1c28600381b3d3fb7 100644
--- a/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/BlockLightEngine.java
@@ -13,7 +13,7 @@ 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 static final Direction[] DIRECTIONS = me.titaniumtown.Constants.ALL_Direction; // JettPack - reduce allocs
private final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
private final MutableInt mutableInt = new MutableInt(); // Paper
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/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/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
index 35c39aed9583275ef25d32c783715798b52bdb63..b470da69f271d1a5ebb9727c0c34944e85ce3a51 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -119,7 +119,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) {

View File

@@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..d2b00d9a91b60716d5f458048df3d944
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
index 7443df5c2648d279630a7db38d7ddcf4e7113f97..3b6a84fee8e24f53f2f1f8a1ef7db388ae414fe8 100644 index 87f6559990fde02318bfe2fc7e0a40b39b116888..5e789ce4d13212b83cceeead0a24613a2d247f32 100644
--- a/src/main/java/net/minecraft/util/Mth.java --- a/src/main/java/net/minecraft/util/Mth.java
+++ b/src/main/java/net/minecraft/util/Mth.java +++ b/src/main/java/net/minecraft/util/Mth.java
@@ -8,6 +8,7 @@ import net.minecraft.core.Vec3i; @@ -8,6 +8,7 @@ import net.minecraft.core.Vec3i;

View File

@@ -7,10 +7,10 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f733feced 100644 index 74210dc2eef63da7360b1f833bb59b278419fb2b..859d2e82f21efa1232e7e69f787840b16ed4bd4b 100644
--- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java --- a/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
+++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java +++ b/src/main/java/net/minecraft/world/level/entity/EntitySectionStorage.java
@@ -32,33 +32,45 @@ public class EntitySectionStorage<T extends EntityAccess> { @@ -32,33 +32,66 @@ public class EntitySectionStorage<T extends EntityAccess> {
this.intialSectionVisibility = chunkStatusDiscriminator; this.intialSectionVisibility = chunkStatusDiscriminator;
} }
@@ -36,8 +36,6 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f
- EntitySection<T> entitySection = this.sections.get(r); - EntitySection<T> entitySection = this.sections.get(r);
- if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) { - if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
- action.accept(entitySection); - action.accept(entitySection);
- }
- }
+ int minX = SectionPos.posToSectionCoord(box.minX - 2.0D); + int minX = SectionPos.posToSectionCoord(box.minX - 2.0D);
+ int minY = SectionPos.posToSectionCoord(box.minY - 2.0D); + int minY = SectionPos.posToSectionCoord(box.minY - 2.0D);
+ int minZ = SectionPos.posToSectionCoord(box.minZ - 2.0D); + int minZ = SectionPos.posToSectionCoord(box.minZ - 2.0D);
@@ -45,18 +43,39 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f
+ int maxY = SectionPos.posToSectionCoord(box.maxY + 2.0D); + int maxY = SectionPos.posToSectionCoord(box.maxY + 2.0D);
+ int maxZ = SectionPos.posToSectionCoord(box.maxZ + 2.0D); + int maxZ = SectionPos.posToSectionCoord(box.maxZ + 2.0D);
+ +
+ for (int x = minX; x <= maxX; x++) { + if (maxX >= minX + 4 || maxZ >= minZ + 4) {
+ for (int z = Math.max(minZ, 0); z <= maxZ; z++) { + // [VanillaCopy]
+ this.forEachInColumn(x, minY, maxY, z, action); + for(int o = minX; o <= maxX; ++o) {
+ long p = SectionPos.asLong(o, 0, 0);
+ long q = SectionPos.asLong(o, -1, -1);
+ LongIterator longIterator = this.sectionIds.subSet(p, q + 1L).iterator();
+
+ while(longIterator.hasNext()) {
+ long r = longIterator.nextLong();
+ int s = SectionPos.y(r);
+ int t = SectionPos.z(r);
+ if (s >= minY && s <= maxY && t >= minZ && t <= maxZ) {
+ EntitySection<T> entitySection = this.sections.get(r);
+ if (entitySection != null && !entitySection.isEmpty() && entitySection.getStatus().isAccessible()) {
+ action.accept(entitySection);
+ }
}
}
} }
+ } else {
+ for (int x = minX; x <= maxX; x++) {
+ for (int z = Math.max(minZ, 0); z <= maxZ; z++) {
+ this.forEachInColumn(x, minY, maxY, z, action);
+ }
+ +
+ int bound = Math.min(-1, maxZ); + int bound = Math.min(-1, maxZ);
+ for (int z = minZ; z <= bound; z++) { + for (int z = minZ; z <= bound; z++) {
+ this.forEachInColumn(x, minY, maxY, z, action); + this.forEachInColumn(x, minY, maxY, z, action);
+ }
+ } + }
+ } }
+ } + }
+
+ private void forEachInColumn(int x, int minY, int maxY, int z, Consumer<EntitySection<T>> action) { + private void forEachInColumn(int x, int minY, int maxY, int z, Consumer<EntitySection<T>> action) {
+ //y from negative to positive, but y is treated as unsigned + //y from negative to positive, but y is treated as unsigned
+ for (int y = Math.max(minY, 0); y <= maxY; y++) { + for (int y = Math.max(minY, 0); y <= maxY; y++) {
@@ -65,9 +84,9 @@ index 74210dc2eef63da7360b1f833bb59b278419fb2b..c3826f82bdf72a03b1f8ce61d0f75e4f
+ int bound = Math.min(-1, maxY); + int bound = Math.min(-1, maxY);
+ for (int y = minY; y <= bound; y++) { + for (int y = minY; y <= bound; y++) {
+ this.consumeSection(SectionPos.asLong(x, y, z), action); + this.consumeSection(SectionPos.asLong(x, y, z), action);
} + }
+ } + }
+
+ private void consumeSection(long pos, Consumer<EntitySection<T>> action) { + private void consumeSection(long pos, Consumer<EntitySection<T>> action) {
+ EntitySection<T> section = this.getSection(pos); + EntitySection<T> section = this.getSection(pos);
+ if (section != null && 0 != section.size() && section.getStatus().isAccessible()) { + if (section != null && 0 != section.size() && section.getStatus().isAccessible()) {

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cd08f9b16c065be8f0eacaeba51d3e72d332daf9..c1156377bb9314241772ba5e4f458915bba84d47 100644 index 7a0c1ba40156df69bbbf36d96bed0950130d2351..133286cae44d984c5cd91302b94b9bfa9a32401d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -487,7 +487,13 @@ public abstract class PlayerList { @@ -487,7 +487,13 @@ public abstract class PlayerList {

View File

@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 364ecdbe5bbe837b76451bb032fc52f41d8e0dca..96c6ef03a64e425472c64884c91ac4951950362b 100644 index a98d115b7dccd836fa2c0f50333730db6f388aff..39666d538ea0d87a4defa6f5a00a062ec0d3027b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -115,8 +115,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -116,8 +116,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public static final int TICKS_PER_DAY = 24000; public static final int TICKS_PER_DAY = 24000;
public static final int MAX_ENTITY_SPAWN_Y = 20000000; public static final int MAX_ENTITY_SPAWN_Y = 20000000;
public static final int MIN_ENTITY_SPAWN_Y = -20000000; public static final int MIN_ENTITY_SPAWN_Y = -20000000;

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c1156377bb9314241772ba5e4f458915bba84d47..29fafe94b0d42f84af810b9ec9d78e2913970d1d 100644 index 133286cae44d984c5cd91302b94b9bfa9a32401d..e4c5521ecc421bbf7150d08c5961d484cb02bd0f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -747,13 +747,19 @@ public abstract class PlayerList { @@ -747,13 +747,19 @@ public abstract class PlayerList {
@@ -31,7 +31,7 @@ index c1156377bb9314241772ba5e4f458915bba84d47..29fafe94b0d42f84af810b9ec9d78e29
//chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper
//event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 08ec8433931fc4347b4e679b9359895ade82d7f6..e630c5a97fae9db6b85d6d0e66cf4c261b2f2138 100644 index 8982562721c3a5a5a3305e90bd8b5bc21585a425..db22fc485e6091bd81c0c369f302c6ffb4157448 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java --- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java +++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -73,9 +73,14 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> { @@ -73,9 +73,14 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {

View File

@@ -20,7 +20,7 @@ index 20cfe7b9b7127ddeb97aa91d759fc17b4a548eaf..34665a768285fd99e49d57d3879deb1f
private long lastFill = -1; private long lastFill = -1;
private long nextRefill = -1; private long nextRefill = -1;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 663ab7f3c2e7514c211f01114aa8869f24615da0..5830bda766ea88bb45096d900afe76600ce2f9e0 100644 index 1d5cee5cae732fbe9181cb3cecc68ec980257248..babc3235c8e7d1e45c21e42184a4c1a13485d950 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -415,7 +415,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -415,7 +415,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -46,7 +46,7 @@ index 62f26f5d3ef5546f26424185e378fea64c08ce2f..54559b015813ca1c5dae9cb229a4a63f
double d1 = (double) (center.y - maxRange); double d1 = (double) (center.y - maxRange);
double d2 = (double) (center.x + maxRange); double d2 = (double) (center.x + maxRange);
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7b23535a680d2a8534dcb8dd87770f66fb982c13..5e9c7f428e4a0d920569c2a02e999da910fc9397 100644 index 470dbed47830e2f580c090bc762a7be5cf389ce5..1912e5a0db7f15e21028ef80e19623900c655f4a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -368,7 +368,7 @@ public class ServerPlayer extends Player { @@ -368,7 +368,7 @@ public class ServerPlayer extends Player {
@@ -207,10 +207,10 @@ index 97f99a06b8954b08af9f4156abe8abdad359349a..e0e27004d67fd759903645cff8a491e5
this.hitPlayers = Maps.newHashMap(); this.hitPlayers = Maps.newHashMap();
this.level = world; this.level = world;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 96c6ef03a64e425472c64884c91ac4951950362b..1b6fc6511c32e6509f773d5259e7a07c3b8e79bf 100644 index 39666d538ea0d87a4defa6f5a00a062ec0d3027b..2bc690b1ed94a998b30e313922ab889aaa262416 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -123,13 +123,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -124,13 +124,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Thread thread; public final Thread thread;
private final boolean isDebug; private final boolean isDebug;
private int skyDarken; private int skyDarken;
@@ -253,7 +253,7 @@ index d33af84300db18ea2b71dba2c9ed43390a293500..e60d244c44396ec09ecff889d8b9543b
MinecraftServer minecraftServer = this.level.getServer(); MinecraftServer minecraftServer = this.level.getServer();
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 5fb475b3ccaa98861e2c817b37cd1740e5bfed8d..e8c5c0c6e05194707db35246444e4a44878a227b 100644 index c0e1d53f41bf8ed0de8cca901ea75483bbada3bc..49a994091ee574aa6f7927f1a519a24fdd2c3ec7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -231,7 +231,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { @@ -231,7 +231,7 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View File

@@ -57,10 +57,10 @@ index babc3235c8e7d1e45c21e42184a4c1a13485d950..8d511ce78d6a7d305cb158482ebe3946
private void updateStatusIcon(ServerStatus metadata) { private void updateStatusIcon(ServerStatus metadata) {
Optional<File> optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile); Optional<File> optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile);
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 99a86acedeed4aede7e7afc7e9ee122b78201c7e..4c853c5fd3251c177d31048df545ed55f57cc6ee 100644 index addf249717b5271b664f4a9d28dd6cc177db5688..d63d923562878e00cd0c95d3b46a11ee68932011 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -1276,10 +1276,12 @@ public class ServerChunkCache extends ChunkSource { @@ -1264,10 +1264,12 @@ public class ServerChunkCache extends ChunkSource {
return runnable; return runnable;
} }

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Don't create new random instance
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 5e9c7f428e4a0d920569c2a02e999da910fc9397..0011192cdba6dcb7ca125ae4a49ca89a93cc40f2 100644 index 1912e5a0db7f15e21028ef80e19623900c655f4a..cd6c398e9cc12b24ffbb30ff1665c92a0d1a1051 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -368,7 +368,7 @@ public class ServerPlayer extends Player { @@ -368,7 +368,7 @@ public class ServerPlayer extends Player {
@@ -40,10 +40,10 @@ index f42bce03c21309efbb208be21263b6c09927ed6c..711d5dc2a8b3a5f2a2a35cab59b5ecfd
} }
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 1b6fc6511c32e6509f773d5259e7a07c3b8e79bf..bda7ec47f0a91055a4e86b8968c695a71c2c95aa 100644 index 2bc690b1ed94a998b30e313922ab889aaa262416..023c9da96e0269bd5082baf5a34d0dbe79d1450b 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -123,13 +123,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -124,13 +124,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Thread thread; public final Thread thread;
private final boolean isDebug; private final boolean isDebug;
private int skyDarken; private int skyDarken;

View File

@@ -7,10 +7,10 @@ Original code by Titaniumtown, licensed under GNU General Public License v3.0
You can find the original code on https://gitlab.com/Titaniumtown/JettPack You can find the original code on https://gitlab.com/Titaniumtown/JettPack
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index bda7ec47f0a91055a4e86b8968c695a71c2c95aa..980c34a1b816e9c57e31255465626192f96ae147 100644 index 023c9da96e0269bd5082baf5a34d0dbe79d1450b..3fc2177553756d6759ccf72aa10f7be0eb07df85 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -173,8 +173,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -174,8 +174,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final co.aikar.timings.WorldTimingsHandler timings; // Paper public final co.aikar.timings.WorldTimingsHandler timings; // Paper
public static BlockPos lastPhysicsProblem; // Spigot public static BlockPos lastPhysicsProblem; // Spigot
@@ -21,7 +21,7 @@ index bda7ec47f0a91055a4e86b8968c695a71c2c95aa..980c34a1b816e9c57e31255465626192
private int tileTickPosition; private int tileTickPosition;
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
@@ -400,8 +400,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -401,8 +401,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// CraftBukkit end // CraftBukkit end
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java 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 b470da69f271d1a5ebb9727c0c34944e85ce3a51..633a27ec48a7bb208a7a1629d2b6079a7da27518 100644 index 35c39aed9583275ef25d32c783715798b52bdb63..6bff63c5897ffd24eeb0dba8a8bfabc38e6b21ee 100644
--- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
+++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java
@@ -24,6 +24,7 @@ public class PlayerDataStorage { @@ -24,6 +24,7 @@ public class PlayerDataStorage {

View File

@@ -7,10 +7,10 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index 6a8786790cfeb4373d23d7e743f06b19efa45c35..6e66a19c1c9ce284359e3b65552df68a40804aab 100644 index e7f677cb5abb24c52b10087837f44c865140635c..c501ffbd1f49b2da666888bc7737b1370befe07b 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -106,6 +106,7 @@ relocation { @@ -113,6 +113,7 @@ relocation {
relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") { relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") {
exclude("org.bukkit.craftbukkit.Main*") exclude("org.bukkit.craftbukkit.Main*")
} }

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 99cb51ad54f7a6ed63d392070a7dd6903c1676de..8e02bfa3a4530326d32c01bd4948b307cc4a6923 100644 index 19fb9fe02ef029aecec00dc02f72a2b4a2cda48b..e945a82a23e16820866b899d1b79b4fafe6945dc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1200,6 +1200,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab @@ -1200,6 +1200,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab

View File

@@ -7,7 +7,7 @@ Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 2cb12547c778fe439536e2e2aa479d4a25ab4a6e..073dae1f61c0fa6b5431b15af8c3cb8f50a73928 100644 index cb35f2f1f2f4d568bc59ce5c08ab3b908533264c..9fc769d019cedee1f6014e5db45180b2259743c6 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -319,7 +319,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser

View File

@@ -7,10 +7,10 @@ Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index c66bdf07917a3dae95085d4c33bc37a238b6492e..dcf959b7627b1d2aa30afc7cc87a7ce14102d7e2 100644 index 3fc2177553756d6759ccf72aa10f7be0eb07df85..2a4e420cb272eeb4fefe7545b2d8d7e13a7ceb6c 100644
--- a/src/main/java/net/minecraft/world/level/Level.java --- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -900,7 +900,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -901,7 +901,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) { public void neighborChanged(BlockPos pos, Block sourceBlock, BlockPos neighborPos) {
if (!this.isClientSide) { if (!this.isClientSide) {
@@ -21,7 +21,7 @@ index c66bdf07917a3dae95085d4c33bc37a238b6492e..dcf959b7627b1d2aa30afc7cc87a7ce1
try { try {
// CraftBukkit start // CraftBukkit start
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 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 101763868fcfa8f0e428b3b7f36983d21d20f9ff..95746873cfc8e624a39d3793ad5d934efc3b7e84 100644 index eac017fc521bfd1391e75db8628f42b28329d681..bd482fa127c554d71c9293ef13bbdb4c940320be 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -965,7 +965,8 @@ public abstract class BlockBehaviour { @@ -965,7 +965,8 @@ public abstract class BlockBehaviour {

View File

@@ -7,7 +7,7 @@ Original code by Starlis, licensed under GNU General Public License v3.0
You can find the original code on https://github.com/starlis/empirecraft You can find the original code on https://github.com/starlis/empirecraft
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 4d0f9131d1bad591b96b2156bd870447104b5a30..df73c89d23634ee81cc845a9e95b12cf2fdfd6b2 100644 index 66f808cabcf6a9a6584849b285f1c60133adc7b4..c38be29d0d9f42181e5c7bcbed68b2bdb8bc5a16 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -174,9 +174,9 @@ public final class ItemStack { @@ -174,9 +174,9 @@ public final class ItemStack {

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur You can find the original code on https://github.com/PurpurMC/Purpur
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 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 6278115e3511fe2176b29122e2c733498f31bb5a..bb3253bc4a0356394cdc06e5e6eb7a2f6c38c61c 100644 index bc028de0ac71e69e8d714db5f65286f306544bf1..500a4013ce525c0474fe3991457d4c2a50ceb7ed 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -176,6 +176,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { @@ -176,6 +176,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 4fa44b576404438d08085e1d8c82fa96206eae50..042985988d11ca9f1bf6a62ec0622392c6e9b99f 100644 index e80176708db486190dd527e3ade5fc690ceb39f7..2d0c8d6f8677e289befde5ada4ae702eed73754d 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -189,6 +189,7 @@ public class ServerEntity { @@ -189,6 +189,7 @@ public class ServerEntity {

View File

@@ -19,7 +19,7 @@ index 5209e0d076099516525f578ddbfe14064e67f235..789652eb317f6359358b3e8c9a6818e4
public void absMoveTo(double x, double y, double z) { public void absMoveTo(double x, double y, double z) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 5b0a904673db2eb98296807730ce9454b8740aa9..8987bd73727c7e4195a209bd3344474719bd6ca8 100644 index 3236a1dc51c394b784d3f42b78e76bf7c2f69c37..5e0dec96d04c925108210a470a2c2671470de897 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2923,7 +2923,7 @@ public abstract class LivingEntity extends Entity { @@ -2923,7 +2923,7 @@ public abstract class LivingEntity extends Entity {

View File

@@ -29,7 +29,7 @@ index fa56cd09102a89692b42f1d14257990508c5c720..f9251183df72ddc56662fd3f02acf216
setListData(vector); setListData(vector);
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8e02bfa3a4530326d32c01bd4948b307cc4a6923..8595b31137db798b6ae8969970e607459593d39d 100644 index e945a82a23e16820866b899d1b79b4fafe6945dc..eaf775072e4782db6f05d12b7c8e4184d13c661e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -303,7 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab @@ -303,7 +303,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab

View File

@@ -7,7 +7,7 @@ Original code by PurpurMC, licensed under MIT
You can find the original code on https://github.com/PurpurMC/Purpur You can find the original code on https://github.com/PurpurMC/Purpur
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0011192cdba6dcb7ca125ae4a49ca89a93cc40f2..ade6a3d0e90e8c82e3e90bd2d12369ccd0760eca 100644 index cd6c398e9cc12b24ffbb30ff1665c92a0d1a1051..8eabffbfa852773c28702c2c2dd3b124b24e8ae2 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1140,6 +1140,7 @@ public class ServerPlayer extends Player { @@ -1140,6 +1140,7 @@ public class ServerPlayer extends Player {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] PaperPR Optimize despawn when no player is on range
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index def1aadb3002441b34bebb24cf727b1b91a688ba..d696bbb44994994af87ee0df5317ca94d20cb74c 100644 index 35ff7abd8251b0af6c23fbb63804db632ec5b85d..b101e0b234c9cef315f871b880c1dcb3647d5ff6 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -796,9 +796,6 @@ public abstract class Mob extends LivingEntity { @@ -796,9 +796,6 @@ public abstract class Mob extends LivingEntity {

View File

@@ -7,7 +7,7 @@ Original code by Cryptite, licensed under MIT
You can find the original code on https://github.com/Cryptite/Slice You can find the original code on https://github.com/Cryptite/Slice
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8987bd73727c7e4195a209bd3344474719bd6ca8..d0fb41d5c1b7a4cc0d5f554ec20dfc5ecb3a0058 100644 index 5e0dec96d04c925108210a470a2c2671470de897..ce1872b69ed6162f4bbab6c839fa8b9cd1d2aa9a 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3040,7 +3040,7 @@ public abstract class LivingEntity extends Entity { @@ -3040,7 +3040,7 @@ public abstract class LivingEntity extends Entity {

View File

@@ -133,7 +133,7 @@ index 2e2bfccfc6cec6582a5b595e0343c27be5267b7a..e97d4081e37b82019dbc90ae6c53b868
} }
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 042985988d11ca9f1bf6a62ec0622392c6e9b99f..756d4a9f7e2be49076af43212a7c1126e28a11fc 100644 index 2d0c8d6f8677e289befde5ada4ae702eed73754d..fca77df27456c0dea9ed8bc15884ac6211508504 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java --- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -389,7 +389,19 @@ public class ServerEntity { @@ -389,7 +389,19 @@ public class ServerEntity {

View File

@@ -32,7 +32,7 @@ index a544db042c8d2ecec8d323770552c4f10ca758a6..c04da8da5b40430b61972bce32cec4e8
public int size() { public int size() {
diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
index 68e89dbd79171627046e89699057964e44c40e7d..a92b902e7b2f913f2e7042f53f6b0290dbf0a994 100644 index 68e89dbd79171627046e89699057964e44c40e7d..eeb4d25f2e6cf62dee4f81d6852dcf09aeefd3ff 100644
--- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java --- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
+++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java
@@ -3,15 +3,25 @@ package net.minecraft.world.phys.shapes; @@ -3,15 +3,25 @@ package net.minecraft.world.phys.shapes;
@@ -47,9 +47,9 @@ index 68e89dbd79171627046e89699057964e44c40e7d..a92b902e7b2f913f2e7042f53f6b0290
protected CubeVoxelShape(DiscreteVoxelShape voxels) { protected CubeVoxelShape(DiscreteVoxelShape voxels) {
super(voxels); super(voxels);
+ // JettPack start - lithium: shapes.precompute_shape_arrays + // JettPack start - lithium: shapes.precompute_shape_arrays
+ this.list = new DoubleList[me.titaniumtown.Constants.ALL_Direction.length]; + this.list = new DoubleList[Direction.Axis.values().length];
+ +
+ for (Direction.Axis axis : me.titaniumtown.Constants.ALL_AXIS_Direction) { + for (Direction.Axis axis : Direction.Axis.values()) {
+ this.list[axis.ordinal()] = new CubePointRange(voxels.getSize(axis)); + this.list[axis.ordinal()] = new CubePointRange(voxels.getSize(axis));
+ } + }
+ // JettPack end + // JettPack end

View File

@@ -1,19 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Thu, 23 Dec 2021 23:59:12 -0500
Subject: [PATCH] PaperPR Fix entity position desync
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 756d4a9f7e2be49076af43212a7c1126e28a11fc..ab0ec6d91694abb836a70e7ce2971f63913a53f6 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -164,7 +164,7 @@ public class ServerEntity {
}
// CraftBukkit end
- if (this.tickCount > 0 || this.entity instanceof AbstractArrow) {
+ if (this.tickCount >= 0 || this.entity instanceof AbstractArrow) {
// Paper start - remove allocation of Vec3D here
long k = ClientboundMoveEntityPacket.entityToPacket(vec3d_dx);
long l = ClientboundMoveEntityPacket.entityToPacket(vec3d_dy);

View File

@@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..da81a142d2b072f846f9905a0d5b8e29
+} +}
\ No newline at end of file \ No newline at end of file
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index 7764b1f86aca33dc227bf4357c20839b8820eb67..2e141e7b85ef54a084698b5a920b85212271fce8 100644 index c0d123bff1825366c30aadd3ad8a7fde68ef74e4..d248c83016c8dbd5573c615335a390235003cbe0 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -725,12 +725,12 @@ public class PaperCommand extends Command { @@ -725,12 +725,12 @@ public class PaperCommand extends Command {
@@ -126,7 +126,7 @@ index 88f10d729aa1e0a01790521821d691a0ecd373a2..df2c8dffd626eab0e03b1b62940a52fa
// Paper end // Paper end
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e9777c0d9c0de9378951fb08155409a3dfcc9958..d0a3dac7920d309eefdb72e888817f282662bf0a 100644 index ce1872b69ed6162f4bbab6c839fa8b9cd1d2aa9a..05490f66d645a61e74c3fda6c757ed03803dbd1d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1470,7 +1470,7 @@ public abstract class LivingEntity extends Entity { @@ -1470,7 +1470,7 @@ public abstract class LivingEntity extends Entity {

View File

@@ -9,7 +9,7 @@ list is only used in the tick and tickPassenger methods, so we can safely not ad
markers to it. markers to it.
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
index 2e141e7b85ef54a084698b5a920b85212271fce8..6b843f9fba6c26b1581be114d6f255a655cde411 100644 index d248c83016c8dbd5573c615335a390235003cbe0..1bdffb061c9ba08160f35a8c56582f575fea6903 100644
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
@@ -614,7 +614,7 @@ public class PaperCommand extends Command { @@ -614,7 +614,7 @@ public class PaperCommand extends Command {
@@ -22,7 +22,7 @@ index 2e141e7b85ef54a084698b5a920b85212271fce8..6b843f9fba6c26b1581be114d6f255a6
} }
}); });
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a0857991d64d89874fea552a5459a45f14529034..b836f61a7b5490dea6a531a7e7342ff986194485 100644 index 59d57108f38f38e03cd8b69a53c3e9d40179599a..a7ac129b754f8aa2c96606c88685caf3a32dc8a2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2408,6 +2408,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2408,6 +2408,7 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@@ -2067,7 +2067,7 @@ index d7dcf36c8c972e30320c56e447822cf26f6d5fb3..d7913e8ce46b38d9e2e345c33ecf63f6
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b836f61a7b5490dea6a531a7e7342ff986194485..fd50a81c6cce512e5c7fa47f5e6ab7ab131c575c 100644 index a7ac129b754f8aa2c96606c88685caf3a32dc8a2..fc1e584ade36bf2c21c34f6a41b5a6ae8eb5d350 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -161,9 +161,14 @@ import org.bukkit.event.weather.LightningStrikeEvent; @@ -161,9 +161,14 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@@ -2184,7 +2184,7 @@ index f6b8df3493a902c1b8d0d5fe81d593f63ba464d1..334d065b953590d6eba6e853cd9938a1
public static final BooleanProperty INVERTED = BlockStateProperties.INVERTED; public static final BooleanProperty INVERTED = BlockStateProperties.INVERTED;
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D); protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D);
diff --git a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java 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 14db3ab0eaa3b3a259366a6ca73026bf07ddfed8..b1fd5adb98e5b9c6f0798c65c0c83af879acc46f 100644 index 9c764d2273d70b8dffcaa7f324544cb48f12acc3..63adeacd5f05e56cebca89ac2c2fba221dc60607 100644
--- a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java --- a/src/main/java/net/minecraft/world/level/block/DiodeBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DiodeBlock.java
@@ -22,6 +22,18 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit @@ -22,6 +22,18 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
@@ -2317,7 +2317,7 @@ index 0afffc33f3be221a28c62115f493808aeffb1bd8..eb792a5d16826bbed2c9b4d306b9eed0
public boolean isSignalSource(BlockState state) { public boolean isSignalSource(BlockState state) {
return true; return true;
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java 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 ec89c162ad7de9d1647934efd02b2581b4689a6d..e1cd41d548115aea464aa11fb5e50021f6a3b4a4 100644 index 037330bcb10039c013b2ed5fd68dee16ede20fbe..9f150a0075544f2e777f0efd5dbb82746b0fa3d0 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java --- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -39,8 +39,82 @@ import net.minecraft.world.phys.shapes.CollisionContext; @@ -39,8 +39,82 @@ import net.minecraft.world.phys.shapes.CollisionContext;
@@ -2506,7 +2506,7 @@ index ec89c162ad7de9d1647934efd02b2581b4689a6d..e1cd41d548115aea464aa11fb5e50021
@Override @Override
diff --git a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java 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 93a2dade36a08a17eae34181f087114eca706872..b592b13fc2119100c53a7092acee2ae24616f24c 100644 index 954b86bea345a8e0e3a8dd425f356db6f5cd496f..6b18f1947df9ddc427ec8deb2890592ae61d621c 100644
--- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java --- a/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java +++ b/src/main/java/net/minecraft/world/level/block/RedstoneTorchBlock.java
@@ -20,6 +20,18 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit @@ -20,6 +20,18 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit

View File

@@ -1,153 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Etil <81570777+etil2jz@users.noreply.github.com>
Date: Thu, 6 Jan 2022 18:48:10 +0100
Subject: [PATCH] Add `new Object[0]` to `reduce allocs`
diff --git a/src/main/java/me/titaniumtown/Constants.java b/src/main/java/me/titaniumtown/Constants.java
index 9ede2f067eacc1d418a8d6223f4052b81410d3b3..13a710a6d517a229b8c5679f40cffa3924dc791b 100644
--- a/src/main/java/me/titaniumtown/Constants.java
+++ b/src/main/java/me/titaniumtown/Constants.java
@@ -19,4 +19,5 @@ public final class Constants {
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 Object[] EMPTY_object_arr = new Object[0];
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 7b8f9cf06833860d0fc02399822e6aea214883ed..1caa987e2f03203379fb2f798d38d2240665fa00 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -304,7 +304,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
public void setListener(PacketListener listener) {
- Validate.notNull(listener, "packetListener", new Object[0]);
+ Validate.notNull(listener, "packetListener", me.titaniumtown.Constants.EMPTY_object_arr);
this.packetListener = listener;
}
// Paper start
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 79936ad8196846e187f8153c15cd8a3e21380876..cb074736f3d547fa188c65da0db7a344ec5f7fa9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1442,8 +1442,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnab
try {
BufferedImage bufferedimage = ImageIO.read(file);
- Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", new Object[0]);
- Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", new Object[0]);
+ Validate.validState(bufferedimage.getWidth() == 64, "Must be 64 pixels wide", me.titaniumtown.Constants.EMPTY_object_arr);
+ Validate.validState(bufferedimage.getHeight() == 64, "Must be 64 pixels high", me.titaniumtown.Constants.EMPTY_object_arr);
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
ImageIO.write(bufferedimage, "PNG", bytearrayoutputstream);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8d50853d35f2d880bf8eb17ea0780dc2c9b1a367..9e352acd099d61d4e523ee895f658f50dada3e6f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -378,7 +378,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
- this.disconnect(new TranslatableComponent("disconnect.timeout", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
+ this.disconnect(new TranslatableComponent("disconnect.timeout", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.TIMEOUT); // Paper - kick event cause
}
} else {
if (elapsedTime >= 15000L) { // 15 seconds
@@ -815,13 +815,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async
// CraftBukkit start
if (this.chatSpamTickCount.addAndGet(com.destroystokyo.paper.PaperConfig.tabSpamIncrement) > com.destroystokyo.paper.PaperConfig.tabSpamLimit && !this.server.getPlayerList().isOp(this.player.getGameProfile())) { // Paper start - split and make configurable
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper start
String str = packet.getCommand(); int index = -1;
if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) {
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
// Paper end
@@ -2949,7 +2949,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (recipeSpamPackets.addAndGet(com.destroystokyo.paper.PaperConfig.autoRecipeIncrement) > com.destroystokyo.paper.PaperConfig.autoRecipeLimit) {
- server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
+ server.scheduleOnMain(() -> this.disconnect(new TranslatableComponent("disconnect.spam", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM)); // Paper - kick event cause
return;
}
}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 6006b9b824eee427712c5eafc67788982fc64936..a53f2210409410ba2b0edbd479ed8ab21fc8e5a9 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -255,7 +255,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@Override
public void handleHello(ServerboundHelloPacket packet) {
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]);
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", me.titaniumtown.Constants.EMPTY_object_arr);
this.gameProfile = packet.getGameProfile();
// Paper start - validate usernames
if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) {
@@ -299,7 +299,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@Override
public void handleKey(ServerboundKeyPacket packet) {
- Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", new Object[0]);
+ Validate.validState(this.state == ServerLoginPacketListenerImpl.State.KEY, "Unexpected key packet", me.titaniumtown.Constants.EMPTY_object_arr);
PrivateKey privatekey = this.server.getKeyPair().getPrivate();
final String s;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4feddab26597b67edc4f79e10d41a88d96f16b37..ddd687336a727b164b5f4c566e02b3ad50b26dad 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -316,7 +316,7 @@ public abstract class PlayerList {
}
void disconnectPendingPlayer(ServerPlayer entityplayer) {
- TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]);
+ TranslatableComponent msg = new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr);
entityplayer.networkManager.send(new ClientboundDisconnectPacket(msg), (future) -> {
entityplayer.networkManager.disconnect(msg);
entityplayer.networkManager = null;
@@ -730,7 +730,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
entityplayer = (ServerPlayer) iterator.next();
this.save(entityplayer); // CraftBukkit - Force the player's inventory to be saved
- entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", new Object[0]), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
+ entityplayer.connection.disconnect(new TranslatableComponent("multiplayer.disconnect.duplicate_login", me.titaniumtown.Constants.EMPTY_object_arr), org.bukkit.event.player.PlayerKickEvent.Cause.DUPLICATE_LOGIN); // Paper - kick event cause
}
// Instead of kicking then returning, we need to store the kick reason
diff --git a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
index 049d750d3af991dd14ac8cf644330404e74b2151..f965d6751c8f5a8ec4b26e6ac65414540345b04a 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/WeakCollection.java
@@ -166,7 +166,7 @@ public final class WeakCollection<T> implements Collection<T> {
@Override
public Object[] toArray() {
- return this.toArray(new Object[0]);
+ return this.toArray(me.titaniumtown.Constants.EMPTY_object_arr);
}
@Override
diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
index bf4c622735bf1f4ae190329465426dac6d178c0d..a4b760c8e001545d519b977aeb474222c5bd2c66 100644
--- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemStackTest.java
@@ -310,7 +310,7 @@ public class ItemStackTest extends AbstractTestingBase {
return ImmutableList.of(); // TODO, test basic durability issues
}
- static final Object[][] EMPTY_ARRAY = new Object[0][];
+ static final Object[][] EMPTY_ARRAY = me.titaniumtown.Constants.EMPTY_object_arr[];
/**
* Materials that generate unique item meta types.
*/

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d0a3dac7920d309eefdb72e888817f282662bf0a..30fdf60cf255414f5efe8d842f291f74892629bc 100644 index 05490f66d645a61e74c3fda6c757ed03803dbd1d..bb033fa7fa99b3c1d47d5e48ba361d9bf69bfb48 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3370,6 +3370,8 @@ public abstract class LivingEntity extends Entity { @@ -3370,6 +3370,8 @@ public abstract class LivingEntity extends Entity {

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fd50a81c6cce512e5c7fa47f5e6ab7ab131c575c..91317d79ce86368aa1826cafe7fa0de41b04a569 100644 index fc1e584ade36bf2c21c34f6a41b5a6ae8eb5d350..68854fa91cb9558256b819aaa2a51de6f84b0803 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -220,6 +220,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -220,6 +220,13 @@ public class ServerLevel extends Level implements WorldGenLevel {

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 30fdf60cf255414f5efe8d842f291f74892629bc..2b84a6a38459b715a415a183ca40697d4f8fbf72 100644 index bb033fa7fa99b3c1d47d5e48ba361d9bf69bfb48..60384a8ff1d60be7a02dfb5d81864085a554ee3c 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2419,6 +2419,8 @@ public abstract class LivingEntity extends Entity { @@ -2419,6 +2419,8 @@ public abstract class LivingEntity extends Entity {

View File

@@ -9,7 +9,7 @@ Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings) You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2c6a71f55 100644 index 765b56776e457109ddea9f7dbfd0b17beefee51e..8a9783a15e1bd1a1c82ec221d662f71cd71f8371 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java --- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java +++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
@@ -11,6 +11,27 @@ public final class ImprovedNoise { @@ -11,6 +11,27 @@ public final class ImprovedNoise {
@@ -92,7 +92,7 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2
public double noiseWithDerivative(double x, double y, double z, double[] ds) { public double noiseWithDerivative(double x, double y, double z, double[] ds) {
double d = x + this.xo; double d = x + this.xo;
@@ -84,26 +109,141 @@ public final class ImprovedNoise { @@ -84,26 +109,107 @@ public final class ImprovedNoise {
return this.p[hash & 255] & 255; return this.p[hash & 255] & 255;
} }
@@ -185,38 +185,14 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2
+ final double var60 = localX - 1.0; + final double var60 = localX - 1.0;
+ final double var61 = localY - 1.0; + final double var61 = localY - 1.0;
+ final double var62 = localZ - 1.0; + final double var62 = localZ - 1.0;
+ final double var63 = var36 * localX; + final double var87 = var36 * localX + var37 * localY + var38 * localZ;
+ final double var64 = var37 * localY; + final double var88 = var39 * var60 + var40 * localY + var41 * localZ;
+ final double var65 = var38 * localZ; + final double var89 = var42 * localX + var43 * var61 + var44 * localZ;
+ final double var66 = var39 * var60; + final double var90 = var45 * var60 + var46 * var61 + var47 * localZ;
+ final double var67 = var40 * localY; + final double var91 = var48 * localX + var49 * localY + var50 * var62;
+ final double var68 = var41 * localZ; + final double var92 = var51 * var60 + var52 * localY + var53 * var62;
+ final double var69 = var42 * localX; + final double var93 = var54 * localX + var55 * var61 + var56 * var62;
+ final double var70 = var43 * var61; + final double var94 = var57 * var60 + var58 * var61 + var59 * var62;
+ final double var71 = var44 * localZ;
+ final double var72 = var45 * var60;
+ final double var73 = var46 * var61;
+ final double var74 = var47 * localZ;
+ final double var75 = var48 * localX;
+ final double var76 = var49 * localY;
+ final double var77 = var50 * var62;
+ final double var78 = var51 * var60;
+ final double var79 = var52 * localY;
+ final double var80 = var53 * var62;
+ final double var81 = var54 * localX;
+ final double var82 = var55 * var61;
+ final double var83 = var56 * var62;
+ final double var84 = var57 * var60;
+ final double var85 = var58 * var61;
+ final double var86 = var59 * var62;
+ final double var87 = var63 + var64 + var65;
+ final double var88 = var66 + var67 + var68;
+ final double var89 = var69 + var70 + var71;
+ final double var90 = var72 + var73 + var74;
+ final double var91 = var75 + var76 + var77;
+ final double var92 = var78 + var79 + var80;
+ final double var93 = var81 + var82 + var83;
+ final double var94 = var84 + var85 + var86;
+ +
+ final double var95 = localX * 6.0 - 15.0; + final double var95 = localX * 6.0 - 15.0;
+ final double var96 = fadeLocalX * 6.0 - 15.0; + final double var96 = fadeLocalX * 6.0 - 15.0;
@@ -228,21 +204,11 @@ index 765b56776e457109ddea9f7dbfd0b17beefee51e..883a8dcf94b619cd5ffbcfc6f28809c2
+ final double var102 = fadeLocalX * fadeLocalX * fadeLocalX * var99; + final double var102 = fadeLocalX * fadeLocalX * fadeLocalX * var99;
+ final double var103 = localZ * localZ * localZ * var100; + final double var103 = localZ * localZ * localZ * var100;
+ +
+ final double var104 = var90 - var89; + final double var113 = var87 + var101 * (var88 - var87);
+ final double var105 = var88 - var87; + final double var114 = var93 + var101 * (var94 - var93);
+ final double var106 = var94 - var93; + final double var115 = var91 + var101 * (var92 - var91);
+ final double var107 = var92 - var91;
+ final double var108 = var101 * var104;
+ final double var109 = var101 * var105;
+ final double var110 = var101 * var106;
+ final double var111 = var101 * var107;
+ final double var112 = var89 + var108;
+ final double var113 = var87 + var109;
+ final double var114 = var93 + var110;
+ final double var115 = var91 + var111;
+ final double var116 = var112 - var113;
+ final double var117 = var114 - var115; + final double var117 = var114 - var115;
+ final double var118 = var102 * var116; + final double var118 = var102 * (var89 + var101 * (var90 - var89) - var113);
+ final double var119 = var102 * var117; + final double var119 = var102 * var117;
+ final double var120 = var113 + var118; + final double var120 = var113 + var118;
+ final double var121 = var115 + var119; + final double var121 = var115 + var119;

View File

@@ -7,7 +7,7 @@ Original code by CaffeineMC, licensed under GNU Lesser General Public License v3
You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings) You can find the original code on https://github.com/CaffeineMC/lithium-fabric (Yarn mappings)
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 2b84a6a38459b715a415a183ca40697d4f8fbf72..b7c6dd25e439d24719c8f663c7a448854dc6ee7a 100644 index 60384a8ff1d60be7a02dfb5d81864085a554ee3c..eab2a2daff86dbcdf5f2f63c6948d89033686118 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -564,11 +564,11 @@ public abstract class LivingEntity extends Entity { @@ -564,11 +564,11 @@ public abstract class LivingEntity extends Entity {

View File

@@ -8,7 +8,7 @@ You can find the original code on https://github.com/CaffeineMC/lithium-fabric (
diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java diff --git a/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..74057e9ccfb8b4bc6c44f64cfcde4f9429444bf2 index 0000000000000000000000000000000000000000..16debe176798f316c122e8e7aef2b50ecb9883a6
--- /dev/null --- /dev/null
+++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java +++ b/src/main/java/me/jellysquid/mods/lithium/common/world/chunk/LithiumHashPalette.java
@@ -0,0 +1,189 @@ @@ -0,0 +1,189 @@
@@ -201,6 +201,7 @@ index 0000000000000000000000000000000000000000..74057e9ccfb8b4bc6c44f64cfcde4f94
+ return new LithiumHashPalette<>(idList, bits, listener, list); + return new LithiumHashPalette<>(idList, bits, listener, list);
+ } + }
+} +}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java diff --git a/src/main/java/net/minecraft/util/BitStorage.java b/src/main/java/net/minecraft/util/BitStorage.java
index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f35dd200c 100644 index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f35dd200c 100644
--- a/src/main/java/net/minecraft/util/BitStorage.java --- a/src/main/java/net/minecraft/util/BitStorage.java
@@ -221,21 +222,22 @@ index 106610ccc74b70b557b01c61262d56c4f1147acf..fc986f02290fbe20246022072944980f
+ <T> void compact(Palette<T> srcPalette, Palette<T> dstPalette, short[] out); // JettPack - lithium: chunk.serialization + <T> void compact(Palette<T> srcPalette, Palette<T> dstPalette, short[] out); // JettPack - lithium: chunk.serialization
} }
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index 881a2318aac72526e0451688af58c620e4f525d1..d5ade4b516f41b58be87bcf33286e8e764c30068 100644 index 881a2318aac72526e0451688af58c620e4f525d1..cf5051f05f8bd387b20fd4dafcbe2a5fd9b7170c 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -3,6 +3,7 @@ package net.minecraft.util; @@ -2,6 +2,7 @@ package net.minecraft.util;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.apache.commons.lang3.Validate;
+import net.minecraft.world.level.chunk.Palette; // JettPack +import net.minecraft.world.level.chunk.Palette; // JettPack
import org.apache.commons.lang3.Validate;
public class SimpleBitStorage implements BitStorage { public class SimpleBitStorage implements BitStorage {
private static final int[] MAGIC = new int[]{-1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE, 0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756, 0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0, 390451572, 390451572, 0, 357913941, 357913941, 0, 330382099, 330382099, 0, 306783378, 306783378, 0, 286331153, 286331153, 0, Integer.MIN_VALUE, 0, 3, 252645135, 252645135, 0, 238609294, 238609294, 0, 226050910, 226050910, 0, 214748364, 214748364, 0, 204522252, 204522252, 0, 195225786, 195225786, 0, 186737708, 186737708, 0, 178956970, 178956970, 0, 171798691, 171798691, 0, 165191049, 165191049, 0, 159072862, 159072862, 0, 153391689, 153391689, 0, 148102320, 148102320, 0, 143165576, 143165576, 0, 138547332, 138547332, 0, Integer.MIN_VALUE, 0, 4, 130150524, 130150524, 0, 126322567, 126322567, 0, 122713351, 122713351, 0, 119304647, 119304647, 0, 116080197, 116080197, 0, 113025455, 113025455, 0, 110127366, 110127366, 0, 107374182, 107374182, 0, 104755299, 104755299, 0, 102261126, 102261126, 0, 99882960, 99882960, 0, 97612893, 97612893, 0, 95443717, 95443717, 0, 93368854, 93368854, 0, 91382282, 91382282, 0, 89478485, 89478485, 0, 87652393, 87652393, 0, 85899345, 85899345, 0, 84215045, 84215045, 0, 82595524, 82595524, 0, 81037118, 81037118, 0, 79536431, 79536431, 0, 78090314, 78090314, 0, 76695844, 76695844, 0, 75350303, 75350303, 0, 74051160, 74051160, 0, 72796055, 72796055, 0, 71582788, 71582788, 0, 70409299, 70409299, 0, 69273666, 69273666, 0, 68174084, 68174084, 0, Integer.MIN_VALUE, 0, 5};
@@ -201,4 +202,44 @@ public class SimpleBitStorage implements BitStorage { @@ -201,4 +202,44 @@ public class SimpleBitStorage implements BitStorage {
super(message); super(message);
} }
} }
-}
+ +
+ // JettPack start - lithium: chunk.serialization + // JettPack start - lithium: chunk.serialization
+ @Override + @Override
@@ -276,19 +278,20 @@ index 881a2318aac72526e0451688af58c620e4f525d1..d5ade4b516f41b58be87bcf33286e8e7
+ } + }
+ } + }
+ // JettPack end + // JettPack end
} +}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index 97c744508cc535418eba65fa722859c81c22d647..3558ce5dfb7bafff17b41ebad76b63c611c0b07d 100644 index 5d8e9bdf5538b19681f21949368d862fab8a89ad..2224245a985dfe78565dfdb42840d3ed43530525 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
@@ -3,6 +3,7 @@ package net.minecraft.util; @@ -2,6 +2,7 @@ package net.minecraft.util;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
import org.apache.commons.lang3.Validate;
+import net.minecraft.world.level.chunk.Palette; // JettPack +import net.minecraft.world.level.chunk.Palette; // JettPack
import org.apache.commons.lang3.Validate;
public class ZeroBitStorage implements BitStorage { public class ZeroBitStorage implements BitStorage {
public static final long[] RAW = me.titaniumtown.Constants.EMPTY_long_arr; // JettPack
@@ -72,4 +73,6 @@ public class ZeroBitStorage implements BitStorage { @@ -72,4 +73,6 @@ public class ZeroBitStorage implements BitStorage {
public BitStorage copy() { public BitStorage copy() {
return this; return this;
@@ -308,10 +311,10 @@ index acae3eb30e0689048937f479dc3070f0688abdad..9c2b79655f2c63a208c7087d5d897db0
int onResize(int newBits, T object); int onResize(int newBits, T object);
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b7775e1da 100644 index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..446592f9343fe005bf9a4055250efb1a8ba93fbd 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -22,8 +22,26 @@ import net.minecraft.util.Mth; @@ -22,8 +22,23 @@ import net.minecraft.util.Mth;
import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.SimpleBitStorage;
import net.minecraft.util.ThreadingDetector; import net.minecraft.util.ThreadingDetector;
import net.minecraft.util.ZeroBitStorage; import net.minecraft.util.ZeroBitStorage;
@@ -321,11 +324,9 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b
+ // JettPack start - lithium: chunk.serialization + // JettPack start - lithium: chunk.serialization
+ private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]); + private static final ThreadLocal<short[]> CACHED_ARRAY_4096 = ThreadLocal.withInitial(() -> new short[4096]);
+ private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]); + private static final ThreadLocal<short[]> CACHED_ARRAY_64 = ThreadLocal.withInitial(() -> new short[64]);
+
+ private Optional<LongStream> asOptional(long[] data) { + private Optional<LongStream> asOptional(long[] data) {
+ return Optional.of(Arrays.stream(data)); + return Optional.of(Arrays.stream(data));
+ } + }
+
+ private short[] getOrCreate(int size) { + private short[] getOrCreate(int size) {
+ return switch (size) { + return switch (size) {
+ case 64 -> CACHED_ARRAY_64.get(); + case 64 -> CACHED_ARRAY_64.get();
@@ -333,12 +334,11 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b
+ default -> new short[size]; + default -> new short[size];
+ }; + };
+ } + }
+
+ // JettPack end + // JettPack end
private static final int MIN_PALETTE_BITS = 0; private static final int MIN_PALETTE_BITS = 0;
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> { private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
return 0; return 0;
@@ -278,30 +296,54 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -278,30 +293,54 @@ public class PalettedContainer<T> implements PaletteResize<T> {
private synchronized PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) { // Paper - synchronize private synchronized PalettedContainer.DiscData<T> write(IdMap<T> idList, PalettedContainer.Strategy provider) { // Paper - synchronize
this.acquire(); this.acquire();
@@ -410,7 +410,7 @@ index eef1b58cfaf3cfa90f3786785dd94d050dfdd4c2..62defdcdaa15abea2b5bf796d7eb248b
} }
private static <T> void swapPalette(int[] is, IntUnaryOperator intUnaryOperator) { private static <T> void swapPalette(int[] is, IntUnaryOperator intUnaryOperator) {
@@ -333,17 +375,37 @@ public class PalettedContainer<T> implements PaletteResize<T> { @@ -333,17 +372,37 @@ public class PalettedContainer<T> implements PaletteResize<T> {
} }
public void count(PalettedContainer.CountConsumer<T> counter) { public void count(PalettedContainer.CountConsumer<T> counter) {

View File

@@ -1,180 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: ishland <ishlandmc@yeah.net>
Date: Tue, 21 Sep 2021 10:37:45 +0200
Subject: [PATCH] c2me: vectorizations.vectorize_noise
Copyright (c) 2021-2022 ishland
Original code by RelativityMC, licensed under MIT
You can find the original code on https://github.com/RelativityMC/C2ME-fabric (Yarn mappings)
diff --git a/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java
new file mode 100644
index 0000000000000000000000000000000000000000..77aed653efa723b17e1943e40202954d730f4b47
--- /dev/null
+++ b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedAlgorithms.java
@@ -0,0 +1,9 @@
+package com.ishland.c2me.libs.vectorized_algorithms;
+
+public class VectorizedAlgorithms {
+
+ public static double perlinNoiseVectorized(byte[] p, int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) {
+ return VectorizedPerlinNoise.sample(p, sectionX, sectionY, sectionZ, localX, localY, localZ, fadeLocalX);
+ }
+
+}
diff --git a/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java
new file mode 100644
index 0000000000000000000000000000000000000000..6679e557f4a3c7dbe88c77c605c97ff673425d7e
--- /dev/null
+++ b/src/main/java/com/ishland/c2me/libs/vectorized_algorithms/VectorizedPerlinNoise.java
@@ -0,0 +1,115 @@
+package com.ishland.c2me.libs.vectorized_algorithms;
+
+import jdk.incubator.vector.DoubleVector;
+import jdk.incubator.vector.VectorSpecies;
+
+public class VectorizedPerlinNoise {
+
+ protected static final int[][] GRADIENTS = new int[][]{{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0}, {1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1}, {0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}, {1, 1, 0}, {0, -1, 1}, {-1, 1, 0}, {0, -1, -1}};
+ private static final VectorSpecies<Double> speciesPreferred = DoubleVector.SPECIES_PREFERRED;
+ private static final VectorSpecies<Double> speciesGrad = speciesPreferred.length() > 8 ? DoubleVector.SPECIES_512 : speciesPreferred;
+ private static final VectorSpecies<Double> speciesPerlinFade = speciesPreferred.length() > 4 ? DoubleVector.SPECIES_256 : speciesPreferred;
+
+ static {
+ System.out.println("Using vector size of " + speciesGrad.vectorBitSize() + " bits for grad()");
+ System.out.println("Using vector size of " + speciesPerlinFade.vectorBitSize() + " bits for perlinFade()");
+ }
+
+ private static double lerp(double delta, double start, double end) {
+ return start + delta * (end - start);
+ }
+
+ static double sample(byte[] p, int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) {
+ int i = p[sectionX & 0xFF] & 255;
+ int j = p[sectionX + 1 & 0xFF] & 255;
+ int k = p[i + sectionY & 0xFF] & 255;
+ int l = p[i + sectionY + 1 & 0xFF] & 255;
+ int m = p[j + sectionY & 0xFF] & 255;
+ int n = p[j + sectionY + 1 & 0xFF] & 255;
+
+ // grad ops
+ double[] gradX = new double[] {
+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][0],
+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][0],
+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][0],
+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][0],
+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][0],
+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][0],
+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][0],
+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][0],
+ };
+ double[] mulX = new double[] {
+ localX, localX - 1.0, localX, localX - 1.0,
+ localX, localX - 1.0, localX, localX - 1.0,
+ };
+ double[] gradY = new double[] {
+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][1],
+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][1],
+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][1],
+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][1],
+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][1],
+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][1],
+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][1],
+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][1],
+ };
+ double[] mulY = new double[] {
+ localY, localY, localY - 1.0, localY - 1.0,
+ localY, localY, localY - 1.0, localY - 1.0,
+ };
+ double[] gradZ = new double[] {
+ GRADIENTS[p[k + sectionZ & 0xFF] & 15][2],
+ GRADIENTS[p[m + sectionZ & 0xFF] & 15][2],
+ GRADIENTS[p[l + sectionZ & 0xFF] & 15][2],
+ GRADIENTS[p[n + sectionZ & 0xFF] & 15][2],
+ GRADIENTS[p[k + sectionZ + 1 & 0xFF] & 15][2],
+ GRADIENTS[p[m + sectionZ + 1 & 0xFF] & 15][2],
+ GRADIENTS[p[l + sectionZ + 1 & 0xFF] & 15][2],
+ GRADIENTS[p[n + sectionZ + 1 & 0xFF] & 15][2],
+ };
+ double[] mulZ = new double[] {
+ localZ, localZ, localZ, localZ,
+ localZ - 1.0, localZ - 1.0, localZ - 1.0, localZ - 1.0,
+ };
+
+ double[] gradResArray = new double[8];
+ for (int i1 = 0; i1 < gradX.length; i1 += speciesGrad.length()) {
+ final DoubleVector gradXVector = DoubleVector.fromArray(speciesGrad, gradX, i1);
+ final DoubleVector mulXVector = DoubleVector.fromArray(speciesGrad, mulX, i1);
+ final DoubleVector resX = gradXVector.mul(mulXVector);
+ final DoubleVector gradYVector = DoubleVector.fromArray(speciesGrad, gradY, i1);
+ final DoubleVector mulYVector = DoubleVector.fromArray(speciesGrad, mulY, i1);
+ final DoubleVector resY = gradYVector.mul(mulYVector);
+ final DoubleVector gradZVector = DoubleVector.fromArray(speciesGrad, gradZ, i1);
+ final DoubleVector mulZVector = DoubleVector.fromArray(speciesGrad, mulZ, i1);
+ final DoubleVector resZ = gradZVector.mul(mulZVector);
+ final DoubleVector res = resX.add(resY).add(resZ);
+ res.intoArray(gradResArray, i1);
+ }
+
+ // fade ops
+ // perlinFade(value): value * value * value * (value * (value * 6.0 - 15.0) + 10.0)
+ final double[] fades = new double[]{localX, fadeLocalX, localZ, 0.0};
+ final double[] fadeResArray = new double[4];
+ for (int i1 = 0; i1 < fades.length; i1 += speciesPerlinFade.length()) {
+ final DoubleVector vector = DoubleVector.fromArray(speciesPerlinFade, fades, i1);
+ final DoubleVector res = vector
+ .mul(6.0)
+ .add(-15.0)
+ .mul(vector)
+ .add(10.0)
+ .mul(vector)
+ .mul(vector)
+ .mul(vector);
+ res.intoArray(fadeResArray, i1);
+ }
+
+ // lerp(delta, start, end): start + delta * (end - start)
+
+ return lerp(
+ fadeResArray[2],
+ lerp(fadeResArray[1], lerp(fadeResArray[0], gradResArray[0], gradResArray[1]), lerp(fadeResArray[0], gradResArray[2], gradResArray[3])),
+ lerp(fadeResArray[1], lerp(fadeResArray[0], gradResArray[4], gradResArray[5]), lerp(fadeResArray[0], gradResArray[6], gradResArray[7]))
+ );
+ }
+
+}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
index 883a8dcf94b619cd5ffbcfc6f28809c2c6a71f55..873614980ec45bcd64ef05fd938bd99b85b9e51e 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
@@ -1,5 +1,6 @@
package net.minecraft.world.level.levelgen.synth;
+import com.ishland.c2me.libs.vectorized_algorithms.VectorizedAlgorithms; // Mirai - c2me: vectorizations.vectorize_noise
import com.google.common.annotations.VisibleForTesting;
import net.minecraft.util.Mth;
import net.minecraft.world.level.levelgen.RandomSource;
@@ -115,6 +116,7 @@ public final class ImprovedNoise {
* @reason inline Mth & small optimization: remove frequent type conversions and redundant ops
*/
private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalX) {
+ if (wtf.etil.mirai.MiraiConfig.vectorizedPerlinNoise) { return VectorizedAlgorithms.perlinNoiseVectorized(p, sectionX, sectionY, sectionZ, localX, localY, localZ, fadeLocalX); } // Mirai - c2me: vectorizations.vectorize_noise
// TODO [VanillaCopy] but inlined
final int var0 = sectionX & 0xFF;
final int var1 = (sectionX + 1) & 0xFF;
diff --git a/src/main/java/wtf/etil/mirai/MiraiConfig.java b/src/main/java/wtf/etil/mirai/MiraiConfig.java
index 1ba057cbd0ec23cd7ef3d3d1c7685f44cfe34eec..90cf922c8df669ac80451d64b376918dece09dc9 100644
--- a/src/main/java/wtf/etil/mirai/MiraiConfig.java
+++ b/src/main/java/wtf/etil/mirai/MiraiConfig.java
@@ -247,4 +247,9 @@ public class MiraiConfig {
riskyMathRoundOpt = getBoolean("use-risky-mathround-opt", riskyMathRoundOpt);
}
+ public static boolean vectorizedPerlinNoise = false;
+ private static void vectorizedNoise() {
+ vectorizedPerlinNoise = getBoolean("use-vectorized-perlin-noise", vectorizedPerlinNoise);
+ }
+
}
\ No newline at end of file

View File

@@ -1284,7 +1284,7 @@ index 6e5d13e63c97cb95b93af1d997dc0eb53f966566..231448a1a49f1c4034ce09e06dcbdabe
throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper throw new ResourceLocationException("Non [a-z0-9_.-] character in namespace of location: " + org.apache.commons.lang3.StringUtils.normalizeSpace(this.namespace) + ":" + org.apache.commons.lang3.StringUtils.normalizeSpace(this.path)); // Paper
} else if (!isValidPath(this.path)) { } else if (!isValidPath(this.path)) {
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index 2f5c021b6849acb81064d55418707921424b649b..8cf835307c36fb048d62af9f417daeeeb71a0cff 100644 index e2c8f716af55ebb7e4233c2a3d6515f8f4a239fa..3392c4b39c7edb2ddfe6580ab15c75573e64c850 100644
--- a/src/main/java/net/minecraft/server/Main.java --- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java
@@ -64,6 +64,7 @@ public class Main { @@ -64,6 +64,7 @@ public class Main {

Some files were not shown because too many files have changed in this diff Show More