2021-09-30 01:48:54 -05:00
|
|
|
//
|
|
|
|
|
// Source code recreated from a .class file by IntelliJ IDEA
|
2021-09-30 21:44:30 -05:00
|
|
|
// (powered by FernFlower decompiler)
|
2021-09-30 01:48:54 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package noppes.npcs.scripted.event;
|
|
|
|
|
|
2021-09-30 21:44:30 -05:00
|
|
|
import cpw.mods.fml.common.eventhandler.Cancelable;
|
2021-10-18 20:50:54 -05:00
|
|
|
import net.minecraft.block.Block;
|
2021-09-30 01:48:54 -05:00
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2021-10-12 02:57:32 -05:00
|
|
|
import net.minecraft.entity.item.EntityXPOrb;
|
|
|
|
|
import net.minecraft.item.ItemStack;
|
2021-09-30 01:48:54 -05:00
|
|
|
import net.minecraft.util.DamageSource;
|
2021-10-18 20:50:54 -05:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
|
|
|
|
import net.minecraft.world.World;
|
2021-10-12 02:57:32 -05:00
|
|
|
import noppes.npcs.scripted.*;
|
2021-10-18 06:33:39 -05:00
|
|
|
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
|
|
|
|
import noppes.npcs.scripted.entity.ScriptPlayer;
|
|
|
|
|
import noppes.npcs.scripted.interfaces.*;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
|
|
|
|
public class PlayerEvent extends CustomNPCsEvent {
|
|
|
|
|
public final IPlayer player;
|
|
|
|
|
|
|
|
|
|
public PlayerEvent(IPlayer player) {
|
|
|
|
|
this.player = player;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class ChatEvent extends PlayerEvent {
|
|
|
|
|
public String message;
|
|
|
|
|
|
|
|
|
|
public ChatEvent(IPlayer player, String message) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.message = message;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class KeyPressedEvent extends PlayerEvent {
|
|
|
|
|
public final int key;
|
|
|
|
|
public final boolean isCtrlPressed;
|
|
|
|
|
public final boolean isAltPressed;
|
|
|
|
|
public final boolean isShiftPressed;
|
|
|
|
|
public final boolean isMetaPressed;
|
|
|
|
|
|
|
|
|
|
public KeyPressedEvent(IPlayer player, int key, boolean isCtrlPressed, boolean isAltPressed, boolean isShiftPressed, boolean isMetaPressed) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.key = key;
|
|
|
|
|
this.isCtrlPressed = isCtrlPressed;
|
|
|
|
|
this.isAltPressed = isAltPressed;
|
|
|
|
|
this.isShiftPressed = isShiftPressed;
|
|
|
|
|
this.isMetaPressed = isMetaPressed;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
public static class MouseClickedEvent extends PlayerEvent {
|
|
|
|
|
public final int button;
|
|
|
|
|
public final int mouseWheel;
|
|
|
|
|
|
|
|
|
|
public MouseClickedEvent(IPlayer player, int button, int mouseWheel){
|
|
|
|
|
super(player);
|
|
|
|
|
this.button = button;
|
|
|
|
|
this.mouseWheel = mouseWheel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class PickupXPEvent extends PlayerEvent {
|
|
|
|
|
public final int amount;
|
|
|
|
|
|
|
|
|
|
public PickupXPEvent(IPlayer player, EntityXPOrb orb) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.amount = orb.xpValue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
public static class LevelUpEvent extends PlayerEvent {
|
|
|
|
|
public final int change;
|
|
|
|
|
|
|
|
|
|
public LevelUpEvent(IPlayer player, int change) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.change = change;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class LogoutEvent extends PlayerEvent {
|
|
|
|
|
public LogoutEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class LoginEvent extends PlayerEvent {
|
|
|
|
|
public LoginEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-15 09:17:31 -05:00
|
|
|
public static class RespawnEvent extends PlayerEvent {
|
|
|
|
|
public RespawnEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ChangedDimension extends PlayerEvent {
|
|
|
|
|
public final int fromDim;
|
|
|
|
|
public final int toDim;
|
|
|
|
|
|
|
|
|
|
public ChangedDimension(IPlayer player, int fromDim, int toDim){
|
|
|
|
|
super(player);
|
|
|
|
|
this.fromDim = fromDim;
|
|
|
|
|
this.toDim = toDim;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
public static class TimerEvent extends PlayerEvent {
|
|
|
|
|
public final int id;
|
|
|
|
|
|
|
|
|
|
public TimerEvent(IPlayer player, int id) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.id = id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class DamagedEvent extends PlayerEvent {
|
|
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
public float damage;
|
|
|
|
|
public boolean clearTarget = false;
|
|
|
|
|
|
|
|
|
|
public DamagedEvent(IPlayer player, Entity source, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.source = NpcAPI.Instance().getIEntity(source);
|
|
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-15 09:17:31 -05:00
|
|
|
@Cancelable
|
|
|
|
|
public static class LightningEvent extends PlayerEvent {
|
|
|
|
|
public LightningEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class SoundEvent extends PlayerEvent {
|
|
|
|
|
public final String name;
|
|
|
|
|
public final float pitch;
|
|
|
|
|
public final float volume;
|
|
|
|
|
|
|
|
|
|
public SoundEvent(ScriptPlayer player, String name, float pitch, float volume) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.pitch = pitch;
|
|
|
|
|
this.volume = volume;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
public static class FallEvent extends PlayerEvent {
|
|
|
|
|
public final float distance;
|
|
|
|
|
|
|
|
|
|
public FallEvent(IPlayer player, float distance){
|
|
|
|
|
super(player);
|
|
|
|
|
this.distance = distance;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-10-18 20:50:54 -05:00
|
|
|
public static class JumpEvent extends PlayerEvent {
|
|
|
|
|
public JumpEvent(IPlayer player){
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 01:48:54 -05:00
|
|
|
public static class KilledEntityEvent extends PlayerEvent {
|
|
|
|
|
public final IEntityLivingBase entity;
|
|
|
|
|
|
|
|
|
|
public KilledEntityEvent(IPlayer player, EntityLivingBase entity) {
|
|
|
|
|
super(player);
|
2021-10-12 02:57:32 -05:00
|
|
|
this.entity = new ScriptLivingBase<>(entity);//NpcAPI.Instance().getIEntity(entity);
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class DiedEvent extends PlayerEvent {
|
|
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final String type;
|
|
|
|
|
public final IEntity source;
|
|
|
|
|
|
|
|
|
|
public DiedEvent(IPlayer player, DamageSource damagesource, Entity entity) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
2021-09-30 21:44:30 -05:00
|
|
|
this.type = damagesource.getDamageType();
|
2021-09-30 01:48:54 -05:00
|
|
|
this.source = NpcAPI.Instance().getIEntity(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class RangedLaunchedEvent extends PlayerEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack bow;
|
|
|
|
|
public int charge;
|
|
|
|
|
|
|
|
|
|
public RangedLaunchedEvent(IPlayer player, ItemStack bow, int charge) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
2021-10-12 02:57:32 -05:00
|
|
|
this.bow = NpcAPI.Instance().getIItemStack(bow);
|
|
|
|
|
this.charge = charge;
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class DamagedEntityEvent extends PlayerEvent {
|
|
|
|
|
public final IDamageSource damageSource;
|
|
|
|
|
public final IEntity target;
|
|
|
|
|
public float damage;
|
|
|
|
|
|
|
|
|
|
public DamagedEntityEvent(IPlayer player, Entity target, float damage, DamageSource damagesource) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.target = NpcAPI.Instance().getIEntity(target);
|
|
|
|
|
this.damage = damage;
|
|
|
|
|
this.damageSource = NpcAPI.Instance().getIDamageSource(damagesource);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ContainerClosed extends PlayerEvent {
|
|
|
|
|
public final IContainer container;
|
|
|
|
|
|
|
|
|
|
public ContainerClosed(IPlayer player, IContainer container) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.container = container;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class ContainerOpen extends PlayerEvent {
|
|
|
|
|
public final IContainer container;
|
|
|
|
|
|
|
|
|
|
public ContainerOpen(IPlayer player, IContainer container) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.container = container;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class PickUpEvent extends PlayerEvent {
|
|
|
|
|
public final IItemStack item;
|
|
|
|
|
|
|
|
|
|
public PickUpEvent(IPlayer player, IItemStack item) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.item = item;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class TossEvent extends PlayerEvent {
|
2021-10-12 02:57:32 -05:00
|
|
|
public final IItemStack[] items;
|
2021-09-30 01:48:54 -05:00
|
|
|
|
2021-10-12 02:57:32 -05:00
|
|
|
public TossEvent(IPlayer player, IItemStack[] items) {
|
2021-09-30 01:48:54 -05:00
|
|
|
super(player);
|
2021-10-12 02:57:32 -05:00
|
|
|
this.items = items;
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class AttackEvent extends PlayerEvent {
|
|
|
|
|
public final int type;
|
|
|
|
|
public final Object target;
|
|
|
|
|
|
|
|
|
|
public AttackEvent(IPlayer player, int type, Object target) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.target = target;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class InteractEvent extends PlayerEvent {
|
|
|
|
|
public final int type;
|
|
|
|
|
public final Object target;
|
|
|
|
|
|
|
|
|
|
public InteractEvent(IPlayer player, int type, Object target) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.type = type;
|
|
|
|
|
this.target = target;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class UpdateEvent extends PlayerEvent {
|
|
|
|
|
public UpdateEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class InitEvent extends PlayerEvent {
|
|
|
|
|
public InitEvent(IPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-12 02:57:32 -05:00
|
|
|
|
|
|
|
|
public static class StartUsingItem extends PlayerEvent {
|
|
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public StartUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class UsingItem extends PlayerEvent {
|
|
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public UsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class StopUsingItem extends PlayerEvent {
|
|
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public StopUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static class FinishUsingItem extends PlayerEvent {
|
|
|
|
|
public final IItemStack item;
|
|
|
|
|
public final int duration;
|
|
|
|
|
|
|
|
|
|
public FinishUsingItem(IPlayer player, ItemStack item, int duration){
|
|
|
|
|
super(player);
|
|
|
|
|
|
|
|
|
|
this.item = NpcAPI.Instance().getIItemStack(item);
|
|
|
|
|
this.duration = duration;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Cancelable
|
|
|
|
|
public static class BreakEvent extends PlayerEvent {
|
|
|
|
|
public final IBlock block;
|
|
|
|
|
public int exp;
|
|
|
|
|
|
|
|
|
|
public BreakEvent(IPlayer player, IBlock block, int exp) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.block = block;
|
|
|
|
|
this.exp = exp;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-10-18 20:50:54 -05:00
|
|
|
|
|
|
|
|
public static class UseHoe extends PlayerEvent {
|
|
|
|
|
public final IItemStack hoe;
|
|
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
|
|
|
|
public UseHoe(IPlayer player, ItemStack item, int x, int y, int z) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.hoe = new ScriptItemStack(item);
|
|
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class WakeUp extends PlayerEvent{
|
|
|
|
|
public final boolean setSpawn;
|
|
|
|
|
|
|
|
|
|
public WakeUp(IPlayer player, boolean setSpawn) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.setSpawn = setSpawn;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Sleep extends PlayerEvent {
|
|
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
|
|
|
|
public Sleep(ScriptPlayer player, int x, int y, int z) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Achievement extends PlayerEvent {
|
|
|
|
|
public final String description;
|
|
|
|
|
|
|
|
|
|
public Achievement(IPlayer player, String description) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.description = description;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class FillBucket extends PlayerEvent {
|
|
|
|
|
public final IItemStack current;
|
|
|
|
|
public final IItemStack result;
|
|
|
|
|
|
|
|
|
|
public FillBucket(IPlayer player, ItemStack current, ItemStack result) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.current = new ScriptItemStack(current);
|
|
|
|
|
this.result = new ScriptItemStack(result);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class Bonemeal extends PlayerEvent {
|
|
|
|
|
public final IBlock block;
|
|
|
|
|
public final int x;
|
|
|
|
|
public final int y;
|
|
|
|
|
public final int z;
|
|
|
|
|
|
|
|
|
|
public Bonemeal(IPlayer player, int x, int y, int z, World world) {
|
|
|
|
|
super(player);
|
|
|
|
|
this.block = API.getIBlock(world, x, y, z);
|
|
|
|
|
this.x = x;
|
|
|
|
|
this.y = y;
|
|
|
|
|
this.z = z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class RangedChargeEvent extends PlayerEvent {
|
|
|
|
|
public RangedChargeEvent(ScriptPlayer player) {
|
|
|
|
|
super(player);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-30 01:48:54 -05:00
|
|
|
}
|