39 lines
1 KiB
Java
39 lines
1 KiB
Java
package ee3.common.event;
|
|
|
|
import static net.minecraftforge.event.Event.Result.DEFAULT;
|
|
import static net.minecraftforge.event.Event.Result.DENY;
|
|
import ee3.common.lib.ModAction;
|
|
import net.minecraft.src.EntityPlayer;
|
|
import net.minecraftforge.event.Cancelable;
|
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
|
|
|
@Cancelable
|
|
public class ModActionEvent extends PlayerEvent {
|
|
|
|
public final ModAction modAction;
|
|
public final int x, y, z;
|
|
public final int sideHit;
|
|
|
|
public Result allowEvent;
|
|
|
|
public ModActionEvent(EntityPlayer player, ModAction modAction, int x, int y, int z, int sideHit) {
|
|
|
|
super(player);
|
|
this.modAction = modAction;
|
|
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);
|
|
}
|
|
|
|
}
|