mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 19:15:11 +00:00
Implemented global Forge events. Reorganized NPC API files.
This commit is contained in:
1 parent
c5ed7497c8
commit
72f2c3c60a
72 files changed
+321
-395
No files matched your search
@@ -15,8 +15,8 @@ import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptEvent;
|
||||
import noppes.npcs.scripted.ScriptNpc;
|
||||
import noppes.npcs.scripted.event.ScriptEvent;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
@@ -16,26 +16,24 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerUseItemEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.event.ForgeEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.AttackEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ChatEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerClosed;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.ContainerOpen;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.DamagedEntityEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.KeyPressedEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LevelUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LoginEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.LogoutEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.PickUpEvent;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.TossEvent;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
@@ -47,50 +45,44 @@ public class EventHooks {
|
||||
public EventHooks() {
|
||||
}
|
||||
|
||||
public static void onForgeInit(IScriptHandler handler) {
|
||||
noppes.npcs.scripted.event.ForgeEvent.InitEvent event = new noppes.npcs.scripted.event.ForgeEvent.InitEvent();
|
||||
handler.callScript(EnumScriptType.INIT, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerInit(PlayerDataScript handler) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.InitEvent event = new noppes.npcs.scripted.event.PlayerEvent.InitEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.INIT, event);
|
||||
handler.callScript(EnumScriptType.INIT, event, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerTick(PlayerDataScript handler) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.UpdateEvent event = new noppes.npcs.scripted.event.PlayerEvent.UpdateEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.TICK, event);
|
||||
handler.callScript(EnumScriptType.TICK, event, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerInteract(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.InteractEvent event) {
|
||||
handler.callScript(EnumScriptType.INTERACT, event, "target", event.target, "type", event.type);
|
||||
handler.callScript(EnumScriptType.INTERACT, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStartUsingItem(PlayerDataScript handler, int duration, ItemStack item){
|
||||
PlayerEvent.StartUsingItem event = new PlayerEvent.StartUsingItem(handler.getPlayer(), item, duration);
|
||||
handler.callScript(EnumScriptType.START_USING_ITEM, event, "duration", event.duration, "item", event.item);
|
||||
handler.callScript(EnumScriptType.START_USING_ITEM, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onUsingItem(PlayerDataScript handler, int duration, ItemStack item){
|
||||
PlayerEvent.UsingItem event = new PlayerEvent.UsingItem(handler.getPlayer(), item, duration);
|
||||
handler.callScript(EnumScriptType.USING_ITEM, event, "duration", event.duration, "item", event.item);
|
||||
handler.callScript(EnumScriptType.USING_ITEM, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStopUsingItem(PlayerDataScript handler, int duration, ItemStack item){
|
||||
PlayerEvent.StopUsingItem event = new PlayerEvent.StopUsingItem(handler.getPlayer(), item, duration);
|
||||
handler.callScript(EnumScriptType.STOP_USING_ITEM, event, "duration", event.duration, "item", event.item);
|
||||
handler.callScript(EnumScriptType.STOP_USING_ITEM, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onFinishUsingItem(PlayerDataScript handler, int duration, ItemStack item){
|
||||
PlayerEvent.FinishUsingItem event = new PlayerEvent.FinishUsingItem(handler.getPlayer(), item, duration);
|
||||
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event, "duration", event.duration, "item", event.item);
|
||||
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -99,126 +91,126 @@ public class EventHooks {
|
||||
for(int i = 0; i < entityItems.size(); i++){ items[i] = NpcAPI.Instance().getIItemStack(entityItems.get(i).getEntityItem()); }
|
||||
|
||||
TossEvent event = new TossEvent(handler.getPlayer(), items);
|
||||
handler.callScript(EnumScriptType.DROP, event, "items", event.items);
|
||||
handler.callScript(EnumScriptType.DROP, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerPickupXP(PlayerDataScript handler, EntityXPOrb orb) {
|
||||
PlayerEvent.PickupXPEvent event = new PlayerEvent.PickupXPEvent(handler.getPlayer(), orb);
|
||||
handler.callScript(EnumScriptType.PICKUP_XP, event, "amount", event.amount);
|
||||
handler.callScript(EnumScriptType.PICKUP_XP, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerPickUp(PlayerDataScript handler, EntityItem entityItem) {
|
||||
PickUpEvent event = new PickUpEvent(handler.getPlayer(), new ScriptItemStack(entityItem.getEntityItem()));//NpcAPI.Instance().getIItemStack(entityItem.getEntityItem()));
|
||||
handler.callScript(EnumScriptType.PICKUP, event, "item", event.item);
|
||||
handler.callScript(EnumScriptType.PICKUP, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerContainerOpen(PlayerDataScript handler, Container container) {
|
||||
ContainerOpen event = new ContainerOpen(handler.getPlayer(), NpcAPI.Instance().getIContainer(container));
|
||||
handler.callScript(EnumScriptType.CONTAINER_OPEN, event, "container", event.container);
|
||||
handler.callScript(EnumScriptType.CONTAINER_OPEN, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerDeath(PlayerDataScript handler, DamageSource source, Entity entity) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.DiedEvent event = new noppes.npcs.scripted.event.PlayerEvent.DiedEvent(handler.getPlayer(), source, entity);
|
||||
handler.callScript(EnumScriptType.KILLED, event, "source", event.source, "damageSource", event.damageSource, "type", event.type);
|
||||
handler.callScript(EnumScriptType.KILLED, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerKills(PlayerDataScript handler, EntityLivingBase entityLiving) {
|
||||
noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent event = new noppes.npcs.scripted.event.PlayerEvent.KilledEntityEvent(handler.getPlayer(), entityLiving);
|
||||
handler.callScript(EnumScriptType.KILLS, event, "entity", event.entity);
|
||||
handler.callScript(EnumScriptType.KILLS, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerDamaged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.DamagedEvent event) {
|
||||
handler.callScript(EnumScriptType.DAMAGED, event, "damage", event.damage, "source", event.source, "damageSource", event.damageSource);
|
||||
handler.callScript(EnumScriptType.DAMAGED, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerLightning(PlayerDataScript handler) {
|
||||
PlayerEvent.LightningEvent event = new PlayerEvent.LightningEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.LIGHTNING, event);
|
||||
handler.callScript(EnumScriptType.LIGHTNING, event, "event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerSound(PlayerDataScript handler, String name, float pitch, float volume) {
|
||||
PlayerEvent.SoundEvent event = new PlayerEvent.SoundEvent(handler.getPlayer(), name, pitch, volume);
|
||||
handler.callScript(EnumScriptType.PLAYSOUND, event, "name", name, "pitch", pitch, "volume", volume);
|
||||
handler.callScript(EnumScriptType.PLAYSOUND, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerFall(PlayerDataScript handler, float distance) {
|
||||
PlayerEvent.FallEvent event = new PlayerEvent.FallEvent(handler.getPlayer(),distance);
|
||||
handler.callScript(EnumScriptType.FALL, event, "distance", event.distance);
|
||||
handler.callScript(EnumScriptType.FALL, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerLogin(PlayerDataScript handler) {
|
||||
LoginEvent event = new LoginEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.LOGIN, event);
|
||||
handler.callScript(EnumScriptType.LOGIN, event, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
public static void onPlayerRespawn(PlayerDataScript handler) {
|
||||
PlayerEvent.RespawnEvent event = new PlayerEvent.RespawnEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.RESPAWN, event);
|
||||
handler.callScript(EnumScriptType.RESPAWN, event, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerLogout(PlayerDataScript handler) {
|
||||
LogoutEvent event = new LogoutEvent(handler.getPlayer());
|
||||
handler.callScript(EnumScriptType.LOGOUT, event);
|
||||
handler.callScript(EnumScriptType.LOGOUT, event, "event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerChat(PlayerDataScript handler, ChatEvent event) {
|
||||
handler.callScript(EnumScriptType.CHAT, event, "message", event.message);
|
||||
handler.callScript(EnumScriptType.CHAT, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerRanged(PlayerDataScript handler, noppes.npcs.scripted.event.PlayerEvent.RangedLaunchedEvent event) {
|
||||
handler.callScript(EnumScriptType.RANGED_LAUNCHED, event, "bow", event.bow, "charge", event.charge);
|
||||
handler.callScript(EnumScriptType.RANGED_LAUNCHED, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerDamagedEntity(PlayerDataScript handler, DamagedEntityEvent event) {
|
||||
handler.callScript(EnumScriptType.DAMAGED_ENTITY, event, "target", event.target, "damage", event.damage, "damageSource", event.damageSource, "");
|
||||
handler.callScript(EnumScriptType.DAMAGED_ENTITY, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerChangeDim(PlayerDataScript handler, int fromDim, int toDim) {
|
||||
PlayerEvent.ChangedDimension event = new PlayerEvent.ChangedDimension(handler.getPlayer(), fromDim, toDim);
|
||||
handler.callScript(EnumScriptType.CHANGED_DIM, event, "fromDim", event.fromDim, "toDim", event.toDim);
|
||||
handler.callScript(EnumScriptType.CHANGED_DIM, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerMouseClicked(EntityPlayerMP player, int button, int mouseWheel) {
|
||||
PlayerDataScript handler = PlayerData.get(player).scriptData;
|
||||
PlayerEvent.MouseClickedEvent event = new PlayerEvent.MouseClickedEvent(handler.getPlayer(), button, mouseWheel);
|
||||
handler.callScript(EnumScriptType.MOUSE_CLICKED, event, "button", event.button, "mouseWheel", event.mouseWheel);
|
||||
handler.callScript(EnumScriptType.MOUSE_CLICKED, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerKeyPressed(EntityPlayerMP player, int button, boolean isCtrlPressed, boolean isShiftPressed, boolean isAltPressed, boolean isMetaPressed) {
|
||||
PlayerDataScript handler = PlayerData.get(player).scriptData;
|
||||
KeyPressedEvent event = new KeyPressedEvent(handler.getPlayer(), button, isCtrlPressed, isAltPressed, isShiftPressed, isMetaPressed);
|
||||
handler.callScript(EnumScriptType.KEY_PRESSED, event, "key", button, "isCtrlPressed", isCtrlPressed, "isAltPressed", isAltPressed, "isShiftPressed", isShiftPressed, "isMetaPressed", isMetaPressed);
|
||||
handler.callScript(EnumScriptType.KEY_PRESSED, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onPlayerTimer(PlayerData data, int id) {
|
||||
PlayerDataScript handler = data.scriptData;
|
||||
noppes.npcs.scripted.event.PlayerEvent.TimerEvent event = new noppes.npcs.scripted.event.PlayerEvent.TimerEvent(handler.getPlayer(), id);
|
||||
handler.callScript(EnumScriptType.TIMER, event);
|
||||
handler.callScript(EnumScriptType.TIMER, event,"event", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onPlayerBreak(PlayerDataScript handler, PlayerEvent.BreakEvent event) {
|
||||
handler.callScript(EnumScriptType.BREAK, event, "block", event.block, "xp", event.exp);
|
||||
handler.callScript(EnumScriptType.BREAK, event,"event", event);
|
||||
return WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -227,9 +219,22 @@ public class EventHooks {
|
||||
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.EntityEvent(event, e), event);
|
||||
}
|
||||
|
||||
public static void onForgeWorldEvent(WorldEvent event) {
|
||||
if(ScriptController.Instance.forgeScripts.isEnabled()) {
|
||||
IWorld e = NpcAPI.Instance().getIWorld((WorldServer)event.world);
|
||||
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.WorldEvent(event, e), event);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onForgeInit(ForgeDataScript handler) {
|
||||
noppes.npcs.scripted.event.ForgeEvent.InitEvent event = new noppes.npcs.scripted.event.ForgeEvent.InitEvent();
|
||||
handler.callScript("init", event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onForgeEvent(ForgeEvent ev, Event event) {
|
||||
ForgeDataScript data = ScriptController.Instance.forgeScripts;
|
||||
if(data.isEnabled()) {
|
||||
ForgeDataScript handler = ScriptController.Instance.forgeScripts;
|
||||
if(handler.isEnabled()) {
|
||||
String eventName = event.getClass().getName();
|
||||
int i = eventName.lastIndexOf(".");
|
||||
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
|
||||
@@ -237,7 +242,7 @@ public class EventHooks {
|
||||
ev.setCanceled(event.isCanceled());
|
||||
}
|
||||
|
||||
data.callScript(eventName, event);
|
||||
handler.callScript(eventName, event);
|
||||
WrapperNpcAPI.EVENT_BUS.post(ev);
|
||||
if(event.isCancelable()) {
|
||||
event.setCanceled(ev.isCanceled());
|
||||
@@ -245,11 +250,4 @@ public class EventHooks {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void onForgeWorldEvent(WorldEvent event) {
|
||||
if(ScriptController.Instance.forgeScripts.isEnabled()) {
|
||||
IWorld e = NpcAPI.Instance().getIWorld((WorldServer)event.world);
|
||||
onForgeEvent(new noppes.npcs.scripted.event.ForgeEvent.WorldEvent(event, e), event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,6 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
import net.minecraft.command.ICommandManager;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.server.CommandBlockLogic;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -29,7 +28,6 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.rcon.RConConsoleSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.MobSpawnerBaseLogic;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -38,7 +36,6 @@ import net.minecraft.tileentity.TileEntityMobSpawner;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.constants.EnumGuiType;
|
||||
@@ -76,7 +73,7 @@ import noppes.npcs.controllers.TransportLocation;
|
||||
import noppes.npcs.entity.EntityDialogNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleTransporter;
|
||||
import noppes.npcs.scripted.ScriptEventDialog;
|
||||
import noppes.npcs.scripted.event.ScriptEventDialog;
|
||||
|
||||
public class NoppesUtilServer {
|
||||
private static HashMap<String,Quest> editingQuests = new HashMap<String,Quest>();
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.PlayerScriptContainer;
|
||||
import noppes.npcs.EventScriptContainer;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
@@ -13,10 +13,10 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
public class EventGuiScriptList extends SubGuiInterface{
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
private PlayerScriptContainer container;
|
||||
private EventScriptContainer container;
|
||||
private List<String> scripts;
|
||||
|
||||
public EventGuiScriptList(List<String> scripts, PlayerScriptContainer container){
|
||||
public EventGuiScriptList(List<String> scripts, EventScriptContainer container){
|
||||
this.container = container;
|
||||
setBackground("menubg.png");
|
||||
xSize = 346;
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.PlayerScriptContainer;
|
||||
import noppes.npcs.EventScriptContainer;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
@@ -18,10 +18,10 @@ import noppes.npcs.client.gui.util.SubGuiInterface;
|
||||
public class EventGuiScriptList extends SubGuiInterface {
|
||||
private GuiCustomScroll scroll1;
|
||||
private GuiCustomScroll scroll2;
|
||||
private PlayerScriptContainer container;
|
||||
private EventScriptContainer container;
|
||||
private List<String> scripts;
|
||||
|
||||
public EventGuiScriptList(List<String> scripts, PlayerScriptContainer container) {
|
||||
public EventGuiScriptList(List<String> scripts, EventScriptContainer container) {
|
||||
this.container = container;
|
||||
this.setBackground("menubg.png");
|
||||
this.xSize = 346;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
|
||||
public class GuiScriptForge extends GuiScriptInterface {
|
||||
private ForgeDataScript script = new ForgeDataScript();
|
||||
|
||||
public GuiScriptForge() {
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.ScriptForgeGet);
|
||||
}
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
this.script.readFromNBT(compound);
|
||||
super.setGuiData(compound);
|
||||
}
|
||||
|
||||
public void save() {
|
||||
super.save();
|
||||
Client.sendData(EnumPacketServer.ScriptForgeSave, script.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
}
|
||||
@@ -39,9 +39,9 @@ public class GuiScriptGlobal extends GuiNPCInterface {
|
||||
if (guibutton.id == 0) {
|
||||
this.displayGuiScreen(new GuiScriptPlayers());
|
||||
}
|
||||
/*if (guibutton.id == 1) {
|
||||
if (guibutton.id == 1) {
|
||||
this.displayGuiScreen(new GuiScriptForge());
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
public void keyTyped(char c, int i) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
|
||||
public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallback, IGuiData, ITextChangeListener, ICustomScrollListener, IJTextAreaListener {
|
||||
public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallback, IGuiData, ITextChangeListener, ICustomScrollListener, IJTextAreaListener, ITextfieldListener {
|
||||
private int activeTab = 0;
|
||||
public IScriptHandler handler;
|
||||
public Map<String, List<String>> languages = new HashMap();
|
||||
@@ -56,49 +56,12 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
GuiMenuTopButton top;
|
||||
this.addTopButton(top = new GuiMenuTopButton(0, this.guiLeft + 4, this.guiTop - 17, "gui.settings"));
|
||||
|
||||
List<String> hookList = new ArrayList<String>();
|
||||
if(handler instanceof PlayerDataScript) {
|
||||
hookList.add("playerscript.disabled");
|
||||
hookList.add("playerscript.init");
|
||||
hookList.add("playerscript.tick");
|
||||
hookList.add("playerscript.interact");
|
||||
hookList.add("playerscript.damaged");
|
||||
hookList.add("playerscript.killed");
|
||||
hookList.add("playerscript.kills");
|
||||
hookList.add("playerscript.chat");
|
||||
hookList.add("playerscript.drop");
|
||||
hookList.add("playerscript.containerOpen");
|
||||
hookList.add("playerscript.login");
|
||||
hookList.add("playerscript.logout");
|
||||
hookList.add("playerscript.chat");
|
||||
hookList.add("playerscript.damagedentity");
|
||||
hookList.add("playerscript.keyPressed");
|
||||
hookList.add("playerscript.mouseClicked");
|
||||
hookList.add("playerscript.pickUp");
|
||||
hookList.add("playerscript.rangedLaunched");
|
||||
hookList.add("playerscript.pickupXP");
|
||||
hookList.add("playerscript.timer");
|
||||
hookList.add("playerscript.startItem");
|
||||
hookList.add("playerscript.usingItem");
|
||||
hookList.add("playerscript.stopItem");
|
||||
hookList.add("playerscript.finishItem");
|
||||
hookList.add("playerscript.fall");
|
||||
hookList.add("playerscript.playSound");
|
||||
hookList.add("playerscript.lightning");
|
||||
hookList.add("playerscript.break");
|
||||
hookList.add("playerscript.changedDim");
|
||||
hookList.add("playerscript.respawn");
|
||||
}
|
||||
else if(handler instanceof ForgeDataScript){
|
||||
hookList.add("forgescript.forgeInit");
|
||||
}
|
||||
|
||||
int topXoffset = 0;
|
||||
int topYoffset = 0;
|
||||
for(int ta = 0; ta < this.handler.getScripts().size(); ++ta) {
|
||||
if(ta%15 == 0 && ta > 0) {
|
||||
if(ta%20 == 0 && ta > 0) {
|
||||
topYoffset -= 20;
|
||||
topXoffset -= top.width+260;
|
||||
topXoffset -= top.width+20*22;
|
||||
}
|
||||
this.addTopButton(top = new GuiMenuTopButton(ta + 1, top.xPosition+top.width + topXoffset, top.yPosition + topYoffset, ta + 1 + ""));
|
||||
topXoffset = 0;
|
||||
@@ -106,7 +69,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
scriptLimit = ta + 2;
|
||||
}
|
||||
|
||||
if(this.handler.getScripts().size() < 75)
|
||||
if(this.handler.getScripts().size() < 100)
|
||||
this.addTopButton(new GuiMenuTopButton(scriptLimit, top.xPosition+top.width, top.yPosition, "+"));
|
||||
|
||||
top = this.getTopButton(this.activeTab);
|
||||
@@ -117,14 +80,54 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
|
||||
top.active = true;
|
||||
if(this.activeTab > 0) {
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.setSize(68, 198);
|
||||
hooks.guiLeft = guiLeft + 4;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
hooks.setUnsortedList(hookList);
|
||||
hooks.selected = getScriptHook(this.handler.getScripts().get(this.activeTab - 1),hookList);
|
||||
addScroll(hooks);
|
||||
if(handler instanceof PlayerDataScript) {
|
||||
List<String> hookList = new ArrayList<String>();
|
||||
hookList.add("playerscript.disabled");
|
||||
hookList.add("playerscript.init");
|
||||
hookList.add("playerscript.tick");
|
||||
hookList.add("playerscript.interact");
|
||||
hookList.add("playerscript.damaged");
|
||||
hookList.add("playerscript.killed");
|
||||
hookList.add("playerscript.kills");
|
||||
hookList.add("playerscript.chat");
|
||||
hookList.add("playerscript.drop");
|
||||
hookList.add("playerscript.containerOpen");
|
||||
hookList.add("playerscript.login");
|
||||
hookList.add("playerscript.logout");
|
||||
hookList.add("playerscript.chat");
|
||||
hookList.add("playerscript.damagedentity");
|
||||
hookList.add("playerscript.keyPressed");
|
||||
hookList.add("playerscript.mouseClicked");
|
||||
hookList.add("playerscript.pickUp");
|
||||
hookList.add("playerscript.rangedLaunched");
|
||||
hookList.add("playerscript.pickupXP");
|
||||
hookList.add("playerscript.timer");
|
||||
hookList.add("playerscript.startItem");
|
||||
hookList.add("playerscript.usingItem");
|
||||
hookList.add("playerscript.stopItem");
|
||||
hookList.add("playerscript.finishItem");
|
||||
hookList.add("playerscript.fall");
|
||||
hookList.add("playerscript.playSound");
|
||||
hookList.add("playerscript.lightning");
|
||||
hookList.add("playerscript.break");
|
||||
hookList.add("playerscript.changedDim");
|
||||
hookList.add("playerscript.respawn");
|
||||
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.setSize(68, 198);
|
||||
hooks.guiLeft = guiLeft + 4;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
hooks.setUnsortedList(hookList);
|
||||
hooks.selected = getScriptHook(this.handler.getScripts().get(this.activeTab - 1),hookList);
|
||||
addScroll(hooks);
|
||||
}
|
||||
else if(handler instanceof ForgeDataScript){
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
GuiNpcTextField hookField = new GuiNpcTextField(1,this,this.fontRendererObj,guiLeft + 4,guiTop + 14,68,20,"");
|
||||
hookField.setText(this.handler.getScripts().get(this.activeTab - 1).type);
|
||||
addTextField(hookField);
|
||||
}
|
||||
|
||||
EventScriptContainer var7 = (EventScriptContainer)this.handler.getScripts().get(this.activeTab - 1);
|
||||
GuiNpcTextArea left = new GuiNpcTextArea(2, this, this.guiLeft + 72 + yoffset, this.guiTop + yoffset, this.xSize - 180 - yoffset, (int)((double)this.ySize * 0.96D) - yoffset * 2, var7 == null?"":var7.script);
|
||||
@@ -175,6 +178,13 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
this.handler.getScripts().get(this.activeTab - 1).setType(scroll.getSelected().replace("playerscript.",""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield) {
|
||||
if(textfield.id == 1){
|
||||
this.handler.getScripts().get(this.activeTab - 1).setType(textfield.getText());
|
||||
}
|
||||
}
|
||||
|
||||
private int getScriptHook(EventScriptContainer eventScriptContainer, List<String> list) {
|
||||
for(String s : list) {
|
||||
if (s.replace("playerscript.", "").equals(eventScriptContainer.type)) {
|
||||
@@ -334,8 +344,6 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
text = text.replace("\r\n", "\n");
|
||||
text = text.replace("\r", "\n");
|
||||
container.script = text;
|
||||
|
||||
ScriptController.Instance.playerScripts.errored.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
|
||||
public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
@@ -28,4 +29,9 @@ public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
super.save();
|
||||
Client.sendData(EnumPacketServer.ScriptPlayerSave, script.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public void close() {
|
||||
super.close();
|
||||
ScriptController.Instance.playerScripts.errored.clear();
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,9 @@ public enum EnumPacketServer {
|
||||
ScriptPlayerSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptPlayerGet(false),
|
||||
|
||||
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptForgeGet(false),
|
||||
|
||||
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||
|
||||
@@ -64,7 +64,10 @@ public enum EnumScriptType {
|
||||
PLAYSOUND("playSound"),
|
||||
RESPAWN("respawn"),
|
||||
CHANGED_DIM("changedDim"),
|
||||
BREAK("break");
|
||||
BREAK("break"),
|
||||
FORGE_INIT("forgeInit"),
|
||||
FORGE_ENTITY("forgeEntity"),
|
||||
FORGE_WORLD("forgeWorld");
|
||||
|
||||
public String function;
|
||||
|
||||
|
||||
@@ -2,9 +2,8 @@ package noppes.npcs.containers;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.interfaces.IContainer;
|
||||
import noppes.npcs.scripted.ScriptContainer;
|
||||
|
||||
public class ContainerNpcInterface extends Container{
|
||||
|
||||
@@ -31,13 +31,13 @@ import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptAnimal;
|
||||
import noppes.npcs.scripted.ScriptEntity;
|
||||
import noppes.npcs.scripted.ScriptLiving;
|
||||
import noppes.npcs.scripted.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.ScriptMonster;
|
||||
import noppes.npcs.scripted.ScriptPixelmon;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.entity.ScriptAnimal;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
import noppes.npcs.scripted.entity.ScriptLiving;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.entity.ScriptMonster;
|
||||
import noppes.npcs.scripted.entity.ScriptPixelmon;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.util.JsonException;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import noppes.npcs.scripted.ScriptEntity;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
|
||||
public class ScriptEntityData implements IExtendedEntityProperties{
|
||||
public ScriptEntity base;
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.EventScriptContainer;
|
||||
@@ -22,6 +21,7 @@ import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
|
||||
import javax.script.ScriptEngine;
|
||||
|
||||
@@ -51,40 +51,9 @@ public class ForgeDataScript implements IScriptHandler {
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void callScript(EnumScriptType type, Event event, Object... obs) {
|
||||
if(this.isEnabled()) {
|
||||
// CustomNpcs.getServer().func_152344_a(() -> {
|
||||
Minecraft.getMinecraft().func_152344_a(() -> {
|
||||
if (ScriptController.Instance.lastLoaded > this.lastInited) {
|
||||
this.lastInited = ScriptController.Instance.lastLoaded;
|
||||
if (!type.equals(EnumScriptType.FORGE_INIT)) {
|
||||
EventHooks.onForgeInit(this);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator var3 = this.scripts.iterator();
|
||||
|
||||
while (var3.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer) var3.next();
|
||||
if(script.type != type.function)
|
||||
continue;
|
||||
|
||||
script.setEngine(scriptLanguage);
|
||||
if(script.engine == null)
|
||||
return;
|
||||
for(int i = 0; i + 1 < obs.length; i += 2){
|
||||
Object ob = obs[i + 1];
|
||||
if(ob instanceof Entity)
|
||||
ob = ScriptController.Instance.getScriptForEntity((Entity)ob);
|
||||
script.engine.put(obs[i].toString(), ob);
|
||||
}
|
||||
ScriptEngine engine = script.engine;
|
||||
|
||||
//script.run(EnumScriptType.valueOf(type), event);
|
||||
script.run(engine);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void callScript(EnumScriptType var1, Event var2, Object... obs) {
|
||||
callScript(var1.function, var2);
|
||||
}
|
||||
|
||||
public void callScript(String type, Event event) {
|
||||
@@ -102,11 +71,19 @@ public class ForgeDataScript implements IScriptHandler {
|
||||
|
||||
while (var3.hasNext()) {
|
||||
EventScriptContainer script = (EventScriptContainer) var3.next();
|
||||
//script.run(EnumScriptType.valueOf(type), event);
|
||||
|
||||
if(!script.type.equals(type))
|
||||
continue;
|
||||
|
||||
script.setEngine(scriptLanguage);
|
||||
if(script.engine == null)
|
||||
return;
|
||||
|
||||
Event result = (Event) script.engine.get("event");
|
||||
if(result == null)
|
||||
script.engine.put("event", event);
|
||||
script.engine.put("API", new WrapperNpcAPI());
|
||||
|
||||
ScriptEngine engine = script.engine;
|
||||
|
||||
script.run(engine);
|
||||
|
||||
@@ -20,15 +20,13 @@ import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.EventScriptContainer;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.event.PlayerEvent;
|
||||
import noppes.npcs.scripted.wrapper.WrapperNpcAPI;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.script.ScriptEngine;
|
||||
@@ -47,9 +45,6 @@ public class PlayerDataScript implements IScriptHandler {
|
||||
|
||||
public ScriptPlayer dummyPlayer;
|
||||
public ScriptWorld dummyWorld;
|
||||
private final static EntityType entities = new EntityType();
|
||||
private final static JobType jobs = new JobType();
|
||||
private final static RoleType roles = new RoleType();
|
||||
|
||||
public PlayerDataScript(EntityPlayer player) {
|
||||
if(player != null) {
|
||||
@@ -132,9 +127,7 @@ public class PlayerDataScript implements IScriptHandler {
|
||||
PlayerEvent result = (PlayerEvent) engine.get("event");
|
||||
if(result == null)
|
||||
engine.put("event", result = new PlayerEvent(this.getPlayer()));
|
||||
engine.put("EntityType", entities);
|
||||
engine.put("RoleType", roles);
|
||||
engine.put("JobType", jobs);
|
||||
script.engine.put("API", new WrapperNpcAPI());
|
||||
script.run(engine);
|
||||
|
||||
if (script.errored) {
|
||||
|
||||
@@ -93,7 +93,12 @@ import noppes.npcs.roles.JobInterface;
|
||||
import noppes.npcs.roles.RoleCompanion;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import noppes.npcs.roles.RoleInterface;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.event.ScriptEventAttack;
|
||||
import noppes.npcs.scripted.event.ScriptEventDamaged;
|
||||
import noppes.npcs.scripted.event.ScriptEventKilled;
|
||||
import noppes.npcs.scripted.event.ScriptEventTarget;
|
||||
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||
import noppes.npcs.util.GameProfileAlt;
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@ import java.util.Map;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.scripted.ITimers;
|
||||
import noppes.npcs.scripted.interfaces.ITimers;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
|
||||
public class DataTimers implements ITimers {
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.io.File;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,6 +19,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
|
||||
public abstract class NpcAPI {
|
||||
private static NpcAPI instance = null;
|
||||
@@ -31,8 +33,12 @@ public abstract class NpcAPI {
|
||||
|
||||
public abstract IEntity getIEntity(Entity var1);
|
||||
|
||||
public abstract IPlayer getIPlayer(EntityPlayerMP var1);
|
||||
|
||||
public abstract IBlock getIBlock(World var1, BlockPos var2);
|
||||
|
||||
public abstract IBlock getIBlock(World world, int x, int y, int z);
|
||||
|
||||
public abstract IContainer getIContainer(IInventory var1);
|
||||
|
||||
public abstract IContainer getIContainer(Container var1);
|
||||
|
||||
@@ -7,7 +7,6 @@ package noppes.npcs.scripted;
|
||||
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -15,6 +14,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
import noppes.npcs.util.LRUHashMap;
|
||||
|
||||
public class ScriptBlock implements IBlock {
|
||||
|
||||
@@ -7,6 +7,7 @@ package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import noppes.npcs.scripted.interfaces.IPos;
|
||||
|
||||
public class ScriptBlockPos implements IPos {
|
||||
private BlockPos blockPos;
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockAir;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
import noppes.npcs.scripted.IContainer;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.IContainer;
|
||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
|
||||
public class ScriptContainer implements IContainer {
|
||||
private IInventory inventory;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
|
||||
/**
|
||||
* Created by luisc on 9/8/2021.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
|
||||
public class ScriptEventDialog extends ScriptEvent{
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public boolean isClosing(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import noppes.npcs.controllers.Faction;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
|
||||
public class ScriptFaction {
|
||||
private Faction faction;
|
||||
|
||||
@@ -13,9 +13,11 @@ import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.scripted.interfaces.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.INbt;
|
||||
|
||||
public class ScriptItemStack implements IItemStack {
|
||||
protected ItemStack item;
|
||||
public ItemStack item;
|
||||
|
||||
public ScriptItemStack(ItemStack item){
|
||||
this.item = item;
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagInt;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import noppes.npcs.scripted.interfaces.INbt;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
|
||||
public class ScriptNbt implements INbt {
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.scripted.entity.ScriptPixelmon;
|
||||
|
||||
public class ScriptPixelmonPlayerData {
|
||||
private EntityPlayerMP player;
|
||||
|
||||
@@ -23,11 +23,14 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.blocks.tiles.TileSign;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.interfaces.IBlock;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
|
||||
public class ScriptWorld implements IWorld{
|
||||
public class ScriptWorld implements IWorld {
|
||||
private static Map<String,Object> tempData = new HashMap<String,Object>();
|
||||
public WorldServer world;
|
||||
public ScriptWorld(WorldServer world){
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IAnimal;
|
||||
|
||||
public class ScriptAnimal<T extends EntityAnimal> extends ScriptLiving<T> implements IAnimal {
|
||||
|
||||
+7
-7
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -19,16 +18,17 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptEntityParticle;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.INbt;
|
||||
|
||||
public class ScriptEntity<T extends Entity> implements IEntity{
|
||||
public class ScriptEntity<T extends Entity> implements IEntity {
|
||||
protected T entity;
|
||||
private Map<String,Object> tempData = new HashMap<String,Object>();
|
||||
|
||||
+2
-6
@@ -1,12 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.NPCEntityHelper;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IEntityLiving;
|
||||
|
||||
public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> implements IEntityLiving {
|
||||
|
||||
+4
-16
@@ -1,27 +1,15 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTBase.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IEntityLivingBase;
|
||||
|
||||
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase{
|
||||
public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T> implements IEntityLivingBase {
|
||||
protected T entity;
|
||||
|
||||
public ScriptLivingBase(T entity){
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IMonster;
|
||||
|
||||
public class ScriptMonster<T extends EntityMob> extends ScriptLiving<T> implements IMonster {
|
||||
|
||||
+4
-5
@@ -1,9 +1,6 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
@@ -11,9 +8,11 @@ import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.scripted.ScriptFaction;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.constants.AnimationType;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||
import noppes.npcs.scripted.roles.ScriptJobBard;
|
||||
import noppes.npcs.scripted.roles.ScriptJobConversation;
|
||||
import noppes.npcs.scripted.roles.ScriptJobFollower;
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.scripted.interfaces.IPixelmon;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptPixelmon<T extends EntityTameable> extends ScriptAnimal<T> implements IPixelmon {
|
||||
+4
-1
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -22,7 +22,10 @@ import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.Quest;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.interfaces.IPlayer;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
|
||||
@@ -7,8 +7,8 @@ package noppes.npcs.scripted.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.IWorld;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
|
||||
@Cancelable
|
||||
public class ForgeEvent extends CustomNPCsEvent {
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
|
||||
public class PlayerEvent extends CustomNPCsEvent {
|
||||
public final IPlayer player;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
public
|
||||
class ScriptEvent{
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
|
||||
public class ScriptEventAttack extends ScriptEvent{
|
||||
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
|
||||
public class ScriptEventDamaged extends ScriptEvent{
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
public class ScriptEventDialog extends ScriptEvent{
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public boolean isClosing(){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,8 +1,9 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
|
||||
public class ScriptEventKilled extends ScriptEvent{
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.event;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
|
||||
public class ScriptEventTarget extends ScriptEvent{
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
+5
-11
@@ -3,20 +3,14 @@
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.scripted.IItemStack;
|
||||
import noppes.npcs.scripted.constants.AnimationType;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.ScriptFaction;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.roles.*;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
/**
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
||||
+2
-25
@@ -3,34 +3,11 @@
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.scripted.IWorld;
|
||||
import noppes.npcs.scripted.IItemStack;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptEntity;
|
||||
import noppes.npcs.scripted.ScriptEntityParticle;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IEntity<T extends Entity> {
|
||||
/**
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
|
||||
+4
-6
@@ -1,11 +1,9 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
|
||||
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
|
||||
/**
|
||||
+1
-12
@@ -1,17 +1,6 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface IItemStack {
|
||||
public String getName();
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
|
||||
+3
-17
@@ -1,22 +1,8 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.stats.StatBase;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
|
||||
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
|
||||
/**
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
public interface ITimers {
|
||||
void start(int var1, int var2, boolean var3);
|
||||
+4
-23
@@ -1,29 +1,10 @@
|
||||
package noppes.npcs.scripted;
|
||||
package noppes.npcs.scripted.interfaces;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntitySign;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.scripted.entity.ScriptEntity;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
|
||||
public interface IWorld {
|
||||
/**
|
||||
@@ -2,10 +2,6 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobConversation;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobConversation extends ScriptJobInterface{
|
||||
|
||||
@@ -2,8 +2,7 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.scripted.ScriptNpc;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobFollower extends ScriptJobInterface{
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobHealer;
|
||||
import noppes.npcs.scripted.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobHealer extends ScriptJobInterface{
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobItemGiver extends ScriptJobInterface{
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.roles.JobHealer;
|
||||
import noppes.npcs.roles.JobPuppet;
|
||||
import noppes.npcs.scripted.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobPuppet extends ScriptJobInterface{
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
import noppes.npcs.roles.JobSpawner;
|
||||
import noppes.npcs.scripted.ScriptItemStack;
|
||||
import noppes.npcs.scripted.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.entity.ScriptLivingBase;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
|
||||
public class ScriptJobSpawner extends ScriptJobInterface{
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleFollower;
|
||||
import noppes.npcs.scripted.ScriptPlayer;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
|
||||
public class ScriptRoleFollower extends ScriptRoleInterface{
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
package noppes.npcs.scripted.wrapper;
|
||||
|
||||
import net.minecraft.util.DamageSource;
|
||||
import noppes.npcs.scripted.IDamageSource;
|
||||
import noppes.npcs.scripted.interfaces.IDamageSource;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.IEntity;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
|
||||
public class ScriptDamageSource implements IDamageSource {
|
||||
private DamageSource source;
|
||||
|
||||
@@ -8,20 +8,14 @@ package noppes.npcs.scripted.wrapper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import noppes.npcs.scripted.entity.*;
|
||||
import noppes.npcs.scripted.interfaces.IEntity;
|
||||
|
||||
public class WrapperEntityData{
|
||||
public IEntity base;
|
||||
|
||||
@@ -9,17 +9,15 @@ import java.io.File;
|
||||
import java.util.Map;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockAir;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
@@ -28,16 +26,11 @@ import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.containers.ContainerNpcInterface;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.QuestController;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
import noppes.npcs.util.LRUHashMap;
|
||||
import noppes.npcs.util.NBTJsonUtil;
|
||||
import noppes.npcs.util.JsonException;
|
||||
|
||||
public class WrapperNpcAPI extends NpcAPI {
|
||||
private static final Map<Integer, ScriptWorld> worldCache = new LRUHashMap(10);
|
||||
@@ -59,10 +52,22 @@ public class WrapperNpcAPI extends NpcAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public IPlayer getIPlayer(EntityPlayerMP player) {
|
||||
if (player != null && !player.worldObj.isRemote) {
|
||||
return new ScriptPlayer(player);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public IBlock getIBlock(World world, BlockPos pos) {
|
||||
return new ScriptBlock(world, world.getBlock(pos.getX(),pos.getY(),pos.getZ()), pos);
|
||||
}
|
||||
|
||||
public IBlock getIBlock(World world, int x, int y, int z) {
|
||||
return new ScriptBlock(world, world.getBlock(x, y, z), new BlockPos(x,y,z));
|
||||
}
|
||||
|
||||
public INbt getINbt(NBTTagCompound compound) {
|
||||
return compound == null?new ScriptNbt(new NBTTagCompound()):new ScriptNbt(compound);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user