Initial 1.11-pre1 update

This commit is contained in:
cpw committed 2016-11-13 17:09:55 -05:00
1 parent c177219ff3
commit 4e6a774075
294 files changed
+3099 -2846

No files matched your search

@@ -81,6 +81,7 @@ public class ItemStackTransformer implements IClassTransformer {
for (MethodNode m: classNode.methods)
{
if (m.name.equals("func_190923_F") || m.name.equals("func_190926_b")) continue;
for (ListIterator<AbstractInsnNode> it = m.instructions.iterator(); it.hasNext(); )
{
AbstractInsnNode insnNode = it.next();
@@ -172,29 +172,6 @@ public class EntityRegistry
private void doModEntityRegistration(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates)
{
ModContainer mc = FMLCommonHandler.instance().findContainerFor(mod);
EntityRegistration er = new EntityRegistration(mc, entityClass, entityName, id, trackingRange, updateFrequency, sendsVelocityUpdates);
try
{
entityClassRegistrations.put(entityClass, er);
entityNames.put(entityName, mc);
if (!EntityList.CLASS_TO_NAME.containsKey(entityClass))
{
String entityModName = String.format("%s.%s", mc.getModId(), entityName);
EntityList.CLASS_TO_NAME.put(entityClass, entityModName);
EntityList.NAME_TO_CLASS.put(entityModName, entityClass);
FMLLog.finer("Automatically registered mod %s entity %s as %s", mc.getModId(), entityName, entityModName);
}
else
{
FMLLog.fine("Skipping automatic mod %s entity registration for already registered class %s", mc.getModId(), entityClass.getName());
}
}
catch (IllegalArgumentException e)
{
FMLLog.log(Level.WARN, e, "The mod %s tried to register the entity (name,class) (%s,%s) one or both of which are already registered", mc.getModId(), entityName, entityClass.getName());
return;
}
entityRegistrations.put(mc, er);
}
/**
@@ -214,16 +191,6 @@ public class EntityRegistry
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
{
if (EntityList.CLASS_TO_NAME.containsKey(entityClass))
{
String name = EntityList.CLASS_TO_NAME.get(entityClass);
EntityList.ENTITY_EGGS.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
}
else
{
FMLLog.fine("Failed registering entity egg %s (No entity found)", entityClass.getName());
}
}
/**
@@ -272,7 +239,7 @@ public class EntityRegistry
@SuppressWarnings("unchecked")
public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType typeOfCreature, Biome... biomes)
{
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
Class <? extends Entity > entityClazz = null;
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
@@ -312,7 +279,7 @@ public class EntityRegistry
@SuppressWarnings("unchecked")
public static void removeSpawn(String entityName, EnumCreatureType typeOfCreature, Biome... biomes)
{
Class <? extends Entity > entityClazz = EntityList.NAME_TO_CLASS.get(entityName);
Class <? extends Entity > entityClazz = null;
if (EntityLiving.class.isAssignableFrom(entityClazz))
{
@@ -257,7 +257,7 @@ public class GameRegistry
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
{
TileEntity.addMapping(tileEntityClass, id);
// TileEntity.addMapping(tileEntityClass, id);
}
/**
@@ -270,7 +270,7 @@ public class GameRegistry
*/
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
{
TileEntity.addMapping(tileEntityClass, id);
// TileEntity.addMapping(tileEntityClass, id);
Map<String, Class<?>> teMappings = ObfuscationReflectionHelper.getPrivateValue(TileEntity.class, null, "field_" + "145855_i", "nameToClassMap");
for (String s : alternatives)
{
@@ -25,10 +25,10 @@ import java.util.Map;
import java.util.Random;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraft.entity.monster.EntityZombieVillager;
import org.apache.commons.lang3.Validate;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.ZombieType;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityVillager.ITradeList;
import net.minecraft.util.EnumFacing;
@@ -315,10 +315,9 @@ public class VillagerRegistry
List<VillagerProfession> entries = INSTANCE.professions.getValues();
entity.setProfession(entries.get(rand.nextInt(entries.size())));
}
public static void setRandomProfession(EntityZombie entity, Random rand)
public static void setRandomProfession(EntityZombieVillager entity, Random rand)
{
List<VillagerProfession> entries = INSTANCE.professions.getValues();
entity.setVillagerType(entries.get(rand.nextInt(entries.size())));
}
@@ -352,50 +351,21 @@ public class VillagerRegistry
}
@SuppressWarnings("deprecation")
public static void onSetProfession(EntityZombie entity, VillagerProfession prof)
public static void onSetProfession(EntityZombieVillager entity, VillagerProfession prof)
{
if (prof == null)
{
if (entity.getZombieType() != ZombieType.NORMAL && entity.getZombieType() != ZombieType.HUSK)
entity.setZombieType(ZombieType.NORMAL);
return;
}
int network = INSTANCE.professions.getId(prof);
if (network == -1 || prof != INSTANCE.professions.getObjectById(network))
{
throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + network + " " + prof);
}
if (network >= 0 && network < 5) // Vanilla
{
if (entity.getZombieType() == null || entity.getZombieType().getId() != network + 1)
{
entity.setZombieType(ZombieType.getVillagerByOrdinal(network));
}
}
else if (entity.getZombieType() != null)
entity.setZombieType(ZombieType.NORMAL);
}
public static void onSetProfession(EntityZombie entity, ZombieType type, int network)
public static void onSetProfession(EntityZombieVillager entity, int network)
{
if (type == ZombieType.NORMAL || type == ZombieType.HUSK)
{
if (entity.getVillagerTypeForge() != null)
entity.setVillagerType(null);
return;
}
int realID = network - 1;
if (type == null) //Forge type?
realID = network * -1; // Forge encoded as -ID
VillagerProfession prof = INSTANCE.professions.getObjectById(realID);
if (prof == null && network != 0 || INSTANCE.professions.getId(prof) != realID)
{
throw new RuntimeException("Attempted to set villager profession to unregistered profession: " + realID + " " + prof);
}
if (prof != entity.getVillagerTypeForge())
entity.setVillagerType(prof);
if (prof != entity.getForgeProfession())
entity.setForgeProfession(prof);
}
@Deprecated public static VillagerProfession getById(int network){ return INSTANCE.professions.getObjectById(network); }