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 2016-06-22 23:42:28 -04:00
parent 1a97d74939
commit d1f4d71d93
4 changed files with 0 additions and 59 deletions

View file

@ -20,15 +20,6 @@
this.field_70145_X = this.func_175149_v();
if (this.func_175149_v())
@@ -220,7 +226,7 @@
super.func_70071_h_();
- if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !this.field_71070_bA.func_75145_c(this))
+ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA))
{
this.func_71053_j();
this.field_71070_bA = this.field_71069_bz;
@@ -361,6 +367,7 @@
this.func_70105_a(f, f1);
}

View file

@ -18,15 +18,6 @@
{
int i = Math.max(0, p_i45285_1_.func_184108_a(p_i45285_2_));
int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p()));
@@ -252,7 +253,7 @@
this.field_71070_bA.func_75142_b();
- if (!this.field_70170_p.field_72995_K && !this.field_71070_bA.func_75145_c(this))
+ if (!this.field_70170_p.field_72995_K && !net.minecraftforge.common.ForgeHooks.canInteractWith(this, this.field_71070_bA))
{
this.func_71053_j();
this.field_71070_bA = this.field_71069_bz;
@@ -435,6 +436,7 @@
public void func_70645_a(DamageSource p_70645_1_)

View file

@ -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

View file

@ -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;
}
}