Advertisement
Guest User

Untitled

a guest
Jul 20th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.07 KB | None | 0 0
  1. /*
  2.  * Minecraft Forge
  3.  * Copyright (c) 2016-2018.
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Lesser General Public
  7.  * License as published by the Free Software Foundation version 2.1
  8.  * of the License.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Lesser General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Lesser General Public
  16.  * License along with this library; if not, write to the Free Software
  17.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  18.  */
  19.  
  20. package net.minecraftforge.fml.common.gameevent;
  21.  
  22. import net.minecraft.entity.item.EntityItem;
  23. import net.minecraft.entity.player.EntityPlayer;
  24. import net.minecraft.inventory.IInventory;
  25. import net.minecraft.item.ItemStack;
  26. import net.minecraftforge.fml.common.eventhandler.Event;
  27.  
  28. import javax.annotation.Nonnull;
  29.  
  30. public class PlayerEvent extends Event {
  31.     public final EntityPlayer player;
  32.     private PlayerEvent(EntityPlayer player)
  33.     {
  34.         this.player = player;
  35.     }
  36.  
  37.     public static class ItemPickupEvent extends PlayerEvent {
  38.         @Deprecated
  39.         public final EntityItem pickedUp;
  40.         /**
  41.         * Original EntityItem with current remaining stack size
  42.         */
  43.         private final EntityItem originalEntity;
  44.         /**
  45.          * Clone item stack, containing the item and amount picked up
  46.          */
  47.         private final ItemStack stack;
  48.         public ItemPickupEvent(EntityPlayer player, EntityItem entPickedUp, ItemStack stack)
  49.         {
  50.             super(player);
  51.             this.originalEntity = entPickedUp;
  52.             this.pickedUp = entPickedUp;
  53.             this.stack = stack;
  54.         }
  55.  
  56.         public ItemStack getStack() {
  57.             return stack;
  58.         }
  59.  
  60.         public EntityItem getOriginalEntity() {
  61.             return originalEntity;
  62.         }
  63.     }
  64.  
  65.     public static class ItemCraftedEvent extends PlayerEvent {
  66.         @Nonnull
  67.         public final ItemStack crafting;
  68.         public final IInventory craftMatrix;
  69.         public ItemCraftedEvent(EntityPlayer player, @Nonnull ItemStack crafting, IInventory craftMatrix)
  70.         {
  71.             super(player);
  72.             this.crafting = crafting;
  73.             this.craftMatrix = craftMatrix;
  74.         }
  75.     }
  76.     public static class ItemSmeltedEvent extends PlayerEvent {
  77.         @Nonnull
  78.         public final ItemStack smelting;
  79.         public ItemSmeltedEvent(EntityPlayer player, @Nonnull ItemStack crafting)
  80.         {
  81.             super(player);
  82.             this.smelting = crafting;
  83.         }
  84.     }
  85.  
  86.     public static class PlayerLoggedInEvent extends PlayerEvent {
  87.         public PlayerLoggedInEvent(EntityPlayer player)
  88.         {
  89.             super(player);
  90.         }
  91.     }
  92.  
  93.     public static class PlayerLoggedOutEvent extends PlayerEvent {
  94.         public PlayerLoggedOutEvent(EntityPlayer player)
  95.         {
  96.             super(player);
  97.         }
  98.     }
  99.  
  100.     public static class PlayerRespawnEvent extends PlayerEvent {
  101.         private final boolean endConquered;
  102.  
  103.         public PlayerRespawnEvent(EntityPlayer player, boolean endConquered)
  104.         {
  105.             super(player);
  106.             this.endConquered = endConquered;
  107.         }
  108.  
  109.         /**
  110.          * Did this respawn event come from the player conquering the end?
  111.          * @return if this respawn was because the player conquered the end
  112.          */
  113.         public boolean isEndConquered()
  114.         {
  115.             return this.endConquered;
  116.         }
  117.  
  118.  
  119.     }
  120.  
  121.     public static class PlayerChangedDimensionEvent extends PlayerEvent {
  122.         public final int fromDim;
  123.         public final int toDim;
  124.         public PlayerChangedDimensionEvent(EntityPlayer player, int fromDim, int toDim)
  125.         {
  126.             super(player);
  127.             this.fromDim = fromDim;
  128.             this.toDim = toDim;
  129.         }
  130.     }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement