本文整理汇总了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);
}
}
}
示例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);
}
示例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(),
"");
}
示例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);
}
}
示例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);
}
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
示例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();
}
示例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);
}
示例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);
}
}