mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 21:57:40 +00:00
Fixed API interface errors, added casts for custom item script handlers in EventHooks, and added some event interfaces.
This commit is contained in:
1 parent
be9ae94163
commit
aa02e5dcc3
41 files changed
+181
-66
No files matched your search
@@ -100,12 +100,12 @@ var activeTableTab = "activeTableTab";
|
||||
<li class="blockList">
|
||||
<dl>
|
||||
<dt>All Superinterfaces:</dt>
|
||||
<dd><a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>, noppes.npcs.api.IScriptHandler</dd>
|
||||
<dd><a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>, noppes.npcs.controllers.data.IScriptHandler</dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<br>
|
||||
<pre>public interface <span class="typeNameLabel">IItemCustom</span>
|
||||
extends <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>, noppes.npcs.api.IScriptHandler</pre>
|
||||
extends <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>, noppes.npcs.controllers.data.IScriptHandler</pre>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -305,10 +305,10 @@ extends <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.
|
||||
<code><a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#addEnchant-int-int-">addEnchant</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getAttribute-java.lang.String-">getAttribute</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getBookAuthor--">getBookAuthor</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getBookText--">getBookText</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getBookTitle--">getBookTitle</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getDisplayName--">getDisplayName</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getItemDamage--">getItemDamage</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getItemName--">getItemName</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getItemNbt--">getItemNbt</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getLore--">getLore</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getMaxStackSize--">getMaxStackSize</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getMCItemStack--">getMCItemStack</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getMCNbt--">getMCNbt</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getName--">getName</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getNbt--">getNbt</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getStackSize--">getStackSize</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#getTag-java.lang.String-">getTag</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#hasAttribute-java.lang.String-">hasAttribute</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#hasCustomName--">hasCustomName</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#hasEnchant-int-">hasEnchant</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#hasLore--">hasLore</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#hasTag-java.lang.String-">hasTag</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#isBlock--">isBlock</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#isEnchanted--">isEnchanted</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#isWrittenBook--">isWrittenBook</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#removeTags--">removeTags</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setAttribute-java.lang.String-double-">setAttribute</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setCustomName-java.lang.String-">setCustomName</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setItemDamage-int-">setItemDamage</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setLore-java.lang.String:A-">setLore</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setMCNbt-net.minecraft.nbt.NBTTagCompound-">setMCNbt</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setStackSize-int-">setStackSize</a>, <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html#setTag-java.lang.String-java.lang.Object-">setTag</a></code></li>
|
||||
</ul>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.noppes.npcs.api.IScriptHandler">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.noppes.npcs.controllers.data.IScriptHandler">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from interface noppes.npcs.api.IScriptHandler</h3>
|
||||
<h3>Methods inherited from interface noppes.npcs.controllers.data.IScriptHandler</h3>
|
||||
<code>callScript, clearConsole, getConsoleText, getLanguage, getScripts, isClient, noticeString, setLanguage</code></li>
|
||||
</ul>
|
||||
</li>
|
||||
@@ -334,7 +334,7 @@ extends <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.
|
||||
<pre>boolean getEnabled()</pre>
|
||||
<dl>
|
||||
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
||||
<dd><code>getEnabled</code> in interface <code>noppes.npcs.api.IScriptHandler</code></dd>
|
||||
<dd><code>getEnabled</code> in interface <code>noppes.npcs.controllers.data.IScriptHandler</code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -347,7 +347,7 @@ extends <a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.
|
||||
<pre>void setEnabled(boolean bo)</pre>
|
||||
<dl>
|
||||
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
||||
<dd><code>setEnabled</code> in interface <code>noppes.npcs.api.IScriptHandler</code></dd>
|
||||
<dd><code>setEnabled</code> in interface <code>noppes.npcs.controllers.data.IScriptHandler</code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -83,10 +83,10 @@
|
||||
<li type="circle">noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemBook.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemBook</span></a></li>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemStack</span></a>
|
||||
<ul>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.api.IScriptHandler)</li>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.controllers.data.IScriptHandler)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li type="circle">noppes.npcs.api.IScriptHandler
|
||||
<li type="circle">noppes.npcs.controllers.data.IScriptHandler
|
||||
<ul>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.api.item.<a href="../../../../../noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>)</li>
|
||||
</ul>
|
||||
|
||||
@@ -320,7 +320,7 @@
|
||||
<li type="circle">noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemBook.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemBook</span></a></li>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemStack</span></a>
|
||||
<ul>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.api.IScriptHandler)</li>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.controllers.data.IScriptHandler)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li type="circle">noppes.npcs.api.jobs.<a href="noppes/npcs/scripted/interfaces/jobs/IJob.html" title="interface in noppes.npcs.api.jobs"><span class="typeNameLink">IJob</span></a>
|
||||
@@ -373,7 +373,7 @@
|
||||
<li type="circle">noppes.npcs.api.roles.<a href="noppes/npcs/scripted/interfaces/roles/IRoleTransporter.html" title="interface in noppes.npcs.api.roles"><span class="typeNameLink">IRoleTransporter</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li type="circle">noppes.npcs.api.IScriptHandler
|
||||
<li type="circle">noppes.npcs.controllers.data.IScriptHandler
|
||||
<ul>
|
||||
<li type="circle">noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemCustom.html" title="interface in noppes.npcs.api.item"><span class="typeNameLink">IItemCustom</span></a> (also extends noppes.npcs.api.item.<a href="noppes/npcs/scripted/interfaces/item/IItemStack.html" title="interface in noppes.npcs.api.item">IItemStack</a>)</li>
|
||||
</ul>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import noppes.npcs.api.entity.IPixelmon;
|
||||
|
||||
public interface IPixelmonPlayerData {
|
||||
|
||||
IPixelmon getPartySlot(int slot);
|
||||
|
||||
int countPCPixelmon();
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.api;
|
||||
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.scripted.scoreboard.ScriptScoreboard;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
@@ -408,7 +408,7 @@ public interface IWorld {
|
||||
IEntity spawnClone(int x, int y, int z, int tab, String name);
|
||||
IEntity spawnClone(IPos pos, int tab, String name);
|
||||
|
||||
ScriptScoreboard getScoreboard();
|
||||
IScoreboard getScoreboard();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
|
||||
@@ -11,8 +11,8 @@ import noppes.npcs.api.ITimers;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.roles.ScriptJobInterface;
|
||||
import noppes.npcs.scripted.roles.ScriptRoleInterface;
|
||||
import noppes.npcs.api.jobs.IJob;
|
||||
import noppes.npcs.api.roles.IRole;
|
||||
|
||||
public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
/**
|
||||
@@ -201,14 +201,14 @@ public interface ICustomNpc<T extends EntityCreature> extends IEntityLiving<T> {
|
||||
/**
|
||||
* @return Returns the npcs current role
|
||||
*/
|
||||
ScriptRoleInterface getRole();
|
||||
IRole getRole();
|
||||
|
||||
void setRole(int role);
|
||||
|
||||
/**
|
||||
* @return Returns the npcs current job
|
||||
*/
|
||||
ScriptJobInterface getJob();
|
||||
IJob getJob();
|
||||
|
||||
void setJob(int job);
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package noppes.npcs.api.entity;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.api.IBlock;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.ScriptDamageSource;
|
||||
|
||||
public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T> {
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ public interface IEntityLivingBase<T extends EntityLivingBase> extends IEntity<T
|
||||
|
||||
void hurt(float damage, IEntity source);
|
||||
|
||||
void hurt(float damage, ScriptDamageSource damageSource);
|
||||
void hurt(float damage, IDamageSource damageSource);
|
||||
|
||||
/**
|
||||
* @return Entity's max health
|
||||
|
||||
@@ -3,7 +3,6 @@ package noppes.npcs.api.entity;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import noppes.npcs.api.*;
|
||||
import noppes.npcs.scripted.entity.ScriptDBCPlayer;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.IPlayerData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
@@ -12,7 +11,6 @@ import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
|
||||
public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T> {
|
||||
/**
|
||||
@@ -277,13 +275,13 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
|
||||
* Requires pixelmon to be installed
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
ScriptPixelmonPlayerData getPixelmonData();
|
||||
IPixelmonPlayerData getPixelmonData();
|
||||
|
||||
ITimers getTimers();
|
||||
|
||||
void updatePlayerInventory();
|
||||
|
||||
ScriptDBCPlayer<T> getDBCPlayer();
|
||||
IDBCPlayer getDBCPlayer();
|
||||
|
||||
boolean blocking();
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
|
||||
public interface CustomGuiEvent {
|
||||
|
||||
IPlayer getPlayer();
|
||||
|
||||
ICustomGui getGui();
|
||||
|
||||
interface ButtonEvent {
|
||||
}
|
||||
|
||||
interface UnfocusedEvent {
|
||||
}
|
||||
|
||||
interface CloseEvent {
|
||||
}
|
||||
|
||||
interface ScrollEvent {
|
||||
}
|
||||
|
||||
interface SlotEvent {
|
||||
}
|
||||
|
||||
interface SlotClickEvent {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.handler.data.INaturalSpawn;
|
||||
|
||||
public interface CustomNPCsEvent {
|
||||
interface CNPCNaturalSpawnEvent {
|
||||
INaturalSpawn getNaturalSpawn();
|
||||
|
||||
IPos getAttemptPosition();
|
||||
|
||||
boolean animalSpawnPassed();
|
||||
|
||||
boolean monsterSpawnPassed();
|
||||
|
||||
boolean liquidSpawnPassed();
|
||||
|
||||
boolean airSpawnPassed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface DialogEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface FactionEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface ForgeEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface ItemEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface NpcEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface PlayerEvent {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.api.event;
|
||||
|
||||
public interface QuestEvent {
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
package noppes.npcs.api.gui;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.scripted.gui.ScriptGuiComponent;
|
||||
|
||||
public interface ICustomGuiComponent {
|
||||
int getID();
|
||||
@@ -41,5 +40,5 @@ public interface ICustomGuiComponent {
|
||||
|
||||
NBTTagCompound toNBT(NBTTagCompound nbt);
|
||||
|
||||
ScriptGuiComponent fromNBT(NBTTagCompound nbt);
|
||||
ICustomGuiComponent fromNBT(NBTTagCompound nbt);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.api.item;
|
||||
import noppes.npcs.controllers.IScriptHandler;
|
||||
|
||||
public interface IItemCustom extends IItemStack, IScriptHandler {
|
||||
public interface IItemCustom extends IItemStack {
|
||||
|
||||
boolean getEnabled();
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
package noppes.npcs.api.jobs;
|
||||
|
||||
import noppes.npcs.roles.JobInterface;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
|
||||
public interface IJob {
|
||||
|
||||
int getType();
|
||||
|
||||
JobInterface getJobInterface();
|
||||
|
||||
ICustomNpc getNpc();
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package noppes.npcs.api.overlay;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.scripted.overlay.ScriptOverlayComponent;
|
||||
|
||||
public interface ICustomOverlayComponent {
|
||||
int getID();
|
||||
@@ -32,5 +31,5 @@ public interface ICustomOverlayComponent {
|
||||
|
||||
NBTTagCompound toNBT(NBTTagCompound nbt);
|
||||
|
||||
ScriptOverlayComponent fromNBT(NBTTagCompound nbt);
|
||||
ICustomOverlayComponent fromNBT(NBTTagCompound nbt);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs.api.scoreboard;
|
||||
|
||||
public interface IScriptScoreboard {
|
||||
public interface IScoreboard {
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import noppes.npcs.api.item.IItemCustom;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -51,70 +52,70 @@ public class EventHooks {
|
||||
}
|
||||
|
||||
public static void onScriptItemInit(IItemCustom handler) {
|
||||
if (!handler.isClient()) {
|
||||
if (!((ScriptCustomItem) handler).isClient()) {
|
||||
ItemEvent.InitEvent event = new ItemEvent.InitEvent(handler);
|
||||
handler.callScript(EnumScriptType.INIT, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.INIT, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
}
|
||||
|
||||
public static void onScriptItemUpdate(IItemCustom handler, EntityLivingBase player) {
|
||||
if (!handler.isClient()) {
|
||||
if (!((ScriptCustomItem) handler).isClient()) {
|
||||
ItemEvent.UpdateEvent event = new ItemEvent.UpdateEvent(handler, NpcAPI.Instance().getIEntity(player));
|
||||
handler.callScript(EnumScriptType.TICK, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.TICK, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean onScriptItemTossed(IItemCustom handler, EntityPlayer player, EntityItem entity) {
|
||||
ItemEvent.TossedEvent event = new ItemEvent.TossedEvent(handler, (IPlayer)NpcAPI.Instance().getIEntity(player), NpcAPI.Instance().getIEntity(entity));
|
||||
handler.callScript(EnumScriptType.TOSSED, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.TOSSED, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onScriptItemPickedUp(IItemCustom handler, EntityPlayer player) {
|
||||
ItemEvent.PickedUpEvent event = new ItemEvent.PickedUpEvent(handler, (IPlayer)NpcAPI.Instance().getIEntity(player));
|
||||
handler.callScript(EnumScriptType.PICKEDUP, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.PICKEDUP, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onScriptItemSpawn(IItemCustom handler, EntityItem entity) {
|
||||
ItemEvent.SpawnEvent event = new ItemEvent.SpawnEvent(handler, NpcAPI.Instance().getIEntity(entity));
|
||||
handler.callScript(EnumScriptType.SPAWN, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.SPAWN, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onScriptItemInteract(IItemCustom handler, noppes.npcs.scripted.event.ItemEvent.InteractEvent event) {
|
||||
handler.callScript(EnumScriptType.INTERACT, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.INTERACT, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onScriptItemAttack(IItemCustom handler, noppes.npcs.scripted.event.ItemEvent.AttackEvent event) {
|
||||
handler.callScript(EnumScriptType.ATTACK, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.ATTACK, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStartUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
||||
ItemEvent.StartUsingItem event = new ItemEvent.StartUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.START_USING_ITEM, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.START_USING_ITEM, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
||||
ItemEvent.UsingItem event = new ItemEvent.UsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.USING_ITEM, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.USING_ITEM, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onStopUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
||||
ItemEvent.StopUsingItem event = new ItemEvent.StopUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.STOP_USING_ITEM, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.STOP_USING_ITEM, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onFinishUsingCustomItem(IItemCustom handler, IPlayer player, int duration) {
|
||||
ItemEvent.FinishUsingItem event = new ItemEvent.FinishUsingItem(handler, player, duration);
|
||||
handler.callScript(EnumScriptType.FINISH_USING_ITEM, event);
|
||||
((ScriptCustomItem) handler).callScript(EnumScriptType.FINISH_USING_ITEM, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagDouble;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
|
||||
public class NBTTags {
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.swing.GuiJTextArea;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
|
||||
@@ -18,7 +18,7 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
|
||||
@@ -19,7 +19,6 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
|
||||
public class ForgeDataScript implements IScriptHandler {
|
||||
|
||||
+2
-1
@@ -3,12 +3,13 @@
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package noppes.npcs.api;
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
|
||||
public interface IScriptHandler {
|
||||
void callScript(EnumScriptType var1, Event var2);
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -16,7 +16,6 @@ import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
|
||||
@@ -49,15 +49,15 @@ public class PlayerItemGiverData implements IPlayerItemGiverData {
|
||||
}
|
||||
|
||||
public long getTime(IJobItemGiver jobItemGiver){
|
||||
return itemgivers.get(((JobItemGiver) jobItemGiver.getJobInterface()).itemGiverId);
|
||||
return itemgivers.get(((JobItemGiver) jobItemGiver).itemGiverId);
|
||||
}
|
||||
|
||||
public void setTime(IJobItemGiver jobItemGiver, long day) {
|
||||
itemgivers.put(((JobItemGiver) jobItemGiver.getJobInterface()).itemGiverId, day);
|
||||
itemgivers.put(((JobItemGiver) jobItemGiver).itemGiverId, day);
|
||||
}
|
||||
|
||||
public boolean hasInteractedBefore(IJobItemGiver jobItemGiver) {
|
||||
return itemgivers.containsKey(((JobItemGiver) jobItemGiver.getJobInterface()).itemGiverId);
|
||||
return itemgivers.containsKey(((JobItemGiver) jobItemGiver).itemGiverId);
|
||||
}
|
||||
|
||||
public IJobItemGiver[] getItemGivers() {
|
||||
|
||||
@@ -3,10 +3,11 @@ package noppes.npcs.scripted;
|
||||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.IPixelmonPlayerData;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.scripted.entity.ScriptPixelmon;
|
||||
|
||||
public class ScriptPixelmonPlayerData {
|
||||
public class ScriptPixelmonPlayerData implements IPixelmonPlayerData {
|
||||
private EntityPlayerMP player;
|
||||
public ScriptPixelmonPlayerData(EntityPlayerMP player){
|
||||
this.player = player;
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
import noppes.npcs.blocks.tiles.TileBigSign;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.ServerCloneController;
|
||||
@@ -878,7 +879,7 @@ public class ScriptWorld implements IWorld {
|
||||
return this.spawnClone(pos.getX(),pos.getY(),pos.getZ(),tab,name);
|
||||
}
|
||||
|
||||
public ScriptScoreboard getScoreboard(){
|
||||
public IScoreboard getScoreboard(){
|
||||
return new ScriptScoreboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.EntityDamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import noppes.npcs.api.IDamageSource;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.ScriptDamageSource;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
@@ -49,7 +50,7 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
entity.attackEntityFrom(new EntityDamageSource(source.getTypeName(),source.getMCEntity()),damage);
|
||||
}
|
||||
|
||||
public void hurt(float damage, ScriptDamageSource damageSource) {
|
||||
public void hurt(float damage, IDamageSource damageSource) {
|
||||
entity.attackEntityFrom(damageSource.getMCDamageSource(),damage);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.UUID;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.jobs.IJob;
|
||||
import noppes.npcs.api.roles.IRole;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumJobType;
|
||||
import noppes.npcs.constants.EnumNavType;
|
||||
@@ -331,7 +333,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @return Returns the npcs current role
|
||||
*/
|
||||
public ScriptRoleInterface getRole(){
|
||||
public IRole getRole(){
|
||||
if(npc.advanced.role == EnumRoleType.Bank)
|
||||
return new ScriptRoleBank(npc);
|
||||
else if(npc.advanced.role == EnumRoleType.Follower)
|
||||
@@ -357,7 +359,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
/**
|
||||
* @return Returns the npcs current job
|
||||
*/
|
||||
public ScriptJobInterface getJob(){
|
||||
public IJob getJob(){
|
||||
if(npc.advanced.job == EnumJobType.Bard)
|
||||
return new ScriptJobBard(npc);
|
||||
else if(npc.advanced.job == EnumJobType.Conversation)
|
||||
|
||||
@@ -663,7 +663,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
* Requires pixelmon to be installed
|
||||
* @since 1.7.10d
|
||||
*/
|
||||
public ScriptPixelmonPlayerData getPixelmonData(){
|
||||
public IPixelmonPlayerData getPixelmonData(){
|
||||
if(!PixelmonHelper.Enabled)
|
||||
return null;
|
||||
return new ScriptPixelmonPlayerData(player);
|
||||
|
||||
@@ -15,6 +15,14 @@ public class CustomGuiEvent extends Event {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
public IPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public ICustomGui getGui() {
|
||||
return gui;
|
||||
}
|
||||
|
||||
public static class ButtonEvent extends CustomGuiEvent {
|
||||
public final int buttonId;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import noppes.npcs.api.AbstractNpcAPI;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.handler.data.INaturalSpawn;
|
||||
|
||||
public class CustomNPCsEvent extends Event{
|
||||
public class CustomNPCsEvent extends Event implements noppes.npcs.api.event.CustomNPCsEvent {
|
||||
public final AbstractNpcAPI API = AbstractNpcAPI.Instance();
|
||||
|
||||
public CustomNPCsEvent() {
|
||||
@@ -24,7 +24,7 @@ public class CustomNPCsEvent extends Event{
|
||||
public boolean isCancelled(){return this.isCanceled();}
|
||||
|
||||
@Cancelable
|
||||
public static class CNPCNaturalSpawnEvent extends CustomNPCsEvent {
|
||||
public static class CNPCNaturalSpawnEvent extends CustomNPCsEvent implements noppes.npcs.api.event.CustomNPCsEvent.CNPCNaturalSpawnEvent {
|
||||
public final INaturalSpawn naturalSpawn;
|
||||
public final IPos attemptPosition;
|
||||
public final boolean animalSpawnPassed;
|
||||
@@ -41,5 +41,29 @@ public class CustomNPCsEvent extends Event{
|
||||
this.liquidSpawnPassed = liquidSpawnPassed;
|
||||
this.airSpawnPassed = airSpawnPassed;
|
||||
}
|
||||
|
||||
public INaturalSpawn getNaturalSpawn() {
|
||||
return this.naturalSpawn;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.api.IScriptHandler;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
|
||||
@@ -9,11 +9,12 @@ import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
|
||||
/**
|
||||
* @author Karel
|
||||
*/
|
||||
public class ScriptScoreboard {
|
||||
public class ScriptScoreboard implements IScoreboard {
|
||||
private Scoreboard board;
|
||||
|
||||
public ScriptScoreboard(){
|
||||
|
||||
Reference in new issue
Block a user