mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 06:24:42 +00:00
Merge branch 'dev' into dev
This commit is contained in:
799 files changed
+49724
-13791
No files matched your search
@@ -149,4 +149,16 @@ public class ScriptLiving<T extends EntityLiving> extends ScriptLivingBase<T> im
|
||||
public boolean canBeSteered() {
|
||||
return this.entity.canBeSteered();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
super.setRotation(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), rotation, getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(float rotation){
|
||||
super.setPitch(rotation);
|
||||
entity.getLookHelper().setLookPosition(getX(), getY(), getZ(), getRotation(), rotation);
|
||||
}
|
||||
}
|
||||
@@ -225,6 +225,16 @@ public class ScriptLivingBase<T extends EntityLivingBase> extends ScriptEntity<T
|
||||
return getMCEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRotation(){
|
||||
return entity.renderYawOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotation(float rotation){
|
||||
entity.renderYawOffset = rotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the entity swing its hand
|
||||
*/
|
||||
|
||||
@@ -9,11 +9,9 @@ import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.api.entity.IEntityLivingBase;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.entity.data.IModelData;
|
||||
import noppes.npcs.api.handler.IActionManager;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IFaction;
|
||||
import noppes.npcs.api.handler.data.ILines;
|
||||
import noppes.npcs.api.handler.data.*;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.jobs.IJob;
|
||||
import noppes.npcs.api.roles.IRole;
|
||||
@@ -93,21 +91,28 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public void setRotation(float rotation){
|
||||
npc.ai.orientation = (int)rotation;
|
||||
super.setRotation(rotation);
|
||||
super.setRotation(rotation);
|
||||
int r = (int) rotation;
|
||||
if(npc.ais.orientation != r) {
|
||||
npc.updateClient = true;
|
||||
npc.rotationYawHead = npc.rotationYaw = npc.renderYawOffset = npc.ais.orientation = r;
|
||||
npc.prevRenderYawOffset = r;
|
||||
npc.prevRotationYaw = r;
|
||||
npc.prevRotationYawHead = r;
|
||||
}
|
||||
}
|
||||
|
||||
public void setRotationType(int rotationType){
|
||||
for (EnumStandingType e : EnumStandingType.values()) {
|
||||
if (e.ordinal() == rotationType) {
|
||||
npc.ai.standingType = e;
|
||||
npc.ais.standingType = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getRotationType(){
|
||||
return npc.ai.standingType.ordinal();
|
||||
return npc.ais.standingType.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +121,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void setMovingType(int movingType){
|
||||
for(EnumMovingType e : EnumMovingType.values()) {
|
||||
if (e.ordinal() == movingType) {
|
||||
npc.ai.movingType = e;
|
||||
npc.ais.movingType = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +131,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @return The moving type of the npc. 0 = standing, 1 = wandering, 2 = moving path
|
||||
*/
|
||||
public int getMovingType(){
|
||||
return npc.ai.movingType.ordinal();
|
||||
return npc.ais.movingType.ordinal();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +175,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
}
|
||||
|
||||
public IPos getHome() {
|
||||
return NpcAPI.Instance().getIPos(npc.ai.startPos[0],npc.ai.startPos[1],npc.ai.startPos[2]);
|
||||
return NpcAPI.Instance().getIPos(npc.ais.startPos[0],npc.ais.startPos[1],npc.ais.startPos[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +189,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param x The home x position
|
||||
*/
|
||||
public void setHomeX(int x){
|
||||
npc.ai.startPos[0] = x;
|
||||
npc.ais.startPos[0] = x;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,7 +203,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param y The home y position
|
||||
*/
|
||||
public void setHomeY(int y){
|
||||
npc.ai.startPos[1] = y;
|
||||
npc.ais.startPos[1] = y;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +217,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param z The home x position
|
||||
*/
|
||||
public void setHomeZ(int z){
|
||||
npc.ai.startPos[2] = z;
|
||||
npc.ais.startPos[2] = z;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,11 +226,11 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param z The home z position
|
||||
*/
|
||||
public void setHome(int x, int y, int z){
|
||||
npc.ai.startPos = new int[]{x, y, z};
|
||||
npc.ais.startPos = new int[]{x, y, z};
|
||||
}
|
||||
|
||||
public void setHome(IPos pos){
|
||||
npc.ai.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()};
|
||||
npc.ais.startPos = new int[]{pos.getX(), pos.getY(), pos.getZ()};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,14 +245,14 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
* @param bo Whether or not the npc will try to return to his home position
|
||||
*/
|
||||
public void setReturnToHome(boolean bo){
|
||||
npc.ai.returnToStart = bo;
|
||||
npc.ais.returnToStart = bo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether or not the npc returns home
|
||||
*/
|
||||
public boolean getReturnToHome(){
|
||||
return npc.ai.returnToStart;
|
||||
return npc.ais.returnToStart;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -697,29 +702,29 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
*/
|
||||
public void setAnimation(int type){
|
||||
if(type == AnimationType.NORMAL)
|
||||
npc.ai.animationType = EnumAnimation.NONE;
|
||||
npc.ais.animationType = EnumAnimation.NONE;
|
||||
else if(type == AnimationType.SITTING)
|
||||
npc.ai.animationType = EnumAnimation.SITTING;
|
||||
npc.ais.animationType = EnumAnimation.SITTING;
|
||||
else if(type == AnimationType.DANCING)
|
||||
npc.ai.animationType = EnumAnimation.DANCING;
|
||||
npc.ais.animationType = EnumAnimation.DANCING;
|
||||
else if(type == AnimationType.SNEAKING)
|
||||
npc.ai.animationType = EnumAnimation.SNEAKING;
|
||||
npc.ais.animationType = EnumAnimation.SNEAKING;
|
||||
else if(type == AnimationType.LYING)
|
||||
npc.ai.animationType = EnumAnimation.LYING;
|
||||
npc.ais.animationType = EnumAnimation.LYING;
|
||||
else if(type == AnimationType.HUGGING)
|
||||
npc.ai.animationType = EnumAnimation.HUG;
|
||||
npc.ais.animationType = EnumAnimation.HUG;
|
||||
}
|
||||
|
||||
public void setTacticalVariant(int variant){
|
||||
if(variant > EnumNavType.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ai.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ai.directLOS;
|
||||
npc.ais.tacticalVariant = EnumNavType.values()[variant];
|
||||
npc.ais.directLOS = EnumNavType.values()[variant] != EnumNavType.Stalk && npc.ais.directLOS;
|
||||
}
|
||||
|
||||
public int getTacticalVariant(){
|
||||
return npc.ai.tacticalVariant.ordinal();
|
||||
return npc.ais.tacticalVariant.ordinal();
|
||||
}
|
||||
|
||||
public void setTacticalVariant(String variant){
|
||||
@@ -732,22 +737,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(!found)
|
||||
return;
|
||||
|
||||
npc.ai.tacticalVariant = EnumNavType.valueOf(variant);
|
||||
npc.ais.tacticalVariant = EnumNavType.valueOf(variant);
|
||||
}
|
||||
|
||||
public String getTacticalVariantName(){
|
||||
return npc.ai.tacticalVariant.name();
|
||||
return npc.ais.tacticalVariant.name();
|
||||
}
|
||||
|
||||
public void setCombatPolicy(int variant){
|
||||
if(variant > EnumCombatPolicy.values().length-1 || variant < 0)
|
||||
return;
|
||||
|
||||
npc.ai.combatPolicy = EnumCombatPolicy.values()[variant];
|
||||
npc.ais.combatPolicy = EnumCombatPolicy.values()[variant];
|
||||
}
|
||||
|
||||
public int getCombatPolicy(){
|
||||
return npc.ai.combatPolicy.ordinal();
|
||||
return npc.ais.combatPolicy.ordinal();
|
||||
}
|
||||
|
||||
public void setCombatPolicy(String variant){
|
||||
@@ -760,22 +765,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(!found)
|
||||
return;
|
||||
|
||||
npc.ai.combatPolicy = EnumCombatPolicy.valueOf(variant);
|
||||
npc.ais.combatPolicy = EnumCombatPolicy.valueOf(variant);
|
||||
}
|
||||
|
||||
public String getCombatPolicyName(){
|
||||
return npc.ai.combatPolicy.name();
|
||||
return npc.ais.combatPolicy.name();
|
||||
}
|
||||
|
||||
public void setTacticalRadius(int tacticalRadius){
|
||||
if(tacticalRadius < 0)
|
||||
tacticalRadius = 0;
|
||||
|
||||
npc.ai.tacticalRadius = tacticalRadius;
|
||||
npc.ais.tacticalRadius = tacticalRadius;
|
||||
}
|
||||
|
||||
public int getTacticalRadius(){
|
||||
return npc.ai.tacticalRadius;
|
||||
return npc.ais.tacticalRadius;
|
||||
}
|
||||
|
||||
public void setIgnoreCobweb(boolean ignore){
|
||||
@@ -789,21 +794,21 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void setOnFoundEnemy(int onAttack){
|
||||
if(onAttack < 0 || onAttack > 3)
|
||||
return;
|
||||
npc.ai.onAttack = onAttack;
|
||||
npc.ais.onAttack = onAttack;
|
||||
}
|
||||
|
||||
public int onFoundEnemy(){
|
||||
return npc.ai.onAttack;
|
||||
return npc.ais.onAttack;
|
||||
}
|
||||
|
||||
public void setShelterFrom(int shelterFrom){
|
||||
if(shelterFrom < 0 || shelterFrom > 2)
|
||||
return;
|
||||
npc.ai.findShelter = shelterFrom;
|
||||
npc.ais.findShelter = shelterFrom;
|
||||
}
|
||||
|
||||
public int getShelterFrom(){
|
||||
return npc.ai.findShelter;
|
||||
return npc.ais.findShelter;
|
||||
}
|
||||
|
||||
public boolean hasLivingAnimation() {
|
||||
@@ -1188,7 +1193,7 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if (type > 3)
|
||||
type = 3;
|
||||
|
||||
npc.ai.onAttack = type;
|
||||
npc.ais.onAttack = type;
|
||||
npc.updateTasks();
|
||||
}
|
||||
|
||||
@@ -1254,22 +1259,22 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
fly = 1;
|
||||
else fly = 0;
|
||||
|
||||
npc.ai.movementType = fly;
|
||||
npc.ais.movementType = fly;
|
||||
}
|
||||
|
||||
public boolean canFly(){
|
||||
return npc.ai.movementType == 1;
|
||||
return npc.ais.movementType == 1;
|
||||
}
|
||||
|
||||
public void setFlySpeed(double flySpeed){
|
||||
if(flySpeed < 0.0D)
|
||||
flySpeed = 0.0D;
|
||||
|
||||
npc.ai.flySpeed = flySpeed;
|
||||
npc.ais.flySpeed = flySpeed;
|
||||
}
|
||||
|
||||
public double getFlySpeed(double flySpeed){
|
||||
return npc.ai.flySpeed;
|
||||
return npc.ais.flySpeed;
|
||||
}
|
||||
|
||||
public void setFlyGravity(double flyGravity){
|
||||
@@ -1278,36 +1283,36 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
if(flyGravity > 1.0D)
|
||||
flyGravity = 1.0D;
|
||||
|
||||
npc.ai.flyGravity = flyGravity;
|
||||
npc.ais.flyGravity = flyGravity;
|
||||
}
|
||||
|
||||
public double getFlyGravity(double flySpeed){
|
||||
return npc.ai.flyGravity;
|
||||
return npc.ais.flyGravity;
|
||||
}
|
||||
|
||||
public void setFlyHeightLimit(int flyHeightLimit){
|
||||
if(flyHeightLimit < 0)
|
||||
flyHeightLimit = 0;
|
||||
|
||||
this.npc.ai.flyHeightLimit = flyHeightLimit;
|
||||
this.npc.ais.flyHeightLimit = flyHeightLimit;
|
||||
}
|
||||
public int getFlyHeightLimit(int flyHeightLimit){
|
||||
return this.npc.ai.flyHeightLimit;
|
||||
return this.npc.ais.flyHeightLimit;
|
||||
}
|
||||
|
||||
public void limitFlyHeight(boolean limit){
|
||||
this.npc.ai.hasFlyLimit = limit;
|
||||
this.npc.ais.hasFlyLimit = limit;
|
||||
}
|
||||
public boolean isFlyHeightLimited(boolean limit){
|
||||
return this.npc.ai.hasFlyLimit;
|
||||
return this.npc.ais.hasFlyLimit;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
npc.ai.setWalkingSpeed(speed);
|
||||
npc.ais.setWalkingSpeed(speed);
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return npc.ai.getWalkingSpeed();
|
||||
return npc.ais.getWalkingSpeed();
|
||||
}
|
||||
|
||||
public void setSkinType(byte type) {
|
||||
@@ -1372,4 +1377,12 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
|
||||
public void updateClient() { this.npc.updateClient(); }
|
||||
|
||||
public void updateAI() { this.npc.updateTasks(); }
|
||||
|
||||
public IActionManager getActionManager() {
|
||||
return npc.actionManager;
|
||||
}
|
||||
|
||||
public IMagicData getMagicData() {
|
||||
return npc.stats.magicData;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package noppes.npcs.scripted.entity;
|
||||
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.data.AchievementPacket;
|
||||
import kamkeel.npcs.network.packets.data.ChatAlertPacket;
|
||||
import kamkeel.npcs.network.packets.data.gui.GuiClosePacket;
|
||||
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -13,22 +18,20 @@ import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import noppes.npcs.*;
|
||||
import noppes.npcs.CustomNpcsPermissions;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.api.*;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.handler.IOverlayHandler;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.api.handler.data.IDialog;
|
||||
import noppes.npcs.api.handler.data.IQuest;
|
||||
import noppes.npcs.api.handler.data.ISound;
|
||||
import noppes.npcs.api.handler.data.*;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.api.overlay.ICustomOverlay;
|
||||
import noppes.npcs.compat.PixelmonHelper;
|
||||
import noppes.npcs.config.ConfigScript;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumQuestRepeat;
|
||||
import noppes.npcs.constants.EnumQuestType;
|
||||
import noppes.npcs.containers.ContainerCustomGui;
|
||||
import noppes.npcs.controllers.*;
|
||||
@@ -45,7 +48,6 @@ import noppes.npcs.util.ValueUtil;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T> implements IPlayer {
|
||||
public T player;
|
||||
@@ -263,8 +265,9 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return;
|
||||
QuestData questdata = new QuestData(quest);
|
||||
data.questData.activeQuests.put(id, questdata);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
|
||||
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "quest.newquest", quest.title);
|
||||
ChatAlertPacket.sendChatAlert((EntityPlayerMP) player, "quest.newquest", ": ", quest.title);
|
||||
data.updateClient = true;
|
||||
}
|
||||
|
||||
@@ -277,10 +280,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
if (quest == null)
|
||||
return;
|
||||
PlayerData data = PlayerData.get(player);
|
||||
if(quest.repeat == EnumQuestRepeat.RLDAILY || quest.repeat == EnumQuestRepeat.RLWEEKLY)
|
||||
data.questData.finishedQuests.put(quest.id, System.currentTimeMillis());
|
||||
else
|
||||
data.questData.finishedQuests.put(quest.id, player.worldObj.getTotalWorldTime());
|
||||
PlayerQuestController.setQuestFinishedUtil(player, quest, data.questData);
|
||||
data.updateClient = true;
|
||||
}
|
||||
|
||||
@@ -756,7 +756,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
|
||||
public void closeGui() {
|
||||
((EntityPlayerMP)this.entity).closeContainer();
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.GUI_CLOSE, -1, new NBTTagCompound());
|
||||
GuiClosePacket.closeGUI(player, -1 , new NBTTagCompound());
|
||||
}
|
||||
|
||||
public void showCustomOverlay(ICustomOverlay overlay) {
|
||||
@@ -764,8 +764,8 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public void closeOverlay(int id) {
|
||||
Server.sendData((EntityPlayerMP)this.entity, EnumPacketClient.SCRIPT_OVERLAY_CLOSE, id, new NBTTagCompound());
|
||||
}
|
||||
PacketHandler.Instance.sendToPlayer(new ScriptOverlayClosePacket(id), (EntityPlayerMP)this.entity);
|
||||
}
|
||||
|
||||
public IOverlayHandler getOverlays() {
|
||||
return this.getData().skinOverlays;
|
||||
@@ -798,4 +798,8 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
public boolean conqueredEnd() {
|
||||
return this.player.playerConqueredTheEnd;
|
||||
}
|
||||
|
||||
public IMagicData getMagicData() {
|
||||
return this.getData().magicData;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user