Revert "Added PlayerOpenContainerEvent and added ForgeHooks.canInteractWith"

This reverts commit 8d0b58ee6f.

# Conflicts:
#	common/net/minecraftforge/common/ForgeHooks.java
#	patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch
#	patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch
This commit is contained in:
cpw committed 2016-06-22 23:43:41 -04:00
1 parent 1a97d74939
commit d1f4d71d93
4 files changed
-59

No files matched your search

@@ -93,7 +93,6 @@ import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent;
import net.minecraftforge.event.entity.player.AnvilRepairEvent;
import net.minecraftforge.event.entity.player.AttackEntityEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerOpenContainerEvent;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.NoteBlockEvent;
import net.minecraftforge.fluids.IFluidBlock;
@@ -655,13 +654,6 @@ public class ForgeHooks
return ichat;
}
public static boolean canInteractWith(EntityPlayer player, Container openContainer)
{
PlayerOpenContainerEvent event = new PlayerOpenContainerEvent(player, openContainer);
MinecraftForge.EVENT_BUS.post(event);
return event.getResult() == Event.Result.DEFAULT ? event.isCanInteractWith() : event.getResult() == Event.Result.ALLOW ? true : false;
}
public static int onBlockBreakEvent(World world, GameType gameType, EntityPlayerMP entityPlayer, BlockPos pos)
{
// Logic from tryHarvestBlock for pre-canceling the event
@@ -1,33 +0,0 @@
package net.minecraftforge.event.entity.player;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
/**
* This event is fired when a player attempts to view a container during
* player tick.
*
* setResult ALLOW to allow the container to stay open
* setResult DENY to force close the container (denying access)
*
* DEFAULT is vanilla behavior
*
*/
@HasResult
public class PlayerOpenContainerEvent extends PlayerEvent
{
private final boolean canInteractWith;
public PlayerOpenContainerEvent(EntityPlayer player, Container openContainer)
{
super(player);
this.canInteractWith = openContainer.canInteractWith(player);
}
public boolean isCanInteractWith()
{
return canInteractWith;
}
}