mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 14:35:12 +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
@@ -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