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


Java ItemTossEvent.setCanceled方法代码示例

本文整理汇总了Java中net.minecraftforge.event.entity.item.ItemTossEvent.setCanceled方法的典型用法代码示例。如果您正苦于以下问题:Java ItemTossEvent.setCanceled方法的具体用法?Java ItemTossEvent.setCanceled怎么用?Java ItemTossEvent.setCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.event.entity.item.ItemTossEvent的用法示例。


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

示例1: onDropped

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
/** ������������������� */
@SubscribeEvent
public void onDropped(ItemTossEvent event) {
	if (event.entityItem.getEntityItem().getItem() instanceof ItemShakingSword) {
		EntityPlayer player = event.player;
		if (!player.worldObj.isRemote) {
			player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("keycraft.prompt.useshakingsword")));
		}
		ItemStack stack = new ItemStack(Items.iron_sword, 1, event.entityItem.getEntityItem().getItemDamage());
		if (player.inventory.addItemStackToInventory(stack)) {
			event.setCanceled(true);
		} else {
			event.entityItem.setEntityItemStack(stack);
		}
	}
   }
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:17,代码来源:ItemShakingSword.java

示例2: onItemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemToss(ItemTossEvent event) {
	EntityItem item = event.entityItem;
	ItemStack stack = item.getEntityItem();
	if (stack != null) {
		if (stack.getItem() instanceof IHandleToss) {
			((IHandleToss) stack.getItem()).onItemTossed(item, event.player);
		}
		if (!item.isDead && (stack.getItem() == Items.emerald || (stack.getItem() instanceof IFairyUpgrade)
				&& ((IFairyUpgrade) stack.getItem()).hasFairyUpgrade(stack))) {
			TileEntityDungeonCore core = WorldUtils.getNearbyFairySpawner(item.worldObj, item.posX, item.posY, item.posZ, true);
			if (core != null) {
				core.scheduleItemUpdate(event.player);
			}
		}
	}
	event.setCanceled(item.isDead);
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:19,代码来源:ZSSItemEvents.java

示例3: onItemDrop

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemDrop(ItemTossEvent event){
	if (event.entity.worldObj.isRemote)
		return;

	if (!ClaimsList.For(event.entity.worldObj).actionIsTrusted(event.player, PermissionsMutex.DROP_ITEMS, event.entityItem.posX, event.entityItem.posY, event.entityItem.posZ))
		event.setCanceled(true);
	else
		GriefGuardian._dal.logAction(
				(EntityPlayerMP)event.player, 
				Actions.ITEM_DROP, 
				(int)Math.floor(event.entity.posX), 
				(int)Math.floor(event.entity.posY), 
				(int)Math.floor(event.entity.posZ), 
				event.player.getCurrentEquippedItem(), 
				"");
}
 
开发者ID:Mithion,项目名称:GriefGuardian,代码行数:18,代码来源:ClaimGuardEventHandler.java

示例4: itemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void itemToss(ItemTossEvent event)
{
    Item item = event.getEntityItem().getEntityItem().getItem();
    if (item == Item.getItemFromBlock(ModBlocks.blockDeath) || item == ModItems.itemDeathList)
    {
        event.setCanceled(true);
    }
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:10,代码来源:TombManyGravesCommonEvents.java

示例5: onItemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemToss(ItemTossEvent event)
{
    if(!event.getPlayer().world.isRemote)
    {
        if(spawnWolfFromItem(event.getPlayer(), event.getEntityItem(), event.getPlayer()))
        {
            event.setCanceled(true);
        }
    }
}
 
开发者ID:iChun,项目名称:BeeBarker,代码行数:12,代码来源:EventHandlerServer.java

示例6: onItemTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onItemTossEvent (ItemTossEvent event) {
    if (!event.getPlayer().world.isRemote)
    	if(event.getPlayer().getCapability(ModCapabilities.DRIVE_STATE, null).getInDrive() && !event.getPlayer().getCapability(ModCapabilities.DRIVE_STATE, null).getActiveDriveName().equals(Strings.Form_Anti)) {
    		event.setCanceled(true);
    		return;
    	}
    
        if (event.getEntityItem().getItem().getItem() instanceof ItemKeyblade && (event.getEntityItem().getItem().getItem() != ModItems.WoodenKeyblade && event.getEntityItem().getItem().getItem() != ModItems.WoodenStick && event.getEntityItem().getItem().getItem() != ModItems.DreamSword && event.getEntityItem().getItem().getItem() != ModItems.DreamStaff)) {
            event.getEntityItem().isDead = true;
            event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null).setIsKeybladeSummoned(EnumHand.MAIN_HAND, false);
            if(!ItemStack.areItemStacksEqual(event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null).getInventoryKeychain().getStackInSlot(0), ItemStack.EMPTY))
            	PacketDispatcher.sendTo(new SyncKeybladeData(event.getPlayer().getCapability(ModCapabilities.SUMMON_KEYBLADE, null)), (EntityPlayerMP) event.getPlayer());

        } else if (event.getEntityItem().getItem().getItem() instanceof ItemMunny) {
            event.setCanceled(true);
            if (!event.getPlayer().world.isRemote) {
                PacketDispatcher.sendTo(new ShowOverlayPacket("munny", event.getEntityItem().getItem().getTagCompound().getInteger("amount")), (EntityPlayerMP) event.getPlayer());

                event.getPlayer().getCapability(ModCapabilities.MUNNY, null).addMunny(event.getEntityItem().getItem().getTagCompound().getInteger("amount"));
            }
        }
    if (event.getEntityItem().getItem().getItem() == event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null).currentWeapon()) {
        event.getEntityItem().isDead = true;
        event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null).setWeaponSummoned(EnumHand.MAIN_HAND, false);
        PacketDispatcher.sendTo(new SyncOrgXIIIData(event.getPlayer().getCapability(ModCapabilities.ORGANIZATION_XIII, null)), (EntityPlayerMP) event.getPlayer());
    }
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys-Re-Coded,代码行数:29,代码来源:ItemEvents.java

示例7: onDropped

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
/** ���������ŷ���� */
@SubscribeEvent
public void onDropped(ItemTossEvent event) {
	if (event.entityItem.getEntityItem().getItem() instanceof ItemAuroraTrident) {
		event.setCanceled(true);
		recycle(event.entityItem.getEntityItem(), event.player);
	}
   }
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:9,代码来源:ItemAuroraTrident.java

示例8: onDropped

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
/** ���������ŷ���� */
@SubscribeEvent
public void onDropped(ItemTossEvent event) {
	if (event.entityItem.getEntityItem().getItem() instanceof ItemAuroraBlade) {
		event.setCanceled(true);
		recycle(event.entityItem.getEntityItem(), event.player);
	}
   }
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:9,代码来源:ItemAuroraBlade.java

示例9: onDrop

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDrop(ItemTossEvent e) {
    if(e.entity.worldObj.isRemote) return;
    if(e.entityItem.getEntityItem() != null && e.entityItem.getEntityItem().getItem() instanceof ItemHorcrux) {
        e.setCanceled(true);
        e.player.inventory.addItemStackToInventory(e.entityItem.getEntityItem());
    }
}
 
开发者ID:MagiciansArtificeTeam,项目名称:Magicians-Artifice,代码行数:9,代码来源:ItemHorcrux.java

示例10: onDrop

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onDrop(ItemTossEvent e) {
    if(e.entity.worldObj.isRemote) return;
    if(!e.entityItem.getEntityItem().isItemEnchanted()) return;
    if(!EnchantmentHelper.getEnchantments(e.entityItem.getEntityItem()).containsKey(HackeryMod.enchantQuest.effectId)) return;
    e.setCanceled(true);
    e.player.inventory.setInventorySlotContents(e.player.inventory.getFirstEmptyStack(),e.entityItem.getEntityItem());
    e.player.inventoryContainer.detectAndSendChanges();
}
 
开发者ID:KJ4IPS,项目名称:Hackery,代码行数:10,代码来源:QuestEnchantHandler.java

示例11: itemThrown

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void itemThrown(ItemTossEvent event){
	if(event.getEntityItem().getEntityItem().getItem() instanceof Undroppable)
		event.setCanceled(true);
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Wars-Mod,代码行数:6,代码来源:CommonEvents.java

示例12: DropItems

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGHEST)
  public void DropItems(ItemTossEvent evt) {
		
	if(Main.debug==1)System.out.println(evt.getPlayer().getName() + " called TossEvent");

	
		if(!Main.logged.contains(evt.getPlayer().getName()) && Main.passwords.containsKey(evt.getPlayer().getName())){
			
		ItemStack itemStack = evt.getEntityItem().getEntityItem();
           evt.setCanceled(true);
           evt.getPlayer().inventory.addItemStackToInventory(itemStack);
		}
		
	
}
 
开发者ID:Fungie2134,项目名称:AuthMod,代码行数:16,代码来源:DropItem.java


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