mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Remove structures slave map to Feature registry (#9091)
This commit is contained in:
1 parent
8980252e16
commit
8f407c3a22
1 file changed
+4
-21
@@ -34,7 +34,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
@@ -54,6 +53,7 @@ import net.minecraftforge.registries.holdersets.HolderSetType;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -75,6 +75,7 @@ import static net.minecraftforge.registries.ForgeRegistries.Keys.*;
|
||||
* INTERNAL ONLY
|
||||
* MODDERS SHOULD HAVE NO REASON TO USE THIS CLASS
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public class GameData
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -83,7 +84,6 @@ public class GameData
|
||||
private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap");
|
||||
private static final ResourceLocation BLOCKSTATE_TO_ID = new ResourceLocation("minecraft:blockstatetoid");
|
||||
private static final ResourceLocation BLOCKSTATE_TO_POINT_OF_INTEREST_TYPE = new ResourceLocation("minecraft:blockstatetopointofinteresttype");
|
||||
private static final ResourceLocation STRUCTURES = new ResourceLocation("minecraft:structures");
|
||||
|
||||
private static boolean hasInit = false;
|
||||
private static final boolean DISABLE_VANILLA_REGISTRIES = Boolean.parseBoolean(System.getProperty("forge.disableVanillaGameData", "false")); // Use for unit tests/debugging
|
||||
@@ -133,7 +133,7 @@ public class GameData
|
||||
|
||||
// Worldgen
|
||||
makeRegistry(WORLD_CARVERS).disableSaving().disableSync().create();
|
||||
makeRegistry(FEATURES).addCallback(FeatureCallbacks.INSTANCE).disableSaving().disableSync().create();
|
||||
makeRegistry(FEATURES).disableSaving().disableSync().create();
|
||||
makeRegistry(CHUNK_STATUS, "empty").disableSaving().disableSync().create();
|
||||
makeRegistry(BLOCK_STATE_PROVIDER_TYPES).disableSaving().disableSync().create();
|
||||
makeRegistry(FOLIAGE_PLACER_TYPES).disableSaving().disableSync().create();
|
||||
@@ -167,7 +167,7 @@ public class GameData
|
||||
{
|
||||
return makeRegistry(FLUID_TYPES).disableSaving();
|
||||
}
|
||||
|
||||
|
||||
static RegistryBuilder<HolderSetType> getHolderSetTypeRegistryBuilder()
|
||||
{
|
||||
return new RegistryBuilder<HolderSetType>().disableSaving().disableSync();
|
||||
@@ -534,23 +534,6 @@ public class GameData
|
||||
}
|
||||
}
|
||||
|
||||
private static class FeatureCallbacks implements IForgeRegistry.ClearCallback<Feature<?>>, IForgeRegistry.CreateCallback<Feature<?>>
|
||||
{
|
||||
static final FeatureCallbacks INSTANCE = new FeatureCallbacks();
|
||||
|
||||
@Override
|
||||
public void onClear(IForgeRegistryInternal<Feature<?>> owner, RegistryManager stage)
|
||||
{
|
||||
owner.getSlaveMap(STRUCTURES, BiMap.class).clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(IForgeRegistryInternal<Feature<?>> owner, RegistryManager stage)
|
||||
{
|
||||
owner.setSlaveMap(STRUCTURES, HashBiMap.create());
|
||||
}
|
||||
}
|
||||
|
||||
private static class PointOfInterestTypeCallbacks implements IForgeRegistry.AddCallback<PoiType>, IForgeRegistry.ClearCallback<PoiType>, IForgeRegistry.CreateCallback<PoiType>
|
||||
{
|
||||
static final PointOfInterestTypeCallbacks INSTANCE = new PointOfInterestTypeCallbacks();
|
||||
|
||||
Reference in new issue
Block a user