當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。