9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00

Updated Upstream (Purpur)

Upstream has released updates that appear to apply and compile correctly

Purpur Changes:
PurpurMC/Purpur@3e944ed properly fix infinityWorksWithoutArrows option
PurpurMC/Purpur@da953af Updated Upstream (Paper)
This commit is contained in:
NONPLAYT
2024-05-13 17:48:55 +03:00
parent aa28592605
commit 178d6a8c1e
2 changed files with 46 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
group = space.bxteam.divinemc
version = 1.20.6-R0.1-SNAPSHOT
purpurRef = be47af0884f583ac90968d4f1e90275cc383bd9d
purpurRef = da953af857486ad7888802152901c407cf53a95e
org.gradle.caching = true
org.gradle.parallel = true

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Mon, 13 May 2024 17:40:02 +0300
Subject: [PATCH] C2ME: reduce_allocs
diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/OreFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/OreFeature.java
index 506b2afd099c9b7e9ac3f6f2fcea8e523fae396b..2394f6f2c031b25a6cbeb79918a04b5710548d98 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/feature/OreFeature.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/feature/OreFeature.java
@@ -69,7 +69,7 @@ public class OreFeature extends Feature<OreConfiguration> {
int verticalSize
) {
int i = 0;
- BitSet bitSet = new BitSet(horizontalSize * verticalSize * horizontalSize);
+ BitSet bitSet = space.bxteam.divinemc.util.c2me.ObjectCachingUtils.getCachedOrNewBitSet(horizontalSize * verticalSize * horizontalSize); // DivineMC - C2ME: reduce_allocs
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
int j = config.size;
double[] ds = new double[j * 4];
diff --git a/src/main/java/space/bxteam/divinemc/util/c2me/ObjectCachingUtils.java b/src/main/java/space/bxteam/divinemc/util/c2me/ObjectCachingUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..828b9cb2f6506b9775dfccc934e9a64d5ddfaeff
--- /dev/null
+++ b/src/main/java/space/bxteam/divinemc/util/c2me/ObjectCachingUtils.java
@@ -0,0 +1,20 @@
+package space.bxteam.divinemc.util.c2me;
+
+import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
+
+import java.util.BitSet;
+import java.util.function.IntFunction;
+
+public class ObjectCachingUtils {
+ private static final IntFunction<BitSet> bitSetConstructor = BitSet::new;
+
+ public static ThreadLocal<Int2ObjectOpenHashMap<BitSet>> BITSETS = ThreadLocal.withInitial(Int2ObjectOpenHashMap::new);
+
+ private ObjectCachingUtils() {}
+
+ public static BitSet getCachedOrNewBitSet(int bits) {
+ final BitSet bitSet = BITSETS.get().computeIfAbsent(bits, bitSetConstructor);
+ bitSet.clear();
+ return bitSet;
+ }
+}