43 lines
1.8 KiB
Diff
43 lines
1.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cryptite <cryptite@gmail.com>
|
|
Date: Tue, 25 Apr 2023 09:05:16 -0500
|
|
Subject: [PATCH] Do not freeze MappedRegistry
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/core/MappedRegistry.java b/src/main/java/net/minecraft/core/MappedRegistry.java
|
|
index 742af4feb3986ca7d8f5ed136b556a41cbe0722f..d8fd0627b781e4b66ad0882304ec417fbb5c9b20 100644
|
|
--- a/src/main/java/net/minecraft/core/MappedRegistry.java
|
|
+++ b/src/main/java/net/minecraft/core/MappedRegistry.java
|
|
@@ -334,7 +334,7 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
|
if (this.frozen) {
|
|
return this;
|
|
} else {
|
|
- this.frozen = true;
|
|
+// this.frozen = true; // Slice
|
|
this.byValue.forEach((value, entry) -> {
|
|
entry.bindValue(value);
|
|
});
|
|
@@ -361,14 +361,16 @@ public class MappedRegistry<T> implements WritableRegistry<T> {
|
|
|
|
@Override
|
|
public Holder.Reference<T> createIntrusiveHolder(T value) {
|
|
+ // Slice start
|
|
if (this.unregisteredIntrusiveHolders == null) {
|
|
- throw new IllegalStateException("This registry can't create intrusive holders");
|
|
- } else {
|
|
- this.validateWrite();
|
|
- return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
|
- return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
|
- });
|
|
+ this.unregisteredIntrusiveHolders = new HashMap<>();
|
|
}
|
|
+ // Slice end
|
|
+
|
|
+ this.validateWrite();
|
|
+ return this.unregisteredIntrusiveHolders.computeIfAbsent(value, (valuex) -> {
|
|
+ return Holder.Reference.createIntrusive(this.asLookup(), valuex);
|
|
+ });
|
|
}
|
|
|
|
@Override
|