Initial 1.13.2 update. Major thing to note is that Dimensions have been completely revamped.

DimensionType is not unique per Dimension. See DimensionManager for more details.
Vanilla now has a chunk loading system, so Forge's will need to be deprecated/adapted.
This commit is contained in:
LexManos committed 2019-02-14 15:08:53 -08:00
1 parent 9a1688599a
commit ca72710937
361 files changed
+3166 -3547

No files matched your search

@@ -39,6 +39,7 @@ import net.minecraft.util.registry.RegistryNamespaced;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.ModDimension;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.event.RegistryEvent.MissingMappings;
import net.minecraftforge.fml.LifecycleEventProvider;
@@ -84,15 +85,16 @@ public class GameData
public static final ResourceLocation ENTITIES = new ResourceLocation("minecraft:entities");
public static final ResourceLocation TILEENTITIES = new ResourceLocation("minecraft:tileentities");
public static final ResourceLocation PROFESSIONS = new ResourceLocation("minecraft:villagerprofessions");
public static final ResourceLocation MODDIMENSIONS = new ResourceLocation("forge:moddimensions");
private static final int MAX_REGISTRY_SIZE = Integer.MAX_VALUE >> 5;
private static final int MAX_BLOCK_ID = 4095;
private static final int MIN_ITEM_ID = MAX_BLOCK_ID + 1;
private static final int MAX_ITEM_ID = 31999;
private static final int MAX_POTION_ID = 255; // SPacketEntityEffect sends bytes, we can only use 255
private static final int MAX_BIOME_ID = 255; // Maximum number in a byte in the chunk
private static final int MAX_SOUND_ID = Integer.MAX_VALUE >> 5; // Varint (SPacketSoundEffect)
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect)
private static final int MAX_POTIONTYPE_ID = MAX_REGISTRY_SIZE; // Int (SPacketEffect)
private static final int MAX_ENCHANTMENT_ID = Short.MAX_VALUE - 1; // Short - serialized as a short in ItemStack NBTs.
private static final int MAX_ENTITY_ID = Integer.MAX_VALUE >> 5; // Varint (SPacketSpawnMob)
private static final int MAX_ENTITY_ID = MAX_REGISTRY_SIZE; // Varint (SPacketSpawnMob)
private static final int MAX_TILE_ENTITY_ID = Integer.MAX_VALUE; //Doesnt seem to be serialized anywhere, so no max.
private static final int MAX_PROFESSION_ID = 1024; //TODO: Is this serialized anywhere anymore?
@@ -118,7 +120,7 @@ public class GameData
return;
hasInit = true;
makeRegistry(BLOCKS, Block.class, MAX_BLOCK_ID, new ResourceLocation("air")).addCallback(BlockCallbacks.INSTANCE).create();
makeRegistry(ITEMS, Item.class, MIN_ITEM_ID, MAX_ITEM_ID).addCallback(ItemCallbacks.INSTANCE).create();
makeRegistry(ITEMS, Item.class, MAX_ITEM_ID).addCallback(ItemCallbacks.INSTANCE).create();
makeRegistry(POTIONS, Potion.class, MAX_POTION_ID).create();
makeRegistry(BIOMES, Biome.class, MAX_BIOME_ID).create();
makeRegistry(SOUNDEVENTS, SoundEvent.class, MAX_SOUND_ID).create();
@@ -128,12 +130,9 @@ public class GameData
// TODO do we need the callback and the static field anymore?
makeRegistry(ENTITIES, EntityType.class, MAX_ENTITY_ID).create();
makeRegistry(TILEENTITIES, TileEntityType.class, MAX_TILE_ENTITY_ID).disableSaving().create();
makeRegistry(MODDIMENSIONS, ModDimension.class, MAX_REGISTRY_SIZE).disableSaving().create();
}
private static <T extends IForgeRegistryEntry<T>> RegistryBuilder<T> makeRegistry(ResourceLocation name, Class<T> type, int min, int max)
{
return new RegistryBuilder<T>().setName(name).setType(type).setIDRange(min, max).addCallback(new NamespacedWrapper.Factory<T>());
}
private static <T extends IForgeRegistryEntry<T>> RegistryBuilder<T> makeRegistry(ResourceLocation name, Class<T> type, int max)
{
return new RegistryBuilder<T>().setName(name).setType(type).setMaxID(max).addCallback(new NamespacedWrapper.Factory<T>());
@@ -143,22 +142,22 @@ public class GameData
return new RegistryBuilder<T>().setName(name).setType(type).setMaxID(max).addCallback(new NamespacedDefaultedWrapper.Factory<T>()).setDefaultKey(_default);
}
public static <V extends IForgeRegistryEntry<V>> RegistryNamespacedDefaultedByKey<ResourceLocation, V> getWrapperDefaulted(Class<V> cls)
public static <V extends IForgeRegistryEntry<V>> RegistryNamespacedDefaultedByKey<V> getWrapperDefaulted(Class<V> cls)
{
IForgeRegistry<V> reg = RegistryManager.ACTIVE.getRegistry(cls);
Validate.notNull(reg, "Attempted to get vanilla wrapper for unknown registry: " + cls.toString());
@SuppressWarnings("unchecked")
RegistryNamespacedDefaultedByKey<ResourceLocation, V> ret = reg.getSlaveMap(NamespacedDefaultedWrapper.Factory.ID, NamespacedDefaultedWrapper.class);
RegistryNamespacedDefaultedByKey<V> ret = reg.getSlaveMap(NamespacedDefaultedWrapper.Factory.ID, NamespacedDefaultedWrapper.class);
Validate.notNull(ret, "Attempted to get vanilla wrapper for registry created incorrectly: " + cls.toString());
return ret;
}
public static <V extends IForgeRegistryEntry<V>> RegistryNamespaced<ResourceLocation, V> getWrapper(Class<V> cls)
public static <V extends IForgeRegistryEntry<V>> RegistryNamespaced<V> getWrapper(Class<V> cls)
{
IForgeRegistry<V> reg = RegistryManager.ACTIVE.getRegistry(cls);
Validate.notNull(reg, "Attempted to get vanilla wrapper for unknown registry: " + cls.toString());
@SuppressWarnings("unchecked")
RegistryNamespaced<ResourceLocation, V> ret = reg.getSlaveMap(NamespacedWrapper.Factory.ID, NamespacedWrapper.class);
RegistryNamespaced<V> ret = reg.getSlaveMap(NamespacedWrapper.Factory.ID, NamespacedWrapper.class);
Validate.notNull(ret, "Attempted to get vanilla wrapper for registry created incorrectly: " + cls.toString());
return ret;
}
@@ -382,7 +381,7 @@ public class GameData
@Override
public Block createDummy(ResourceLocation key)
{
Block ret = new BlockDummyAir(Block.Builder.create(Material.AIR));
Block ret = new BlockDummyAir(Block.Properties.create(Material.AIR));
GameData.forceRegistryName(ret, key);
return ret;
}
@@ -404,9 +403,9 @@ public class GameData
private static class BlockDummyAir extends BlockAir //A named class so DummyBlockReplacementTest can detect if its a dummy
{
private BlockDummyAir(Block.Builder builder)
private BlockDummyAir(Block.Properties properties)
{
super(builder);
super(properties);
}
@Override