mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-24 05:54:41 +00:00
Some entity patches.
This commit is contained in:
1 parent
728319cbb5
commit
ad788880e5
57 files changed
+697
-751
No files matched your search
@@ -14,7 +14,7 @@ import net.minecraft.entity.DataWatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.ModContainer;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
@@ -110,12 +110,12 @@ public abstract class FMLMessage {
|
||||
}
|
||||
|
||||
public static class EntityAdjustMessage extends EntityMessage {
|
||||
int serverX;
|
||||
int serverY;
|
||||
int serverZ;
|
||||
long serverX;
|
||||
long serverY;
|
||||
long serverZ;
|
||||
|
||||
public EntityAdjustMessage() {}
|
||||
public EntityAdjustMessage(Entity entity, int serverX, int serverY, int serverZ)
|
||||
public EntityAdjustMessage(Entity entity, long serverX, long serverY, long serverZ)
|
||||
{
|
||||
super(entity);
|
||||
this.serverX = serverX;
|
||||
@@ -127,9 +127,9 @@ public abstract class FMLMessage {
|
||||
void toBytes(ByteBuf buf)
|
||||
{
|
||||
super.toBytes(buf);
|
||||
buf.writeInt(serverX);
|
||||
buf.writeInt(serverY);
|
||||
buf.writeInt(serverZ);
|
||||
buf.writeLong(serverX);
|
||||
buf.writeLong(serverY);
|
||||
buf.writeLong(serverZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -109,7 +109,7 @@ public class FMLNetworkHandler
|
||||
|
||||
}
|
||||
|
||||
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, int serverX, int serverY, int serverZ)
|
||||
public static void makeEntitySpawnAdjustment(Entity entity, EntityPlayerMP player, long serverX, long serverY, long serverZ)
|
||||
{
|
||||
EmbeddedChannel embeddedChannel = channelPair.get(Side.SERVER);
|
||||
embeddedChannel.attr(FMLOutboundHandler.FML_MESSAGETARGET).set(OutboundTarget.PLAYER);
|
||||
|
||||
@@ -118,8 +118,6 @@ public class EntityRegistry
|
||||
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
|
||||
private Map<String,ModContainer> entityNames = Maps.newHashMap();
|
||||
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
|
||||
private Map<String, EntityList.EntityEggInfo> entityEggs = Maps.newHashMap();
|
||||
private Map<String, EntityList.EntityEggInfo> entityEggsUn = Collections.unmodifiableMap(entityEggs);
|
||||
|
||||
public static EntityRegistry instance()
|
||||
{
|
||||
@@ -200,40 +198,6 @@ public class EntityRegistry
|
||||
entityRegistrations.put(mc, er);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a spawn egg for the specified entity class.
|
||||
* The class must already be registered in the EntityList.classToStringMapping.
|
||||
* This can be done either by using the global ID system, or preferably the registerModEntity functions above.
|
||||
* Once registered mob eggs can be created by using minecraft:spawn_egg with NBT entry 'entity_name' with
|
||||
* value of the name this class is registered in the classToStringMapping with.
|
||||
*
|
||||
* @param entityClass The entity class
|
||||
* @param primary Primary egg color
|
||||
* @param secondary Secondary egg color
|
||||
*
|
||||
* @throws IllegalArgumentException if entityClass is not registered in classToStringMapping.
|
||||
*
|
||||
*/
|
||||
public static void registerEgg(Class<? extends Entity> entityClass, int primary, int secondary)
|
||||
{
|
||||
if (!EntityList.classToStringMapping.containsKey(entityClass))
|
||||
throw new IllegalArgumentException("Entity not registered in classToString map: " + entityClass);
|
||||
|
||||
String name = (String)EntityList.classToStringMapping.get(entityClass);
|
||||
EntityRegistry.instance().entityEggs.put(name, new EntityList.EntityEggInfo(name, primary, secondary));
|
||||
FMLLog.fine("Registering entity egg '%s' for %s", name, entityClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Unmodifiable view of the registered entity eggs list.
|
||||
*
|
||||
* @return An Unmodifiable view of the registered entity eggs list.
|
||||
*/
|
||||
public static Map<String, EntityList.EntityEggInfo> getEggs()
|
||||
{
|
||||
return instance().entityEggsUn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers in the minecraft Entity ID list. This is generally not a good idea and shouldn't be used.
|
||||
* Simply use {@link #registerModEntity(Class, String, int, Object, int, int, boolean, int, int)} instead.
|
||||
|
||||
+1
-1
@@ -21,8 +21,8 @@ import org.apache.commons.lang3.Validate;
|
||||
import org.apache.logging.log4j.Level;
|
||||
|
||||
import net.minecraft.util.ObjectIntIdentityMap;
|
||||
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.functions.GenericIterableFactory;
|
||||
import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;
|
||||
|
||||
@@ -431,11 +431,10 @@ public class VillagerRegistry
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
|
||||
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()),
|
||||
new PriceInfo(-2, -1))
|
||||
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.getDyeDamage()), new PriceInfo(-2, -1))
|
||||
},
|
||||
{
|
||||
new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)),
|
||||
new ListItemForEmeralds(Items.ender_pearl, new PriceInfo(4, 7)),
|
||||
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
|
||||
},
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user