2021-09-30 21:44:30 -05:00
|
|
|
//
|
|
|
|
|
// Source code recreated from a .class file by IntelliJ IDEA
|
|
|
|
|
// (powered by Fernflower decompiler)
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
package noppes.npcs.scripted.event;
|
|
|
|
|
|
2022-06-29 03:36:52 -05:00
|
|
|
import cpw.mods.fml.common.eventhandler.Cancelable;
|
2021-09-30 21:44:30 -05:00
|
|
|
import cpw.mods.fml.common.eventhandler.Event;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.AbstractNpcAPI;
|
|
|
|
|
import noppes.npcs.api.IPos;
|
2024-01-20 12:16:31 +03:00
|
|
|
import noppes.npcs.api.IWorld;
|
2022-11-24 14:36:09 -06:00
|
|
|
import noppes.npcs.api.event.ICustomNPCsEvent;
|
2022-11-15 15:25:53 -05:00
|
|
|
import noppes.npcs.api.handler.data.INaturalSpawn;
|
2022-11-24 16:46:20 -06:00
|
|
|
import noppes.npcs.constants.EnumScriptType;
|
2021-09-30 21:44:30 -05:00
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public class CustomNPCsEvent extends Event implements ICustomNPCsEvent {
|
2022-05-11 17:12:48 -05:00
|
|
|
public final AbstractNpcAPI API = AbstractNpcAPI.Instance();
|
2021-09-30 21:44:30 -05:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return "CNPCEvent";
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-30 21:44:30 -05:00
|
|
|
public CustomNPCsEvent() {
|
|
|
|
|
}
|
2022-02-06 12:39:07 -06:00
|
|
|
|
|
|
|
|
public void setCancelled(boolean bo){
|
|
|
|
|
this.setCanceled(bo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean isCancelled(){return this.isCanceled();}
|
2022-06-29 03:36:52 -05:00
|
|
|
|
|
|
|
|
@Cancelable
|
2022-11-24 14:36:09 -06:00
|
|
|
public static class CNPCNaturalSpawnEvent extends CustomNPCsEvent implements ICustomNPCsEvent.CNPCNaturalSpawnEvent {
|
2022-06-29 03:36:52 -05:00
|
|
|
public final INaturalSpawn naturalSpawn;
|
2022-11-24 14:36:09 -06:00
|
|
|
public IPos attemptPosition;
|
2022-06-29 03:36:52 -05:00
|
|
|
public final boolean animalSpawnPassed;
|
|
|
|
|
public final boolean monsterSpawnPassed;
|
|
|
|
|
public final boolean liquidSpawnPassed;
|
|
|
|
|
public final boolean airSpawnPassed;
|
|
|
|
|
|
|
|
|
|
public CNPCNaturalSpawnEvent(INaturalSpawn naturalSpawn, IPos attemptPosition, boolean animalSpawnPassed, boolean monsterSpawnPassed, boolean liquidSpawnPassed, boolean airSpawnPassed) {
|
|
|
|
|
this.naturalSpawn = naturalSpawn;
|
|
|
|
|
this.attemptPosition = attemptPosition;
|
|
|
|
|
|
|
|
|
|
this.animalSpawnPassed = animalSpawnPassed;
|
|
|
|
|
this.monsterSpawnPassed = monsterSpawnPassed;
|
|
|
|
|
this.liquidSpawnPassed = liquidSpawnPassed;
|
|
|
|
|
this.airSpawnPassed = airSpawnPassed;
|
|
|
|
|
}
|
2022-11-23 23:59:01 -06:00
|
|
|
|
2022-11-24 16:46:20 -06:00
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.CNPC_NATURAL_SPAWN.function;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-23 23:59:01 -06:00
|
|
|
public INaturalSpawn getNaturalSpawn() {
|
|
|
|
|
return this.naturalSpawn;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 14:36:09 -06:00
|
|
|
public void setAttemptPosition(IPos attemptPosition) {
|
|
|
|
|
this.attemptPosition = attemptPosition;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-23 23:59:01 -06:00
|
|
|
public IPos getAttemptPosition() {
|
|
|
|
|
return this.attemptPosition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean animalSpawnPassed() {
|
|
|
|
|
return this.animalSpawnPassed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean monsterSpawnPassed() {
|
|
|
|
|
return this.monsterSpawnPassed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean liquidSpawnPassed() {
|
|
|
|
|
return this.liquidSpawnPassed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean airSpawnPassed() {
|
|
|
|
|
return this.airSpawnPassed;
|
|
|
|
|
}
|
2022-06-29 03:36:52 -05:00
|
|
|
}
|
2024-01-20 12:16:31 +03:00
|
|
|
|
|
|
|
|
public static class ScriptedCommandEvent extends CustomNPCsEvent implements ICustomNPCsEvent.ScriptedCommandEvent {
|
|
|
|
|
|
|
|
|
|
public IWorld world;
|
|
|
|
|
public IPos pos;
|
|
|
|
|
public String senderName;
|
|
|
|
|
public int id;
|
|
|
|
|
public String[] args;
|
|
|
|
|
public String replyMessage = "";
|
|
|
|
|
|
|
|
|
|
public ScriptedCommandEvent(IWorld world, IPos pos, String senderName, int id, String[] args){
|
|
|
|
|
this.world = world;
|
|
|
|
|
this.pos = pos;
|
|
|
|
|
this.senderName = senderName;
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.args = args;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String getHookName() {
|
|
|
|
|
return EnumScriptType.SCRIPT_COMMAND.function;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IWorld getSenderWorld() {
|
|
|
|
|
return world;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPos getSenderPosition() {
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getSenderName() {
|
|
|
|
|
return senderName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setReplyMessage(String message) {
|
|
|
|
|
replyMessage = message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getId() {
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String[] getArgs() {
|
|
|
|
|
return args;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-09-30 21:44:30 -05:00
|
|
|
}
|