mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 11:05:40 +00:00
Fix substitutions being broken after freezing - actually store the original state in registry copies, not the computed state, which is wrong because it only sees the sub, not the original.
This commit is contained in:
1 parent
5f06c95cfa
commit
d7dda9e960
2 files changed
+31
-1
No files matched your search
+29
-1
@@ -27,7 +27,11 @@ public class SubstitutionInjectionTest
|
||||
{
|
||||
private ResourceLocation myDirt = new ResourceLocation("minecraft:dirt");
|
||||
private BlockDirt toSub = new BlockDirt() {
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "SUB" + super.toString() + "SUB";
|
||||
}
|
||||
};
|
||||
|
||||
@BeforeClass
|
||||
@@ -103,5 +107,29 @@ public class SubstitutionInjectionTest
|
||||
assertEquals("Got my dirt substitute - registry", toSub, fnd);
|
||||
dirtitem = (ItemBlock)itemRegistry.getValue(myDirt);
|
||||
assertEquals("ItemBlock points at my block", toSub, dirtitem.block);
|
||||
|
||||
// TEST 2 repeat: Does the substitute get injected when told by loading operation? The substitute should be found in the registry
|
||||
PersistentRegistryManager.injectSnapshot(snapshot, true, true);
|
||||
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
||||
fnd = blockRegistry.getValue(myDirt);
|
||||
currDirt = Blocks.DIRT;
|
||||
assertEquals("Got my dirt substitute - Blocks", toSub, currDirt);
|
||||
assertEquals("Got my dirt substitute - Blocks and registry", currDirt, fnd);
|
||||
assertEquals("Got my dirt substitute - registry", toSub, fnd);
|
||||
|
||||
dirtitem = (ItemBlock)itemRegistry.getValue(myDirt);
|
||||
assertEquals("ItemBlock points at my block", toSub, dirtitem.block);
|
||||
|
||||
// TEST 3 repeat: Does the substitute get restored when reverting to frozen state? The substitute should be found in the registry again
|
||||
PersistentRegistryManager.revertToFrozen();
|
||||
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
|
||||
fnd = blockRegistry.getValue(myDirt);
|
||||
currDirt = Blocks.DIRT;
|
||||
assertEquals("Got my dirt substitute - Blocks", toSub, currDirt);
|
||||
assertEquals("Got my dirt substitute - Blocks and registry", currDirt, fnd);
|
||||
assertEquals("Got my dirt substitute - registry", toSub, fnd);
|
||||
dirtitem = (ItemBlock)itemRegistry.getValue(myDirt);
|
||||
assertEquals("ItemBlock points at my block", toSub, dirtitem.block);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user