First draft of Entity Registry re-write.
This commit is contained in:
parent
5ac6d374ed
commit
97ea0c4713
|
@ -0,0 +1,20 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java
|
||||||
|
@@ -38,7 +38,7 @@
|
||||||
|
{
|
||||||
|
if (!this.field_70170_p.field_72995_K)
|
||||||
|
{
|
||||||
|
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(itemstack));
|
||||||
|
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(itemstack));
|
||||||
|
|
||||||
|
if (oclass != null && this.getClass() == oclass)
|
||||||
|
{
|
||||||
|
@@ -79,7 +79,7 @@
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(p_190669_1_));
|
||||||
|
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(p_190669_1_));
|
||||||
|
return oclass != null && p_190669_2_ == oclass;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,78 @@
|
||||||
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
|
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
|
||||||
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
|
||||||
@@ -189,7 +189,17 @@
|
@@ -105,10 +105,8 @@
|
||||||
|
public static final ResourceLocation field_191307_a = new ResourceLocation("lightning_bolt");
|
||||||
|
private static final ResourceLocation field_191310_e = new ResourceLocation("player");
|
||||||
|
private static final Logger field_151516_b = LogManager.getLogger();
|
||||||
|
- public static final RegistryNamespaced < ResourceLocation, Class <? extends Entity >> field_191308_b = new RegistryNamespaced();
|
||||||
|
public static final Map<ResourceLocation, EntityList.EntityEggInfo> field_75627_a = Maps.<ResourceLocation, EntityList.EntityEggInfo>newLinkedHashMap();
|
||||||
|
- public static final Set<ResourceLocation> field_191309_d = Sets.<ResourceLocation>newHashSet();
|
||||||
|
- private static final List<String> field_191311_g = Lists.<String>newArrayList();
|
||||||
|
+ private static final Set<ResourceLocation> EXTRA_NAMES = Sets.newHashSet();
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static ResourceLocation func_191301_a(Entity p_191301_0_)
|
||||||
|
@@ -119,30 +117,44 @@
|
||||||
|
@Nullable
|
||||||
|
public static ResourceLocation func_191306_a(Class <? extends Entity > p_191306_0_)
|
||||||
|
{
|
||||||
|
- return (ResourceLocation)field_191308_b.func_177774_c(p_191306_0_);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(p_191306_0_);
|
||||||
|
+ return entry == null ? null : entry.getRegistryName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String func_75621_b(Entity p_75621_0_)
|
||||||
|
{
|
||||||
|
- int i = field_191308_b.func_148757_b(p_75621_0_.getClass());
|
||||||
|
- return i == -1 ? null : (String)field_191311_g.get(i);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(p_75621_0_.getClass());
|
||||||
|
+ return entry == null ? null : entry.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public static String func_191302_a(@Nullable ResourceLocation p_191302_0_)
|
||||||
|
{
|
||||||
|
- int i = field_191308_b.func_148757_b(field_191308_b.func_82594_a(p_191302_0_));
|
||||||
|
- return i == -1 ? null : (String)field_191311_g.get(i);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(p_191302_0_);
|
||||||
|
+ return entry == null ? null : entry.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public static Class <? extends Entity > func_90035_a(int p_90035_0_)
|
||||||
|
{
|
||||||
|
- return (Class)field_191308_b.func_148754_a(p_90035_0_);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.GameData.getEntityRegistry().func_148754_a(p_90035_0_);
|
||||||
|
+ return entry == null ? null : entry.getEntityClass();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static int getID(Class<? extends Entity> cls)
|
||||||
|
+ {
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(cls);
|
||||||
|
+ return entry == null ? -1 : net.minecraftforge.fml.common.registry.GameData.getEntityRegistry().getId(entry);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static Class<? extends Entity> getClass(ResourceLocation key)
|
||||||
|
+ {
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(key);
|
||||||
|
+ return entry == null ? null : entry.getEntityClass();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
@Nullable
|
||||||
|
public static Entity func_191304_a(@Nullable Class <? extends Entity > p_191304_0_, World p_191304_1_)
|
||||||
|
{
|
||||||
|
@@ -174,7 +186,7 @@
|
||||||
|
@Nullable
|
||||||
|
public static Entity func_188429_b(ResourceLocation p_188429_0_, World p_188429_1_)
|
||||||
|
{
|
||||||
|
- return func_191304_a((Class)field_191308_b.func_82594_a(p_188429_0_), p_188429_1_);
|
||||||
|
+ return func_191304_a(getClass(p_188429_0_), p_188429_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@@ -189,7 +201,17 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -18,3 +90,51 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
|
@@ -197,7 +219,7 @@
|
||||||
|
|
||||||
|
public static Set<ResourceLocation> func_180124_b()
|
||||||
|
{
|
||||||
|
- return field_191309_d;
|
||||||
|
+ return Sets.union(net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getKeys(), EXTRA_NAMES);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_)
|
||||||
|
@@ -336,7 +358,7 @@
|
||||||
|
func_191305_a("zombie_horse", 3232308, 9945732);
|
||||||
|
func_191305_a("zombie_pigman", 15373203, 5009705);
|
||||||
|
func_191305_a("zombie_villager", 5651507, 7969893);
|
||||||
|
- field_191309_d.add(field_191307_a);
|
||||||
|
+ EXTRA_NAMES.add(field_191307_a);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_)
|
||||||
|
@@ -357,22 +379,19 @@
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_);
|
||||||
|
- field_191308_b.func_177775_a(p_191303_0_, resourcelocation, p_191303_2_);
|
||||||
|
- field_191309_d.add(resourcelocation);
|
||||||
|
-
|
||||||
|
- while (field_191311_g.size() <= p_191303_0_)
|
||||||
|
- {
|
||||||
|
- field_191311_g.add((String)null);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- field_191311_g.set(p_191303_0_, p_191303_3_);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry =
|
||||||
|
+ new net.minecraftforge.fml.common.registry.EntityEntry(p_191303_2_, p_191303_3_);
|
||||||
|
+ net.minecraftforge.fml.common.registry.GameData.getEntityRegistry().func_177775_a(p_191303_0_, resourcelocation, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static EntityList.EntityEggInfo func_191305_a(String p_191305_0_, int p_191305_1_, int p_191305_2_)
|
||||||
|
{
|
||||||
|
ResourceLocation resourcelocation = new ResourceLocation(p_191305_0_);
|
||||||
|
- return (EntityList.EntityEggInfo)field_75627_a.put(resourcelocation, new EntityList.EntityEggInfo(resourcelocation, p_191305_1_, p_191305_2_));
|
||||||
|
+ EntityList.EntityEggInfo egg = new EntityList.EntityEggInfo(resourcelocation, p_191305_1_, p_191305_2_);
|
||||||
|
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(resourcelocation);
|
||||||
|
+ if (entry != null) entry.setEgg(egg);
|
||||||
|
+ return (EntityList.EntityEggInfo)field_75627_a.put(resourcelocation, egg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EntityEggInfo
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
--- ../src-base/minecraft/net/minecraft/network/play/server/SPacketSpawnMob.java
|
||||||
|
+++ ../src-work/minecraft/net/minecraft/network/play/server/SPacketSpawnMob.java
|
||||||
|
@@ -38,7 +38,7 @@
|
||||||
|
{
|
||||||
|
this.field_149042_a = p_i46973_1_.func_145782_y();
|
||||||
|
this.field_186894_b = p_i46973_1_.func_110124_au();
|
||||||
|
- this.field_149040_b = EntityList.field_191308_b.func_148757_b(p_i46973_1_.getClass());
|
||||||
|
+ this.field_149040_b = EntityList.getID(p_i46973_1_.getClass());
|
||||||
|
this.field_149041_c = p_i46973_1_.field_70165_t;
|
||||||
|
this.field_149038_d = p_i46973_1_.field_70163_u;
|
||||||
|
this.field_149039_e = p_i46973_1_.field_70161_v;
|
|
@ -420,7 +420,7 @@ public class ForgeModContainer extends DummyModContainer implements WorldAccessC
|
||||||
{
|
{
|
||||||
universalBucket = new UniversalBucket();
|
universalBucket = new UniversalBucket();
|
||||||
universalBucket.setUnlocalizedName("forge.bucketFilled");
|
universalBucket.setUnlocalizedName("forge.bucketFilled");
|
||||||
GameRegistry.registerItem(universalBucket, "bucketFilled");
|
GameRegistry.register(universalBucket.setRegistryName("forge", "bucketFilled"));
|
||||||
MinecraftForge.EVENT_BUS.register(universalBucket);
|
MinecraftForge.EVENT_BUS.register(universalBucket);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a captured snapshot of a block which will not change
|
* Represents a captured snapshot of a block which will not change
|
||||||
|
@ -150,7 +150,7 @@ public class BlockSnapshot implements Serializable
|
||||||
{
|
{
|
||||||
if (this.replacedBlock == null)
|
if (this.replacedBlock == null)
|
||||||
{
|
{
|
||||||
this.replacedBlock = GameRegistry.findBlock(this.getRegistryName().getResourceDomain(), this.getRegistryName().getResourcePath()).getStateFromMeta(getMeta());
|
this.replacedBlock = ForgeRegistries.BLOCKS.getValue(this.getRegistryName()).getStateFromMeta(getMeta());
|
||||||
}
|
}
|
||||||
return this.replacedBlock;
|
return this.replacedBlock;
|
||||||
}
|
}
|
||||||
|
@ -326,4 +326,4 @@ public class BlockSnapshot implements Serializable
|
||||||
public void setWorld(World world) { this.world = world; }
|
public void setWorld(World world) { this.world = world; }
|
||||||
public ResourceLocation getRegistryName() { return registryName; }
|
public ResourceLocation getRegistryName() { return registryName; }
|
||||||
public int getMeta() { return meta; }
|
public int getMeta() { return meta; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Minecraft Forge
|
||||||
|
* Copyright (c) 2016.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation version 2.1
|
||||||
|
* of the License.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package net.minecraftforge.fml.common.registry;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
|
import net.minecraft.entity.EntityList.EntityEggInfo;
|
||||||
|
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry.Impl;
|
||||||
|
|
||||||
|
public class EntityEntry extends Impl<EntityEntry>
|
||||||
|
{
|
||||||
|
private Class<? extends Entity> cls;
|
||||||
|
private String name;
|
||||||
|
private EntityEggInfo egg;
|
||||||
|
|
||||||
|
public EntityEntry(Class<? extends Entity> cls, String name)
|
||||||
|
{
|
||||||
|
this.cls = cls;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<? extends Entity> getEntityClass(){ return this.cls; }
|
||||||
|
public String getName(){ return this.name; }
|
||||||
|
public EntityEggInfo getEgg(){ return this.egg; }
|
||||||
|
|
||||||
|
public void setEgg(EntityEggInfo egg)
|
||||||
|
{
|
||||||
|
this.egg = egg;
|
||||||
|
if (this.getRegistryName() != null)
|
||||||
|
EntityList.ENTITY_EGGS.put(this.getRegistryName(), egg);
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,33 +19,28 @@
|
||||||
|
|
||||||
package net.minecraftforge.fml.common.registry;
|
package net.minecraftforge.fml.common.registry;
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList.EntityEggInfo;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.EntityTracker;
|
import net.minecraft.entity.EntityTracker;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
import net.minecraft.world.biome.Biome.SpawnListEntry;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
import net.minecraftforge.fml.common.FMLLog;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
|
||||||
import net.minecraftforge.fml.common.ModContainer;
|
import net.minecraftforge.fml.common.ModContainer;
|
||||||
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
|
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
import com.google.common.collect.ArrayListMultimap;
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
import com.google.common.collect.BiMap;
|
import com.google.common.collect.BiMap;
|
||||||
import com.google.common.collect.HashBiMap;
|
import com.google.common.collect.HashBiMap;
|
||||||
import com.google.common.collect.ListMultimap;
|
import com.google.common.collect.ListMultimap;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.common.primitives.UnsignedBytes;
|
|
||||||
|
|
||||||
public class EntityRegistry
|
public class EntityRegistry
|
||||||
{
|
{
|
||||||
|
@ -53,6 +48,7 @@ public class EntityRegistry
|
||||||
{
|
{
|
||||||
private Class<? extends Entity> entityClass;
|
private Class<? extends Entity> entityClass;
|
||||||
private ModContainer container;
|
private ModContainer container;
|
||||||
|
private ResourceLocation regName;
|
||||||
private String entityName;
|
private String entityName;
|
||||||
private int modId;
|
private int modId;
|
||||||
private int trackingRange;
|
private int trackingRange;
|
||||||
|
@ -60,9 +56,10 @@ public class EntityRegistry
|
||||||
private boolean sendsVelocityUpdates;
|
private boolean sendsVelocityUpdates;
|
||||||
private Function<EntitySpawnMessage, Entity> customSpawnCallback;
|
private Function<EntitySpawnMessage, Entity> customSpawnCallback;
|
||||||
private boolean usesVanillaSpawning;
|
private boolean usesVanillaSpawning;
|
||||||
public EntityRegistration(ModContainer mc, Class<? extends Entity> entityClass, String entityName, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
public EntityRegistration(ModContainer mc, ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||||
{
|
{
|
||||||
this.container = mc;
|
this.container = mc;
|
||||||
|
this.regName = registryName;
|
||||||
this.entityClass = entityClass;
|
this.entityClass = entityClass;
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
this.modId = id;
|
this.modId = id;
|
||||||
|
@ -70,6 +67,10 @@ public class EntityRegistry
|
||||||
this.updateFrequency = updateFrequency;
|
this.updateFrequency = updateFrequency;
|
||||||
this.sendsVelocityUpdates = sendsVelocityUpdates;
|
this.sendsVelocityUpdates = sendsVelocityUpdates;
|
||||||
}
|
}
|
||||||
|
public ResourceLocation getRegistryName()
|
||||||
|
{
|
||||||
|
return regName;
|
||||||
|
}
|
||||||
public Class<? extends Entity> getEntityClass()
|
public Class<? extends Entity> getEntityClass()
|
||||||
{
|
{
|
||||||
return entityClass;
|
return entityClass;
|
||||||
|
@ -121,7 +122,6 @@ public class EntityRegistry
|
||||||
private static final EntityRegistry INSTANCE = new EntityRegistry();
|
private static final EntityRegistry INSTANCE = new EntityRegistry();
|
||||||
|
|
||||||
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
|
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
|
||||||
private Map<String,ModContainer> entityNames = Maps.newHashMap();
|
|
||||||
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
|
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
|
||||||
|
|
||||||
public static EntityRegistry instance()
|
public static EntityRegistry instance()
|
||||||
|
@ -144,9 +144,9 @@ public class EntityRegistry
|
||||||
* @param updateFrequency The frequency of tracking updates
|
* @param updateFrequency The frequency of tracking updates
|
||||||
* @param sendsVelocityUpdates Whether to send velocity information packets as well
|
* @param sendsVelocityUpdates Whether to send velocity information packets as well
|
||||||
*/
|
*/
|
||||||
public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
public static void registerModEntity(ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||||
{
|
{
|
||||||
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
instance().doModEntityRegistration(registryName, entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,15 +163,36 @@ public class EntityRegistry
|
||||||
* @param eggPrimary Primary egg color
|
* @param eggPrimary Primary egg color
|
||||||
* @param eggSecondary Secondary egg color
|
* @param eggSecondary Secondary egg color
|
||||||
*/
|
*/
|
||||||
public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggPrimary, int eggSecondary)
|
public static void registerModEntity(ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggPrimary, int eggSecondary)
|
||||||
{
|
{
|
||||||
instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
instance().doModEntityRegistration(registryName, entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
|
||||||
EntityRegistry.registerEgg(entityClass, eggPrimary, eggSecondary);
|
EntityRegistry.registerEgg(registryName, eggPrimary, eggSecondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doModEntityRegistration(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
private void doModEntityRegistration(ResourceLocation registryName, Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
|
||||||
{
|
{
|
||||||
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
|
||||||
|
EntityRegistration er = new EntityRegistration(mc, registryName, entityClass, entityName, id, trackingRange, updateFrequency, sendsVelocityUpdates);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
entityClassRegistrations.put(entityClass, er);
|
||||||
|
if (!ForgeRegistries.ENTITIES.containsKey(registryName))
|
||||||
|
{
|
||||||
|
EntityEntry entry = new EntityEntry(entityClass, entityName).setRegistryName(registryName);
|
||||||
|
ForgeRegistries.ENTITIES.register(entry);
|
||||||
|
FMLLog.finer("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entry.getRegistryName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FMLLog.fine("Skipping automatic mod %s entity registration for already registered entry %s class %s", mc.getModId(), registryName, entityClass.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IllegalArgumentException e)
|
||||||
|
{
|
||||||
|
FMLLog.log(Level.WARN, e, "The mod %s tried to register the entity (registry,name,class) (%s,%s,%s) one or both of which are already registered", mc.getModId(), registryName, entityName, entityClass.getName());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entityRegistrations.put(mc, er);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,8 +210,15 @@ public class EntityRegistry
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
|
public static void registerEgg(ResourceLocation name, int primary, int secondary)
|
||||||
{
|
{
|
||||||
|
EntityEntry entry = ForgeRegistries.ENTITIES.getValue(name);
|
||||||
|
if (entry == null)
|
||||||
|
{
|
||||||
|
FMLLog.bigWarning("Attempted to registry a entity egg for entity (%s) that is not in the Entity Registry", name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
entry.setEgg(new EntityEggInfo(name, primary, secondary));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -329,4 +357,16 @@ public class EntityRegistry
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Helper function
|
||||||
|
public static EntityEntry getEntry(Class<? extends Entity> entry)
|
||||||
|
{
|
||||||
|
//TODO: Slave map for faster lookup?
|
||||||
|
for (EntityEntry e : ForgeRegistries.ENTITIES)
|
||||||
|
{
|
||||||
|
if (e.getEntityClass() == entry)
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class ForgeRegistries
|
||||||
public static final IForgeRegistry<PotionType> POTION_TYPES = GameRegistry.findRegistry(PotionType.class);
|
public static final IForgeRegistry<PotionType> POTION_TYPES = GameRegistry.findRegistry(PotionType.class);
|
||||||
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = GameRegistry.findRegistry(Enchantment.class);
|
public static final IForgeRegistry<Enchantment> ENCHANTMENTS = GameRegistry.findRegistry(Enchantment.class);
|
||||||
public static final IForgeRegistry<VillagerProfession> VILLAGER_PROFESSIONS = GameRegistry.findRegistry(VillagerProfession.class);
|
public static final IForgeRegistry<VillagerProfession> VILLAGER_PROFESSIONS = GameRegistry.findRegistry(VillagerProfession.class);
|
||||||
|
public static final IForgeRegistry<EntityEntry> ENTITIES = GameRegistry.findRegistry(EntityEntry.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.google.common.collect.HashBiMap;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.Enchantment;
|
||||||
|
import net.minecraft.entity.EntityList;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.potion.Potion;
|
import net.minecraft.potion.Potion;
|
||||||
|
@ -60,6 +61,8 @@ public class GameData
|
||||||
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect)
|
private static final int MAX_POTIONTYPE_ID = Integer.MAX_VALUE >> 5; // Int (SPacketEffect)
|
||||||
private static final int MIN_ENCHANTMENT_ID = 0; // Int
|
private static final int MIN_ENCHANTMENT_ID = 0; // Int
|
||||||
private static final int MAX_ENCHANTMENT_ID = Short.MAX_VALUE - 1; // Short - serialized as a short in ItemStack NBTs.
|
private static final int MAX_ENCHANTMENT_ID = Short.MAX_VALUE - 1; // Short - serialized as a short in ItemStack NBTs.
|
||||||
|
private static final int MIN_ENTITY_ID = 0;
|
||||||
|
private static final int MAX_ENTITY_ID = Integer.MAX_VALUE >> 5; // Varint (SPacketSpawnMob)
|
||||||
|
|
||||||
private static final ResourceLocation BLOCK_TO_ITEM = new ResourceLocation("minecraft:blocktoitemmap");
|
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_ID = new ResourceLocation("minecraft:blockstatetoid");
|
||||||
|
@ -78,6 +81,7 @@ public class GameData
|
||||||
ResourceLocation WATER = new ResourceLocation("water");
|
ResourceLocation WATER = new ResourceLocation("water");
|
||||||
iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null, null);
|
iPotionTypeRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.POTIONTYPES, PotionType.class, WATER, MIN_POTIONTYPE_ID, MAX_POTIONTYPE_ID, false, null, null, null, null);
|
||||||
iEnchantmentRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ENCHANTMENTS, Enchantment.class, null, MIN_ENCHANTMENT_ID, MAX_ENCHANTMENT_ID, false, null, null, null, null);
|
iEnchantmentRegistry = PersistentRegistryManager.createRegistry(PersistentRegistryManager.ENCHANTMENTS, Enchantment.class, null, MIN_ENCHANTMENT_ID, MAX_ENCHANTMENT_ID, false, null, null, null, null);
|
||||||
|
iEntityRegistry = (FMLControlledNamespacedRegistry<EntityEntry>)new RegistryBuilder<EntityEntry>().setName(PersistentRegistryManager.ENTITIES).setType(EntityEntry.class).setIDRange(MIN_ENTITY_ID, MAX_ENTITY_ID).addCallback(EntityCallbacks.INSTANCE).create();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -99,6 +103,7 @@ public class GameData
|
||||||
private final FMLControlledNamespacedRegistry<SoundEvent> iSoundEventRegistry;
|
private final FMLControlledNamespacedRegistry<SoundEvent> iSoundEventRegistry;
|
||||||
private final FMLControlledNamespacedRegistry<PotionType> iPotionTypeRegistry;
|
private final FMLControlledNamespacedRegistry<PotionType> iPotionTypeRegistry;
|
||||||
private final FMLControlledNamespacedRegistry<Enchantment> iEnchantmentRegistry;
|
private final FMLControlledNamespacedRegistry<Enchantment> iEnchantmentRegistry;
|
||||||
|
private final FMLControlledNamespacedRegistry<EntityEntry> iEntityRegistry;
|
||||||
|
|
||||||
//TODO: ? These are never used by ID, so they don't need to be full registries/persisted.
|
//TODO: ? These are never used by ID, so they don't need to be full registries/persisted.
|
||||||
//Need cpw to decide how we want to go about this as they are generic registries that
|
//Need cpw to decide how we want to go about this as they are generic registries that
|
||||||
|
@ -145,6 +150,10 @@ public class GameData
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static LegacyNamespacedRegistry<Class<? extends TileEntity>> getTileEntityRegistry() { return getMain().iTileEntityRegistry; }
|
public static LegacyNamespacedRegistry<Class<? extends TileEntity>> getTileEntityRegistry() { return getMain().iTileEntityRegistry; }
|
||||||
|
|
||||||
|
/** INTERNAL ONLY */
|
||||||
|
@Deprecated
|
||||||
|
public static FMLControlledNamespacedRegistry<EntityEntry> getEntityRegistry() { return getMain().iEntityRegistry; }
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
static Item findItem(String modId, String name)
|
static Item findItem(String modId, String name)
|
||||||
{
|
{
|
||||||
|
@ -162,56 +171,6 @@ public class GameData
|
||||||
return mainData;
|
return mainData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
int registerItem(Item item, String name) // from GameRegistry
|
|
||||||
{
|
|
||||||
return iItemRegistry.add(-1, addPrefix(name), item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
int registerBlock(Block block, String name) // from GameRegistry
|
|
||||||
{
|
|
||||||
return iBlockRegistry.add(-1, addPrefix(name), block);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Prefix the supplied name with the current mod id.
|
|
||||||
* <p/>
|
|
||||||
* If no mod id can be determined, minecraft will be assumed.
|
|
||||||
* The prefix is separated with a colon.
|
|
||||||
* <p/>
|
|
||||||
* If there's already a prefix, it'll be prefixed again if the new prefix
|
|
||||||
* doesn't match the old prefix, as used by vanilla calls to addObject.
|
|
||||||
*
|
|
||||||
* @param name name to prefix.
|
|
||||||
* @return prefixed name.
|
|
||||||
*/
|
|
||||||
private ResourceLocation addPrefix(String name)
|
|
||||||
{
|
|
||||||
int index = name.lastIndexOf(':');
|
|
||||||
String oldPrefix = index == -1 ? "" : name.substring(0, index);
|
|
||||||
name = index == -1 ? name : name.substring(index + 1);
|
|
||||||
String prefix;
|
|
||||||
ModContainer mc = Loader.instance().activeModContainer();
|
|
||||||
|
|
||||||
if (mc != null)
|
|
||||||
{
|
|
||||||
prefix = mc.getModId().toLowerCase();
|
|
||||||
}
|
|
||||||
else // no mod container, assume minecraft
|
|
||||||
{
|
|
||||||
prefix = "minecraft";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
|
|
||||||
{
|
|
||||||
FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", prefix, name);
|
|
||||||
prefix = oldPrefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ResourceLocation(prefix, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException
|
void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException
|
||||||
{
|
{
|
||||||
ResourceLocation nameToSubstitute = new ResourceLocation(name);
|
ResourceLocation nameToSubstitute = new ResourceLocation(name);
|
||||||
|
@ -470,6 +429,29 @@ public class GameData
|
||||||
// no op for the minute?
|
// no op for the minute?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Map<ResourceLocation, ?> slaveset, BiMap<ResourceLocation, ? extends IForgeRegistry<?>> registries)
|
||||||
|
{
|
||||||
|
// no op for the minute?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static class EntityCallbacks implements IForgeRegistry.AddCallback<EntityEntry>,IForgeRegistry.ClearCallback<EntityEntry>,IForgeRegistry.CreateCallback<EntityEntry>
|
||||||
|
{
|
||||||
|
static final EntityCallbacks INSTANCE = new EntityCallbacks();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAdd(EntityEntry entry, int id, Map<ResourceLocation, ?> slaves)
|
||||||
|
{
|
||||||
|
if (entry.getEgg() != null)
|
||||||
|
EntityList.ENTITY_EGGS.put(entry.getRegistryName(), entry.getEgg());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClear(IForgeRegistry<EntityEntry> registry, Map<ResourceLocation, ?> slaveset)
|
||||||
|
{
|
||||||
|
// no op for the minute?
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Map<ResourceLocation, ?> slaveset, BiMap<ResourceLocation, ? extends IForgeRegistry<?>> registries)
|
public void onCreate(Map<ResourceLocation, ?> slaveset, BiMap<ResourceLocation, ? extends IForgeRegistry<?>> registries)
|
||||||
{
|
{
|
||||||
|
|
|
@ -398,133 +398,4 @@ public class GameRegistry
|
||||||
}
|
}
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ============================= DEPRECATED/INTERNAL MODDERS DO NOT USE =================================
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated public static void registerItem(Item item){ register(item); }
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static void registerItem(Item item, String name)
|
|
||||||
{
|
|
||||||
if (item.getRegistryName() == null && Strings.isNullOrEmpty(name))
|
|
||||||
throw new IllegalArgumentException("Attempted to register a item with no name: " + item);
|
|
||||||
if (item.getRegistryName() != null && !item.getRegistryName().toString().equals(name))
|
|
||||||
throw new IllegalArgumentException("Attempted to register a item with conflicting names. Old: " + item.getRegistryName() + " New: " + name);
|
|
||||||
register(item.getRegistryName() == null ? item.setRegistryName(name) : item);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Block registerBlock(Block block)
|
|
||||||
{
|
|
||||||
register(block);
|
|
||||||
register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
|
||||||
return block;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Block registerBlock(Block block, String name)
|
|
||||||
{
|
|
||||||
if (block.getRegistryName() == null && Strings.isNullOrEmpty(name))
|
|
||||||
throw new IllegalArgumentException("Attempted to register a Block with no name: " + block);
|
|
||||||
if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name))
|
|
||||||
throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name);
|
|
||||||
return registerBlock(block.getRegistryName() != null ? block : block.setRegistryName(name));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass){ return registerBlock(block, itemclass, block.getRegistryName()); }
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name){ return registerBlock(block, itemclass, name, new Object[] {}); }
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, Object... itemCtorArgs){ return registerBlock(block, itemclass, block.getRegistryName().toString(), itemCtorArgs); }
|
|
||||||
/**
|
|
||||||
* Use {@link #register(IForgeRegistryEntry)} instead
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Block registerBlock(Block block, Class<? extends ItemBlock> itemclass, String name, Object... itemCtorArgs)
|
|
||||||
{
|
|
||||||
if (Strings.isNullOrEmpty(name))
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Attempted to register a block with no name: " + block);
|
|
||||||
}
|
|
||||||
if (Loader.instance().isInState(LoaderState.CONSTRUCTING))
|
|
||||||
{
|
|
||||||
FMLLog.warning("The mod %s is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event.", Loader.instance().activeModContainer());
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
assert block != null : "registerBlock: block cannot be null";
|
|
||||||
if (block.getRegistryName() != null && !block.getRegistryName().toString().equals(name))
|
|
||||||
throw new IllegalArgumentException("Attempted to register a Block with conflicting names. Old: " + block.getRegistryName() + " New: " + name);
|
|
||||||
ItemBlock i = null;
|
|
||||||
if (itemclass != null)
|
|
||||||
{
|
|
||||||
Class<?>[] ctorArgClasses = new Class<?>[itemCtorArgs.length + 1];
|
|
||||||
ctorArgClasses[0] = Block.class;
|
|
||||||
for (int idx = 1; idx < ctorArgClasses.length; idx++)
|
|
||||||
{
|
|
||||||
ctorArgClasses[idx] = itemCtorArgs[idx - 1].getClass();
|
|
||||||
}
|
|
||||||
Constructor<? extends ItemBlock> itemCtor = itemclass.getConstructor(ctorArgClasses);
|
|
||||||
i = itemCtor.newInstance(ObjectArrays.concat(block, itemCtorArgs));
|
|
||||||
}
|
|
||||||
// block registration has to happen first
|
|
||||||
register(block.getRegistryName() == null ? block.setRegistryName(name) : block);
|
|
||||||
if (i != null)
|
|
||||||
register(i.setRegistryName(name));
|
|
||||||
return block;
|
|
||||||
} catch (Exception e)
|
|
||||||
{
|
|
||||||
FMLLog.log(Level.ERROR, e, "Caught an exception during block registration");
|
|
||||||
throw new LoaderException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Use Block.REGISTRY.getValue(ResourceLocation) instead!
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Look up a mod block in the global "named item list"
|
|
||||||
*
|
|
||||||
* @param modId The modid owning the block
|
|
||||||
* @param name The name of the block itself
|
|
||||||
* @return The block or null if not found
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Block findBlock(String modId, String name)
|
|
||||||
{
|
|
||||||
return GameData.findBlock(modId, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use Item.REGISTRY.getValue(ResourceLocation) instead!
|
|
||||||
*
|
|
||||||
* Look up a mod item in the global "named item list"
|
|
||||||
*
|
|
||||||
* @param modId The modid owning the item
|
|
||||||
* @param name The name of the item itself
|
|
||||||
* @return The item or null if not found
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Item findItem(String modId, String name)
|
|
||||||
{
|
|
||||||
return GameData.findItem(modId, name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,7 @@ public class PersistentRegistryManager
|
||||||
public static final ResourceLocation SOUNDEVENTS = new ResourceLocation("minecraft:soundevents");
|
public static final ResourceLocation SOUNDEVENTS = new ResourceLocation("minecraft:soundevents");
|
||||||
public static final ResourceLocation POTIONTYPES = new ResourceLocation("minecraft:potiontypes");
|
public static final ResourceLocation POTIONTYPES = new ResourceLocation("minecraft:potiontypes");
|
||||||
public static final ResourceLocation ENCHANTMENTS = new ResourceLocation("minecraft:enchantments");
|
public static final ResourceLocation ENCHANTMENTS = new ResourceLocation("minecraft:enchantments");
|
||||||
|
public static final ResourceLocation ENTITIES = new ResourceLocation("minecraft:entities");
|
||||||
static final ResourceLocation SUBSTITUTION_ORIGINALS = new ResourceLocation("fml:suboriginals");
|
static final ResourceLocation SUBSTITUTION_ORIGINALS = new ResourceLocation("fml:suboriginals");
|
||||||
|
|
||||||
@Deprecated //Use RegistryBuilder TODO: Remove in 1.11
|
@Deprecated //Use RegistryBuilder TODO: Remove in 1.11
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.minecraftforge.debug;
|
package net.minecraftforge.debug;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
@ -29,8 +27,6 @@ import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.text.TextComponentString;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
|
@ -98,6 +94,7 @@ public class DynBucketTest
|
||||||
|
|
||||||
public static class ClientProxy extends CommonProxy
|
public static class ClientProxy extends CommonProxy
|
||||||
{
|
{
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Override
|
@Override
|
||||||
void setupModels()
|
void setupModels()
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class ModelAnimationDebug
|
||||||
});
|
});
|
||||||
String entityName = MODID + ":entity_chest";
|
String entityName = MODID + ":entity_chest";
|
||||||
//EntityRegistry.registerGlobalEntityID(EntityChest.class, entityName, EntityRegistry.findGlobalUniqueEntityId());
|
//EntityRegistry.registerGlobalEntityID(EntityChest.class, entityName, EntityRegistry.findGlobalUniqueEntityId());
|
||||||
EntityRegistry.registerModEntity(EntityChest.class, entityName, 0, ModelAnimationDebug.instance, 64, 20, true, 0xFFAAAA00, 0xFFDDDD00);
|
EntityRegistry.registerModEntity(new ResourceLocation(entityName), EntityChest.class, entityName, 0, ModelAnimationDebug.instance, 64, 20, true, 0xFFAAAA00, 0xFFDDDD00);
|
||||||
RenderingRegistry.registerEntityRenderingHandler(EntityChest.class, new IRenderFactory<EntityChest>()
|
RenderingRegistry.registerEntityRenderingHandler(EntityChest.class, new IRenderFactory<EntityChest>()
|
||||||
{
|
{
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class WRNormalMod
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLPreInitializationEvent event)
|
public void init(FMLPreInitializationEvent event)
|
||||||
{
|
{
|
||||||
EntityRegistry.registerModEntity(EntityScaleTest.class, "scale_test", 0, instance, 60, 3, true);
|
EntityRegistry.registerModEntity(new ResourceLocation("wrnormal", "scale_test"), EntityScaleTest.class, "scale_test", 0, instance, 60, 3, true);
|
||||||
proxy.registerRenders();
|
proxy.registerRenders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue