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


Java ItemTossEvent类代码示例

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


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

示例1: itemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
@SubscribeEvent
public void itemToss(ItemTossEvent event) {
	ItemStack stack=(event.getEntityItem().getItem());
	if(!event.getPlayer().world.isRemote && stack.getItem() instanceof ItemUsable && stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active > 0){
	
	//event.getPlayer().getCapability(TF2weapons.WEAPONS_CAP, null).state = 0;
		if(stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active == 2){
			TF2weapons.network.sendTo(new TF2Message.WeaponDroppedMessage(ItemFromData.getData(stack).getName()), (EntityPlayerMP) event.getPlayer());
			((ItemUsable) stack.getItem()).holster(event.getPlayer().getCapability(TF2weapons.WEAPONS_CAP, null), stack, event.getPlayer(), event.getPlayer().world);
		}
		stack.getCapability(TF2weapons.WEAPONS_DATA_CAP, null).active = 0;
	}
	
	if(stack.getItem() instanceof ItemFromData && stack.hasTagCompound() && (stack.getTagCompound().getBoolean("Bought") || stack.getTagCompound().getBoolean("Valve"))){
		event.getEntity().setEntityInvulnerable(true);
		event.getEntityItem().setThrower(event.getPlayer().getName());
	}
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:19,代码来源:TF2EventsCommon.java

示例2: onPlayerTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName)
{
    player.captureDrops = true;
    EntityItem ret = player.dropItem(item, false, includeName);
    player.capturedDrops.clear();
    player.captureDrops = false;

    if (ret == null)
    {
        return null;
    }

    ItemTossEvent event = new ItemTossEvent(ret, player);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }

    if (!player.worldObj.isRemote)
    {
        player.getEntityWorld().spawnEntityInWorld(event.getEntityItem());
    }
    return event.getEntityItem();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:ForgeHooks.java

示例3: onPlayerTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName)
{
    player.captureDrops = true;
    EntityItem ret = player.func_146097_a(item, false, includeName);
    player.capturedDrops.clear();
    player.captureDrops = false;

    if (ret == null)
    {
        return null;
    }

    ItemTossEvent event = new ItemTossEvent(ret, player);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }

    player.func_71012_a(event.entityItem);
    return event.entityItem;
}
 
开发者ID:SchrodingersSpy,项目名称:TRHS_Club_Mod_2016,代码行数:22,代码来源:ForgeHooks.java

示例4: onPlayerTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item, boolean includeName)
{
    player.captureDrops = true;
    EntityItem ret = player.func_146097_a(item, false, includeName);
    player.capturedDrops.clear();
    player.captureDrops = false;

    if (ret == null)
    {
        return null;
    }

    ItemTossEvent event = new ItemTossEvent(ret, player);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }

    player.joinEntityItemWithWorld(event.entityItem);
    return event.entityItem;
}
 
开发者ID:alexandrage,项目名称:CauldronGit,代码行数:22,代码来源:ForgeHooks.java

示例5: 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

示例6: 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

示例7: onPlayerTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
public static EntityItem onPlayerTossEvent(EntityPlayer player, ItemStack item)
{
    player.captureDrops = true;
    EntityItem ret = player.dropPlayerItemWithRandomChoice(item, false);
    player.capturedDrops.clear();
    player.captureDrops = false;

    if (ret == null)
    {
        return null;
    }

    ItemTossEvent event = new ItemTossEvent(ret, player);
    if (MinecraftForge.EVENT_BUS.post(event))
    {
        return null;
    }

    player.joinEntityItemWithWorld(event.entityItem);
    return event.entityItem;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:22,代码来源:ForgeHooks.java

示例8: 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

示例9: usePlayer

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
@Override
public void usePlayer(OpenModsFakePlayer player) {
	player.setPositionAndRotation(x, y - player.getEyeHeight(), z, yaw, pitch);

	final EntityItem itemToDrop = new EntityItem(player.getEntityWorld(), x, y, z, stack.copy());
	itemToDrop.setPosition(itemToDrop.posX, itemToDrop.posY - itemToDrop.height, itemToDrop.posZ);
	itemToDrop.setPickupDelay(40);

	ItemTossEvent event = new ItemTossEvent(itemToDrop, player);
	if (MinecraftForge.EVENT_BUS.post(event)) {
		Log.info("Item %s drop from this %s aborted by event", stack, this);
	} else {
		final EntityItem droppedItem = event.getEntityItem();

		droppedItem.motionX = v.x;
		droppedItem.motionY = v.y;
		droppedItem.motionZ = v.z;

		player.getEntityWorld().spawnEntity(droppedItem);
	}
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:22,代码来源:DropItemAction.java

示例10: itemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
@SubscribeEvent
public static  void itemToss(ItemTossEvent event)
{
	if(event.getEntityItem().getItem().isEmpty())
		return;

	if(event.getEntityItem().getItem().getItem() instanceof ItemAnimaShield)
	{
		ItemAnimaShield i  = (ItemAnimaShield) event.getEntityItem().getItem().getItem();
		i.setOff(event.getEntityItem().getItem(), event.getPlayer());
	}
}
 
开发者ID:Lemonszz,项目名称:Anima-Mundi,代码行数:13,代码来源:ShieldEvents.java

示例11: onTossItem

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTossItem(ItemTossEvent event)
{
    if (event.entityItem != null && event.player instanceof EntityPlayerMP)
    {
        ItemStack stack = event.entityItem.getEntityItem();
        sendItemStackToClient((EntityPlayerMP)event.player, MalmoMessageType.SERVER_DISCARDITEM, stack);
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:10,代码来源:RewardForDiscardingItemImplementation.java

示例12: 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

示例13: onTossItem

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
@SubscribeEvent
public void onTossItem(ItemTossEvent event)
{
    if (event.getEntityItem() != null && event.getPlayer() instanceof EntityPlayerMP)
    {
        ItemStack stack = event.getEntityItem().getEntityItem();
        sendItemStackToClient((EntityPlayerMP)event.getPlayer(), MalmoMessageType.SERVER_DISCARDITEM, stack);
    }
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:10,代码来源:RewardForDiscardingItemImplementation.java

示例14: onItemTossEvent

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
/**
 * Event listener for Action.DROP (when player drops the item from his
 * inventory)
 */
@SubscribeEvent
public void onItemTossEvent(ItemTossEvent event) throws IOException
{
    EntityPlayer player = event.getPlayer();
    List<Action> events = CommonProxy.manager.getActions(player);

    if (!player.worldObj.isRemote && events != null)
    {
        events.add(new DropAction(event.getEntityItem().getEntityItem()));
    }
}
 
开发者ID:mchorse,项目名称:blockbuster,代码行数:16,代码来源:ActionHandler.java

示例15: itemToss

import net.minecraftforge.event.entity.item.ItemTossEvent; //导入依赖的package包/类
/** Alters behaviour when player drops an item. */
@SubscribeEvent
public void itemToss(ItemTossEvent event) {
    
    EntityPlayer player = event.getPlayer();
    Item item = event.getEntityItem().getEntityItem().getItem();
    long time = player.world.getWorldTime();
    
    player.getCapability(GeoCaps.CAP_PLAYER, null).addDelay(item, time);
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:11,代码来源:PlayerEvents.java


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