2012-12-17 21:21:53 +01:00
|
|
|
package com.pahimar.ee3.event;
|
2012-12-13 04:41:40 +01:00
|
|
|
|
2013-03-08 19:40:59 +01:00
|
|
|
import static net.minecraftforge.event.Event.Result.DEFAULT;
|
|
|
|
import static net.minecraftforge.event.Event.Result.DENY;
|
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;
|
|
|
|
|
2013-03-08 19:40:59 +01:00
|
|
|
/**
|
|
|
|
* Equivalent-Exchange-3
|
|
|
|
*
|
|
|
|
* ActionRequestEvent
|
|
|
|
*
|
|
|
|
* @author pahimar
|
|
|
|
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
|
|
|
|
*
|
|
|
|
*/
|
2012-12-13 04:41:40 +01:00
|
|
|
@Cancelable
|
2012-12-17 22:38:56 +01:00
|
|
|
public class ActionRequestEvent extends PlayerEvent {
|
2012-12-19 19:09:56 +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-19 19:09:56 +01:00
|
|
|
|
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;
|
2012-12-19 19:09:56 +01:00
|
|
|
if (sideHit == -1) {
|
2012-12-13 04:41:40 +01:00
|
|
|
allowEvent = DENY;
|
|
|
|
}
|
|
|
|
}
|
2012-12-19 19:09:56 +01:00
|
|
|
|
2012-12-13 04:41:40 +01:00
|
|
|
@Override
|
2012-12-19 19:09:56 +01:00
|
|
|
public void setCanceled(boolean cancel) {
|
|
|
|
|
2012-12-13 04:41:40 +01:00
|
|
|
super.setCanceled(cancel);
|
2013-03-08 19:40:59 +01:00
|
|
|
allowEvent = cancel ? DENY : allowEvent == DENY ? DENY : DEFAULT;
|
2012-12-13 04:41:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|