本文整理匯總了Java中net.minecraftforge.event.AttachCapabilitiesEvent.getObject方法的典型用法代碼示例。如果您正苦於以下問題:Java AttachCapabilitiesEvent.getObject方法的具體用法?Java AttachCapabilitiesEvent.getObject怎麽用?Java AttachCapabilitiesEvent.getObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraftforge.event.AttachCapabilitiesEvent
的用法示例。
在下文中一共展示了AttachCapabilitiesEvent.getObject方法的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);
}
}
示例2: 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());
}
}
}
示例3: 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());
}
}
}
示例4: 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());
}
}
}
示例5: 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));
}
}
示例6: 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));
}
}
示例7: 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));
}
}
示例8: 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));
}
}
示例9: 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());
}
}
示例10: 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());
}
}
示例11: attachCapability
import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void attachCapability(AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof EntityPlayer) {
event.addCapability(new ResourceLocation(ModInfo.MODID, "account"), new AccountCapability((EntityPlayer) event.getObject()));
event.addCapability(new ResourceLocation(ModInfo.MODID, "cart"), new CartCapability((EntityPlayer) event.getObject()));
}
}
示例12: onEntityCaps
import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void onEntityCaps(AttachCapabilitiesEvent<Entity> e)
{
if (e.getObject() instanceof EntityPlayer)
{
e.addCapability(CapabilityRegistry.ENTRY_STORE_NAME, new IfEntryStoreProvider());
e.addCapability(CapabilityRegistry.AURA_CONTAINER_NAME, new AuraContainerProvider());
}
}
示例13: attachCapabilities
import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
@SubscribeEvent
public static void attachCapabilities(final AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof EntityMob) {
final Stats stats = new Stats((EntityMob) event.getObject());
event.addCapability(HEALTH_ID, createProvider((IHealth) stats));
event.addCapability(ATTACK_ID, createProvider((IAttack) stats));
event.addCapability(FOLLOW_ID, createProvider((IFollow) stats));
}
}
示例14: attachCapabilities
import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
/**
* Attach the {@link ITurn} capability to all living entities.
*
* @param event The event
*/
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> e) {
if (e.getObject() instanceof EntityPlayer) {
final PlayerTurn playerTurn = new PlayerTurn((EntityPlayer) e.getObject());
e.addCapability(ID, createProvider(playerTurn));
}
}
示例15: attachCapabilities
import net.minecraftforge.event.AttachCapabilitiesEvent; //導入方法依賴的package包/類
/**
* Attach the {@link IEmpire} capability to all living entities.
*
* @param event The event
*/
@SubscribeEvent
public void attachCapabilities(AttachCapabilitiesEvent<Entity> e) {
if (e.getObject() instanceof EntityPlayer) {
final PlayerEmpire playerEmpire = new PlayerEmpire((EntityPlayer) e.getObject());
e.addCapability(ID, createProvider(playerEmpire));
}
}