Package net.minecraftforge.event.entity.player

Examples of net.minecraftforge.event.entity.player.EntityItemPickupEvent


    @Override
  public void onCollideWithPlayer(EntityPlayer player)
    {
        if (!worldObj.isRemote)
        {
            EntityItemPickupEvent event = new EntityItemPickupEvent(player, this);

            if (MinecraftForge.EVENT_BUS.post(event))
            {
                return;
            }
           
            int spawnerTeamID = spawner.getTeamID();
            Team spawnerTeam = TeamsManager.getInstance().getTeam(spawnerTeamID);
            Team playerTeam = PlayerHandler.getPlayerData(player).team;
            if(spawnerTeam != null)
            {
              if(playerTeam != spawnerTeam)
                return;
            }

            //Getter of EntityItem
            int var2 = getEntityItem().stackSize;

            if ((event.getResult() == Result.ALLOW || var2 <= 0 || player.inventory.addItemStackToInventory(getEntityItem())))
            {
              FMLCommonHandler.instance().firePlayerItemPickupEvent(player, this);

                playSound("random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
                player.onItemPickup(this, var2);
View Full Code Here


    @Override
    public boolean interactFirst(EntityPlayer player) //interact
    {
    if(worldObj.isRemote)
      return true;
    EntityItemPickupEvent event = new EntityItemPickupEvent(player, this);
    TeamsManager.getInstance().playerLoot(event);
    if(!event.isCanceled())
    {
        ItemStack currentItem = player.getCurrentEquippedItem();
        if(currentItem != null && currentItem.getItem() instanceof ItemGun)
        {
          GunType gunType = ((ItemGun)currentItem.getItem()).type;
View Full Code Here

    public boolean continueExecuting(){
        if(curPickingUpEntity.isDead) return false;
        if(curPickingUpEntity.getDistanceToEntity(drone) < 1.5) {
            ItemStack stack = curPickingUpEntity.getEntityItem();
            if(itemPickupWidget.isItemValidForFilters(stack)) {
                new EventHandlerPneumaticCraft().onPlayerPickup(new EntityItemPickupEvent(drone.getFakePlayer(), curPickingUpEntity));//not posting the event globally, as I don't have a way of handling a canceled event.
                int stackSize = stack.stackSize;
                ItemStack remainder = PneumaticCraftUtils.exportStackToInventory(drone.getInventory(), stack, ForgeDirection.UP);//side doesn't matter, drones aren't ISided.
                if(remainder == null) {
                    drone.onItemPickup(curPickingUpEntity, stackSize);
                    curPickingUpEntity.setDead();
View Full Code Here

TOP

Related Classes of net.minecraftforge.event.entity.player.EntityItemPickupEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.