Java Code Examples for net.minecraft.entity.Entity#getExtendedProperties()

The following examples show how to use net.minecraft.entity.Entity#getExtendedProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HackTickHandler.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void worldTick(TickEvent.WorldTickEvent event){
    if(event.phase == TickEvent.Phase.END) {
        try {
            for(Entity entity : (List<Entity>)event.world.loadedEntityList) {
                HackingEntityProperties hackingProps = (HackingEntityProperties)entity.getExtendedProperties("PneumaticCraftHacking");
                if(hackingProps != null) {
                    hackingProps.update(entity);
                } else {
                    Log.warning("Extended entity props HackingEntityProperties couldn't be found in the entity " + entity.getCommandSenderName());
                }
            }
        } catch(Throwable e) {
            //Catching a CME which I have no clue on what might cause it.
        }
    }
}
 
Example 2
Source File: HackTickHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
public void trackEntity(Entity entity, IHackableEntity iHackable){
    if(iHackable.getId() != null) {
        HackingEntityProperties hackingProps = (HackingEntityProperties)entity.getExtendedProperties("PneumaticCraftHacking");
        if(hackingProps != null) {
            hackingProps.addHackable(iHackable);
        } else {
            Log.warning("Extended entity props HackingEntityProperties couldn't be found in the entity " + entity.getCommandSenderName());
        }
    }
}
 
Example 3
Source File: PneumaticCraftAPIHandler.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<IHackableEntity> getCurrentEntityHacks(Entity entity){
    HackingEntityProperties hackingProps = (HackingEntityProperties)entity.getExtendedProperties("PneumaticCraftHacking");
    if(hackingProps != null) {
        List<IHackableEntity> hackables = hackingProps.getCurrentHacks();
        if(hackables != null) return hackables;
    } else {
        Log.warning("Extended entity props HackingEntityProperties couldn't be found in the entity " + entity.getCommandSenderName());
    }
    return new ArrayList<IHackableEntity>();
}