mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-28 07:55:53 +00:00
Command work, and Added TileEntityType as a Forge Registry.
This commit is contained in:
1 parent
3f743887e7
commit
b4c23aba8e
22 files changed
+396
-2758
No files matched your search
@@ -21,13 +21,13 @@ package net.minecraftforge.registries;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.init.Bootstrap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
@@ -39,6 +39,7 @@ import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfessio
|
||||
* Created to have a central place to access the registries directly if modders need.
|
||||
* It is still advised that if you are registering things to go through {@link GameRegistry} register methods, but queries and iterations can use this.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class ForgeRegistries
|
||||
{
|
||||
static { init(); } // This must be above the fields so we guarantee it's run before findRegistry is called. Yay static inializers
|
||||
@@ -52,6 +53,7 @@ public class ForgeRegistries
|
||||
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = RegistryManager.ACTIVE.getRegistry(Enchantment.class);
|
||||
public static final IForgeRegistry<VillagerProfession> VILLAGER_PROFESSIONS = RegistryManager.ACTIVE.getRegistry(VillagerProfession.class);
|
||||
public static final IForgeRegistry<EntityType<?>> ENTITIES = RegistryManager.ACTIVE.getRegistry(EntityType.class);
|
||||
public static final IForgeRegistry<TileEntityType<?>> TILE_ENTITIES = RegistryManager.ACTIVE.getRegistry(TileEntityType.class);
|
||||
public static final IForgeRegistry<IRecipe> RECIPES = RegistryManager.ACTIVE.getRegistry(IRecipe.class);
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionType;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ObjectIntIdentityMap;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
@@ -87,6 +88,7 @@ public class GameData
|
||||
public static final ResourceLocation POTIONTYPES = new ResourceLocation("minecraft:potiontypes");
|
||||
public static final ResourceLocation ENCHANTMENTS = new ResourceLocation("minecraft:enchantments");
|
||||
public static final ResourceLocation ENTITIES = new ResourceLocation("minecraft:entities");
|
||||
public static final ResourceLocation TILEENTITIES = new ResourceLocation("minecraft:tileentities");
|
||||
public static final ResourceLocation RECIPES = new ResourceLocation("minecraft:recipes");
|
||||
public static final ResourceLocation PROFESSIONS = new ResourceLocation("minecraft:villagerprofessions");
|
||||
private static final int MAX_BLOCK_ID = 4095;
|
||||
@@ -98,6 +100,7 @@ public class GameData
|
||||
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // 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_TILE_ENTITY_ID = Integer.MAX_VALUE; //Doesnt seem to be serialized anywhere, so no max.
|
||||
private static final int MAX_RECIPE_ID = Integer.MAX_VALUE >> 5; // Varint CPacketRecipeInfo/SPacketRecipeBook
|
||||
private static final int MAX_PROFESSION_ID = 1024; //TODO: Is this serialized anywhere anymore?
|
||||
|
||||
@@ -111,6 +114,7 @@ public class GameData
|
||||
init();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void init()
|
||||
{
|
||||
if ( DISABLE_VANILLA_REGISTRIES)
|
||||
@@ -132,6 +136,7 @@ public class GameData
|
||||
makeRegistry(PROFESSIONS, VillagerProfession.class, MAX_PROFESSION_ID).create();
|
||||
// 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();
|
||||
}
|
||||
|
||||
private static <T extends IForgeRegistryEntry<T>> RegistryBuilder<T> makeRegistry(ResourceLocation name, Class<T> type, int min, int max)
|
||||
|
||||
Reference in new issue
Block a user