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