Skip to content

Commit 0576688

Browse files
committed
Merge branch '1.18.x/dev' into 1.19.3/dev
# Conflicts: # gradle.properties
2 parents e35588d + c8f9c58 commit 0576688

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Project Specifics
2-
projectVersion=0.2.0
2+
projectVersion=0.2.1
33
modrinthId=jsiDlnm9
44

55
# Minecraft

src/main/java/net/kjp12/ddc/Main.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import it.unimi.dsi.fastutil.objects.Object2FloatArrayMap;
1010
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
11+
import it.unimi.dsi.fastutil.objects.Object2FloatMaps;
1112
import it.unimi.dsi.fastutil.objects.Object2FloatOpenHashMap;
1213
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
1314
import net.minecraft.block.ComposterBlock;
@@ -93,6 +94,18 @@ public static void hotLoad() {
9394
logger.info("[DDC] Evoking {} as `disableDatapackRegistry` for the composter is enabled.",
9495
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE);
9596
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.clear();
97+
} else {
98+
logger.info("[DDC] Evoking vanilla registry entries manually to account for other mods.");
99+
// Capture a working map to avoid spamming the logs when our logger is enabled.
100+
var intermediary = new Object2FloatOpenHashMap<>(ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE);
101+
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.clear();
102+
103+
// Manually clear out all *exact* entries from the intermediate step.
104+
Object2FloatMaps.fastForEach(vanillaCompostableItems,
105+
e -> intermediary.remove(e.getKey(), e.getFloatValue()));
106+
107+
// Set the intermediate step back into working.
108+
ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE.putAll(intermediary);
96109
}
97110
} else {
98111
// Same as above, but redeploys the vanilla registry.

0 commit comments

Comments
 (0)