2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.event;
|
2012-12-13 04:41:40 +01:00
|
|
|
|
2012-12-13 16:01:41 +01:00
|
|
|
import static net.minecraftforge.event.Event.Result.*;
|
2012-12-17 21:21:53 +01:00
|
|
|
|
2012-12-13 16:01:41 +01:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2012-12-13 04:41:40 +01:00
|
|
|
import net.minecraftforge.event.Cancelable;
|
|
|
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
|
|
|
|
|
|
|
@Cancelable
|
2012-12-17 22:38:56 +01:00
|
|
|
public class ActionRequestEvent extends PlayerEvent {
|
2012-12-13 04:41:40 +01:00
|
|
|
|
2012-12-18 19:05:04 +01:00
|
|
|
public final ActionEvent modEvent;
|
2012-12-13 04:41:40 +01:00
|
|
|
public final int x, y, z;
|
|
|
|
public final int sideHit;
|
|
|
|
public Result allowEvent;
|
|
|
|
|
2012-12-18 19:05:04 +01:00
|
|
|
public ActionRequestEvent(EntityPlayer player, ActionEvent modEvent, int x, int y, int z, int sideHit) {
|
2012-12-13 04:41:40 +01:00
|
|
|
|
|
|
|
super(player);
|
2012-12-17 22:38:56 +01:00
|
|
|
this.modEvent = modEvent;
|
2012-12-13 04:41:40 +01:00
|
|
|
this.x = x;
|
|
|
|
this.y = y;
|
|
|
|
this.z = z;
|
|
|
|
this.sideHit = sideHit;
|
|
|
|
if (sideHit == -1) {
|
|
|
|
allowEvent = DENY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setCanceled(boolean cancel)
|
|
|
|
{
|
|
|
|
super.setCanceled(cancel);
|
|
|
|
allowEvent = (cancel ? DENY : allowEvent == DENY ? DENY : DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|