当前位置: 首页>>代码示例>>Java>>正文


Java AttachCapabilitiesEvent类代码示例

本文整理汇总了Java中net.minecraftforge.event.AttachCapabilitiesEvent的典型用法代码示例。如果您正苦于以下问题:Java AttachCapabilitiesEvent类的具体用法?Java AttachCapabilitiesEvent怎么用?Java AttachCapabilitiesEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AttachCapabilitiesEvent类属于net.minecraftforge.event包,在下文中一共展示了AttachCapabilitiesEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public static void registerCapability(AttachCapabilitiesEvent<Entity> event) {
    Entity obj = event.getObject();
    if (obj instanceof EntityPlayer && !(obj instanceof FakePlayer)) {
        EntityPlayer player = (EntityPlayer) obj;
        AbstractPlayerDamageModel damageModel;
        if (player.world.isRemote)
            damageModel = FirstAid.activeDamageConfig == null ? PlayerDamageModel.createTemp() : PlayerDamageModel.create();
        else {
            FirstAid.activeDamageConfig = FirstAidConfig.damageSystem;
            FirstAid.activeHealingConfig = FirstAidConfig.externalHealing;
            FirstAid.scaleMaxHealth = FirstAidConfig.scaleMaxHealth;
            damageModel = PlayerDamageModel.create();
        }
        event.addCapability(CapProvider.IDENTIFIER, new CapProvider(player, damageModel));
        //replace the data manager with our wrapper to grab absorption
        player.dataManager = new DataManagerWrapper(player, player.dataManager);
    }
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:20,代码来源:EventHandler.java

示例2: onAttach

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void onAttach(AttachCapabilitiesEvent event)
{
	Map<ResourceLocation, ICapabilityProvider> map = Maps.newHashMap();
	if (event instanceof AttachCapabilitiesEvent.Item)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.Item) event).getItemStack());
	else if (event instanceof AttachCapabilitiesEvent.Entity)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.Entity) event).getEntity());
	else if (event instanceof AttachCapabilitiesEvent.TileEntity)
		handle(map, event.getObject(), ((AttachCapabilitiesEvent.TileEntity) event).getTileEntity());
	else
		handle(map, event.getObject(), event.getObject());
	for (ICapabilityProvider iCapabilityProvider : event.getCapabilities().values())
		handle(map, iCapabilityProvider, event.getObject());
	for (Map.Entry<ResourceLocation, ICapabilityProvider> entry : map.entrySet())
		event.addCapability(entry.getKey(), entry.getValue());
}
 
开发者ID:InfinityStudio,项目名称:InspiringWorld,代码行数:18,代码来源:CapabilityInterfaceInject.java

示例3: onTELoad

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTELoad(AttachCapabilitiesEvent.TileEntity event) {
    TileEntity tile = event.getTileEntity();
    if (tile instanceof IEnergyReceiver || tile instanceof IEnergyProvider || tile instanceof IEnergyHandler) {
        //This is where we need EnumFacing.UNKNOWN
        try{
            if(tile.hasCapability(CapabilityEnergy.ENERGY, EnumFacing.NORTH)){
                return;
            }
        }catch (Exception e){
            return;
        }

        event.addCapability(new ResourceLocation("rfbridge:forgeEnergy"), new FECapabilityProvider(tile));
    }
}
 
开发者ID:modmuss50,项目名称:RF-Bridge,代码行数:17,代码来源:RFBridge.java

示例4: playerCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
/** Attaches ICapPlayer to the Player. */
@SubscribeEvent
public void playerCapabilities(AttachCapabilitiesEvent<Entity> event) {

    if (!(event.getObject() instanceof EntityPlayer)) {

        return;
    }

    EntityPlayer player = (EntityPlayer) event.getObject();
    
    if (!(player.hasCapability(GeoCaps.CAP_PLAYER, null))) {

        event.addCapability(GeoCaps.CAP_PLAYER_ID,
                new ProviderCapPlayer(new DefaultCapPlayer(player)));
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:18,代码来源:PlayerEvents.java

示例5: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public static void attachCapability(AttachCapabilitiesEvent<Entity> event)
{
    //Attach our capabilities to all players
    Entity entity = event.getObject();
    if(entity instanceof EntityPlayer)
    {
        for(Capability cap : MHCapabilities.getCapabilities())
        {
            ICapability icap = getDefaultICapability(cap);
            if(icap == null) continue;
            if(!entity.hasCapability(cap, null))
                event.addCapability(icap.getKey(), icap.getProvider());
        }
    }
}
 
开发者ID:alxnns1,项目名称:MobHunter,代码行数:17,代码来源:CapabilityHandler.java

示例6: onAddCapabilitiesEntity

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void onAddCapabilitiesEntity(AttachCapabilitiesEvent<Entity> event) {
    if (canHaveAttributes(event.getObject())) {
        EntityLivingBase ent = (EntityLivingBase) event.getObject();
        if (ent instanceof EntityPlayer) {
            event.addCapability(new ResourceLocation(main.MODID + ":radiation_capability"), new RadsFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":water_capability"), new WaterFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":spechial_capability"), new SpechialFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":skills_capability"), new SkillsFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":level_capability"), new LevelFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":ftj_capability"), new FTJFactoryProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":adv_inv_capability"), new IAdvProvider());
            event.addCapability(new ResourceLocation(main.MODID + ":trigger_cap"), new ITrigger_item_Provider());

        }
    }
}
 
开发者ID:Hoijima,项目名称:Fallout_Equestria,代码行数:18,代码来源:EventHandlerPre.java

示例7: onTileEntityCapabilityAttachEvent

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
public void onTileEntityCapabilityAttachEvent(AttachCapabilitiesEvent<TileEntity> event){
    ICapabilityProvider provider = new CapabilityDestinationProvider.Provider();
    boolean requiresCap = false;

    CapabilityDestinationProvider cap = provider.getCapability(CapabilityDestinationProvider.INSTANCE, null);
    for(IDestinationProvider destinationProvider : destinationProviders) {
        if(destinationProvider.isTileEntityApplicable(event.getObject())) {
            try {
                cap.addDestinationProvider(destinationProvider.getClass().newInstance());
                if(!requiresCap) {
                    requiresCap = true;
                    event.addCapability(new ResourceLocation(Constants.MOD_ID, "destinationProviderCapability"), provider);
                }
            } catch(Exception e) {
                e.printStackTrace();
            }
        }
    }
}
 
开发者ID:MineMaarten,项目名称:Signals,代码行数:20,代码来源:RailManager.java

示例8: onEntityCapabilityAttach

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void onEntityCapabilityAttach(AttachCapabilitiesEvent<Entity> event)
{
    Entity entity = event.getObject();
    if(entity instanceof EntityPlayer)
    {
        if(!entity.hasCapability(TEMPORAL_TOOLBELT, EnumFacing.DOWN))
        {
            event.addCapability(new ResourceLocation(Reference.MOD_ID + ":temporal_toolbelt"), new CapabilityTemporalToolbelt.TemporalToolbeltGenericProvider());
        }
        else if(!entity.hasCapability(STASIS_CAPABILITY, EnumFacing.DOWN))
        {
            event.addCapability(new ResourceLocation(Reference.MOD_ID + ":stasis"), new CapabilityStasis.StasisGenericProvider());
        }
    }
    else if(entity instanceof EntityLiving)
    {
        if(!entity.hasCapability(CUSTOM_BEHAVIOR, EnumFacing.DOWN))
        {
            event.addCapability(new ResourceLocation(Reference.MOD_ID + ":customBehavior"), new CapabilityStasis.StasisGenericProvider());
        }
    }
}
 
开发者ID:Lumaceon,项目名称:ClockworkPhase2,代码行数:24,代码来源:CapabilityAttachHandler.java

示例9: attachCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> event) 
{
	if (event.getObject() instanceof EntityMob) 
	{
		final EnemyLevel enemyLevel = new EnemyLevel((EntityMob) event.getObject());
		event.addCapability(ID, createProvider(enemyLevel));
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:10,代码来源:CapabilityEnemyLevel.java

示例10: attachCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> event) 
{
	if (event.getObject() instanceof EntityPlayer) 
	{
		final Stats stats = new Stats((EntityPlayer) event.getObject());
		
		event.addCapability(ID, createProvider(stats));
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:11,代码来源:CapabilityPlayerStats.java

示例11: attachCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> event) 
{
	if (event.getObject() instanceof EntityPlayer) 
	{
		final PlayerInformation playerInfo = new PlayerInformation((EntityPlayer) event.getObject());
		
		event.addCapability(ID, createProvider(playerInfo));
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:11,代码来源:CapabilityPlayerInformation.java

示例12: attachCapabilities

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> event) 
{
	if (event.getObject() instanceof EntityPlayer) 
	{
		final CurrentAbilities currentAbilities = new CurrentAbilities((EntityPlayer) event.getObject());
		
		event.addCapability(ID, createProvider(currentAbilities));
	}
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:11,代码来源:CapabilityCurrentAbilities.java

示例13: onAttachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void onAttachCapability(AttachCapabilitiesEvent<TileEntity> e) {
    if (!enabled) return;

    TileEntity tile = e.getObject();
    if (tile instanceof IMultipartTE) {
        register(e, ((IMultipartTE) tile).getMultipartId());
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:PneumaticMultiPart.java

示例14: attachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public void attachCapability(AttachCapabilitiesEvent.Entity e) {
   if (e.getEntity() instanceof EntityPlayer
         && !e.getEntity().hasCapability(XP_CAPABILITY, null))
      e.addCapability(new ResourceLocation(MODID, "xpCapability"),
            new XPCapability.Provider());
}
 
开发者ID:arucil,项目名称:mc-XPBox,代码行数:8,代码来源:XPBox.java

示例15: onAttachCapability

import net.minecraftforge.event.AttachCapabilitiesEvent; //导入依赖的package包/类
@SubscribeEvent
public static void onAttachCapability(AttachCapabilitiesEvent<Entity> ev)
{
	if (ev.getObject() instanceof EntityPlayer)
	{
		ev.addCapability(new ResourceLocation(ArcaneMagic.MODID, "notebook_storage"), new NotebookInfo());
	}
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:9,代码来源:ModEvents.java


注:本文中的net.minecraftforge.event.AttachCapabilitiesEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。