Java 类net.minecraftforge.common.IExtendedEntityProperties 实例源码

项目:copycore    文件:MessageSyncProperties.java   
@Override
public void handle(EntityPlayer player) {
    Entity entity = player.worldObj.getEntityByID(entityId);
    if (entity == null) {
        copycore.log.warn("Couldn't find entity to sync to for properties '{}'.", identifier);
        return;
    }
    IExtendedEntityProperties properties = entity.getExtendedProperties(identifier);
    if (!(properties instanceof EntityPropertiesBase)) {
        copycore.log.warn("No valid syncable properties found for '{}'.", identifier);
        return;
    }
    EntityPropertiesBase syncProperties = (EntityPropertiesBase)properties;
    int amount = propertyBuffer.readByte();
    for (int i = 0; i < amount; i++)
        syncProperties.getPropertyById(propertyBuffer.readByte()).read(propertyBuffer);
}
项目:Dota2Items    文件:StatsTracker.java   
/**
 * Upon respawn the EntityPlayer is constructed anew, however, with a wrong
 * entityID at the moment of EntityConstructing event dispatch. That entityID
 * is changed later on, but the ExtendedProperties have already been written
 * and cannot be removed. So let us manually copy the required values into
 * the existing ExtendedProperties.  
 */
@Override
public void onPlayerRespawn(EntityPlayer player) {
    IExtendedEntityProperties props = (player.getExtendedProperties(EXT_PROP_STATS));
    if (props != null) {
        EntityStats oldStats = getOrCreateEntityStats(player);
        EntityStats newStats = (EntityStats)props;
        newStats.entity = player;
        newStats.setGold(oldStats.getReliableGold(), oldStats.getUnreliableGold());
        Map<EntityLivingBase, EntityStats> entityStats = getEntityStatsMap(getSide(player));
        entityStats.put(player, newStats);
        newStats.setMana(newStats.getMaxMana());

        newStats.sendSyncPacketToClient(player);
    }
}
项目:SevenCommons    文件:EntityNBTHook.java   
@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
    super.visitMethodInsn(opcode, owner, name, desc);
    if (opcode == INVOKEINTERFACE
            && owner.equals(Type.getInternalName(IExtendedEntityProperties.class))
            && name.equals(ieepMethod)) {

        Type objectType = Type.getType(Object.class);
        Type stringType = Type.getType(String.class);
        Type nbtCompType = Type.getObjectType("net/minecraft/nbt/NBTTagCompound");

        super.visitVarInsn(ALOAD, lastSavedVar);
        super.visitVarInsn(ALOAD, prevLastSavedVar);
        super.visitVarInsn(ALOAD, 1);

        super.visitMethodInsn(INVOKESTATIC,
                Type.getInternalName(ASMHooks.class),
                ieepHookMethod,
                Type.getMethodDescriptor(VOID_TYPE, objectType, stringType, nbtCompType));
    }
}
项目:4Space-5    文件:EntityPlayer.java   
public void clonePlayer(EntityPlayer p_71049_1_, boolean p_71049_2_)
{
    if (p_71049_2_)
    {
        this.inventory.copyInventory(p_71049_1_.inventory);
        setHealth(p_71049_1_.getHealth());
        this.foodStats = p_71049_1_.foodStats;
        this.experienceLevel = p_71049_1_.experienceLevel;
        this.experienceTotal = p_71049_1_.experienceTotal;
        this.experience = p_71049_1_.experience;
        setScore(p_71049_1_.getScore());
        this.teleportDirection = p_71049_1_.teleportDirection;

        this.extendedProperties = p_71049_1_.extendedProperties;
        for (IExtendedEntityProperties p : this.extendedProperties.values()) {
            p.init(this, this.worldObj);
        }
    }
    else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        this.inventory.copyInventory(p_71049_1_.inventory);
        this.experienceLevel = p_71049_1_.experienceLevel;
        this.experienceTotal = p_71049_1_.experienceTotal;
        this.experience = p_71049_1_.experience;
        setScore(p_71049_1_.getScore());
    }
    this.theInventoryEnderChest = p_71049_1_.theInventoryEnderChest;

    this.spawnChunkMap = p_71049_1_.spawnChunkMap;
    this.spawnForcedMap = p_71049_1_.spawnForcedMap;



    NBTTagCompound old = p_71049_1_.getEntityData();
    if (old.hasKey("PlayerPersisted")) {
        getEntityData().setTag("PlayerPersisted", old.getCompoundTag("PlayerPersisted"));
    }
    MinecraftForge.EVENT_BUS.post(new PlayerEvent.Clone(this, p_71049_1_, !p_71049_2_));
}
项目:Elemancy    文件:ItemMagicWeapon.java   
private PlayerMagicProperty getPlayerMagic(EntityPlayer player) {
    IExtendedEntityProperties property = player.getExtendedProperties(PlayerMagicProperty.KEY);
    if (property == null) {
        return null;
    }
    if (!(property instanceof PlayerMagicProperty)) {
        return null;
    }
    return (PlayerMagicProperty) property;

}
项目:TickDynamic    文件:Entity.java   
public Entity(World p_i1582_1_)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    this.field_70135_K = true;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.entityUniqueID = UUID.randomUUID();
    this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
    this.worldObj = p_i1582_1_;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (p_i1582_1_ != null)
    {
        this.dimension = p_i1582_1_.provider.dimensionId;
    }

    this.dataWatcher = new DataWatcher(this);
    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.entityInit();

    extendedProperties = new HashMap<String, IExtendedEntityProperties>();

    MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));

    for (IExtendedEntityProperties props : this.extendedProperties.values())
    {
        props.init(this, p_i1582_1_);
    }
}
项目:TickDynamic    文件:Entity.java   
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
项目:RacesForMinecraft    文件:RacePlayer.java   
public static RacePlayer get(EntityPlayer player) {
    IExtendedEntityProperties entityProperties = ExtendedEntityHandler
            .getExtended(player, RacePlayer.class);
    if (entityProperties != null) {
        return (RacePlayer) entityProperties;
    }
    else {
        return null;
    }
}
项目:copycore    文件:EntityUtils.java   
public static String getIdentifier(Class<? extends IExtendedEntityProperties> propertiesClass) {
    String identifier = propertiesLookup.get(propertiesClass);
    if (identifier == null) {
        try { identifier = (String)propertiesClass.getField("IDENTIFIER").get(null); }
        catch (Exception e) { throw new Error(e); }
        propertiesLookup.put(propertiesClass, identifier);
    }
    return identifier;
}
项目:copycore    文件:EntityUtils.java   
public static <T extends IExtendedEntityProperties> T createProperties(Entity entity, Class<T> propertiesClass) {
    try {
        T properties = propertiesClass.getConstructor().newInstance();
        entity.registerExtendedProperties(getIdentifier(propertiesClass), properties);
        return properties;
    } catch (Exception e) { throw new Error(e); }
}
项目:4Space-1.7    文件:EntityPlayer.java   
public void clonePlayer(EntityPlayer p_71049_1_, boolean p_71049_2_)
{
    if (p_71049_2_)
    {
        this.inventory.copyInventory(p_71049_1_.inventory);
        setHealth(p_71049_1_.getHealth());
        this.foodStats = p_71049_1_.foodStats;
        this.experienceLevel = p_71049_1_.experienceLevel;
        this.experienceTotal = p_71049_1_.experienceTotal;
        this.experience = p_71049_1_.experience;
        setScore(p_71049_1_.getScore());
        this.teleportDirection = p_71049_1_.teleportDirection;

        this.extendedProperties = p_71049_1_.extendedProperties;
        for (IExtendedEntityProperties p : this.extendedProperties.values()) {
            p.init(this, this.worldObj);
        }
    }
    else if (this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
    {
        this.inventory.copyInventory(p_71049_1_.inventory);
        this.experienceLevel = p_71049_1_.experienceLevel;
        this.experienceTotal = p_71049_1_.experienceTotal;
        this.experience = p_71049_1_.experience;
        setScore(p_71049_1_.getScore());
    }
    this.theInventoryEnderChest = p_71049_1_.theInventoryEnderChest;

    this.spawnChunkMap = p_71049_1_.spawnChunkMap;
    this.spawnForcedMap = p_71049_1_.spawnForcedMap;



    NBTTagCompound old = p_71049_1_.getEntityData();
    if (old.hasKey("PlayerPersisted")) {
        getEntityData().setTag("PlayerPersisted", old.getCompoundTag("PlayerPersisted"));
    }
    MinecraftForge.EVENT_BUS.post(new PlayerEvent.Clone(this, p_71049_1_, !p_71049_2_));
}
项目:Quantum-Anomalies    文件:ItemRiftMagnet.java   
@SuppressWarnings("unchecked")
public void onUpdate(ItemStack stack, World world, Entity p, int slot, boolean held) {
    checkCompound(stack);
    if (this.getDamage(stack) == 1 && !world.isRemote) {
        int rangeX = 8;
        int rangeY = 4;

        int ench = EnchantmentHelper.getEnchantmentLevel(QAEnchant.RANGE.get().effectId, stack);

        if (ench > 0) {
            rangeX += ench * 2;
            rangeY += ench;
        }

        List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(p.posX - rangeX, p.posY - rangeY, p.posZ - rangeY, p.posX + rangeX, p.posY + rangeY, p.posZ + rangeX));

        itemLoop:
        for (EntityItem item : items) {
            IExtendedEntityProperties properties = item.getExtendedProperties("tossData");
            if (properties != null) {
                PropertiesItem prop = (PropertiesItem) properties;
                if (p.getUniqueID().toString().equals(prop.tosser) && item.age <= 300) return;
            }

            NBTTagList list = (NBTTagList) stack.stackTagCompound.getTag("blacklist");
            if (list != null)
                for (int i = 0; i < list.tagCount(); i++) {
                    int dmg = list.getCompoundTagAt(i).getInteger("dmg");
                    String nm = list.getCompoundTagAt(i).getString("id");

                    if (item.getEntityItem().getUnlocalizedName().equals(nm) && item.getEntityItem().getItemDamage() == dmg) continue itemLoop;
                }

            item.delayBeforeCanPickup = 0;
            item.setPosition(p.posX, p.posY, p.posZ);
        }
    }
}
项目:SamsPowerups    文件:InventoryPersistProperty.java   
public static InventoryPersistProperty get(EntityPlayer player)
{
    IExtendedEntityProperties property = player.getExtendedProperties(ID);

    if(property != null && property instanceof InventoryPersistProperty)
    {
        return (InventoryPersistProperty)property;
    } else
    {
        return null;
    }
}
项目:Cauldron    文件:Entity.java   
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
项目:Cauldron    文件:Entity.java   
public Entity(World p_i1582_1_)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    this.field_70135_K = true;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.entityUniqueID = UUID.randomUUID();
    this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
    this.worldObj = p_i1582_1_;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (p_i1582_1_ != null)
    {
        this.dimension = p_i1582_1_.provider.dimensionId;
    }

    this.dataWatcher = new DataWatcher(this);
    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.entityInit();

    extendedProperties = new HashMap<String, IExtendedEntityProperties>();

    MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));

    for (IExtendedEntityProperties props : this.extendedProperties.values())
    {
        props.init(this, p_i1582_1_);
    }
}
项目:Cauldron    文件:Entity.java   
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
项目:RuneCraftery    文件:Entity.java   
public Entity(World par1World)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    this.field_70135_K = true;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.dataWatcher = new DataWatcher();
    this.entityUniqueID = UUID.randomUUID();
    this.myEntitySize = EnumEntitySize.SIZE_2;
    this.worldObj = par1World;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (par1World != null)
    {
        this.dimension = par1World.provider.dimensionId;
    }

    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.entityInit();

    extendedProperties = new HashMap<String, IExtendedEntityProperties>();

    MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));

    for (IExtendedEntityProperties props : this.extendedProperties.values())
    {
        props.init(this, par1World);
    }
}
项目:RuneCraftery    文件:Entity.java   
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
项目:SevenCommons    文件:ASMHooks.java   
public static void onNewEntityProps(Entity entity, IExtendedEntityProperties props, String identifier) throws Throwable {
    IEEPSyncCompanion companion = (IEEPSyncCompanion) SyncCompanions.newCompanion(props.getClass());
    if (companion == null) {
        return;
    }

    List<IEEPSyncCompanion> companions = ((EntityProxy) entity)._sc$getPropsCompanions();
    if (companions == null) {
        companions = new ArrayList<>();
        ((EntityProxy) entity)._sc$setPropsCompanions(companions);
    }

    companion._sc$ieep = props;
    companion._sc$entity = entity;
    companion._sc$ident = identifier;

    // maintain ordering in the list
    int len = companions.size();
    int index = 0;
    for (int i = 0; i < len; i++) {
        if (companions.get(i)._sc$ident.compareTo(identifier) >= 0) {
            index = i;
            break;
        }
    }
    companions.add(index, companion);
}
项目:SevenCommons    文件:SyncHelpers.java   
static SyncType getSyncType(Class<?> clazz) {
    if (TileEntity.class.isAssignableFrom(clazz)) {
        return SyncType.TILE_ENTITY;
    } else if (Entity.class.isAssignableFrom(clazz)) {
        return SyncType.ENTITY;
    } else if (Container.class.isAssignableFrom(clazz)) {
        return SyncType.CONTAINER;
    } else if (IExtendedEntityProperties.class.isAssignableFrom(clazz)) {
        return SyncType.ENTITY_PROPS;
    } else {
        throw new IllegalArgumentException("@Sync in invalid class " + clazz);
    }
}
项目:BetterNutritionMod    文件:Entity.java   
public Entity(World par1World)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    this.field_70135_K = true;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.dataWatcher = new DataWatcher();
    this.entityUniqueID = UUID.randomUUID();
    this.myEntitySize = EnumEntitySize.SIZE_2;
    this.worldObj = par1World;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (par1World != null)
    {
        this.dimension = par1World.provider.dimensionId;
    }

    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.entityInit();

    extendedProperties = new HashMap<String, IExtendedEntityProperties>();

    MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));

    for (IExtendedEntityProperties props : this.extendedProperties.values())
    {
        props.init(this, par1World);
    }
}
项目:BetterNutritionMod    文件:Entity.java   
/**
 * Register the instance of IExtendedProperties into the entity's collection.
 * @param identifier The identifier which you can use to retrieve these properties for the entity.
 * @param properties The instanceof IExtendedProperties to register
 * @return The identifier that was used to register the extended properties.  Empty String indicates an error.  If your requested key already existed, this will return a modified one that is unique.
 */
public String registerExtendedProperties(String identifier, IExtendedEntityProperties properties)
{
    if (identifier == null)
    {
        FMLLog.warning("Someone is attempting to register extended properties using a null identifier.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }
    if (properties == null)
    {
        FMLLog.warning("Someone is attempting to register null extended properties.  This is not allowed.  Aborting.  This may have caused instability.");
        return "";
    }

    String baseIdentifier = identifier;
    int identifierModCount = 1;
    while (this.extendedProperties.containsKey(identifier))
    {
        identifier = String.format("%s%d", baseIdentifier, identifierModCount++);
    }

    if (baseIdentifier != identifier)
    {
        FMLLog.info("An attempt was made to register exended properties using an existing key.  The duplicate identifier (%s) has been remapped to %s.", baseIdentifier, identifier);
    }

    this.extendedProperties.put(identifier, properties);
    return identifier;
}
项目:cctags    文件:EntityTagsListener.java   
public static TagProperty getProperty(Entity entity) {
    IExtendedEntityProperties prop = entity.getExtendedProperties(ItemTagUtils.EMBEDDED_TAG_PROPERTY);
    if (prop instanceof TagProperty)
        return (TagProperty)prop;

    return null;
}
项目:cctags    文件:EntityTagsListener.java   
@ForgeSubscribe
public void onEntityDeath(LivingDropsEvent evt) {
    IExtendedEntityProperties prop = evt.entity.getExtendedProperties(ItemTagUtils.EMBEDDED_TAG_PROPERTY);

    if (prop instanceof TagProperty) {
        TagProperty tag = (TagProperty)prop;
        if (tag.tagData != null) {
            ItemStack drop = CCTags.instance.itemTag.createFromData(tag.tagData);
            EntityItem entityItem = Utils.createDrop(evt.entity, drop);
            evt.drops.add(entityItem);
        }
    }
}
项目:TickDynamic    文件:Entity.java   
/**
 * Save the entity to NBT (calls an abstract helper method to write extra data)
 */
public void writeToNBT(NBTTagCompound p_70109_1_)
{
    try
    {
        p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        p_70109_1_.setFloat("FallDistance", this.fallDistance);
        p_70109_1_.setShort("Fire", (short)this.fire);
        p_70109_1_.setShort("Air", (short)this.getAir());
        p_70109_1_.setBoolean("OnGround", this.onGround);
        p_70109_1_.setInteger("Dimension", this.dimension);
        p_70109_1_.setBoolean("Invulnerable", this.invulnerable);
        p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
        p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
        p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
        if (customEntityData != null)
        {
            p_70109_1_.setTag("ForgeData", customEntityData);
        }

       for (String identifier : this.extendedProperties.keySet())
       {
            try
            {
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(p_70109_1_);
            }
            catch (Throwable t)
            {
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

       this.writeEntityToNBT(p_70109_1_);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                p_70109_1_.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:copycore    文件:EntityUtils.java   
public static <T extends IExtendedEntityProperties> T getProperties(Entity entity, Class<T> propertiesClass) {
    IExtendedEntityProperties properties = entity.getExtendedProperties(getIdentifier(propertiesClass));
    return (propertiesClass.isInstance(properties) ? (T)properties : null);
}
项目:copycore    文件:EntityUtils.java   
public static <T extends IExtendedEntityProperties> T getOrCreateProperties(Entity entity, Class<T> propertiesClass) {
    T properties = getProperties(entity, propertiesClass);
    return ((properties != null) ? properties : createProperties(entity, propertiesClass));
}
项目:Cauldron    文件:Entity.java   
public Entity(World p_i1582_1_)
{
    this.entityId = nextEntityID++;
    this.renderDistanceWeight = 1.0D;
    this.boundingBox = AxisAlignedBB.getBoundingBox(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
    this.field_70135_K = true;
    this.width = 0.6F;
    this.height = 1.8F;
    this.nextStepDistance = 1;
    this.rand = new Random();
    this.fireResistance = 1;
    this.firstUpdate = true;
    this.entityUniqueID = new UUID(rand.nextLong(), rand.nextLong()); // Spigot
    this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
    this.worldObj = p_i1582_1_;
    this.setPosition(0.0D, 0.0D, 0.0D);

    if (p_i1582_1_ != null)
    {
        this.dimension = p_i1582_1_.provider.dimensionId;
        // Spigot start
        this.defaultActivationState = org.spigotmc.ActivationRange.initializeEntityActivationState(this, p_i1582_1_.getSpigotConfig()); // Cauldron
    }
    else
    {
        this.defaultActivationState = false;
    }

    // Spigot end
    this.dataWatcher = new DataWatcher(this);
    this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
    this.dataWatcher.addObject(1, Short.valueOf((short)300));
    this.entityInit();

    extendedProperties = new HashMap<String, IExtendedEntityProperties>();

    MinecraftForge.EVENT_BUS.post(new EntityEvent.EntityConstructing(this));

    for (IExtendedEntityProperties props : this.extendedProperties.values())
    {
        props.init(this, p_i1582_1_);
    }
}
项目:Cauldron    文件:Entity.java   
public void writeToNBT(NBTTagCompound p_70109_1_)
{
    try
    {
        p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));

        // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
        // TODO: make sure this is the best way to address this.
        if (Float.isNaN(this.rotationYaw))
        {
            this.rotationYaw = 0;
        }

        if (Float.isNaN(this.rotationPitch))
        {
            this.rotationPitch = 0;
        }

        // CraftBukkit end
        p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        p_70109_1_.setFloat("FallDistance", this.fallDistance);
        p_70109_1_.setShort("Fire", (short)this.fire);
        p_70109_1_.setShort("Air", (short)this.getAir());
        p_70109_1_.setBoolean("OnGround", this.onGround);
        p_70109_1_.setInteger("Dimension", this.dimension);
        p_70109_1_.setBoolean("Invulnerable", this.invulnerable);
        p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
        p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
        p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
        // CraftBukkit start
        p_70109_1_.setLong("WorldUUIDLeast", this.worldObj.getSaveHandler().getUUID().getLeastSignificantBits());
        p_70109_1_.setLong("WorldUUIDMost", this.worldObj.getSaveHandler().getUUID().getMostSignificantBits());
        p_70109_1_.setInteger("Bukkit.updateLevel", CURRENT_LEVEL);
        p_70109_1_.setInteger("Spigot.ticksLived", this.ticksExisted);
        // CraftBukkit end
        if (customEntityData != null)
        {
            p_70109_1_.setTag("ForgeData", customEntityData);
        }

       for (String identifier : this.extendedProperties.keySet())
       {
            try
            {
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(p_70109_1_);
            }
            catch (Throwable t)
            {
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

       this.writeEntityToNBT(p_70109_1_);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                p_70109_1_.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:Cauldron    文件:Entity.java   
public void writeToNBT(NBTTagCompound p_70109_1_)
{
    try
    {
        p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        p_70109_1_.setFloat("FallDistance", this.fallDistance);
        p_70109_1_.setShort("Fire", (short)this.fire);
        p_70109_1_.setShort("Air", (short)this.getAir());
        p_70109_1_.setBoolean("OnGround", this.onGround);
        p_70109_1_.setInteger("Dimension", this.dimension);
        p_70109_1_.setBoolean("Invulnerable", this.invulnerable);
        p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
        p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
        p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
        if (customEntityData != null)
        {
            p_70109_1_.setTag("ForgeData", customEntityData);
        }

       for (String identifier : this.extendedProperties.keySet())
       {
            try
            {
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(p_70109_1_);
            }
            catch (Throwable t)
            {
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

       this.writeEntityToNBT(p_70109_1_);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound();

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                p_70109_1_.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:RuneCraftery    文件:Entity.java   
/**
 * Save the entity to NBT (calls an abstract helper method to write extra data)
 */
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
    try
    {
        par1NBTTagCompound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        par1NBTTagCompound.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        par1NBTTagCompound.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        par1NBTTagCompound.setFloat("FallDistance", this.fallDistance);
        par1NBTTagCompound.setShort("Fire", (short)this.fire);
        par1NBTTagCompound.setShort("Air", (short)this.getAir());
        par1NBTTagCompound.setBoolean("OnGround", this.onGround);
        par1NBTTagCompound.setInteger("Dimension", this.dimension);
        par1NBTTagCompound.setBoolean("Invulnerable", this.invulnerable);
        par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
        par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
        par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
        if (customEntityData != null)
        {
            par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
        }

        for (String identifier : this.extendedProperties.keySet()){
            try{
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(par1NBTTagCompound);
            }catch (Throwable t){
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

        this.writeEntityToNBT(par1NBTTagCompound);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound("Riding");

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                par1NBTTagCompound.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:PerFabricaAdAstra    文件:FluidRespirationProperties.java   
public static void setAirLevel(EntityLivingBase entity, int airLevel) {
    IExtendedEntityProperties props = entity.getExtendedProperties(IDENTIFIER);
    ((FluidRespirationProperties)props).setAirLevel(airLevel);
}
项目:PerFabricaAdAstra    文件:FluidRespirationProperties.java   
public static int getAirLevel(EntityLivingBase entity) {
    IExtendedEntityProperties props = entity.getExtendedProperties(IDENTIFIER);
    return ((FluidRespirationProperties)props).getAirLevel();
}
项目:SevenCommons    文件:BytecodeEmittingCompanionGenerator.java   
private boolean isIEEP() {
    return IExtendedEntityProperties.class.isAssignableFrom(clazz);
}
项目:BetterNutritionMod    文件:Entity.java   
/**
 * Save the entity to NBT (calls an abstract helper method to write extra data)
 */
public void writeToNBT(NBTTagCompound par1NBTTagCompound)
{
    try
    {
        par1NBTTagCompound.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
        par1NBTTagCompound.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
        par1NBTTagCompound.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
        par1NBTTagCompound.setFloat("FallDistance", this.fallDistance);
        par1NBTTagCompound.setShort("Fire", (short)this.fire);
        par1NBTTagCompound.setShort("Air", (short)this.getAir());
        par1NBTTagCompound.setBoolean("OnGround", this.onGround);
        par1NBTTagCompound.setInteger("Dimension", this.dimension);
        par1NBTTagCompound.setBoolean("Invulnerable", this.invulnerable);
        par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
        par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
        par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
        if (customEntityData != null)
        {
            par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
        }

        for (String identifier : this.extendedProperties.keySet()){
            try{
                IExtendedEntityProperties props = this.extendedProperties.get(identifier);
                props.saveNBTData(par1NBTTagCompound);
            }catch (Throwable t){
                FMLLog.severe("Failed to save extended properties for %s.  This is a mod issue.", identifier);
                t.printStackTrace();
            }
        }

        this.writeEntityToNBT(par1NBTTagCompound);

        if (this.ridingEntity != null)
        {
            NBTTagCompound nbttagcompound1 = new NBTTagCompound("Riding");

            if (this.ridingEntity.writeMountToNBT(nbttagcompound1))
            {
                par1NBTTagCompound.setTag("Riding", nbttagcompound1);
            }
        }
    }
    catch (Throwable throwable)
    {
        CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Saving entity NBT");
        CrashReportCategory crashreportcategory = crashreport.makeCategory("Entity being saved");
        this.addEntityCrashInfo(crashreportcategory);
        throw new ReportedException(crashreport);
    }
}
项目:PneumaticCraft    文件:EntityDrone.java   
@Override
public IExtendedEntityProperties getProperty(String key){
    return getExtendedProperties(key);
}
项目:PneumaticCraft    文件:EntityDrone.java   
@Override
public void setProperty(String key, IExtendedEntityProperties property){
    registerExtendedProperties(key, property);
}
项目:PneumaticCraft    文件:TileEntityProgrammableController.java   
@Override
public IExtendedEntityProperties getProperty(String key){
    return properties.get(key);
}
项目:PneumaticCraft    文件:TileEntityProgrammableController.java   
@Override
public void setProperty(String key, IExtendedEntityProperties property){
    properties.put(key, property);
}
项目:TickDynamic    文件:Entity.java   
/**
 * Gets the extended properties identified by the passed in key
 * @param identifier The key that identifies the extended properties.
 * @return The instance of IExtendedProperties that was found, or null.
 */
public IExtendedEntityProperties getExtendedProperties(String identifier)
{
    return this.extendedProperties.get(identifier);
}