Move fml's PlayerEvent and TickEvent to forge. Update
`import net.minecraftforge.fml.common.gameevent.PlayerEvent;` to `import net.minecraftforge.event.entity.player.PlayerEvent;` and `import net.minecraftforge.fml.common.gameevent.TickEvent;` to `import net.minecraftforge.event.TickEvent;` Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
parent
0fd8fa2211
commit
1af7b7603d
9 changed files with 139 additions and 174 deletions
|
@ -31,10 +31,10 @@ import net.minecraftforge.event.world.ChunkEvent;
|
|||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent.ServerTickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent.ClientTickEvent;
|
||||
import net.minecraftforge.event.TickEvent.Phase;
|
||||
import net.minecraftforge.event.TickEvent.ServerTickEvent;
|
||||
|
||||
public class ForgeInternalHandler
|
||||
{
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.gameevent;
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
|
||||
public class TickEvent extends net.minecraftforge.eventbus.api.Event
|
||||
public class TickEvent extends Event
|
||||
{
|
||||
public enum Type {
|
||||
WORLD, PLAYER, CLIENT, SERVER, RENDER;
|
|
@ -21,6 +21,10 @@ package net.minecraftforge.event.entity.player;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
@ -31,6 +35,8 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* PlayerEvent is fired whenever an event involving Living entities occurs. <br>
|
||||
* If a method utilizes this {@link net.minecraftforge.eventbus.api.Event} as its parameter, the method will
|
||||
|
@ -382,4 +388,124 @@ public class PlayerEvent extends LivingEvent
|
|||
return visibilityModifier;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemPickupEvent extends PlayerEvent {
|
||||
/**
|
||||
* Original EntityItem with current remaining stack size
|
||||
*/
|
||||
private final ItemEntity originalEntity;
|
||||
/**
|
||||
* Clone item stack, containing the item and amount picked up
|
||||
*/
|
||||
private final ItemStack stack;
|
||||
public ItemPickupEvent(PlayerEntity player, ItemEntity entPickedUp, ItemStack stack)
|
||||
{
|
||||
super(player);
|
||||
this.originalEntity = entPickedUp;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemEntity getOriginalEntity() {
|
||||
return originalEntity;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemCraftedEvent extends PlayerEvent {
|
||||
@Nonnull
|
||||
private final ItemStack crafting;
|
||||
private final IInventory craftMatrix;
|
||||
public ItemCraftedEvent(PlayerEntity player, @Nonnull ItemStack crafting, IInventory craftMatrix)
|
||||
{
|
||||
super(player);
|
||||
this.crafting = crafting;
|
||||
this.craftMatrix = craftMatrix;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getCrafting()
|
||||
{
|
||||
return this.crafting;
|
||||
}
|
||||
|
||||
public IInventory getInventory()
|
||||
{
|
||||
return this.craftMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemSmeltedEvent extends PlayerEvent {
|
||||
@Nonnull
|
||||
private final ItemStack smelting;
|
||||
public ItemSmeltedEvent(PlayerEntity player, @Nonnull ItemStack crafting)
|
||||
{
|
||||
super(player);
|
||||
this.smelting = crafting;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getSmelting()
|
||||
{
|
||||
return this.smelting;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedInEvent extends PlayerEvent {
|
||||
public PlayerLoggedInEvent(PlayerEntity player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedOutEvent extends PlayerEvent {
|
||||
public PlayerLoggedOutEvent(PlayerEntity player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerRespawnEvent extends PlayerEvent {
|
||||
private final boolean endConquered;
|
||||
|
||||
public PlayerRespawnEvent(PlayerEntity player, boolean endConquered)
|
||||
{
|
||||
super(player);
|
||||
this.endConquered = endConquered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Did this respawn event come from the player conquering the end?
|
||||
* @return if this respawn was because the player conquered the end
|
||||
*/
|
||||
public boolean isEndConquered()
|
||||
{
|
||||
return this.endConquered;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class PlayerChangedDimensionEvent extends PlayerEvent {
|
||||
private final DimensionType fromDim;
|
||||
private final DimensionType toDim;
|
||||
public PlayerChangedDimensionEvent(PlayerEntity player, DimensionType fromDim, DimensionType toDim)
|
||||
{
|
||||
super(player);
|
||||
this.fromDim = fromDim;
|
||||
this.toDim = toDim;
|
||||
}
|
||||
|
||||
public DimensionType getFrom()
|
||||
{
|
||||
return this.fromDim;
|
||||
}
|
||||
|
||||
public DimensionType getTo()
|
||||
{
|
||||
return this.toDim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2019.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.common.gameevent;
|
||||
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class PlayerEvent extends Event {
|
||||
private final PlayerEntity player;
|
||||
private PlayerEvent(PlayerEntity player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public PlayerEntity getPlayer()
|
||||
{
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public static class ItemPickupEvent extends PlayerEvent {
|
||||
/**
|
||||
* Original EntityItem with current remaining stack size
|
||||
*/
|
||||
private final ItemEntity originalEntity;
|
||||
/**
|
||||
* Clone item stack, containing the item and amount picked up
|
||||
*/
|
||||
private final ItemStack stack;
|
||||
public ItemPickupEvent(PlayerEntity player, ItemEntity entPickedUp, ItemStack stack)
|
||||
{
|
||||
super(player);
|
||||
this.originalEntity = entPickedUp;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public ItemEntity getOriginalEntity() {
|
||||
return originalEntity;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ItemCraftedEvent extends PlayerEvent {
|
||||
@Nonnull
|
||||
private final ItemStack crafting;
|
||||
private final IInventory craftMatrix;
|
||||
public ItemCraftedEvent(PlayerEntity player, @Nonnull ItemStack crafting, IInventory craftMatrix)
|
||||
{
|
||||
super(player);
|
||||
this.crafting = crafting;
|
||||
this.craftMatrix = craftMatrix;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getCrafting()
|
||||
{
|
||||
return this.crafting;
|
||||
}
|
||||
|
||||
public IInventory getInventory()
|
||||
{
|
||||
return this.craftMatrix;
|
||||
}
|
||||
}
|
||||
public static class ItemSmeltedEvent extends PlayerEvent {
|
||||
@Nonnull
|
||||
private final ItemStack smelting;
|
||||
public ItemSmeltedEvent(PlayerEntity player, @Nonnull ItemStack crafting)
|
||||
{
|
||||
super(player);
|
||||
this.smelting = crafting;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getSmelting()
|
||||
{
|
||||
return this.smelting;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedInEvent extends PlayerEvent {
|
||||
public PlayerLoggedInEvent(PlayerEntity player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerLoggedOutEvent extends PlayerEvent {
|
||||
public PlayerLoggedOutEvent(PlayerEntity player)
|
||||
{
|
||||
super(player);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PlayerRespawnEvent extends PlayerEvent {
|
||||
private final boolean endConquered;
|
||||
|
||||
public PlayerRespawnEvent(PlayerEntity player, boolean endConquered)
|
||||
{
|
||||
super(player);
|
||||
this.endConquered = endConquered;
|
||||
}
|
||||
|
||||
/**
|
||||
* Did this respawn event come from the player conquering the end?
|
||||
* @return if this respawn was because the player conquered the end
|
||||
*/
|
||||
public boolean isEndConquered()
|
||||
{
|
||||
return this.endConquered;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class PlayerChangedDimensionEvent extends PlayerEvent {
|
||||
private final DimensionType fromDim;
|
||||
private final DimensionType toDim;
|
||||
public PlayerChangedDimensionEvent(PlayerEntity player, DimensionType fromDim, DimensionType toDim)
|
||||
{
|
||||
super(player);
|
||||
this.fromDim = fromDim;
|
||||
this.toDim = toDim;
|
||||
}
|
||||
|
||||
public DimensionType getFrom()
|
||||
{
|
||||
return this.fromDim;
|
||||
}
|
||||
|
||||
public DimensionType getTo()
|
||||
{
|
||||
return this.toDim;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,9 +27,9 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
|
||||
public class BasicEventHooks
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ import net.minecraftforge.api.distmarker.Dist;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
|
||||
//@Mod(name = "advancementcriteriontest", modid = "advancementcriteriontest", version = "1.0", acceptableRemoteVersions = "*")
|
||||
//@Mod.EventBusSubscriber
|
||||
|
|
|
@ -44,7 +44,7 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
|
@ -27,7 +27,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
|||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
|
|
|
@ -36,7 +36,7 @@ import net.minecraftforge.fml.common.Mod;
|
|||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
|
Loading…
Reference in a new issue