mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 01:27:27 +00:00
Merge branch 'dev' of https://github.com/KAMKEEL/CustomNPC-Plus into dev
This commit is contained in:
commit
c818f6ee4e
121 files changed
+1901
-953
No files matched your search
@@ -202,7 +202,7 @@ public class CustomNpcs {
|
||||
new AnimationController();
|
||||
ScriptController.Instance.loadStoredData();
|
||||
ScriptController.Instance.loadForgeScripts();
|
||||
ScriptController.Instance.loadNPCScripts();
|
||||
ScriptController.Instance.loadGlobalNPCScripts();
|
||||
ScriptController.Instance.loadPlayerScripts();
|
||||
ScriptController.HasStart = false;
|
||||
NpcAPI.clearCache();
|
||||
@@ -239,7 +239,7 @@ public class CustomNpcs {
|
||||
GlobalDataController.instance.saveData();
|
||||
ScriptController.Instance.saveForgeScripts();
|
||||
ScriptController.Instance.savePlayerScripts();
|
||||
ScriptController.Instance.saveNpcScripts();
|
||||
ScriptController.Instance.saveGlobalNpcScripts();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
@@ -163,7 +163,7 @@ public class DataDisplay {
|
||||
|
||||
animationData.readFromNBT(nbttagcompound);
|
||||
|
||||
modelSize = ValueUtil.CorrectInt(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
if(modelSize > ConfigMain.NpcSizeLimit)
|
||||
modelSize = ConfigMain.NpcSizeLimit;
|
||||
|
||||
@@ -253,7 +253,7 @@ public class DataDisplay {
|
||||
public void setMarkovGender(int gender) {
|
||||
if(markovGender == gender)
|
||||
return;
|
||||
this.markovGender = ValueUtil.CorrectInt(gender, 0, 2);
|
||||
this.markovGender = ValueUtil.clamp(gender, 0, 2);
|
||||
}
|
||||
|
||||
public int getMarkovGeneratorId(){
|
||||
@@ -263,7 +263,7 @@ public class DataDisplay {
|
||||
public void setMarkovGeneratorId(int id) {
|
||||
if(markovGeneratorId == id)
|
||||
return;
|
||||
this.markovGeneratorId = ValueUtil.CorrectInt(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,10 +136,10 @@ public class DataStats {
|
||||
|
||||
rangedRange = compound.getInteger("MaxFiringRange");
|
||||
fireRate = compound.getInteger("FireRate");
|
||||
minDelay = ValueUtil.CorrectInt(compound.getInteger("minDelay"), 1, 9999);
|
||||
maxDelay = ValueUtil.CorrectInt(compound.getInteger("maxDelay"), 1, 9999);
|
||||
minDelay = ValueUtil.clamp(compound.getInteger("minDelay"), 1, 9999);
|
||||
maxDelay = ValueUtil.clamp(compound.getInteger("maxDelay"), 1, 9999);
|
||||
burstCount = compound.getInteger("BurstCount");
|
||||
shotCount = ValueUtil.CorrectInt(compound.getInteger("ShotCount"), 1, 10);
|
||||
shotCount = ValueUtil.clamp(compound.getInteger("ShotCount"), 1, 10);
|
||||
accuracy = compound.getInteger("Accuracy");
|
||||
|
||||
pDamage = compound.getFloat("pDamage");
|
||||
|
||||
@@ -22,14 +22,19 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.IEntity;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
import noppes.npcs.api.gui.ICustomGui;
|
||||
import noppes.npcs.api.gui.IItemSlot;
|
||||
import noppes.npcs.api.item.IItemCustom;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.client.gui.custom.components.CustomGuiSlot;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.controllers.CustomGuiController;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.EntityProjectile;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.PlayerEvent.*;
|
||||
@@ -115,7 +120,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.InitEvent event = new noppes.npcs.scripted.event.NpcEvent.InitEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INIT, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INIT, event);
|
||||
npc.script.callScript(EnumScriptType.INIT, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
npc.advanced.soulStoneInit = false;
|
||||
@@ -126,7 +131,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
noppes.npcs.scripted.event.NpcEvent.UpdateEvent event = new noppes.npcs.scripted.event.NpcEvent.UpdateEvent(npc.wrappedNPC);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TICK, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TICK, event);
|
||||
npc.script.callScript(EnumScriptType.TICK, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -136,7 +141,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
NpcEvent.DialogEvent event = new NpcEvent.DialogEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
@@ -147,7 +152,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.DialogClosedEvent event = new NpcEvent.DialogClosedEvent(npc.wrappedNPC, player, dialogId, optionId, dialog);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DIALOG_CLOSE, event);
|
||||
npc.script.callScript(EnumScriptType.DIALOG_CLOSE, event, "player", event.getPlayer(), "dialog", event.getDialogId(), "option", event.getOptionId(), "dialogObj", event.getDialog());
|
||||
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
@@ -158,7 +163,7 @@ public class EventHooks {
|
||||
return false;
|
||||
|
||||
NpcEvent.InteractEvent event = new NpcEvent.InteractEvent(npc.wrappedNPC,player);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.INTERACT, event);
|
||||
boolean result = npc.script.callScript(EnumScriptType.INTERACT, event, "player", player);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
return result;
|
||||
@@ -168,7 +173,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.ATTACK_MELEE, event);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -177,7 +182,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.RANGED_LAUNCHED, event);
|
||||
npc.script.callScript(EnumScriptType.ATTACK, event, "target", event.target);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -187,7 +192,7 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.KilledEntityEvent event = new NpcEvent.KilledEntityEvent(npc.wrappedNPC,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLS, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLS, event);
|
||||
npc.script.callScript(EnumScriptType.KILLS, event, "target", entity);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -196,17 +201,27 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TARGET, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET, event);
|
||||
npc.script.callScript(EnumScriptType.TARGET, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static boolean onNPCTargetLost(EntityNPCInterface npc, EntityLivingBase prevtarget, EntityLivingBase newTarget) {
|
||||
if(npc.script.isClient())
|
||||
return false;
|
||||
NpcEvent.TargetLostEvent event = new NpcEvent.TargetLostEvent(npc.wrappedNPC, prevtarget, newTarget);
|
||||
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TARGET_LOST, event);
|
||||
npc.script.callScript(EnumScriptType.TARGET_LOST, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onNPCCollide(EntityNPCInterface npc, Entity entity){
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return;
|
||||
|
||||
NpcEvent.CollideEvent event = new NpcEvent.CollideEvent(npc.wrappedNPC,entity);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.COLLIDE, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.COLLIDE, event);
|
||||
npc.script.callScript(EnumScriptType.COLLIDE, event, "entity", entity);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -215,7 +230,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.DAMAGED, event);
|
||||
npc.script.callScript(EnumScriptType.DAMAGED, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -224,7 +239,7 @@ public class EventHooks {
|
||||
if(npc == null || npc.wrappedNPC == null)
|
||||
return false;
|
||||
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.KILLED, event);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.KILLED, event);
|
||||
npc.script.callScript(EnumScriptType.KILLED, event);
|
||||
return NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
@@ -234,8 +249,29 @@ public class EventHooks {
|
||||
return;
|
||||
|
||||
NpcEvent.TimerEvent event = new NpcEvent.TimerEvent(npc.wrappedNPC, id);
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.TIMER, event);
|
||||
npc.script.callScript(EnumScriptType.TIMER, event);
|
||||
ScriptController.Instance.npcScripts.callScript(EnumScriptType.TIMER, event);
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onProjectileTick(EntityProjectile projectile) {
|
||||
ProjectileEvent.UpdateEvent event = new ProjectileEvent.UpdateEvent((IProjectile) NpcAPI.Instance().getIEntity(projectile));
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_TICK, event);
|
||||
for(ScriptContainer script : projectile.scripts) {
|
||||
if(script.isValid()) {
|
||||
script.run(EnumScriptType.PROJECTILE_TICK, event);
|
||||
}
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onProjectileImpact(EntityProjectile projectile, ProjectileEvent.ImpactEvent event) {
|
||||
ScriptController.Instance.globalNpcScripts.callScript(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||
for(ScriptContainer script : projectile.scripts) {
|
||||
if(script.isValid()) {
|
||||
script.run(EnumScriptType.PROJECTILE_IMPACT, event);
|
||||
}
|
||||
}
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
@@ -521,13 +557,13 @@ public class EventHooks {
|
||||
CustomGuiController.onButton(event);
|
||||
}
|
||||
|
||||
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId) {
|
||||
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId));
|
||||
public static void onCustomGuiSlot(IPlayer player, ICustomGui gui, int slotId, ItemStack stack, IItemSlot slot) {
|
||||
CustomGuiEvent.SlotEvent event = new CustomGuiEvent.SlotEvent(player, gui, slotId, stack, slot);
|
||||
CustomGuiController.onSlotChange(event);
|
||||
}
|
||||
|
||||
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, int dragType, int clickType) {
|
||||
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
||||
public static boolean onCustomGuiSlotClicked(IPlayer player, ICustomGui gui, int slotId, IItemSlot slot, int dragType, int clickType) {
|
||||
CustomGuiEvent.SlotClickEvent event = new CustomGuiEvent.SlotClickEvent(player, gui, slotId, slot, player.getOpenContainer().getSlot(slotId), dragType, clickType);
|
||||
return CustomGuiController.onSlotClick(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class ModelDataShared{
|
||||
public ModelLimbConfig head = new ModelLimbConfig();
|
||||
public ModelLimbConfig arms = new ModelLimbConfig();
|
||||
public ModelLimbConfig body = new ModelLimbConfig();
|
||||
public ModelLimbConfig legs = new ModelLimbConfig();
|
||||
|
||||
public boolean enableRotation = false;
|
||||
public ModelRotate rotation = new ModelRotate();
|
||||
|
||||
public ModelPartData legParts = new ModelPartData();
|
||||
|
||||
public Class<? extends EntityLivingBase> entityClass;
|
||||
public EntityLivingBase entity;
|
||||
|
||||
public NBTTagCompound extra = new NBTTagCompound();
|
||||
|
||||
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
public byte breasts = 0;
|
||||
|
||||
public byte headwear = 2;
|
||||
public byte bodywear = 0;
|
||||
public byte armwear = 0;
|
||||
public byte legwear = 0;
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
public byte solidArmwear = 0;
|
||||
public byte solidLegwear = 0;
|
||||
|
||||
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
|
||||
public byte hideHead = 0;
|
||||
public byte hideBody = 0;
|
||||
public byte hideArms = 0;
|
||||
public byte hideLegs = 0;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
if(entityClass != null)
|
||||
compound.setString("EntityClass", entityClass.getCanonicalName());
|
||||
|
||||
compound.setTag("HeadConfig", head.writeToNBT());
|
||||
compound.setTag("BodyConfig", body.writeToNBT());
|
||||
compound.setTag("ArmsConfig", arms.writeToNBT());
|
||||
compound.setTag("LegsConfig", legs.writeToNBT());
|
||||
|
||||
compound.setTag("LegParts", legParts.writeToNBT());
|
||||
|
||||
compound.setByte("Headwear", headwear);
|
||||
compound.setByte("Bodywear", bodywear);
|
||||
compound.setByte("Armwear", armwear);
|
||||
compound.setByte("Legwear", legwear);
|
||||
|
||||
compound.setByte("SolidArmwear", solidArmwear);
|
||||
compound.setByte("SolidLegwear", solidLegwear);
|
||||
|
||||
compound.setByte("hideHead", hideHead);
|
||||
compound.setByte("hideBody", hideBody);
|
||||
compound.setByte("hideArms", hideArms);
|
||||
compound.setByte("hideLegs", hideLegs);
|
||||
|
||||
compound.setBoolean("EnableRotation", enableRotation);
|
||||
if(enableRotation)
|
||||
compound.setTag("ModelRotation", rotation.writeToNBT());
|
||||
|
||||
compound.setByte("Breasts", breasts);
|
||||
compound.setTag("ExtraData", extra);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(String name : parts.keySet()){
|
||||
NBTTagCompound item = parts.get(name).writeToNBT();
|
||||
item.setString("PartName", name);
|
||||
list.appendTag(item);
|
||||
}
|
||||
compound.setTag("Parts", list);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
setEntityClass(compound.getString("EntityClass"));
|
||||
|
||||
head.readFromNBT(compound.getCompoundTag("HeadConfig"));
|
||||
body.readFromNBT(compound.getCompoundTag("BodyConfig"));
|
||||
arms.readFromNBT(compound.getCompoundTag("ArmsConfig"));
|
||||
legs.readFromNBT(compound.getCompoundTag("LegsConfig"));
|
||||
|
||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
||||
|
||||
headwear = compound.getByte("Headwear");
|
||||
bodywear = compound.getByte("Bodywear");
|
||||
armwear = compound.getByte("Armwear");
|
||||
legwear = compound.getByte("Legwear");
|
||||
|
||||
solidArmwear = compound.getByte("SolidArmwear");
|
||||
solidLegwear = compound.getByte("SolidLegwear");
|
||||
|
||||
hideHead = compound.getByte("hideHead");
|
||||
hideBody = compound.getByte("hideBody");
|
||||
hideArms = compound.getByte("hideArms");
|
||||
hideLegs = compound.getByte("hideLegs");
|
||||
|
||||
enableRotation = compound.getBoolean("EnableRotation");
|
||||
if(enableRotation)
|
||||
rotation.readFromNBT(compound.getCompoundTag("ModelRotation"));
|
||||
|
||||
breasts = compound.getByte("Breasts");
|
||||
extra = compound.getCompoundTag("ExtraData");
|
||||
|
||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
NBTTagList list = compound.getTagList("Parts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
ModelPartData part = new ModelPartData();
|
||||
part.readFromNBT(item);
|
||||
parts.put(item.getString("PartName"), part);
|
||||
}
|
||||
this.parts = parts;
|
||||
|
||||
}
|
||||
|
||||
public void readPartsFromNBT(NBTTagCompound compound){
|
||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
||||
|
||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
NBTTagList list = compound.getTagList("Parts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
ModelPartData part = new ModelPartData();
|
||||
part.readFromNBT(item);
|
||||
parts.put(item.getString("PartName"), part);
|
||||
}
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
private void setEntityClass(String string) {
|
||||
entityClass = null;
|
||||
entity = null;
|
||||
try {
|
||||
Class<?> cls = Class.forName(string);
|
||||
if (EntityLivingBase.class.isAssignableFrom(cls))
|
||||
entityClass = cls.asSubclass(EntityLivingBase.class);
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void setEntityClass(Class<? extends EntityLivingBase> entityClass){
|
||||
this.entityClass = entityClass;
|
||||
entity = null;
|
||||
extra = new NBTTagCompound();
|
||||
if(entityClass == EntityHorse.class)
|
||||
extra.setInteger("Type", -1);
|
||||
}
|
||||
|
||||
public Class<? extends EntityLivingBase> getEntityClass(){
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
public float offsetY() {
|
||||
if(entity == null)
|
||||
return -getBodyY();
|
||||
return entity.height - 1.8f;
|
||||
}
|
||||
|
||||
public void clearEntity() {
|
||||
entity = null;
|
||||
}
|
||||
|
||||
|
||||
public ModelPartData getPartData(String type){
|
||||
return parts.get(type);
|
||||
}
|
||||
|
||||
public void removePart(String type) {
|
||||
parts.remove(type);
|
||||
}
|
||||
|
||||
public ModelPartData getOrCreatePart(String type) {
|
||||
ModelPartData part = parts.get(type);
|
||||
if(part == null)
|
||||
parts.put(type, part = new ModelPartData());
|
||||
return part;
|
||||
}
|
||||
|
||||
public float getBodyY(){
|
||||
if(legParts.type == 3)
|
||||
return (0.9f - body.scaleY) * 0.75f + getLegsY();
|
||||
if(legParts.type == 3)
|
||||
return (0.5f - body.scaleY) * 0.75f + getLegsY();
|
||||
return (1 - body.scaleY) * 0.75f + getLegsY();
|
||||
}
|
||||
|
||||
public float getLegsY() {
|
||||
if(legParts.type == 3)
|
||||
return (0.87f - legs.scaleY) * 1f;
|
||||
return (1 - legs.scaleY) * 0.75f;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package noppes.npcs;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelRotatePart {
|
||||
public float rotationX = 0f, rotationY = 0f, rotationZ = 0f;
|
||||
public boolean disabled = false;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("Disabled", disabled);
|
||||
compound.setFloat("RotationX", rotationX);
|
||||
compound.setFloat("RotationY", rotationY);
|
||||
compound.setFloat("RotationZ", rotationZ);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
disabled = compound.getBoolean("Disabled");
|
||||
rotationX = ValueUtil.correctFloat(compound.getFloat("RotationX"), -0.5f, 0.5f);
|
||||
rotationY = ValueUtil.correctFloat(compound.getFloat("RotationY"), -0.5f, 0.5f);
|
||||
rotationZ = ValueUtil.correctFloat(compound.getFloat("RotationZ"), -0.5f, 0.5f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,10 +18,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.handler.data.IQuestObjective;
|
||||
import noppes.npcs.api.item.IItemStack;
|
||||
import noppes.npcs.constants.EnumOptionType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.containers.ContainerNPCBankInterface;
|
||||
import noppes.npcs.containers.ContainerNPCFollower;
|
||||
import noppes.npcs.containers.ContainerNPCFollowerHire;
|
||||
@@ -329,25 +326,27 @@ public class NoppesUtilPlayer {
|
||||
data.setData(player);
|
||||
Server.sendData(player, EnumPacketClient.GUI_DATA, data.writeNBT());
|
||||
}
|
||||
public static void questCompletion(EntityPlayerMP player, int questId) {
|
||||
public static boolean questCompletion(EntityPlayerMP player, int questId) {
|
||||
if(player == null)
|
||||
return;
|
||||
return false;
|
||||
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
QuestData data = questData.activeQuests.get(questId);
|
||||
|
||||
if(data == null)
|
||||
return;
|
||||
if (data == null)
|
||||
return false;
|
||||
|
||||
if(!data.quest.questInterface.isCompleted(playerData))
|
||||
return;
|
||||
if (!data.quest.questInterface.isCompleted(playerData))
|
||||
return false;
|
||||
|
||||
if (data.quest.completion == EnumQuestCompletion.Instant) {
|
||||
EventHooks.onQuestFinished(player, data.quest);
|
||||
}
|
||||
|
||||
QuestEvent.QuestTurnedInEvent event = new QuestEvent.QuestTurnedInEvent((IPlayer) NpcAPI.Instance().getIEntity(player), data.quest);
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
event.expReward = data.quest.rewardExp;
|
||||
|
||||
event.expReward = data.quest.rewardExp;
|
||||
List<IItemStack> list = new ArrayList();
|
||||
Iterator var8 = data.quest.rewardItems.items.values().iterator();
|
||||
|
||||
@@ -368,6 +367,9 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
EventHooks.onQuestTurnedIn(event);
|
||||
if (event.isCancelled())
|
||||
return false;
|
||||
|
||||
IItemStack[] var12 = event.itemRewards;
|
||||
int var14 = var12.length;
|
||||
for(int var10 = 0; var10 < var14; ++var10) {
|
||||
@@ -393,11 +395,13 @@ public class NoppesUtilPlayer {
|
||||
|
||||
PlayerQuestController.setQuestFinished(data.quest, player);
|
||||
if (data.quest.hasNewQuest()) {
|
||||
Quest nextQuest = data.quest.getNextQuest();
|
||||
QuestData nextQuest = new QuestData(data.quest.getNextQuest());
|
||||
nextQuest.sendAlerts = data.quest.id != data.quest.getNextQuest().id || data.sendAlerts;
|
||||
PlayerQuestController.addActiveQuest(nextQuest, player);
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player,nextQuest);
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player,nextQuest.quest);
|
||||
}
|
||||
playerData.savePlayerDataOnFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean compareItems(ItemStack item, ItemStack item2, boolean ignoreDamage, boolean ignoreNBT){
|
||||
|
||||
@@ -179,7 +179,7 @@ public class NoppesUtilServer {
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.DIALOG, npc.getEntityId(), dialog.writeToNBT(new NBTTagCompound()));
|
||||
dia.factionOptions.addPoints(player);
|
||||
if(dialog.hasQuest())
|
||||
PlayerQuestController.addActiveQuest(dialog.getQuest(),player);
|
||||
PlayerQuestController.addActiveQuest(new QuestData(dialog.getQuest()),player);
|
||||
if(!dialog.command.isEmpty()){
|
||||
runCommand(player, npc.getCommandSenderName(), dialog.command);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public class PacketHandlerPlayer{
|
||||
if(mail.time == time && mail.sender.equals(username)){
|
||||
mail.beenRead = true;
|
||||
if(mail.hasQuest())
|
||||
PlayerQuestController.addActiveQuest(mail.getQuest(), player);
|
||||
PlayerQuestController.addActiveQuest(new QuestData(mail.getQuest()), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,10 +47,7 @@ import noppes.npcs.scripted.gui.ScriptGui;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class PacketHandlerServer{
|
||||
|
||||
@@ -77,10 +74,6 @@ public class PacketHandlerServer{
|
||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||
EventHooks.onCustomGuiButton((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||
return;
|
||||
} else if (type == EnumPacketServer.CustomGuiSlotChange && player.openContainer instanceof ContainerCustomGui) {
|
||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||
return;
|
||||
} else if (type == EnumPacketServer.CustomGuiUnfocused && player.openContainer instanceof ContainerCustomGui) {
|
||||
((ContainerCustomGui) player.openContainer).customGui.fromNBT(Server.readNBT(buffer));
|
||||
EventHooks.onCustomGuiUnfocused((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui) player.openContainer).customGui, buffer.readInt());
|
||||
@@ -92,8 +85,8 @@ public class PacketHandlerServer{
|
||||
} else if (type == EnumPacketServer.CustomGuiClose) {
|
||||
EventHooks.onCustomGuiClose((IPlayer) NpcAPI.Instance().getIEntity(player), (new ScriptGui()).fromNBT(Server.readNBT(buffer)));
|
||||
return;
|
||||
} else if (type == EnumPacketServer.UpdateTrackedQuest) {
|
||||
updateTrackedQuest(buffer, player);
|
||||
} else if (type == EnumPacketServer.QuestLogToServer) {
|
||||
updateQuestLogData(buffer, player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +96,7 @@ public class PacketHandlerServer{
|
||||
else if(type.hasPermission() && !CustomNpcsPermissions.hasPermission(player, type.permission)){
|
||||
//player doesnt have permission to do this
|
||||
}
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
else if(item == null && (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave || type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave || type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave))
|
||||
warn(player, "tried to use custom npcs without a tool in hand, probably a hacker");
|
||||
else {
|
||||
if (item != null) {
|
||||
@@ -120,10 +113,12 @@ public class PacketHandlerServer{
|
||||
else if (item.getItem() == Item.getItemFromBlock(CustomItems.waypoint) || item.getItem() == Item.getItemFromBlock(CustomItems.border) || item.getItem() == Item.getItemFromBlock(CustomItems.redstoneBlock))
|
||||
blockPackets(type, buffer, player);
|
||||
else if (ConfigScript.isScriptDev(player)) {
|
||||
if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||
if (type == EnumPacketServer.EventScriptDataGet || type == EnumPacketServer.EventScriptDataSave)
|
||||
npcEventScriptPackets(type, buffer, player, npc);
|
||||
else if (type == EnumPacketServer.ScriptPlayerGet || type == EnumPacketServer.ScriptPlayerSave)
|
||||
playerScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptNPCGet || type == EnumPacketServer.ScriptNPCSave)
|
||||
npcScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptGlobalNPCGet || type == EnumPacketServer.ScriptGlobalNPCSave)
|
||||
npcGlobalScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptForgeGet || type == EnumPacketServer.ScriptForgeSave)
|
||||
forgeScriptPackets(type, buffer, player);
|
||||
else if (type == EnumPacketServer.ScriptItemDataGet || type == EnumPacketServer.ScriptItemDataSave)
|
||||
@@ -140,12 +135,11 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTrackedQuest(ByteBuf buffer, EntityPlayerMP player) {
|
||||
String trackedQuestString = Server.readString(buffer);
|
||||
if (trackedQuestString != null && trackedQuestString.contains(":")) {
|
||||
String[] splitString = trackedQuestString.split(":");
|
||||
private Quest getQuestFromString(String string) {
|
||||
if (string != null && string.contains(":")) {
|
||||
String[] splitString = string.split(":");
|
||||
if(splitString.length < 2){
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
String categoryName = splitString[0];
|
||||
String questName = splitString[1];
|
||||
@@ -154,16 +148,35 @@ public class PacketHandlerServer{
|
||||
if (category.title.equals(categoryName)) {
|
||||
for (Quest quest : category.quests.values()) {
|
||||
if (quest.title.equals(questName)) {
|
||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = quest;
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player, quest);
|
||||
return;
|
||||
return quest;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
PlayerDataController.instance.getPlayerData(player).questData.trackedQuest = null;
|
||||
private void updateQuestLogData(ByteBuf buffer, EntityPlayerMP player) throws IOException {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
HashMap<String,String> questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||
for (Map.Entry<String,String> entry : questAlerts.entrySet()) {
|
||||
Quest quest = this.getQuestFromString(entry.getKey());
|
||||
if (quest != null) {
|
||||
playerData.questData.activeQuests.get(quest.id).sendAlerts = Boolean.parseBoolean(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
String trackedQuestString = Server.readString(buffer);
|
||||
Quest trackedQuest = this.getQuestFromString(trackedQuestString);
|
||||
if (trackedQuest != null) {
|
||||
playerData.questData.trackedQuest = trackedQuest;
|
||||
NoppesUtilPlayer.sendTrackedQuestData(player, trackedQuest);
|
||||
}
|
||||
|
||||
playerData.questData.trackedQuest = null;
|
||||
Server.sendData(player, EnumPacketClient.OVERLAY_QUEST_TRACKING);
|
||||
}
|
||||
|
||||
@@ -205,7 +218,7 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void getScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
private void getScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("ScriptEnabled", data.getEnabled());
|
||||
compound.setString("ScriptLanguage", data.getLanguage());
|
||||
@@ -225,8 +238,12 @@ public class PacketHandlerServer{
|
||||
|
||||
private void saveScripts(IScriptHandler data, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
int tab = buffer.readInt();
|
||||
int totalScripts = buffer.readInt();
|
||||
if (totalScripts == 0) {
|
||||
data.getScripts().clear();
|
||||
}
|
||||
|
||||
if (tab >= 0) {
|
||||
int totalScripts = buffer.readInt();
|
||||
if (data.getScripts().size() > totalScripts) {
|
||||
data.setScripts(data.getScripts().subList(0,totalScripts));
|
||||
} else while (data.getScripts().size() < totalScripts) {
|
||||
@@ -248,6 +265,20 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void npcEventScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player, EntityNPCInterface npc) throws Exception {
|
||||
DataScript data = npc.script;
|
||||
if(type == EnumPacketServer.EventScriptDataGet) {
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if(type == EnumPacketServer.EventScriptDataSave) {
|
||||
this.saveScripts(data,buffer,player);
|
||||
npc.updateAI = true;
|
||||
npc.script.hasInited = false;
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s SAVED NPC %s (%s, %s, %s) [%s]", "SCRIPTER", player.getCommandSenderName(), npc.display.getName(), (int)npc.posX, (int)(npc).posY, (int)npc.posZ, npc.worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void playerScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
PlayerDataScript data = ScriptController.Instance.playerScripts;
|
||||
if(type == EnumPacketServer.ScriptPlayerGet) {
|
||||
@@ -268,13 +299,13 @@ public class PacketHandlerServer{
|
||||
}
|
||||
}
|
||||
|
||||
private void npcScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
NPCDataScript data = ScriptController.Instance.npcScripts;
|
||||
if(type == EnumPacketServer.ScriptNPCGet) {
|
||||
private void npcGlobalScriptPackets(EnumPacketServer type, ByteBuf buffer, EntityPlayerMP player) throws Exception {
|
||||
GlobalNPCDataScript data = ScriptController.Instance.globalNpcScripts;
|
||||
if(type == EnumPacketServer.ScriptGlobalNPCGet) {
|
||||
this.getScripts(data,buffer,player);
|
||||
} else if(type == EnumPacketServer.ScriptNPCSave) {
|
||||
} else if(type == EnumPacketServer.ScriptGlobalNPCSave) {
|
||||
this.saveScripts(data,buffer,player);
|
||||
ScriptController.Instance.lastNpcUpdate = System.currentTimeMillis();
|
||||
ScriptController.Instance.lastGlobalNpcUpdate = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ public class QuestLogData {
|
||||
public String selectedQuest = "";
|
||||
public String selectedCategory = "";
|
||||
public HashMap<String,String> questText = new HashMap<String,String>();
|
||||
public HashMap<String,String> questAlerts = new HashMap<>();
|
||||
public HashMap<String,Vector<String>> questStatus = new HashMap<String,Vector<String>>();
|
||||
public HashMap<String,String> finish = new HashMap<String,String>();
|
||||
|
||||
@@ -24,6 +25,7 @@ public class QuestLogData {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("Categories", NBTTags.nbtVectorMap(categories));
|
||||
compound.setTag("Logs", NBTTags.nbtStringStringMap(questText));
|
||||
compound.setTag("Alerts", NBTTags.nbtStringStringMap(questAlerts));
|
||||
compound.setTag("Status", NBTTags.nbtVectorMap(questStatus));
|
||||
compound.setTag("QuestFinisher", NBTTags.nbtStringStringMap(finish));
|
||||
compound.setString("TrackedQuestID", trackedQuestKey);
|
||||
@@ -33,6 +35,7 @@ public class QuestLogData {
|
||||
public void readNBT(NBTTagCompound compound){
|
||||
categories = NBTTags.getVectorMap(compound.getTagList("Categories", 10));
|
||||
questText = NBTTags.getStringStringMap(compound.getTagList("Logs", 10));
|
||||
questAlerts = NBTTags.getStringStringMap(compound.getTagList("Alerts", 10));
|
||||
questStatus = NBTTags.getVectorMap(compound.getTagList("Status", 10));
|
||||
finish = NBTTags.getStringStringMap(compound.getTagList("QuestFinisher", 10));
|
||||
trackedQuestKey = compound.getString("TrackedQuestID");
|
||||
@@ -49,7 +52,7 @@ public class QuestLogData {
|
||||
list.add(quest.title);
|
||||
|
||||
questText.put(category + ":" + quest.title, quest.logText);
|
||||
|
||||
questAlerts.put(category + ":" + quest.title, String.valueOf(playerData.questData.activeQuests.get(quest.id).sendAlerts));
|
||||
questStatus.put(category + ":" + quest.title, quest.questInterface.getQuestLogStatus(player));
|
||||
if(quest.completion == EnumQuestCompletion.Npc && quest.questInterface.isCompleted(playerData))
|
||||
finish.put(category + ":" + quest.title, quest.completerNpc);
|
||||
@@ -70,6 +73,14 @@ public class QuestLogData {
|
||||
return questText.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
|
||||
public Boolean getQuestAlerts() {
|
||||
return Boolean.valueOf(questAlerts.get(selectedCategory+":"+selectedQuest));
|
||||
}
|
||||
|
||||
public void toggleQuestAlerts() {
|
||||
questAlerts.put(selectedCategory+":"+selectedQuest,String.valueOf(!getQuestAlerts()));
|
||||
}
|
||||
|
||||
public Vector<String> getQuestStatus() {
|
||||
return questStatus.get(selectedCategory + ":" + selectedQuest);
|
||||
}
|
||||
|
||||
@@ -292,48 +292,54 @@ public class ServerEventsHandler {
|
||||
private void doQuest(EntityPlayer player, EntityLivingBase entity, boolean all) {
|
||||
PlayerData playerData = PlayerDataController.instance.getPlayerData(player);
|
||||
PlayerQuestData questData = playerData.questData;
|
||||
boolean change = false;
|
||||
boolean checkCompletion = false;
|
||||
String entityName = EntityList.getEntityString(entity);
|
||||
|
||||
ArrayList<QuestData> activeQuestValues = new ArrayList<>(questData.activeQuests.values());
|
||||
for(QuestData data : activeQuestValues){
|
||||
if(data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||
if (data.quest.type != EnumQuestType.Kill && data.quest.type != EnumQuestType.AreaKill)
|
||||
continue;
|
||||
if(data.quest.type == EnumQuestType.AreaKill && all){
|
||||
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
||||
for(EntityPlayer pl : list)
|
||||
if(pl != player)
|
||||
doQuest(pl, entity, false);
|
||||
|
||||
if (data.quest.type == EnumQuestType.AreaKill && all) {
|
||||
List<EntityPlayer> list = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, entity.boundingBox.expand(10, 10, 10));
|
||||
for (EntityPlayer pl : list) {
|
||||
if (pl != player) {
|
||||
doQuest(pl, entity, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
String name = entityName;
|
||||
QuestKill quest = (QuestKill) data.quest.questInterface;
|
||||
|
||||
Class entityType = EntityNPCInterface.class;
|
||||
if(quest.targetType == 2) {
|
||||
if (quest.targetType == 2) {
|
||||
try {
|
||||
entityType = Class.forName(quest.customTargetType);
|
||||
} catch (ClassNotFoundException notFoundException) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if(quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||
|
||||
if (quest.targetType > 0 && !(entityType.isInstance(entity)))
|
||||
continue;
|
||||
if(quest.targets.containsKey(entity.getCommandSenderName()))
|
||||
|
||||
if (quest.targets.containsKey(entity.getCommandSenderName()))
|
||||
name = entity.getCommandSenderName();
|
||||
else if(!quest.targets.containsKey(name))
|
||||
else if (!quest.targets.containsKey(name))
|
||||
continue;
|
||||
|
||||
checkCompletion = true;
|
||||
|
||||
HashMap<String, Integer> killed = quest.getKilled(data);
|
||||
if(killed.containsKey(name) && killed.get(name) >= quest.targets.get(name))
|
||||
continue;
|
||||
int amount = 0;
|
||||
if(killed.containsKey(name))
|
||||
amount = killed.get(name);
|
||||
killed.put(name, amount + 1);
|
||||
if (!killed.containsKey(name)) {
|
||||
killed.put(name, 1);
|
||||
} else if(killed.get(name) < quest.targets.get(name)) {
|
||||
int amount = killed.get(name);
|
||||
killed.put(name, amount + 1);
|
||||
}
|
||||
quest.setKilled(data, killed);
|
||||
change = true;
|
||||
}
|
||||
if(!change)
|
||||
if(!checkCompletion)
|
||||
return;
|
||||
|
||||
questData.checkQuestCompletion(playerData,EnumQuestType.Kill);
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.controllers.data.Lines;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.data.ModelRotate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -46,6 +46,7 @@ import noppes.npcs.client.gui.player.companion.GuiNpcCompanionInv;
|
||||
import noppes.npcs.client.gui.player.companion.GuiNpcCompanionStats;
|
||||
import noppes.npcs.client.gui.player.companion.GuiNpcCompanionTalents;
|
||||
import noppes.npcs.client.gui.questtypes.GuiNpcQuestTypeItem;
|
||||
import noppes.npcs.client.gui.GuiNpcRemoteEditor;
|
||||
import noppes.npcs.client.gui.roles.*;
|
||||
import noppes.npcs.client.gui.script.GuiScriptGlobal;
|
||||
import noppes.npcs.client.gui.script.GuiScriptItem;
|
||||
@@ -60,6 +61,8 @@ import noppes.npcs.constants.EnumGuiType;
|
||||
import noppes.npcs.containers.*;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.entity.*;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import tconstruct.client.tabs.InventoryTabFactions;
|
||||
@@ -248,10 +251,16 @@ public class ClientProxy extends CommonProxy {
|
||||
return new GuiNPCManageTags(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ManageAnimations) {
|
||||
EntityCustomNpc animNpc = new EntityCustomNpc(npc.worldObj);
|
||||
animNpc.copyDataFrom(npc,true);
|
||||
animNpc.display.showName = 1;
|
||||
animNpc.display.showBossBar = 0;
|
||||
EntityCustomNpc animNpc;
|
||||
if (npc != null) {
|
||||
animNpc = new EntityCustomNpc(npc.worldObj);
|
||||
animNpc.copyDataFrom(npc, true);
|
||||
animNpc.display.showName = 1;
|
||||
animNpc.display.showBossBar = 0;
|
||||
} else {
|
||||
animNpc = new EntityCustomNpc(Minecraft.getMinecraft().theWorld);
|
||||
animNpc.display.texture = "customnpcs:textures/entity/humanmale/AnimationBody.png";
|
||||
}
|
||||
return new GuiNPCManageAnimations(animNpc);
|
||||
}
|
||||
|
||||
@@ -298,7 +307,7 @@ public class ClientProxy extends CommonProxy {
|
||||
return new GuiScript(npc);
|
||||
|
||||
else if (gui == EnumGuiType.ScriptItem)
|
||||
return new GuiScriptItem(Minecraft.getMinecraft().thePlayer);
|
||||
return new GuiScriptItem();
|
||||
|
||||
else if(gui == EnumGuiType.PlayerAnvil)
|
||||
return new GuiNpcCarpentryBench((ContainerCarpentryBench) container);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.client.controllers;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -28,10 +28,10 @@ public class Preset {
|
||||
Preset preset = new Preset();
|
||||
preset.name = "Elf Male";
|
||||
preset.data = data;
|
||||
data.legs.setScale(0.85f,1.15f);
|
||||
data.arms.setScale(0.85f,1.15f);
|
||||
data.body.setScale(0.85f,1.15f);
|
||||
data.head.setScale(0.85f,0.95f);
|
||||
data.modelScale.legs.setScale(0.85f,1.15f);
|
||||
data.modelScale.arms.setScale(0.85f,1.15f);
|
||||
data.modelScale.body.setScale(0.85f,1.15f);
|
||||
data.modelScale.head.setScale(0.85f,0.95f);
|
||||
presets.put("elf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -39,20 +39,20 @@ public class Preset {
|
||||
preset.name = "Elf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(0.8f,1.05f);
|
||||
data.arms.setScale(0.8f,1.05f);
|
||||
data.body.setScale(0.8f,1.05f);
|
||||
data.head.setScale(0.8f,0.85f);
|
||||
data.modelScale.legs.setScale(0.8f,1.05f);
|
||||
data.modelScale.arms.setScale(0.8f,1.05f);
|
||||
data.modelScale.body.setScale(0.8f,1.05f);
|
||||
data.modelScale.head.setScale(0.8f,0.85f);
|
||||
presets.put("elf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Dwarf Male";
|
||||
preset.data = data;
|
||||
data.legs.setScale(1.1f,0.7f, 0.9f);
|
||||
data.arms.setScale(0.9f,0.7f);
|
||||
data.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.head.setScale(0.85f,0.85f);
|
||||
data.modelScale.legs.setScale(1.1f,0.7f, 0.9f);
|
||||
data.modelScale.arms.setScale(0.9f,0.7f);
|
||||
data.modelScale.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
presets.put("dwarf male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -60,20 +60,20 @@ public class Preset {
|
||||
preset.name = "Dwarf Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(0.9f,0.65f);
|
||||
data.arms.setScale(0.9f,0.65f);
|
||||
data.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.head.setScale(0.85f,0.85f);
|
||||
data.modelScale.legs.setScale(0.9f,0.65f);
|
||||
data.modelScale.arms.setScale(0.9f,0.65f);
|
||||
data.modelScale.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
presets.put("dwarf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Orc Male";
|
||||
preset.data = data;
|
||||
data.legs.setScale(1.2f,1.05f);
|
||||
data.arms.setScale(1.2f,1.05f);
|
||||
data.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.head.setScale(1.2f,1.1f);
|
||||
data.modelScale.legs.setScale(1.2f,1.05f);
|
||||
data.modelScale.arms.setScale(1.2f,1.05f);
|
||||
data.modelScale.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.modelScale.head.setScale(1.2f,1.1f);
|
||||
presets.put("orc male", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -81,9 +81,9 @@ public class Preset {
|
||||
preset.name = "Orc Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(1.1f,1);
|
||||
data.arms.setScale(1.1f,1);
|
||||
data.body.setScale(1.1f, 1f, 1.25f);
|
||||
data.modelScale.legs.setScale(1.1f,1);
|
||||
data.modelScale.arms.setScale(1.1f,1);
|
||||
data.modelScale.body.setScale(1.1f, 1f, 1.25f);
|
||||
presets.put("orc female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -97,10 +97,10 @@ public class Preset {
|
||||
preset.name = "Human Female";
|
||||
preset.data = data;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("human female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -132,10 +132,10 @@ public class Preset {
|
||||
tail.setTexture("tail/tail1", 0);
|
||||
tail.color = 0xD9A64E;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("cat female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
@@ -167,18 +167,18 @@ public class Preset {
|
||||
tail.setTexture("tail/tail2", 0);
|
||||
tail.color = 0x5E5855;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
presets.put("wolf female", preset);
|
||||
|
||||
data = new ModelData();
|
||||
preset = new Preset();
|
||||
preset.name = "Enderchibi";
|
||||
preset.data = data;
|
||||
data.legs.setScale(0.65f,0.75f);
|
||||
data.arms.setScale(0.50f,1.45f);
|
||||
data.modelScale.legs.setScale(0.65f,0.75f);
|
||||
data.modelScale.arms.setScale(0.50f,1.45f);
|
||||
ModelPartData part = data.getOrCreatePart("particles");
|
||||
part.setTexture("particle/type1", 1);
|
||||
part.color = 0xFF0000;
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.client.fx;
|
||||
import net.minecraft.client.particle.EntityPortalFX;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.mainmenu.GuiNPCGlobalMainMenu;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -43,9 +44,10 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 170, guiTop + 6,82,20, "selectServer.edit"));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 170, guiTop + 28,82,20, "selectWorld.deleteButton"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 170, guiTop + 50,82,20, "remote.reset"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 170, guiTop + 132,82,20, "remote.freeze"));
|
||||
this.addButton(new GuiNpcButton(4, guiLeft + 170, guiTop + 72,82,20, "remote.tp"));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 170, guiTop + 110,82,20, "remote.resetall"));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 170, guiTop + 132,82,20, "remote.freeze"));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 170, guiTop + 165,82,20, "menu.global"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,6 +71,9 @@ public class GuiNpcRemoteEditor extends GuiNPCInterface implements IScrollData,
|
||||
((EntityNPCInterface)entity).reset();
|
||||
}
|
||||
}
|
||||
if(id == 6){
|
||||
NoppesUtil.openGUI(player, new GuiNPCGlobalMainMenu(null));
|
||||
}
|
||||
|
||||
if(!data.containsKey(scroll.getSelected()))
|
||||
return;
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.script.GuiNPCEventScripts;
|
||||
import noppes.npcs.client.gui.swing.GuiJTextArea;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
@@ -43,6 +44,7 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
guiTop += 10;
|
||||
GuiMenuTopButton top;
|
||||
addTopButton(top = new GuiMenuTopButton(13, guiLeft + 4, guiTop - 17, "script.scripts"));
|
||||
addTopButton(new GuiMenuTopButton(16, guiLeft + (xSize - 82), guiTop - 17, "eventscript.eventScripts"));
|
||||
top.active = showScript;
|
||||
addTopButton(top = new GuiMenuTopButton(14, top, "gui.settings"));
|
||||
top.active = !showScript;
|
||||
@@ -61,6 +63,9 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
list.add("script.kills");
|
||||
list.add("script.dialog_closed");
|
||||
list.add("script.timer");
|
||||
list.add("script.targetLost");
|
||||
list.add("script.projectileTick");
|
||||
list.add("script.projectileImpact");
|
||||
|
||||
if(showScript){
|
||||
addLabel(new GuiNpcLabel(0, "script.hooks", guiLeft + 4, guiTop + 5));
|
||||
@@ -128,7 +133,7 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
}
|
||||
|
||||
private String getConsoleText() {
|
||||
Map<Long, String> map = this.script.getConsoleText();
|
||||
Map<Long, String> map = this.script.getOldConsoleText();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
Iterator var3 = map.entrySet().iterator();
|
||||
|
||||
@@ -162,6 +167,10 @@ public class GuiScript extends GuiNPCInterface implements IGuiData, GuiYesNoCall
|
||||
GuiConfirmOpenLink guiyesno = new GuiConfirmOpenLink(this, "https://kamkeel.github.io/CustomNPC-Plus/", 0, true);
|
||||
mc.displayGuiScreen(guiyesno);
|
||||
}
|
||||
if(guibutton.id == 16){
|
||||
close();
|
||||
mc.displayGuiScreen(new GuiNPCEventScripts(npc));
|
||||
}
|
||||
if (guibutton.id == 100) {
|
||||
NoppesStringUtils.setClipboardContents(getTextField(2).getText());
|
||||
}
|
||||
|
||||
@@ -454,10 +454,6 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
Client.sendData(EnumPacketServer.CustomGuiButton, new Object[]{this.updateGui().toNBT(), button.id});
|
||||
}
|
||||
|
||||
public void slotChange(CustomGuiSlot slot) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiSlotChange, new Object[]{this.updateGui().toNBT(), slot.slotNumber});
|
||||
}
|
||||
|
||||
public String prevScrollClicked = null;
|
||||
public void customScrollClicked(int i, int j, int k, GuiCustomScroll scroll) {
|
||||
Client.sendData(EnumPacketServer.CustomGuiScrollClick, new Object[]{this.updateGui().toNBT(), scroll.id, scroll.selected, this.getScrollSelection((CustomGuiScrollComponent)scroll), false});
|
||||
@@ -636,7 +632,7 @@ public class GuiCustom extends GuiScreen implements ICustomScrollListener, IGuiD
|
||||
}
|
||||
|
||||
public boolean doesGuiPauseGame() {
|
||||
return this.gui == null || this.gui.getDoesPauseGame();
|
||||
return this.gui == null || this.gui.doesPauseGame();
|
||||
}
|
||||
|
||||
public void addDataHolder(IDataHolder component) {
|
||||
|
||||
@@ -5,26 +5,22 @@
|
||||
|
||||
package noppes.npcs.client.gui.custom.components;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import noppes.npcs.client.gui.custom.GuiCustom;
|
||||
import noppes.npcs.api.gui.IItemSlot;
|
||||
|
||||
public class CustomGuiSlot extends Slot {
|
||||
public boolean clientSide;
|
||||
public int slotNumber;
|
||||
public final int slotNumber;
|
||||
public final IItemSlot slot;
|
||||
public final EntityPlayer player;
|
||||
|
||||
public CustomGuiSlot(IInventory inventoryIn, int index, int xPosition, int yPosition, boolean clientSide) {
|
||||
public CustomGuiSlot(EntityPlayer player, IInventory inventoryIn, int index, IItemSlot slot, int xPosition, int yPosition, boolean clientSide) {
|
||||
super(inventoryIn, index, xPosition, yPosition);
|
||||
this.clientSide = clientSide;
|
||||
this.slotNumber = index;
|
||||
}
|
||||
|
||||
public void onSlotChanged() {
|
||||
if (this.clientSide) {
|
||||
((GuiCustom)Minecraft.getMinecraft().currentScreen).slotChange(this);
|
||||
}
|
||||
|
||||
super.onSlotChanged();
|
||||
this.slot = slot;
|
||||
this.player = player;
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,6 @@ public class GuiNPCManageAnimations extends GuiModelInterface implements IScroll
|
||||
Client.sendData(EnumPacketServer.AnimationListGet);
|
||||
xOffset -= 20;
|
||||
yOffset = -45;
|
||||
npc.display.texture = "customnpcs:textures/entity/humanmale/AnimationBody.png";
|
||||
|
||||
AnimationData data = npc.display.animationData;
|
||||
data.setEnabled(true);
|
||||
|
||||
@@ -21,7 +21,7 @@ public class GuiNpcManagePlayerData extends GuiNPCInterface2 implements IScrollD
|
||||
private EnumPlayerData selection = EnumPlayerData.Players;
|
||||
private String search = "";
|
||||
|
||||
public GuiNpcManagePlayerData(EntityNPCInterface npc,GuiNPCInterface2 parent)
|
||||
public GuiNpcManagePlayerData(EntityNPCInterface npc)
|
||||
{
|
||||
super(npc);
|
||||
Client.sendData(EnumPacketServer.PlayerDataGet,selection);
|
||||
|
||||
@@ -58,7 +58,7 @@ public class GuiNPCGlobalMainMenu extends GuiNPCInterface2{
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageTransport);
|
||||
}
|
||||
if (id == 13) {
|
||||
NoppesUtil.openGUI(player, new GuiNpcManagePlayerData(npc, this));
|
||||
NoppesUtil.openGUI(player, new GuiNpcManagePlayerData(npc));
|
||||
}
|
||||
if (id == 14) {
|
||||
NoppesUtil.requestOpenGUI(EnumGuiType.ManageRecipes, 4, 0, 0);
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCStringSlot;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcTextField;
|
||||
import noppes.npcs.client.gui.util.ITextfieldListener;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
|
||||
@@ -2,9 +2,8 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelLimbConfig;
|
||||
import noppes.npcs.ModelRotatePart;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelRotatePart;
|
||||
import noppes.npcs.client.gui.util.GuiModelInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelLimbConfig;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelScalePart;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
@@ -32,7 +32,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
|
||||
addLabel(new GuiNpcLabel(20, "Head", guiLeft + 55, y + 5, 0xFFFFFF));
|
||||
if(type == 0){
|
||||
drawSlider(y, playerdata.head);
|
||||
drawSlider(y, playerdata.modelScale.head);
|
||||
y += 88;
|
||||
}
|
||||
else{
|
||||
@@ -42,7 +42,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
|
||||
addLabel(new GuiNpcLabel(21, "Body", guiLeft + 55, y + 5, 0xFFFFFF));
|
||||
if(type == 1){
|
||||
drawSlider(y, playerdata.body);
|
||||
drawSlider(y, playerdata.modelScale.body);
|
||||
y += 88;
|
||||
}
|
||||
else{
|
||||
@@ -52,7 +52,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
|
||||
addLabel(new GuiNpcLabel(22, "Arms", guiLeft + 55, y + 5, 0xFFFFFF));
|
||||
if(type == 2){
|
||||
drawSlider(y, playerdata.arms);
|
||||
drawSlider(y, playerdata.modelScale.arms);
|
||||
y += 88;
|
||||
}
|
||||
else {
|
||||
@@ -62,7 +62,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
|
||||
addLabel(new GuiNpcLabel(23, "Legs", guiLeft + 55, y + 5, 0xFFFFFF));
|
||||
if(type == 3){
|
||||
drawSlider(y, playerdata.legs);
|
||||
drawSlider(y, playerdata.modelScale.legs);
|
||||
y += 88;
|
||||
}
|
||||
else{
|
||||
@@ -71,7 +71,7 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
}
|
||||
}
|
||||
|
||||
private void drawSlider(int y, ModelLimbConfig config){
|
||||
private void drawSlider(int y, ModelScalePart config){
|
||||
y += 20;
|
||||
addLabel(new GuiNpcLabel(10, "Width", guiLeft - 25 + offset, y + 5, 0xFFFFFF));
|
||||
scaleWidth = new GuiNpcSlider(this, 10, guiLeft + 50 + offset, y, config.scaleX - 0.5f);
|
||||
@@ -100,13 +100,13 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
}
|
||||
else{
|
||||
// Resetting Type
|
||||
ModelLimbConfig config = playerdata.head;
|
||||
ModelScalePart config = playerdata.modelScale.head;
|
||||
if(type == 1)
|
||||
config = playerdata.body;
|
||||
config = playerdata.modelScale.body;
|
||||
else if(type == 2)
|
||||
config = playerdata.arms;
|
||||
config = playerdata.modelScale.arms;
|
||||
else if(type == 3)
|
||||
config = playerdata.legs;
|
||||
config = playerdata.modelScale.legs;
|
||||
|
||||
if(btn.id == 170){
|
||||
config.scaleX = 1.0f;
|
||||
@@ -143,13 +143,13 @@ public class GuiModelScale extends GuiModelInterface implements ISliderListener{
|
||||
public void mouseDragged(GuiNpcSlider slider) {
|
||||
int percent = (int) (50 + slider.sliderValue * 100);
|
||||
slider.setString(percent + "%");
|
||||
ModelLimbConfig config = playerdata.head;
|
||||
ModelScalePart config = playerdata.modelScale.head;
|
||||
if(type == 1)
|
||||
config = playerdata.body;
|
||||
config = playerdata.modelScale.body;
|
||||
else if(type == 2)
|
||||
config = playerdata.arms;
|
||||
config = playerdata.modelScale.arms;
|
||||
else if(type == 3)
|
||||
config = playerdata.legs;
|
||||
config = playerdata.modelScale.legs;
|
||||
|
||||
if(slider.id == 10)
|
||||
config.scaleX = slider.sliderValue + 0.5f;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.gui.model;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.client.controllers.Preset;
|
||||
import noppes.npcs.client.controllers.PresetController;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.controllers.Preset;
|
||||
import noppes.npcs.client.controllers.PresetController;
|
||||
|
||||
@@ -6,6 +6,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.NoppesUtilPlayer;
|
||||
import noppes.npcs.QuestLogData;
|
||||
import noppes.npcs.client.Client;
|
||||
@@ -83,15 +84,19 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
|
||||
addButton(new GuiButtonNextPage(1, guiLeft + 286, guiTop + 176, true));
|
||||
addButton(new GuiButtonNextPage(2, guiLeft + 144, guiTop + 176, false));
|
||||
|
||||
GuiNpcButton trackingButton = new GuiNpcButton(3, guiLeft + 260, guiTop + 151, 50, 20, new String[]{"Track", "Tracking"}, data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest) ? 1 : 0);
|
||||
if (trackingButton.displayString.equals("Tracking")) {
|
||||
GuiNpcButton trackingButton = new GuiNpcButton(3, guiLeft + 260, guiTop + 151, 50, 20, new String[]{"quest.track", "quest.tracking"}, data.trackedQuestKey.equals(data.selectedCategory + ":" + data.selectedQuest) ? 1 : 0);
|
||||
if (trackingButton.displayString.equals("quest.tracking")) {
|
||||
trackingButton.packedFGColour = 0x32CD32;
|
||||
}
|
||||
addButton(trackingButton);
|
||||
|
||||
GuiNpcButton alertButton = new GuiNpcButton(4, guiLeft + 205, guiTop + 151, 50, 20, new String[]{"quest.alerts", "quest.noAlerts"}, data.getQuestAlerts() ? 0 : 1);
|
||||
addButton(alertButton);
|
||||
|
||||
getButton(1).visible = questDetails && data.hasSelectedQuest();
|
||||
getButton(2).visible = !questDetails && data.hasSelectedQuest();
|
||||
getButton(3).visible = !data.selectedQuest.isEmpty() && getButton(1).visible;
|
||||
getButton(4).visible = getButton(3).visible;
|
||||
}
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
@@ -108,6 +113,9 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
|
||||
data.trackedQuestKey = "";
|
||||
}
|
||||
}
|
||||
if(guibutton.id == 4){
|
||||
data.toggleQuestAlerts();
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
@@ -248,8 +256,11 @@ public class GuiQuestLog extends GuiNPCInterface implements ITopButtonListener,I
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if (this.data != null)
|
||||
Client.sendData(EnumPacketServer.UpdateTrackedQuest, this.data.trackedQuestKey);
|
||||
if (this.data != null) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setTag("Alerts", NBTTags.nbtStringStringMap(data.questAlerts));
|
||||
Client.sendData(EnumPacketServer.QuestLogToServer, compound, this.data.trackedQuestKey);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.DataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiNPCEventScripts extends GuiScriptInterface {
|
||||
private final DataScript script;
|
||||
|
||||
public GuiNPCEventScripts(EntityNPCInterface npc) {
|
||||
this.hookList = new ArrayList<>();
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("dialog");
|
||||
hookList.add("damaged");
|
||||
hookList.add("killed");
|
||||
hookList.add("meleeAttack");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("target");
|
||||
hookList.add("collide");
|
||||
hookList.add("kills");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("timer");
|
||||
hookList.add("targetLost");
|
||||
hookList.add("projectileTick");
|
||||
hookList.add("projectileImpact");
|
||||
|
||||
this.script = new DataScript(npc);
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.EventScriptDataGet);
|
||||
}
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
if (!compound.hasKey("Tab")) {
|
||||
script.setLanguage(compound.getString("ScriptLanguage"));
|
||||
script.setEnabled(compound.getBoolean("ScriptEnabled"));
|
||||
super.setGuiData(compound);
|
||||
} else {
|
||||
int tab = compound.getInteger("Tab");
|
||||
ScriptContainer container = new ScriptContainer(script);
|
||||
container.readFromNBT(compound.getCompoundTag("Script"));
|
||||
if (script.getScripts().isEmpty()) {
|
||||
for (int i = 0; i < compound.getInteger("TotalScripts"); i++) {
|
||||
script.getScripts().add(new ScriptContainer(script));
|
||||
}
|
||||
}
|
||||
script.getScripts().set(tab,container);
|
||||
initGui();
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
super.save();
|
||||
List<ScriptContainer> containers = this.script.getScripts();
|
||||
for (int i = 0; i < containers.size(); i++) {
|
||||
ScriptContainer container = containers.get(i);
|
||||
Client.sendData(EnumPacketServer.EventScriptDataSave, i, containers.size(), container.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
NBTTagCompound scriptData = new NBTTagCompound();
|
||||
scriptData.setString("ScriptLanguage", this.script.getLanguage());
|
||||
scriptData.setBoolean("ScriptEnabled", this.script.getEnabled());
|
||||
scriptData.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.script.getConsoleText()));
|
||||
Client.sendData(EnumPacketServer.EventScriptDataSave, -1, containers.size(), scriptData);
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,33 @@ import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.GlobalNPCDataScript;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GuiScriptAllNPCs extends GuiScriptInterface {
|
||||
private NPCDataScript script = new NPCDataScript(null);
|
||||
private GlobalNPCDataScript script = new GlobalNPCDataScript(null);
|
||||
|
||||
public GuiScriptAllNPCs() {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("dialog");
|
||||
hookList.add("damaged");
|
||||
hookList.add("killed");
|
||||
hookList.add("meleeAttack");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("target");
|
||||
hookList.add("collide");
|
||||
hookList.add("kills");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("timer");
|
||||
hookList.add("targetLost");
|
||||
hookList.add("projectileTick");
|
||||
hookList.add("projectileImpact");
|
||||
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.ScriptNPCGet);
|
||||
Client.sendData(EnumPacketServer.ScriptGlobalNPCGet);
|
||||
}
|
||||
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
@@ -41,12 +58,12 @@ public class GuiScriptAllNPCs extends GuiScriptInterface {
|
||||
List<ScriptContainer> containers = this.script.getScripts();
|
||||
for (int i = 0; i < containers.size(); i++) {
|
||||
ScriptContainer container = containers.get(i);
|
||||
Client.sendData(EnumPacketServer.ScriptNPCSave, i, containers.size(), container.writeToNBT(new NBTTagCompound()));
|
||||
Client.sendData(EnumPacketServer.ScriptGlobalNPCSave, i, containers.size(), container.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
NBTTagCompound scriptData = new NBTTagCompound();
|
||||
scriptData.setString("ScriptLanguage", this.script.getLanguage());
|
||||
scriptData.setBoolean("ScriptEnabled", this.script.getEnabled());
|
||||
scriptData.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.script.getConsoleText()));
|
||||
Client.sendData(EnumPacketServer.ScriptNPCSave, -1, scriptData);
|
||||
Client.sendData(EnumPacketServer.ScriptGlobalNPCSave, -1, containers.size(), scriptData);
|
||||
}
|
||||
}
|
||||
@@ -5,19 +5,67 @@
|
||||
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiScriptForge extends GuiScriptInterface {
|
||||
private ForgeDataScript script = new ForgeDataScript();
|
||||
|
||||
public GuiScriptForge() {
|
||||
hookList.add("init");
|
||||
|
||||
ArrayList<ClassPath.ClassInfo> list = new ArrayList();
|
||||
try {
|
||||
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("cpw.mods.fml.common.gameevent"));
|
||||
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event"));
|
||||
list.removeAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event.terraingen"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for(ClassPath.ClassInfo e1 : list){
|
||||
ClassPath.ClassInfo classLoader = e1;
|
||||
Class infoClass = classLoader.load();
|
||||
ArrayList c = new ArrayList(Arrays.asList(infoClass.getDeclaredClasses()));
|
||||
if(c.isEmpty()) {
|
||||
c.add(infoClass);
|
||||
}
|
||||
Iterator var10 = c.iterator();
|
||||
while(var10.hasNext()) {
|
||||
Class c1 = (Class) var10.next();
|
||||
if(!EntityEvent.EntityConstructing.class.isAssignableFrom(c1) && !WorldEvent.PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers()) && !ChunkEvent.class.isAssignableFrom(c1) && !ChunkWatchEvent.class.isAssignableFrom(c1) && !ChunkDataEvent.class.isAssignableFrom(c1)) {
|
||||
String eventName = c1.getName();
|
||||
int i = eventName.lastIndexOf(".");
|
||||
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
|
||||
|
||||
hookList.add(eventName);
|
||||
}
|
||||
}
|
||||
}
|
||||
hookList.add("onCNPCNaturalSpawn");
|
||||
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.ScriptForgeGet);
|
||||
}
|
||||
@@ -52,6 +100,6 @@ public class GuiScriptForge extends GuiScriptInterface {
|
||||
scriptData.setString("ScriptLanguage", this.script.getLanguage());
|
||||
scriptData.setBoolean("ScriptEnabled", this.script.getEnabled());
|
||||
scriptData.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.script.getConsoleText()));
|
||||
Client.sendData(EnumPacketServer.ScriptForgeSave, -1, scriptData);
|
||||
Client.sendData(EnumPacketServer.ScriptForgeSave, -1, containers.size(), scriptData);
|
||||
}
|
||||
}
|
||||
@@ -5,22 +5,12 @@
|
||||
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import net.minecraft.client.gui.GuiYesNo;
|
||||
import net.minecraft.client.gui.GuiYesNoCallback;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.world.ChunkDataEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.NoppesStringUtils;
|
||||
import noppes.npcs.client.NoppesUtil;
|
||||
import noppes.npcs.client.gui.swing.GuiJTextArea;
|
||||
@@ -29,13 +19,8 @@ import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.controllers.ScriptController;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.IScriptHandler;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@@ -44,6 +29,7 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
public IScriptHandler handler;
|
||||
public Map<String, List<String>> languages = new HashMap();
|
||||
private int scriptLimit = 1;
|
||||
public List<String> hookList = new ArrayList<String>();
|
||||
|
||||
public GuiScriptInterface() {
|
||||
this.drawDefaultBackground = true;
|
||||
@@ -91,132 +77,15 @@ public class GuiScriptInterface extends GuiNPCInterface implements GuiYesNoCallb
|
||||
|
||||
top.active = true;
|
||||
if(this.activeTab > 0) {
|
||||
List<String> hookList = new ArrayList<String>();
|
||||
|
||||
GuiCustomScroll hooks = new GuiCustomScroll(this, 1);
|
||||
hooks.allowUserInput = false;
|
||||
hooks.setSize(108, 198);
|
||||
hooks.guiLeft = guiLeft - 110;
|
||||
hooks.guiTop = guiTop + 14;
|
||||
|
||||
if(handler instanceof PlayerDataScript) {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("attack");
|
||||
hookList.add("attacked");
|
||||
hookList.add("damagedEntity");
|
||||
hookList.add("damaged");
|
||||
hookList.add("kills");
|
||||
hookList.add("killed");
|
||||
hookList.add("drop");
|
||||
hookList.add("respawn");
|
||||
hookList.add("breakBlock");
|
||||
hookList.add("chat");
|
||||
hookList.add("login");
|
||||
hookList.add("logout");
|
||||
hookList.add("keyPressed");
|
||||
hookList.add("mouseClicked");
|
||||
hookList.add("toss");
|
||||
hookList.add("pickUp");
|
||||
hookList.add("pickupXP");
|
||||
hookList.add("rangedCharge");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("timer");
|
||||
hookList.add("startItem");
|
||||
hookList.add("usingItem");
|
||||
hookList.add("stopItem");
|
||||
hookList.add("finishItem");
|
||||
hookList.add("containerOpen");
|
||||
hookList.add("useHoe");
|
||||
hookList.add("bonemeal");
|
||||
hookList.add("fillBucket");
|
||||
hookList.add("jump");
|
||||
hookList.add("fall");
|
||||
hookList.add("wakeUp");
|
||||
hookList.add("sleep");
|
||||
hookList.add("playSound");
|
||||
hookList.add("lightning");
|
||||
hookList.add("changedDim");
|
||||
hookList.add("questStart");
|
||||
hookList.add("questCompleted");
|
||||
hookList.add("questTurnIn");
|
||||
hookList.add("factionPoints");
|
||||
hookList.add("dialogOpen");
|
||||
hookList.add("dialogOption");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("customGuiClosed");
|
||||
hookList.add("customGuiButton");
|
||||
hookList.add("customGuiSlot");
|
||||
hookList.add("customGuiSlotClicked");
|
||||
hookList.add("customGuiScroll");
|
||||
hookList.add("customGuiTextfield");
|
||||
|
||||
}
|
||||
else if(handler instanceof NPCDataScript) {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("dialog");
|
||||
hookList.add("damaged");
|
||||
hookList.add("killed");
|
||||
hookList.add("meleeAttack");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("target");
|
||||
hookList.add("collide");
|
||||
hookList.add("kills");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("timer");
|
||||
}
|
||||
else if(handler instanceof ScriptCustomItem) {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("tossed");
|
||||
hookList.add("pickedUp");
|
||||
hookList.add("spawn");
|
||||
hookList.add("interact");
|
||||
hookList.add("attack");
|
||||
hookList.add("startItem");
|
||||
hookList.add("usingItem");
|
||||
hookList.add("stopItem");
|
||||
hookList.add("finishItem");
|
||||
}
|
||||
else if(handler instanceof ForgeDataScript) {
|
||||
if(handler instanceof ForgeDataScript) {
|
||||
hooks.setSize(238, 198);
|
||||
hooks.guiLeft = guiLeft - 240;
|
||||
|
||||
hookList.add("init");
|
||||
|
||||
ArrayList<ClassPath.ClassInfo> list = new ArrayList();
|
||||
try {
|
||||
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("cpw.mods.fml.common.gameevent"));
|
||||
list.addAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event"));
|
||||
list.removeAll(ClassPath.from(this.getClass().getClassLoader()).getTopLevelClassesRecursive("net.minecraftforge.event.terraingen"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for(ClassPath.ClassInfo e1 : list){
|
||||
ClassPath.ClassInfo classLoader = e1;
|
||||
Class infoClass = classLoader.load();
|
||||
ArrayList c = new ArrayList(Arrays.asList(infoClass.getDeclaredClasses()));
|
||||
if(c.isEmpty()) {
|
||||
c.add(infoClass);
|
||||
}
|
||||
Iterator var10 = c.iterator();
|
||||
while(var10.hasNext()) {
|
||||
Class c1 = (Class) var10.next();
|
||||
if(!EntityEvent.EntityConstructing.class.isAssignableFrom(c1) && !WorldEvent.PotentialSpawns.class.isAssignableFrom(c1) && !TickEvent.RenderTickEvent.class.isAssignableFrom(c1) && !TickEvent.ClientTickEvent.class.isAssignableFrom(c1) && !FMLNetworkEvent.ClientCustomPacketEvent.class.isAssignableFrom(c1) && !ItemTooltipEvent.class.isAssignableFrom(c1) && Event.class.isAssignableFrom(c1) && !Modifier.isAbstract(c1.getModifiers()) && Modifier.isPublic(c1.getModifiers()) && !ChunkEvent.class.isAssignableFrom(c1) && !ChunkWatchEvent.class.isAssignableFrom(c1) && !ChunkDataEvent.class.isAssignableFrom(c1)) {
|
||||
String eventName = c1.getName();
|
||||
int i = eventName.lastIndexOf(".");
|
||||
eventName = StringUtils.uncapitalize(eventName.substring(i + 1).replace("$", ""));
|
||||
|
||||
hookList.add(eventName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hookList.add("onCNPCNaturalSpawn");
|
||||
}
|
||||
hooks.setUnsortedList(hookList);
|
||||
addScroll(hooks);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package noppes.npcs.client.gui.script;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomItems;
|
||||
@@ -11,7 +10,19 @@ import noppes.npcs.scripted.item.ScriptCustomItem;
|
||||
public class GuiScriptItem extends GuiScriptInterface {
|
||||
private ScriptCustomItem item;
|
||||
|
||||
public GuiScriptItem(EntityPlayer player) {
|
||||
public GuiScriptItem() {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("tossed");
|
||||
hookList.add("pickedUp");
|
||||
hookList.add("spawn");
|
||||
hookList.add("interact");
|
||||
hookList.add("attack");
|
||||
hookList.add("startItem");
|
||||
hookList.add("usingItem");
|
||||
hookList.add("stopItem");
|
||||
hookList.add("finishItem");
|
||||
|
||||
this.handler = this.item = new ScriptCustomItem(new ItemStack(CustomItems.scripted_item));
|
||||
Client.sendData(EnumPacketServer.ScriptItemDataGet, new Object[0]);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,58 @@ public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
private PlayerDataScript script = new PlayerDataScript((EntityPlayer)null);
|
||||
|
||||
public GuiScriptPlayers() {
|
||||
hookList.add("init");
|
||||
hookList.add("tick");
|
||||
hookList.add("interact");
|
||||
hookList.add("attack");
|
||||
hookList.add("attacked");
|
||||
hookList.add("damagedEntity");
|
||||
hookList.add("damaged");
|
||||
hookList.add("kills");
|
||||
hookList.add("killed");
|
||||
hookList.add("drop");
|
||||
hookList.add("respawn");
|
||||
hookList.add("breakBlock");
|
||||
hookList.add("chat");
|
||||
hookList.add("login");
|
||||
hookList.add("logout");
|
||||
hookList.add("keyPressed");
|
||||
hookList.add("mouseClicked");
|
||||
hookList.add("toss");
|
||||
hookList.add("pickUp");
|
||||
hookList.add("pickupXP");
|
||||
hookList.add("rangedCharge");
|
||||
hookList.add("rangedLaunched");
|
||||
hookList.add("timer");
|
||||
hookList.add("startItem");
|
||||
hookList.add("usingItem");
|
||||
hookList.add("stopItem");
|
||||
hookList.add("finishItem");
|
||||
hookList.add("containerOpen");
|
||||
hookList.add("useHoe");
|
||||
hookList.add("bonemeal");
|
||||
hookList.add("fillBucket");
|
||||
hookList.add("jump");
|
||||
hookList.add("fall");
|
||||
hookList.add("wakeUp");
|
||||
hookList.add("sleep");
|
||||
hookList.add("playSound");
|
||||
hookList.add("lightning");
|
||||
hookList.add("changedDim");
|
||||
hookList.add("questStart");
|
||||
hookList.add("questCompleted");
|
||||
hookList.add("questTurnIn");
|
||||
hookList.add("factionPoints");
|
||||
hookList.add("dialogOpen");
|
||||
hookList.add("dialogOption");
|
||||
hookList.add("dialogClose");
|
||||
hookList.add("customGuiClosed");
|
||||
hookList.add("customGuiButton");
|
||||
hookList.add("customGuiSlot");
|
||||
hookList.add("customGuiSlotClicked");
|
||||
hookList.add("customGuiScroll");
|
||||
hookList.add("customGuiTextfield");
|
||||
|
||||
this.handler = this.script;
|
||||
Client.sendData(EnumPacketServer.ScriptPlayerGet);
|
||||
}
|
||||
@@ -54,6 +106,6 @@ public class GuiScriptPlayers extends GuiScriptInterface {
|
||||
scriptData.setString("ScriptLanguage", this.script.getLanguage());
|
||||
scriptData.setBoolean("ScriptEnabled", this.script.getEnabled());
|
||||
scriptData.setTag("ScriptConsole", NBTTags.NBTLongStringMap(this.script.getConsoleText()));
|
||||
Client.sendData(EnumPacketServer.ScriptPlayerSave, -1, scriptData);
|
||||
Client.sendData(EnumPacketServer.ScriptPlayerSave, -1, containers.size(), scriptData);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
@@ -32,18 +32,20 @@ public class GuiNpcMenu implements GuiYesNoCallback{
|
||||
{
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
GuiMenuTopButton display = new GuiMenuTopButton(1,guiLeft + 4, guiTop - 17, "menu.display");
|
||||
GuiMenuTopButton stats = new GuiMenuTopButton(2,display.xPosition + display.getWidth() , guiTop - 17, "menu.stats");
|
||||
GuiMenuTopButton ai = new GuiMenuTopButton(6,stats.xPosition + stats.getWidth() , guiTop - 17, "menu.ai");
|
||||
GuiMenuTopButton inv = new GuiMenuTopButton(3,ai.xPosition + ai.getWidth() , guiTop - 17, "menu.inventory");
|
||||
GuiMenuTopButton advanced = new GuiMenuTopButton(4,inv.xPosition + inv.getWidth() , guiTop - 17, "menu.advanced");
|
||||
GuiMenuTopButton global = new GuiMenuTopButton(5,advanced.xPosition + advanced.getWidth() , guiTop - 17, "menu.global");
|
||||
|
||||
GuiMenuTopButton close = new GuiMenuTopButton(0,guiLeft + width - 22, guiTop - 17, "X");
|
||||
GuiMenuTopButton delete = new GuiMenuTopButton(66,guiLeft + width - 72, guiTop - 17,"selectWorld.deleteButton");
|
||||
delete.xPosition = close.xPosition - delete.getWidth();
|
||||
|
||||
topButtons = new GuiMenuTopButton[]{display,stats,ai,inv,advanced,global,close,delete};
|
||||
GuiMenuTopButton close = new GuiMenuTopButton(0,guiLeft + width - 22, guiTop - 17, "X");
|
||||
if (npc != null) {
|
||||
GuiMenuTopButton display = new GuiMenuTopButton(1, guiLeft + 4, guiTop - 17, "menu.display");
|
||||
GuiMenuTopButton stats = new GuiMenuTopButton(2, display.xPosition + display.getWidth(), guiTop - 17, "menu.stats");
|
||||
GuiMenuTopButton ai = new GuiMenuTopButton(6, stats.xPosition + stats.getWidth(), guiTop - 17, "menu.ai");
|
||||
GuiMenuTopButton inv = new GuiMenuTopButton(3, ai.xPosition + ai.getWidth(), guiTop - 17, "menu.inventory");
|
||||
GuiMenuTopButton advanced = new GuiMenuTopButton(4, inv.xPosition + inv.getWidth(), guiTop - 17, "menu.advanced");
|
||||
GuiMenuTopButton global = new GuiMenuTopButton(5, advanced.xPosition + advanced.getWidth(), guiTop - 17, "menu.global");
|
||||
GuiMenuTopButton delete = new GuiMenuTopButton(66,guiLeft + width - 72, guiTop - 17,"selectWorld.deleteButton");
|
||||
delete.xPosition = close.xPosition - delete.getWidth();
|
||||
topButtons = new GuiMenuTopButton[]{display,stats,ai,inv,advanced,global,close,delete};
|
||||
} else {
|
||||
topButtons = new GuiMenuTopButton[]{close};
|
||||
}
|
||||
|
||||
for(GuiMenuTopButton button : topButtons)
|
||||
button.active = button.id == activeMenu;
|
||||
|
||||
@@ -24,6 +24,8 @@ import noppes.npcs.controllers.data.Frame;
|
||||
import noppes.npcs.controllers.data.FramePart;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelScalePart;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -444,7 +446,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
setPlayerData(npc);
|
||||
currentlyPlayerTexture = true;
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
if(npc.modelData.enableRotation){
|
||||
if(npc.modelData.enableRotation && !npc.display.animationData.isActive()){
|
||||
if(isRotationActive(npc)){
|
||||
float pi = (float) Math.PI;
|
||||
|
||||
@@ -632,7 +634,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
bipedRightArm.rotateAngleZ = (float) (Math.PI - 1f - Math.sin(entity.ticksExisted * 0.27f) * 0.5f );
|
||||
}
|
||||
else if(isSneak){
|
||||
this.bipedBody.rotateAngleX = 0.5F / npc.modelData.body.scaleY;
|
||||
this.bipedBody.rotateAngleX = 0.5F / npc.modelData.modelScale.body.scaleY;
|
||||
}
|
||||
|
||||
AnimationData animationData = npc.display.animationData;
|
||||
@@ -736,7 +738,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
float dancing = entity.ticksExisted / 4f;
|
||||
GL11.glTranslatef((float)Math.sin(dancing) * 0.075F, (float)Math.abs(Math.cos(dancing)) * 0.125F - 0.02F, (float)(-Math.abs(Math.cos(dancing))) * 0.075F);
|
||||
}
|
||||
ModelLimbConfig head = entity.modelData.head;
|
||||
ModelScalePart head = entity.modelData.modelScale.head;
|
||||
|
||||
this.copyAnglesPivots(headwear,bipedHead);
|
||||
this.copyAnglesPivots(bipedHeadwear,bipedHead);
|
||||
@@ -772,7 +774,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
GL11.glTranslatef((float)Math.sin(dancing) * 0.015F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
ModelLimbConfig body = entity.modelData.body;
|
||||
ModelScalePart body = entity.modelData.modelScale.body;
|
||||
|
||||
// Hide Body
|
||||
((ModelScaleRenderer)this.bipedBody).isHidden = entity.modelData.hideBody == 1;
|
||||
@@ -782,7 +784,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
|
||||
if(bipedBodywear.showModel && !bipedBodywear.isHidden){
|
||||
if(entity.modelData.bodywear == 1 || isArmor){
|
||||
((ModelScaleRenderer)this.bipedBodywear).setConfig(entity.modelData.body,x,y,z);
|
||||
((ModelScaleRenderer)this.bipedBodywear).setConfig(entity.modelData.modelScale.body,x,y,z);
|
||||
((ModelScaleRenderer)this.bipedBodywear).render(f);
|
||||
}
|
||||
else if(entity.modelData.bodywear == 2){
|
||||
@@ -792,7 +794,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
this.bodywear.rotationPointX = bipedBodywear.rotationPointX;
|
||||
this.bodywear.rotationPointY = bipedBodywear.rotationPointY;
|
||||
this.bodywear.rotationPointZ = bipedBodywear.rotationPointZ;
|
||||
this.bodywear.setConfig(entity.modelData.body,x,y,z);
|
||||
this.bodywear.setConfig(entity.modelData.modelScale.body,x,y,z);
|
||||
this.bodywear.render(f);
|
||||
}
|
||||
}
|
||||
@@ -804,9 +806,9 @@ public class ModelMPM extends ModelNPCMale{
|
||||
}
|
||||
public void renderArms(EntityCustomNpc entity, float f, boolean bo){
|
||||
loadPlayerTexture(entity);
|
||||
ModelLimbConfig arms = entity.modelData.arms;
|
||||
ModelScalePart arms = entity.modelData.modelScale.arms;
|
||||
|
||||
float x = (1 - entity.modelData.body.scaleX) * 0.25f + (1 - arms.scaleX) * 0.075f;
|
||||
float x = (1 - entity.modelData.modelScale.body.scaleX) * 0.25f + (1 - arms.scaleX) * 0.075f;
|
||||
float y = entity.modelData.getBodyY() + (1 - arms.scaleY) * -0.1f;
|
||||
float z = 0;
|
||||
|
||||
@@ -883,7 +885,7 @@ public class ModelMPM extends ModelNPCMale{
|
||||
}
|
||||
private void renderLegs(EntityCustomNpc entity, float f) {
|
||||
loadPlayerTexture(entity);
|
||||
ModelLimbConfig legs = entity.modelData.legs;
|
||||
ModelScalePart legs = entity.modelData.modelScale.legs;
|
||||
|
||||
float x = (1 - legs.scaleX) * 0.125f;
|
||||
float y = entity.modelData.getLegsY();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.client.model.part;
|
||||
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package noppes.npcs.client.model.part;
|
||||
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.part.horns.ModelAntennasBack;
|
||||
import noppes.npcs.client.model.part.horns.ModelAntennasFront;
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.client.model.part;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.part.legs.ModelDigitigradeLegs;
|
||||
@@ -294,8 +294,8 @@ public class ModelLegs extends ModelScaleRenderer{
|
||||
spiderNeck.rotateAngleX = (float) (Math.PI / -8);
|
||||
}
|
||||
if(base.isSleeping(entity) || this.entity.currentAnimation == EnumAnimation.CRAWLING){
|
||||
rotationPointY = 12 * this.entity.modelData.legs.scaleY;
|
||||
rotationPointZ = 15 * this.entity.modelData.legs.scaleY;
|
||||
rotationPointY = 12 * this.entity.modelData.modelScale.legs.scaleY;
|
||||
rotationPointZ = 15 * this.entity.modelData.modelScale.legs.scaleY;
|
||||
|
||||
this.rotateAngleX = (float) (Math.PI / -2);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -3,8 +3,8 @@ package noppes.npcs.client.model.part;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
import noppes.npcs.client.model.util.ModelPlaneRenderer;
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.part.tails.*;
|
||||
@@ -87,18 +87,18 @@ public class ModelTail extends ModelScaleRenderer {
|
||||
|
||||
if(this.entity.modelData.legParts.type == 2){
|
||||
rotationPointY = 13f;
|
||||
rotationPointZ = 14 * this.entity.modelData.legs.scaleZ;
|
||||
rotationPointZ = 14 * this.entity.modelData.modelScale.legs.scaleZ;
|
||||
|
||||
if(base.isSleeping(entity) || this.entity.currentAnimation == EnumAnimation.CRAWLING){
|
||||
rotationPointY = 12 + 16 * this.entity.modelData.legs.scaleZ;
|
||||
rotationPointZ = 1f * this.entity.modelData.legs.scaleY;
|
||||
rotationPointY = 12 + 16 * this.entity.modelData.modelScale.legs.scaleZ;
|
||||
rotationPointZ = 1f * this.entity.modelData.modelScale.legs.scaleY;
|
||||
|
||||
rotateAngleX = (float) (Math.PI / -4);
|
||||
}
|
||||
}
|
||||
else if(this.entity.modelData.legParts.type == 3){
|
||||
rotationPointY = 8.6f;
|
||||
rotationPointZ = 19 * this.entity.modelData.legs.scaleZ;
|
||||
rotationPointZ = 19 * this.entity.modelData.modelScale.legs.scaleZ;
|
||||
}
|
||||
else{
|
||||
rotationPointY = 11;
|
||||
|
||||
@@ -2,8 +2,8 @@ package noppes.npcs.client.model.part;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.util.Model2DRenderer;
|
||||
import noppes.npcs.client.model.util.ModelPartInterface;
|
||||
|
||||
@@ -4,8 +4,8 @@ import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.minecraft.client.model.ModelBox;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import noppes.npcs.ModelLimbConfig;
|
||||
import noppes.npcs.entity.data.ModelScalePart;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelScaleRenderer extends ModelRenderer {
|
||||
@@ -15,7 +15,7 @@ public class ModelScaleRenderer extends ModelRenderer {
|
||||
/** The GL display list rendered by the Tessellator for this model */
|
||||
public int displayList;
|
||||
|
||||
protected ModelLimbConfig config;
|
||||
protected ModelScalePart config;
|
||||
|
||||
public float x, y, z;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ModelScaleRenderer extends ModelRenderer {
|
||||
this.setTextureOffset(par2, par3);
|
||||
}
|
||||
|
||||
public void setConfig(ModelLimbConfig config, float x, float y, float z){
|
||||
public void setConfig(ModelScalePart config, float x, float y, float z){
|
||||
this.config = config;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
||||
@@ -145,17 +145,17 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight =
|
||||
itemstack == null ? 0 : npc.hurtResistantTime > 0 ? 3 : 1;
|
||||
|
||||
modelArmorChestplate.heldItemLeft = modelArmor.heldItemLeft = modelBipedMain.heldItemLeft =
|
||||
modelArmorChestplate.heldItemLeft = modelArmor.heldItemLeft = modelBipedMain.heldItemLeft =
|
||||
npc.getOffHand() == null ? 0 : npc.hurtResistantTime > 0 ? 3 : 1;
|
||||
|
||||
|
||||
modelArmorChestplate.isSneak = modelArmor.isSneak = modelBipedMain.isSneak = npc.isSneaking();
|
||||
|
||||
modelArmorChestplate.isSleeping = modelArmor.isSleeping = modelBipedMain.isSleeping = npc.isPlayerSleeping();
|
||||
modelArmorChestplate.isDancing = modelArmor.isDancing = modelBipedMain.isDancing = npc.currentAnimation == EnumAnimation.DANCING;
|
||||
modelArmorChestplate.aimedBow = modelArmor.aimedBow = modelBipedMain.aimedBow = npc.currentAnimation == EnumAnimation.AIMING;
|
||||
|
||||
|
||||
modelArmorChestplate.isRiding = modelArmor.isRiding = modelBipedMain.isRiding = npc.isRiding();
|
||||
|
||||
|
||||
double d3 = d1 - (double)npc.yOffset;
|
||||
if(npc.isSneaking())
|
||||
{
|
||||
@@ -185,7 +185,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
EntityCustomNpc cnpc = (EntityCustomNpc) npc;
|
||||
GL11.glTranslatef(0, cnpc.modelData.getBodyY(), 0);
|
||||
this.modelBipedMain.bipedHead.postRender(0.0625F);
|
||||
GL11.glScalef(cnpc.modelData.head.scaleX, cnpc.modelData.head.scaleY, cnpc.modelData.head.scaleZ);
|
||||
GL11.glScalef(cnpc.modelData.modelScale.head.scaleX, cnpc.modelData.modelScale.head.scaleY, cnpc.modelData.modelScale.head.scaleZ);
|
||||
}
|
||||
else
|
||||
this.modelBipedMain.bipedHead.postRender(0.0625F);
|
||||
@@ -218,8 +218,8 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
float x = 0;
|
||||
if(npc instanceof EntityCustomNpc){
|
||||
EntityCustomNpc cnpc = (EntityCustomNpc) npc;
|
||||
y = (cnpc.modelData.arms.scaleY - 1) * 0.7f;
|
||||
x = (1 - cnpc.modelData.body.scaleX) * 0.28f + (1 - cnpc.modelData.arms.scaleX) * 0.175f;
|
||||
y = (cnpc.modelData.modelScale.arms.scaleY - 1) * 0.7f;
|
||||
x = (1 - cnpc.modelData.modelScale.body.scaleX) * 0.28f + (1 - cnpc.modelData.modelScale.arms.scaleX) * 0.175f;
|
||||
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
||||
}
|
||||
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
|
||||
@@ -263,7 +263,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
|
||||
}
|
||||
|
||||
|
||||
if (npc.hurtResistantTime > 0 && npc.stats.resistances.playermelee > 1f)
|
||||
{
|
||||
GL11.glTranslatef(0.05F, 0.0F, -0.1F);
|
||||
@@ -309,7 +309,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
}
|
||||
else
|
||||
renderManager.itemRenderer.renderItem(npc, itemstack2, 0);
|
||||
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1, 1, 1, 1.0F);
|
||||
@@ -321,8 +321,8 @@ public class RenderNPCHumanMale extends RenderNPCInterface
|
||||
float x = 0;
|
||||
if(npc instanceof EntityCustomNpc){
|
||||
EntityCustomNpc cnpc = (EntityCustomNpc) npc;
|
||||
y = (cnpc.modelData.arms.scaleY - 1) * 0.7f;
|
||||
x = (1 - cnpc.modelData.body.scaleX) * -0.28f + (1 - cnpc.modelData.arms.scaleX) * -0.175f;
|
||||
y = (cnpc.modelData.modelScale.arms.scaleY - 1) * 0.7f;
|
||||
x = (1 - cnpc.modelData.modelScale.body.scaleX) * -0.28f + (1 - cnpc.modelData.modelScale.arms.scaleX) * -0.175f;
|
||||
GL11.glTranslatef(x, cnpc.modelData.getBodyY(), 0);
|
||||
}
|
||||
this.modelBipedMain.bipedLeftArm.postRender(0.0625F);
|
||||
|
||||
@@ -44,14 +44,15 @@ public enum EnumPacketServer {
|
||||
ScriptForgeSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptForgeGet(false),
|
||||
|
||||
ScriptNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptNPCGet(false),
|
||||
ScriptGlobalNPCSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptGlobalNPCGet(false),
|
||||
|
||||
ScriptItemDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, false),
|
||||
ScriptItemDataGet(false),
|
||||
|
||||
LinkedGetAll, LinkedRemove(CustomNpcsPermissions.GLOBAL_LINKED), LinkedAdd(CustomNpcsPermissions.GLOBAL_LINKED),
|
||||
ScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), ScriptDataGet(true),
|
||||
EventScriptDataSave(CustomNpcsPermissions.TOOL_SCRIPTER, true), EventScriptDataGet(true),
|
||||
PlayerDataRemove(CustomNpcsPermissions.GLOBAL_PLAYERDATA),
|
||||
BankSave(CustomNpcsPermissions.GLOBAL_BANK), BanksGet, BankGet,
|
||||
BankRemove(CustomNpcsPermissions.GLOBAL_BANK),
|
||||
@@ -84,7 +85,7 @@ public enum EnumPacketServer {
|
||||
|
||||
AnimationListGet, AnimationGet, AnimationAdd, AnimationDelete, AnimationSave,
|
||||
|
||||
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, UpdateTrackedQuest,
|
||||
RecipesGet, RecipeGet, QuestOpenGui, PlayerDataGet, QuestLogToServer,
|
||||
|
||||
RemoteNpcsGet(CustomNpcsPermissions.NPC_GUI),
|
||||
RemoteTpToNpc,QuestGet, QuestCategoryGet,
|
||||
@@ -92,7 +93,7 @@ public enum EnumPacketServer {
|
||||
NaturalSpawnGetAll, MailOpenSetup,
|
||||
DimensionsGet, DimensionTeleport, GetTileEntity, Gui, IsGuiOpen,
|
||||
|
||||
CustomGuiButton,CustomGuiSlotChange,CustomGuiScrollClick,CustomGuiClose,CustomGuiUnfocused,
|
||||
CustomGuiButton,CustomGuiScrollClick,CustomGuiClose,CustomGuiUnfocused,
|
||||
|
||||
ServerUpdateSkinOverlays;
|
||||
|
||||
|
||||
@@ -13,10 +13,12 @@ public enum EnumScriptType {
|
||||
KILLS("kills"),
|
||||
DIALOG_CLOSE("dialogClose"),
|
||||
TIMER("timer"),
|
||||
TARGET_LOST("targetLost"),
|
||||
PROJECTILE_TICK("projectileTick"),
|
||||
PROJECTILE_IMPACT("projectileImpact"),
|
||||
|
||||
ATTACKED("attacked"),
|
||||
ATTACK_MELEE("meleeAttack"),
|
||||
TARGET_LOST("targetLost"),
|
||||
ROLE("role"),
|
||||
RANGED_CHARGE("rangedCharge"),
|
||||
RANGED_LAUNCHED("rangedLaunched"),
|
||||
@@ -41,8 +43,6 @@ public enum EnumScriptType {
|
||||
TOSSED("tossed"),
|
||||
PICKEDUP("pickedUp"),
|
||||
PICKUP("pickUp"),
|
||||
PROJECTILE_TICK("projectileTick"),
|
||||
PROJECTILE_IMPACT("projectileImpact"),
|
||||
LEVEL_UP("levelUp"),
|
||||
KEY_PRESSED("keyPressed"),
|
||||
QUEST_EVENT("questEvent"),
|
||||
|
||||
@@ -7,9 +7,11 @@ package noppes.npcs.containers;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
@@ -44,9 +46,9 @@ public class ContainerCustomGui extends Container {
|
||||
while(var3.hasNext()) {
|
||||
IItemSlot slot = (IItemSlot)var3.next();
|
||||
if (slot.hasStack()) {
|
||||
this.addSlot(slot.getPosX(), slot.getPosY(), slot.getStack().getMCItemStack(), player.worldObj.isRemote);
|
||||
this.addSlot(player, slot.getPosX(), slot.getPosY(), slot, slot.getStack().getMCItemStack(), player.worldObj.isRemote);
|
||||
} else {
|
||||
this.addSlot(slot.getPosX(), slot.getPosY(), player.worldObj.isRemote);
|
||||
this.addSlot(player, slot.getPosX(), slot.getPosY(), slot, player.worldObj.isRemote);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,13 +77,13 @@ public class ContainerCustomGui extends Container {
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
void addSlot(int x, int y, boolean clientSide) {
|
||||
this.addSlotToContainer(new CustomGuiSlot(this.guiInventory, this.slotCount++, x, y, clientSide));
|
||||
void addSlot(EntityPlayer player, int x, int y, IItemSlot slot, boolean clientSide) {
|
||||
this.addSlotToContainer(new CustomGuiSlot(player, this.guiInventory, this.slotCount++, slot, x, y, clientSide));
|
||||
}
|
||||
|
||||
void addSlot(int x, int y, ItemStack itemStack, boolean clientSide) {
|
||||
void addSlot(EntityPlayer player, int x, int y, IItemSlot slot, ItemStack itemStack, boolean clientSide) {
|
||||
this.guiInventory.setInventorySlotContents(this.slotCount, itemStack);
|
||||
this.addSlotToContainer(new CustomGuiSlot(this.guiInventory, this.slotCount++, x, y, clientSide));
|
||||
this.addSlotToContainer(new CustomGuiSlot(player, this.guiInventory, this.slotCount++, slot, x, y, clientSide));
|
||||
}
|
||||
|
||||
void addPlayerInventory(EntityPlayer player, int x, int y) {
|
||||
@@ -108,16 +110,36 @@ public class ContainerCustomGui extends Container {
|
||||
public ItemStack slotClick(int slotId, int dragType, int clickTypeIn, EntityPlayer player) {
|
||||
if(slotId < 0)
|
||||
return super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
if(!player.worldObj.isRemote) {
|
||||
if(!EventHooks.onCustomGuiSlotClicked((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, slotId, dragType, clickTypeIn)) {
|
||||
Slot mcSlot = (Slot)this.inventorySlots.get(slotId);
|
||||
if(!player.worldObj.isRemote && mcSlot != null) {
|
||||
IItemSlot slot = null;
|
||||
if (this.getSlot(slotId) instanceof CustomGuiSlot) {
|
||||
slot = ((CustomGuiSlot)this.getSlot(slotId)).slot;
|
||||
}
|
||||
if(!EventHooks.onCustomGuiSlotClicked((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui, slotId, slot, dragType, clickTypeIn)) {
|
||||
ItemStack prevStack = mcSlot.getStack();
|
||||
if (slot != null) {
|
||||
prevStack = slot.getStack() == null ? null : slot.getStack().getMCItemStack();
|
||||
}
|
||||
ItemStack item = super.slotClick(slotId, dragType, clickTypeIn, player);
|
||||
|
||||
if (!ItemStack.areItemStacksEqual(prevStack,item)) {
|
||||
if (slot != null) {
|
||||
slot.setStack(NpcAPI.Instance().getIItemStack(mcSlot.getStack()));
|
||||
}
|
||||
if (player.openContainer instanceof ContainerCustomGui) {
|
||||
EventHooks.onCustomGuiSlot((IPlayer) NpcAPI.Instance().getIEntity(player), ((ContainerCustomGui)player.openContainer).customGui,
|
||||
mcSlot.slotNumber, prevStack, slot);
|
||||
}
|
||||
}
|
||||
|
||||
EntityPlayerMP p = (EntityPlayerMP) player;
|
||||
p.sendContainerToPlayer(this);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,19 +35,21 @@ public class PlayerQuestController {
|
||||
return data.finishedQuests.containsKey(questid);
|
||||
}
|
||||
|
||||
public static void addActiveQuest(Quest quest, EntityPlayer player) {
|
||||
public static void addActiveQuest(QuestData questData, EntityPlayer player) {
|
||||
PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData;
|
||||
if(canQuestBeAccepted(quest, player)){
|
||||
if (EventHooks.onQuestStarted(player, quest)) {
|
||||
if(canQuestBeAccepted(questData.quest, player)){
|
||||
if (EventHooks.onQuestStarted(player, questData.quest)) {
|
||||
return;
|
||||
}
|
||||
|
||||
data.activeQuests.put(quest.id,new QuestData(quest));
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.newquest", quest.title);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.newquest", ": ", quest.title);
|
||||
data.activeQuests.put(questData.quest.id,questData);
|
||||
if (questData.sendAlerts) {
|
||||
Server.sendData((EntityPlayerMP) player, EnumPacketClient.MESSAGE, "quest.newquest", questData.quest.title);
|
||||
Server.sendData((EntityPlayerMP) player, EnumPacketClient.CHAT, "quest.newquest", ": ", questData.quest.title);
|
||||
}
|
||||
} else {
|
||||
long timeUntilRepeat = quest.getTimeUntilRepeat(player);
|
||||
if (timeUntilRepeat > 0 && quest.getIsRepeatable() && quest.repeat != EnumQuestRepeat.NONE && quest.repeat != EnumQuestRepeat.REPEATABLE) {
|
||||
long timeUntilRepeat = questData.quest.getTimeUntilRepeat(player);
|
||||
if (timeUntilRepeat > 0 && questData.quest.getIsRepeatable() && questData.quest.repeat != EnumQuestRepeat.NONE && questData.quest.repeat != EnumQuestRepeat.REPEATABLE) {
|
||||
String timeString = NoppesUtilServer.millisToTime(timeUntilRepeat);
|
||||
String message = "You have " + timeString + " left until you can repeat this quest.";
|
||||
player.addChatMessage(new ChatComponentTranslation(NoppesStringUtils.formatText(message,player)));
|
||||
|
||||
@@ -204,6 +204,10 @@ public class ScriptContainer {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return init && !errored;
|
||||
}
|
||||
|
||||
public boolean hasCode() {
|
||||
return !this.getFullCode().isEmpty();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.data.ForgeDataScript;
|
||||
import noppes.npcs.controllers.data.NPCDataScript;
|
||||
import noppes.npcs.controllers.data.GlobalNPCDataScript;
|
||||
import noppes.npcs.controllers.data.PlayerDataScript;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptWorld;
|
||||
@@ -49,8 +49,8 @@ public class ScriptController {
|
||||
public ForgeDataScript forgeScripts = new ForgeDataScript();
|
||||
public long lastForgeUpdate = 0L;
|
||||
|
||||
public NPCDataScript npcScripts = new NPCDataScript((EntityNPCInterface) null);
|
||||
public long lastNpcUpdate = 0L;
|
||||
public GlobalNPCDataScript globalNpcScripts = new GlobalNPCDataScript((EntityNPCInterface) null);
|
||||
public long lastGlobalNpcUpdate = 0L;
|
||||
|
||||
public ScriptController(){
|
||||
loaded = false;
|
||||
@@ -137,15 +137,15 @@ public class ScriptController {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean loadNPCScripts() {
|
||||
this.npcScripts.clear();
|
||||
public boolean loadGlobalNPCScripts() {
|
||||
this.globalNpcScripts.clear();
|
||||
File file = this.npcScriptsFile();
|
||||
|
||||
try {
|
||||
if(!file.exists()) {
|
||||
return false;
|
||||
} else {
|
||||
this.npcScripts.readFromNBT(NBTJsonUtil.LoadFile(file));
|
||||
this.globalNpcScripts.readFromNBT(NBTJsonUtil.LoadFile(file));
|
||||
shouldSave = false;
|
||||
return true;
|
||||
}
|
||||
@@ -155,11 +155,11 @@ public class ScriptController {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveNpcScripts() {
|
||||
public void saveGlobalNpcScripts() {
|
||||
File file = this.npcScriptsFile();
|
||||
try {
|
||||
NBTJsonUtil.SaveFile(file, this.npcScripts.writeToNBT(new NBTTagCompound()));
|
||||
this.npcScripts.lastInited = -1L;
|
||||
NBTJsonUtil.SaveFile(file, this.globalNpcScripts.writeToNBT(new NBTTagCompound()));
|
||||
this.globalNpcScripts.lastInited = -1L;
|
||||
} catch (IOException | JsonException var4) {
|
||||
var4.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.NBTTags;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.ICustomNpc;
|
||||
import noppes.npcs.config.ConfigDebug;
|
||||
@@ -29,6 +30,8 @@ import javax.script.ScriptEngine;
|
||||
import java.util.*;
|
||||
|
||||
public class DataScript implements IScriptHandler {
|
||||
public List<ScriptContainer> eventScripts = new ArrayList();
|
||||
|
||||
public List<ScriptContainer> scripts = new ArrayList();
|
||||
private final static EntityType entities = new EntityType();
|
||||
private final static JobType jobs = new JobType();
|
||||
@@ -45,7 +48,7 @@ public class DataScript implements IScriptHandler {
|
||||
public boolean hasInited = false;
|
||||
|
||||
public DataScript(EntityNPCInterface npc) {
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
scripts.add(new ScriptContainer(this));
|
||||
}
|
||||
|
||||
@@ -72,6 +75,10 @@ public class DataScript implements IScriptHandler {
|
||||
enabled = compound.getBoolean("ScriptEnabled");
|
||||
}
|
||||
|
||||
public void readEventsFromNBT(NBTTagCompound compound) {
|
||||
eventScripts = NBTTags.GetScript(compound,this);
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("ScriptsContainers", writeScript(scripts));
|
||||
compound.setString("ScriptLanguage", scriptLanguage);
|
||||
@@ -79,9 +86,17 @@ public class DataScript implements IScriptHandler {
|
||||
return compound;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeEventsToNBT(NBTTagCompound compound) {
|
||||
compound.setInteger("TotalScripts",this.eventScripts.size());
|
||||
for (int i = 0; i < this.eventScripts.size(); i++) {
|
||||
compound.setTag("Tab"+i,this.eventScripts.get(i).writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
|
||||
private List<ScriptContainer> readScript(NBTTagList list){
|
||||
List<ScriptContainer> scripts = new ArrayList<>();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < 15; i++) {
|
||||
scripts.add(new ScriptContainer(this));
|
||||
}
|
||||
|
||||
@@ -118,10 +133,19 @@ public class DataScript implements IScriptHandler {
|
||||
}
|
||||
if(!isEnabled())
|
||||
return false;
|
||||
|
||||
if(!hasInited && !npc.isRemote() && type != EnumScriptType.INIT){
|
||||
hasInited = true;
|
||||
for (ScriptContainer scriptContainer : this.eventScripts) {
|
||||
scriptContainer.errored = false;
|
||||
}
|
||||
EventHooks.onNPCInit(this.npc);
|
||||
}
|
||||
|
||||
for (ScriptContainer script : this.eventScripts) {
|
||||
script.run(type, event);
|
||||
}
|
||||
|
||||
ScriptContainer script = scripts.get(type.ordinal());
|
||||
if(script == null || script.errored || !script.hasCode())
|
||||
return false;
|
||||
@@ -173,12 +197,10 @@ public class DataScript implements IScriptHandler {
|
||||
return enabled && ScriptController.HasStart && !npc.worldObj.isRemote && !scripts.isEmpty() && ConfigScript.ScriptingEnabled;
|
||||
}
|
||||
|
||||
public void setConsoleText(Map<Long, String> map) {}
|
||||
|
||||
public Map<Long, String> getConsoleText() {
|
||||
public Map<Long, String> getOldConsoleText() {
|
||||
Map<Long, String> map = new TreeMap();
|
||||
int tab = 0;
|
||||
Iterator var3 = this.getScripts().iterator();
|
||||
Iterator var3 = this.scripts.iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
ScriptContainer script = (ScriptContainer)var3.next();
|
||||
@@ -194,19 +216,28 @@ public class DataScript implements IScriptHandler {
|
||||
return map;
|
||||
}
|
||||
|
||||
public void clearConsole() {
|
||||
Iterator var1 = this.getScripts().iterator();
|
||||
public Map<Long, String> getConsoleText() {
|
||||
TreeMap<Long, String> map = new TreeMap<>();
|
||||
int tab = 0;
|
||||
for (ScriptContainer script : this.getScripts()) {
|
||||
++tab;
|
||||
|
||||
while(var1.hasNext()) {
|
||||
ScriptContainer script = (ScriptContainer)var1.next();
|
||||
for (Map.Entry<Long, String> longStringEntry : script.console.entrySet()) {
|
||||
map.put(longStringEntry.getKey(), " tab " + tab + ":\n" + longStringEntry.getValue());
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public void clearConsole() {
|
||||
for (ScriptContainer script : this.getScripts()) {
|
||||
script.console.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callScript(EnumScriptType var1, Event var2) {
|
||||
callScript(var1, var2, "$$IGNORED$$", null);
|
||||
public void callScript(EnumScriptType type, Event event) {
|
||||
callScript(type, event, "$$IGNORED$$", null);
|
||||
}
|
||||
|
||||
public boolean isClient() {
|
||||
@@ -234,7 +265,7 @@ public class DataScript implements IScriptHandler {
|
||||
}
|
||||
|
||||
public List<ScriptContainer> getScripts() {
|
||||
return this.scripts;
|
||||
return this.eventScripts;
|
||||
}
|
||||
|
||||
public String noticeString() {
|
||||
|
||||
+41
-41
@@ -17,7 +17,7 @@ import javax.annotation.CheckForNull;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.*;
|
||||
|
||||
public class NPCDataScript implements IScriptHandler {
|
||||
public class GlobalNPCDataScript implements IScriptHandler {
|
||||
public List<ScriptContainer> scripts = new ArrayList();
|
||||
public String scriptLanguage = "ECMAScript";
|
||||
private EntityNPCInterface npc;
|
||||
@@ -26,7 +26,7 @@ public class NPCDataScript implements IScriptHandler {
|
||||
private long lastNpcUpdate = -1L;
|
||||
public boolean enabled = false;
|
||||
|
||||
public NPCDataScript(EntityNPCInterface npc) {
|
||||
public GlobalNPCDataScript(EntityNPCInterface npc) {
|
||||
if(npc != null) {
|
||||
this.npc = npc;
|
||||
}
|
||||
@@ -62,9 +62,9 @@ public class NPCDataScript implements IScriptHandler {
|
||||
|
||||
public void callScript(EnumScriptType type, Event event) {
|
||||
if (this.isEnabled()) {
|
||||
if (ScriptController.Instance.lastLoaded > this.lastInited || ScriptController.Instance.lastNpcUpdate > this.lastNpcUpdate) {
|
||||
if (ScriptController.Instance.lastLoaded > this.lastInited || ScriptController.Instance.lastGlobalNpcUpdate > this.lastNpcUpdate) {
|
||||
this.lastInited = ScriptController.Instance.lastLoaded;
|
||||
this.lastNpcUpdate = ScriptController.Instance.lastNpcUpdate;
|
||||
this.lastNpcUpdate = ScriptController.Instance.lastGlobalNpcUpdate;
|
||||
|
||||
for (ScriptContainer script : this.scripts) {
|
||||
script.errored = false;
|
||||
@@ -109,7 +109,7 @@ public class NPCDataScript implements IScriptHandler {
|
||||
return "Global script";
|
||||
} else {
|
||||
BlockPos pos = new BlockPos(this.npc);
|
||||
return NPCDataScript.toStringHelper(this.npc).add("x", pos.getX()).add("y", pos.getY()).add("z", pos.getZ()).toString();
|
||||
return GlobalNPCDataScript.toStringHelper(this.npc).add("x", pos.getX()).add("y", pos.getY()).add("z", pos.getZ()).toString();
|
||||
}
|
||||
}
|
||||
public ICustomNpc getNpc() {
|
||||
@@ -140,61 +140,61 @@ public class NPCDataScript implements IScriptHandler {
|
||||
|
||||
public static final class ToStringHelper {
|
||||
private final String className;
|
||||
private final NPCDataScript.ToStringHelper.ValueHolder holderHead;
|
||||
private NPCDataScript.ToStringHelper.ValueHolder holderTail;
|
||||
private final GlobalNPCDataScript.ToStringHelper.ValueHolder holderHead;
|
||||
private GlobalNPCDataScript.ToStringHelper.ValueHolder holderTail;
|
||||
private boolean omitNullValues;
|
||||
private boolean omitEmptyValues;
|
||||
private ToStringHelper(String className) {
|
||||
this.holderHead = new NPCDataScript.ToStringHelper.ValueHolder();
|
||||
this.holderHead = new GlobalNPCDataScript.ToStringHelper.ValueHolder();
|
||||
this.holderTail = this.holderHead;
|
||||
this.omitNullValues = false;
|
||||
this.omitEmptyValues = false;
|
||||
this.className = (String) Preconditions.checkNotNull(className);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper omitNullValues() {
|
||||
public GlobalNPCDataScript.ToStringHelper omitNullValues() {
|
||||
this.omitNullValues = true;
|
||||
return this;
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, @CheckForNull Object value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, @CheckForNull Object value) {
|
||||
return this.addHolder(name, value);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, boolean value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, boolean value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, char value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, char value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, double value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, double value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, float value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, float value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, int value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, int value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper add(String name, long value) {
|
||||
public GlobalNPCDataScript.ToStringHelper add(String name, long value) {
|
||||
return this.addUnconditionalHolder(name, String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(@CheckForNull Object value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(@CheckForNull Object value) {
|
||||
return this.addHolder(value);
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(boolean value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(boolean value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(char value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(char value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(double value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(double value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(float value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(float value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(int value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(int value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
public NPCDataScript.ToStringHelper addValue(long value) {
|
||||
public GlobalNPCDataScript.ToStringHelper addValue(long value) {
|
||||
return this.addUnconditionalHolder(String.valueOf(value));
|
||||
}
|
||||
private static boolean isEmpty(Object value) {
|
||||
@@ -225,9 +225,9 @@ public class NPCDataScript implements IScriptHandler {
|
||||
boolean omitEmptyValuesSnapshot = this.omitEmptyValues;
|
||||
String nextSeparator = "";
|
||||
StringBuilder builder = (new StringBuilder(32)).append(this.className).append('{');
|
||||
for(NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.holderHead.next; valueHolder != null; valueHolder = valueHolder.next) {
|
||||
for(GlobalNPCDataScript.ToStringHelper.ValueHolder valueHolder = this.holderHead.next; valueHolder != null; valueHolder = valueHolder.next) {
|
||||
Object value = valueHolder.value;
|
||||
if (!(valueHolder instanceof NPCDataScript.ToStringHelper.UnconditionalValueHolder)) {
|
||||
if (!(valueHolder instanceof GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder)) {
|
||||
if (value == null) {
|
||||
if (omitNullValuesSnapshot) {
|
||||
continue;
|
||||
@@ -251,39 +251,39 @@ public class NPCDataScript implements IScriptHandler {
|
||||
}
|
||||
return builder.append('}').toString();
|
||||
}
|
||||
private NPCDataScript.ToStringHelper.ValueHolder addHolder() {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = new NPCDataScript.ToStringHelper.ValueHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper.ValueHolder addHolder() {
|
||||
GlobalNPCDataScript.ToStringHelper.ValueHolder valueHolder = new GlobalNPCDataScript.ToStringHelper.ValueHolder();
|
||||
this.holderTail = this.holderTail.next = valueHolder;
|
||||
return valueHolder;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addHolder(@CheckForNull Object value) {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper addHolder(@CheckForNull Object value) {
|
||||
GlobalNPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
valueHolder.value = value;
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addHolder(String name, @CheckForNull Object value) {
|
||||
NPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper addHolder(String name, @CheckForNull Object value) {
|
||||
GlobalNPCDataScript.ToStringHelper.ValueHolder valueHolder = this.addHolder();
|
||||
valueHolder.value = value;
|
||||
valueHolder.name = (String)Preconditions.checkNotNull(name);
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper.UnconditionalValueHolder addUnconditionalHolder() {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = new NPCDataScript.ToStringHelper.UnconditionalValueHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder addUnconditionalHolder() {
|
||||
GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = new GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder();
|
||||
this.holderTail = this.holderTail.next = valueHolder;
|
||||
return valueHolder;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addUnconditionalHolder(Object value) {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper addUnconditionalHolder(Object value) {
|
||||
GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
valueHolder.value = value;
|
||||
return this;
|
||||
}
|
||||
private NPCDataScript.ToStringHelper addUnconditionalHolder(String name, Object value) {
|
||||
NPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
private GlobalNPCDataScript.ToStringHelper addUnconditionalHolder(String name, Object value) {
|
||||
GlobalNPCDataScript.ToStringHelper.UnconditionalValueHolder valueHolder = this.addUnconditionalHolder();
|
||||
valueHolder.value = value;
|
||||
valueHolder.name = (String)Preconditions.checkNotNull(name);
|
||||
return this;
|
||||
}
|
||||
private static final class UnconditionalValueHolder extends NPCDataScript.ToStringHelper.ValueHolder {
|
||||
private static final class UnconditionalValueHolder extends GlobalNPCDataScript.ToStringHelper.ValueHolder {
|
||||
private UnconditionalValueHolder() {
|
||||
super();
|
||||
}
|
||||
@@ -294,12 +294,12 @@ public class NPCDataScript implements IScriptHandler {
|
||||
@CheckForNull
|
||||
Object value;
|
||||
@CheckForNull
|
||||
NPCDataScript.ToStringHelper.ValueHolder next;
|
||||
GlobalNPCDataScript.ToStringHelper.ValueHolder next;
|
||||
private ValueHolder() {
|
||||
}
|
||||
}
|
||||
}
|
||||
public static NPCDataScript.ToStringHelper toStringHelper(Object self) {
|
||||
return new NPCDataScript.ToStringHelper(self.getClass().getSimpleName());
|
||||
public static GlobalNPCDataScript.ToStringHelper toStringHelper(Object self) {
|
||||
return new GlobalNPCDataScript.ToStringHelper(self.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
@@ -124,18 +124,20 @@ public class PlayerQuestData implements IPlayerQuestData {
|
||||
|
||||
QuestInterface inter = data.quest.questInterface;
|
||||
if(inter.isCompleted(playerData)){
|
||||
if(!data.isCompleted){
|
||||
if(!data.quest.complete(player,data) || data.quest.completeText.isEmpty()){
|
||||
if((!data.isCompleted && data.quest.completion == EnumQuestCompletion.Npc) || data.quest.instantComplete(player,data)){
|
||||
if (data.quest.completeText.isEmpty() && data.sendAlerts) {
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.MESSAGE, "quest.completed", data.quest.title);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.CHAT, "quest.completed",": ",data.quest.title);
|
||||
}
|
||||
data.isCompleted = true;
|
||||
if (data.quest.completion == EnumQuestCompletion.Npc) {
|
||||
EventHooks.onQuestFinished(player, data.quest);
|
||||
}
|
||||
bo = true;
|
||||
EventHooks.onQuestFinished(player,data.quest);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
data.isCompleted = false;
|
||||
}
|
||||
}
|
||||
QuestItem.pickedUp = null;
|
||||
return bo;
|
||||
|
||||
@@ -130,9 +130,8 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
return QuestController.instance == null?null:QuestController.instance.quests.get(nextQuestid);
|
||||
}
|
||||
|
||||
public boolean complete(EntityPlayer player, QuestData data) {
|
||||
if(completion == EnumQuestCompletion.Instant){
|
||||
NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id);
|
||||
public boolean instantComplete(EntityPlayer player, QuestData data) {
|
||||
if(completion == EnumQuestCompletion.Instant && NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id)){
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,16 +5,19 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
public class QuestData {
|
||||
public Quest quest;
|
||||
public boolean isCompleted;
|
||||
public boolean sendAlerts = true;
|
||||
public NBTTagCompound extraData = new NBTTagCompound();
|
||||
public QuestData(Quest quest){
|
||||
this.quest = quest;
|
||||
}
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound){
|
||||
nbttagcompound.setBoolean("QuestCompleted", isCompleted);
|
||||
nbttagcompound.setBoolean("SendAlerts", sendAlerts);
|
||||
nbttagcompound.setTag("ExtraData", extraData);
|
||||
}
|
||||
public void readEntityFromNBT(NBTTagCompound nbttagcompound){
|
||||
isCompleted = nbttagcompound.getBoolean("QuestCompleted");
|
||||
sendAlerts = nbttagcompound.getBoolean("SendAlerts");
|
||||
extraData = nbttagcompound.getCompoundTag("ExtraData");
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.VersionCompatibility;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
|
||||
@@ -64,7 +64,7 @@ public class EntityCustomNpc extends EntityNPCFlying {
|
||||
public void updateHitbox() {
|
||||
Entity entity = modelData.getEntity(this);
|
||||
if(modelData == null || entity == null){
|
||||
baseHeight = 1.9f - modelData.getBodyY() + (modelData.head.scaleY - 1) / 2;
|
||||
baseHeight = 1.9f - modelData.getBodyY() + (modelData.modelScale.head.scaleY - 1) / 2;
|
||||
super.updateHitbox();
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
|
||||
@@ -57,6 +57,7 @@ import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.data.*;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.*;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.entity.ScriptNpc;
|
||||
import noppes.npcs.scripted.event.NpcEvent;
|
||||
import noppes.npcs.util.GameProfileAlt;
|
||||
@@ -69,7 +70,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
public static final GameProfileAlt chateventProfile = new GameProfileAlt();
|
||||
public static FakePlayer chateventPlayer;
|
||||
public static FakePlayer CommandPlayer;
|
||||
public DataDisplay display;
|
||||
public DataStats stats;
|
||||
public DataAI ai;
|
||||
@@ -551,6 +551,9 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
entity = null;
|
||||
else
|
||||
entity = event.getTarget().getMCEntity();
|
||||
} else {
|
||||
if(EventHooks.onNPCTargetLost(this, getAttackTarget(), entity))
|
||||
return;
|
||||
}
|
||||
if (entity != null && entity != this && ai.onAttack != 3 && !isAttacking()) {
|
||||
Line line = advanced.getAttackLine();
|
||||
@@ -901,6 +904,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
EntityUtil.Copy(this, chateventPlayer);
|
||||
chateventProfile.npc = this;
|
||||
chateventPlayer.refreshDisplayName();
|
||||
IItemStack stack = NpcAPI.Instance().createItem("minecraft:stone",0,1);
|
||||
chateventPlayer.setCurrentItemOrArmor(0, stack.getMCItemStack());
|
||||
return chateventPlayer;
|
||||
}
|
||||
|
||||
@@ -941,6 +946,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
stats.readToNBT(compound);
|
||||
ai.readToNBT(compound);
|
||||
script.readFromNBT(compound);
|
||||
script.readEventsFromNBT(compound);
|
||||
timers.readFromNBT(compound);
|
||||
if (compound.hasKey("ItemGiverId")) {
|
||||
itemGiverId = compound.getInteger("ItemGiverId");
|
||||
@@ -978,6 +984,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
stats.writeToNBT(compound);
|
||||
ai.writeToNBT(compound);
|
||||
script.writeToNBT(compound);
|
||||
script.writeEventsToNBT(compound);
|
||||
timers.writeToNBT(compound);
|
||||
advanced.writeToNBT(compound);
|
||||
if (advanced.role != EnumRoleType.None && roleInterface != null)
|
||||
@@ -1578,17 +1585,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
display.readToNBT(compound);
|
||||
}
|
||||
|
||||
public Entity func_174793_f() {
|
||||
if (this.worldObj.isRemote) {
|
||||
return this;
|
||||
} else {
|
||||
EntityUtil.Copy(this, CommandPlayer);
|
||||
CommandPlayer.setWorld(this.worldObj);
|
||||
CommandPlayer.setPosition(this.posX, this.posY, this.posZ);
|
||||
return CommandPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandSenderName() {
|
||||
return display.name;
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityAnimal, Item, EntityPlayer, InventoryPlayer,
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
|
||||
public class EntityNpcDragon extends EntityNPCInterface{
|
||||
public EntityNpcDragon(World world)
|
||||
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
|
||||
public class EntityNpcPony extends EntityNPCInterface
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@ package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
|
||||
public class EntityNpcSlime extends EntityNPCInterface{
|
||||
public EntityNpcSlime(World world)
|
||||
|
||||
@@ -25,10 +25,18 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.DataStats;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.api.IPos;
|
||||
import noppes.npcs.api.IWorld;
|
||||
import noppes.npcs.api.entity.IProjectile;
|
||||
import noppes.npcs.constants.EnumParticleType;
|
||||
import noppes.npcs.constants.EnumPotionType;
|
||||
import noppes.npcs.controllers.ScriptContainer;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.event.ProjectileEvent;
|
||||
import noppes.npcs.util.IProjectileCallback;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -76,10 +84,11 @@ public class EntityProjectile extends EntityThrowable {
|
||||
public EnumPotionType effect = EnumPotionType.None;
|
||||
public int duration = 5;
|
||||
public int amplify = 0;
|
||||
public int accuracy = 60;
|
||||
|
||||
public IProjectileCallback callback;
|
||||
public ItemStack callbackItem;
|
||||
|
||||
public List<ScriptContainer> scripts = new ArrayList<ScriptContainer>();
|
||||
|
||||
public EntityProjectile(World par1World)
|
||||
{
|
||||
@@ -209,6 +218,10 @@ public class EntityProjectile extends EntityThrowable {
|
||||
public void onUpdate()
|
||||
{
|
||||
super.onEntityUpdate();
|
||||
if(++ticksExisted % 10 == 0){
|
||||
EventHooks.onProjectileTick(this);
|
||||
}
|
||||
|
||||
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
|
||||
{
|
||||
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
@@ -432,11 +445,25 @@ public class EntityProjectile extends EntityThrowable {
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition movingobjectposition)
|
||||
{
|
||||
ProjectileEvent.ImpactEvent event;
|
||||
if(movingobjectposition.entityHit != null) {
|
||||
IPos pos = NpcAPI.Instance().getIPos(movingobjectposition.entityHit.posX,movingobjectposition.entityHit.posY,movingobjectposition.entityHit.posZ);
|
||||
event = new ProjectileEvent.ImpactEvent((IProjectile) NpcAPI.Instance().getIEntity(this), 0, movingobjectposition.entityHit);
|
||||
}
|
||||
else {
|
||||
IPos pos = NpcAPI.Instance().getIPos(movingobjectposition.blockX,movingobjectposition.blockY,movingobjectposition.blockZ);
|
||||
IWorld world = NpcAPI.Instance().getIWorld(this.worldObj);
|
||||
event = new ProjectileEvent.ImpactEvent((IProjectile) NpcAPI.Instance().getIEntity(this), 1, NpcAPI.Instance().getIBlock(world, pos));
|
||||
}
|
||||
if (movingobjectposition.entityHit != null) {
|
||||
if (callback != null && callbackItem != null && movingobjectposition.entityHit instanceof EntityLivingBase && callback.onImpact(this, (EntityLivingBase) movingobjectposition.entityHit, callbackItem)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
EventHooks.onProjectileImpact(this, event);
|
||||
|
||||
if (movingobjectposition.entityHit != null)
|
||||
{
|
||||
if(callback != null && callbackItem != null && movingobjectposition.entityHit instanceof EntityLivingBase && callback.onImpact(this, (EntityLivingBase)movingobjectposition.entityHit, callbackItem)){
|
||||
return;
|
||||
}
|
||||
float damage = this.damage;
|
||||
if(damage == 0)
|
||||
damage = 0.001f;
|
||||
@@ -695,6 +722,7 @@ public class EntityProjectile extends EntityThrowable {
|
||||
par1NBTTagCompound.setBoolean("accelerate", this.accelerate);
|
||||
par1NBTTagCompound.setByte("glows", this.dataWatcher.getWatchableObjectByte(24));
|
||||
par1NBTTagCompound.setBoolean("explosive", explosive);
|
||||
par1NBTTagCompound.setInteger("accuracy", accuracy);
|
||||
par1NBTTagCompound.setInteger("PotionEffect", effect.ordinal());
|
||||
par1NBTTagCompound.setString("trail", this.dataWatcher.getWatchableObjectString(22));
|
||||
par1NBTTagCompound.setByte("Render3D", this.dataWatcher.getWatchableObjectByte(28));
|
||||
@@ -724,6 +752,7 @@ public class EntityProjectile extends EntityThrowable {
|
||||
this.duration = par1NBTTagCompound.getInteger("effectDuration");
|
||||
this.accelerate = par1NBTTagCompound.getBoolean("accelerate");
|
||||
this.explosive = par1NBTTagCompound.getBoolean("explosive");
|
||||
this.accuracy = par1NBTTagCompound.getInteger("accuracy");
|
||||
this.effect = EnumPotionType.values()[par1NBTTagCompound.getInteger("PotionEffect") % EnumPotionType.values().length];
|
||||
this.dataWatcher.updateObject(22, par1NBTTagCompound.getString("trail"));
|
||||
this.dataWatcher.updateObject(23, Integer.valueOf(par1NBTTagCompound.getInteger("size")));
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs;
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -0,0 +1,415 @@
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.passive.EntityHorse;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.api.entity.data.IModelData;
|
||||
import noppes.npcs.api.entity.data.IModelRotate;
|
||||
import noppes.npcs.api.entity.data.IModelScale;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class ModelDataShared implements IModelData {
|
||||
public ModelScale modelScale = new ModelScale();
|
||||
|
||||
public boolean enableRotation = false;
|
||||
public ModelRotate rotation = new ModelRotate();
|
||||
|
||||
public ModelPartData legParts = new ModelPartData();
|
||||
|
||||
public Class<? extends EntityLivingBase> entityClass;
|
||||
public EntityLivingBase entity;
|
||||
|
||||
public NBTTagCompound extra = new NBTTagCompound();
|
||||
|
||||
private HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
public byte breasts = 0;
|
||||
|
||||
public byte headwear = 2;
|
||||
public byte bodywear = 0;
|
||||
// Hide Arm/Legwear [0: None, 1: Both, 2: Right, 3: Left],
|
||||
public byte armwear = 0;
|
||||
public byte legwear = 0;
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
public byte solidArmwear = 0;
|
||||
public byte solidLegwear = 0;
|
||||
|
||||
// Hide Body Parts [0: None, 1: Both, 2: Right, 3: Left],
|
||||
public byte hideHead = 0;
|
||||
public byte hideBody = 0;
|
||||
public byte hideArms = 0;
|
||||
public byte hideLegs = 0;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
||||
if(entityClass != null)
|
||||
compound.setString("EntityClass", entityClass.getCanonicalName());
|
||||
|
||||
compound = this.modelScale.writeToNBT(compound);
|
||||
|
||||
compound.setTag("LegParts", legParts.writeToNBT());
|
||||
|
||||
compound.setByte("Headwear", headwear);
|
||||
compound.setByte("Bodywear", bodywear);
|
||||
compound.setByte("Armwear", armwear);
|
||||
compound.setByte("Legwear", legwear);
|
||||
|
||||
compound.setByte("SolidArmwear", solidArmwear);
|
||||
compound.setByte("SolidLegwear", solidLegwear);
|
||||
|
||||
compound.setByte("hideHead", hideHead);
|
||||
compound.setByte("hideBody", hideBody);
|
||||
compound.setByte("hideArms", hideArms);
|
||||
compound.setByte("hideLegs", hideLegs);
|
||||
|
||||
compound.setBoolean("EnableRotation", enableRotation);
|
||||
if(enableRotation)
|
||||
compound.setTag("ModelRotation", rotation.writeToNBT());
|
||||
|
||||
compound.setByte("Breasts", breasts);
|
||||
compound.setTag("ExtraData", extra);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(String name : parts.keySet()){
|
||||
NBTTagCompound item = parts.get(name).writeToNBT();
|
||||
item.setString("PartName", name);
|
||||
list.appendTag(item);
|
||||
}
|
||||
compound.setTag("Parts", list);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
setEntity(compound.getString("EntityClass"));
|
||||
|
||||
this.modelScale.readFromNBT(compound);
|
||||
|
||||
legParts.readFromNBT(compound.getCompoundTag("LegParts"));
|
||||
|
||||
headwear = compound.getByte("Headwear");
|
||||
bodywear = compound.getByte("Bodywear");
|
||||
armwear = compound.getByte("Armwear");
|
||||
legwear = compound.getByte("Legwear");
|
||||
|
||||
solidArmwear = compound.getByte("SolidArmwear");
|
||||
solidLegwear = compound.getByte("SolidLegwear");
|
||||
|
||||
hideHead = compound.getByte("hideHead");
|
||||
hideBody = compound.getByte("hideBody");
|
||||
hideArms = compound.getByte("hideArms");
|
||||
hideLegs = compound.getByte("hideLegs");
|
||||
|
||||
enableRotation = compound.getBoolean("EnableRotation");
|
||||
if(enableRotation)
|
||||
rotation.readFromNBT(compound.getCompoundTag("ModelRotation"));
|
||||
|
||||
breasts = compound.getByte("Breasts");
|
||||
extra = compound.getCompoundTag("ExtraData");
|
||||
|
||||
HashMap<String,ModelPartData> parts = new HashMap<String,ModelPartData>();
|
||||
NBTTagList list = compound.getTagList("Parts", 10);
|
||||
for (int i = 0; i < list.tagCount(); i++) {
|
||||
NBTTagCompound item = list.getCompoundTagAt(i);
|
||||
ModelPartData part = new ModelPartData();
|
||||
part.readFromNBT(item);
|
||||
parts.put(item.getString("PartName"), part);
|
||||
}
|
||||
this.parts = parts;
|
||||
|
||||
}
|
||||
|
||||
public void setEntityClass(Class<? extends EntityLivingBase> entityClass){
|
||||
this.entityClass = entityClass;
|
||||
entity = null;
|
||||
extra = new NBTTagCompound();
|
||||
if(entityClass == EntityHorse.class)
|
||||
extra.setInteger("Type", -1);
|
||||
}
|
||||
|
||||
public Class<? extends EntityLivingBase> getEntityClass(){
|
||||
return entityClass;
|
||||
}
|
||||
|
||||
public float offsetY() {
|
||||
if(entity == null)
|
||||
return -getBodyY();
|
||||
return entity.height - 1.8f;
|
||||
}
|
||||
|
||||
public void clearEntity() {
|
||||
entity = null;
|
||||
}
|
||||
|
||||
|
||||
public ModelPartData getPartData(String type){
|
||||
return parts.get(type);
|
||||
}
|
||||
|
||||
public void removePart(String type) {
|
||||
parts.remove(type);
|
||||
}
|
||||
|
||||
public ModelPartData getOrCreatePart(String type) {
|
||||
ModelPartData part = parts.get(type);
|
||||
if(part == null)
|
||||
parts.put(type, part = new ModelPartData());
|
||||
return part;
|
||||
}
|
||||
|
||||
public float getBodyY(){
|
||||
if(legParts.type == 3)
|
||||
return (0.9f - modelScale.body.scaleY) * 0.75f + getLegsY();
|
||||
if(legParts.type == 3)
|
||||
return (0.5f - modelScale.body.scaleY) * 0.75f + getLegsY();
|
||||
return (1 - modelScale.body.scaleY) * 0.75f + getLegsY();
|
||||
}
|
||||
|
||||
public float getLegsY() {
|
||||
if(legParts.type == 3)
|
||||
return (0.87f - modelScale.legs.scaleY);
|
||||
return (1 - modelScale.legs.scaleY) * 0.75f;
|
||||
}
|
||||
|
||||
//0 - hidden, 1 - 2d, 2 - 3d
|
||||
public void headWear(byte config) {
|
||||
headwear = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
}
|
||||
|
||||
public byte headWear() {
|
||||
return this.headwear;
|
||||
}
|
||||
|
||||
//0 - hidden, 1 - 2d, 2 - 3d
|
||||
public void bodyWear(byte config) {
|
||||
bodywear = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
}
|
||||
|
||||
public byte bodyWear() {
|
||||
return this.bodywear;
|
||||
}
|
||||
|
||||
//0 - hidden, 1 - 2d, 2 - 3d
|
||||
public void rightArmWear(byte config) {
|
||||
config = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
|
||||
// Hide Arm/Legwear [0: None, 1: Both, 2: Right, 3: Left],
|
||||
if (config == 1 || config == 2) {
|
||||
if (armwear == 0)
|
||||
armwear = 2;
|
||||
else if (armwear == 3)
|
||||
armwear = 1;
|
||||
} else {
|
||||
if (armwear == 1)
|
||||
armwear = 3;
|
||||
else if (armwear == 2)
|
||||
armwear = 0;
|
||||
}
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
if (config == 1) {
|
||||
solidArmwear = 0;
|
||||
} else if (config == 2) {
|
||||
if (solidArmwear == 0) {
|
||||
solidArmwear = 2;
|
||||
} else if (solidArmwear == 3) {
|
||||
solidArmwear = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte rightArmWear() {
|
||||
if (armwear == 0 || armwear == 3) {
|
||||
return 0;
|
||||
} else if (solidArmwear == 1 || solidArmwear == 2) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
//0 - hidden, 1 - 2d, 2 - 3d
|
||||
public void leftArmWear(byte config) {
|
||||
config = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
|
||||
// Hide Arm/Legwear [0: None, 1: Both, 2: Right, 3: Left],
|
||||
if (config == 1 || config == 2) {
|
||||
if (armwear == 0)
|
||||
armwear = 3;
|
||||
else if (armwear == 2)
|
||||
armwear = 1;
|
||||
} else {
|
||||
if (armwear == 1)
|
||||
armwear = 2;
|
||||
else if (armwear == 3)
|
||||
armwear = 0;
|
||||
}
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
if (config == 1) {
|
||||
solidArmwear = 0;
|
||||
} else if (config == 2) {
|
||||
if (solidArmwear == 0) {
|
||||
solidArmwear = 3;
|
||||
} else if (solidArmwear == 2) {
|
||||
solidArmwear = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte leftArmWear() {
|
||||
if (armwear == 0 || armwear == 2) {
|
||||
return 0;
|
||||
} else if (solidArmwear == 1 || solidArmwear == 3) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void rightLegWear(byte config) {
|
||||
config = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
|
||||
// Hide Arm/Legwear [0: None, 1: Both, 2: Right, 3: Left],
|
||||
if (config == 1 || config == 2) {
|
||||
if (legwear == 0)
|
||||
legwear = 2;
|
||||
else if (legwear == 3)
|
||||
legwear = 1;
|
||||
} else {
|
||||
if (legwear == 1)
|
||||
legwear = 3;
|
||||
else if (legwear == 2)
|
||||
legwear = 0;
|
||||
}
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
if (config == 1) {
|
||||
solidLegwear = 0;
|
||||
} else if (config == 2) {
|
||||
if (solidLegwear == 0) {
|
||||
solidLegwear = 2;
|
||||
} else if (solidLegwear == 3) {
|
||||
solidLegwear = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte rightLegWear() {
|
||||
if (legwear == 0 || legwear == 3) {
|
||||
return 0;
|
||||
} else if (solidLegwear == 1 || solidLegwear == 2) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void leftLegWear(byte config) {
|
||||
config = ValueUtil.clamp(config, (byte)0, (byte)2);
|
||||
|
||||
// Hide Arm/Legwear [0: None, 1: Both, 2: Right, 3: Left],
|
||||
if (config == 1 || config == 2) {
|
||||
if (legwear == 0)
|
||||
legwear = 3;
|
||||
else if (legwear == 2)
|
||||
legwear = 1;
|
||||
} else {
|
||||
if (legwear == 1)
|
||||
legwear = 2;
|
||||
else if (legwear == 3)
|
||||
legwear = 0;
|
||||
}
|
||||
|
||||
// Solid or normal arm/legwear [0: None, 1: Both, 2: Right, 3: Left]
|
||||
if (config == 1) {
|
||||
solidLegwear = 0;
|
||||
} else if (config == 2) {
|
||||
if (solidLegwear == 0) {
|
||||
solidLegwear = 3;
|
||||
} else if (solidLegwear == 2) {
|
||||
solidLegwear = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public byte leftLegWear() {
|
||||
if (legwear == 0 || legwear == 2) {
|
||||
return 0;
|
||||
} else if (solidLegwear == 1 || solidLegwear == 3) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void hidePart(int part, byte hide) {
|
||||
part = ValueUtil.clamp(part,0,3);
|
||||
hide = part > 1 ? ValueUtil.clamp(hide,(byte) 0,(byte) 3) : ValueUtil.clamp(hide,(byte) 0,(byte) 1);
|
||||
switch (part) {
|
||||
case 0:
|
||||
this.hideHead = hide;
|
||||
break;
|
||||
case 1:
|
||||
this.hideBody = hide;
|
||||
break;
|
||||
case 2:
|
||||
this.hideArms = hide;
|
||||
break;
|
||||
case 3:
|
||||
this.hideLegs = hide;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public int hidden(int part) {
|
||||
part = ValueUtil.clamp(part,0,3);
|
||||
switch (part) {
|
||||
case 0:
|
||||
return this.hideHead;
|
||||
case 1:
|
||||
return this.hideBody;
|
||||
case 2:
|
||||
return this.hideArms;
|
||||
case 3:
|
||||
return this.hideLegs;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void enableRotation(boolean enableRotation) {
|
||||
this.enableRotation = enableRotation;
|
||||
}
|
||||
|
||||
public boolean enableRotation() {
|
||||
return this.enableRotation;
|
||||
}
|
||||
|
||||
public IModelRotate getRotation() {
|
||||
return this.rotation;
|
||||
}
|
||||
|
||||
public IModelScale getScale() {
|
||||
return this.modelScale;
|
||||
}
|
||||
|
||||
public void setEntity(String string) {
|
||||
entityClass = null;
|
||||
entity = null;
|
||||
try {
|
||||
Class<?> cls = Class.forName(string);
|
||||
if (EntityLivingBase.class.isAssignableFrom(cls))
|
||||
entityClass = cls.asSubclass(EntityLivingBase.class);
|
||||
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
public String getEntity() {
|
||||
return entityClass == null ? null : entityClass.getName();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package noppes.npcs;
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
+45
-2
@@ -1,9 +1,11 @@
|
||||
package noppes.npcs;
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IModelRotate;
|
||||
import noppes.npcs.api.entity.data.IModelRotatePart;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelRotate {
|
||||
public class ModelRotate implements IModelRotate {
|
||||
// Rotation
|
||||
public boolean whileStanding = true;
|
||||
public boolean whileAttacking = false;
|
||||
@@ -42,4 +44,45 @@ public class ModelRotate {
|
||||
lleg.readFromNBT(compound.getCompoundTag("PuppetLLeg"));
|
||||
}
|
||||
|
||||
public boolean whileStanding() {
|
||||
return this.whileStanding;
|
||||
}
|
||||
|
||||
public void whileStanding(boolean whileStanding) {
|
||||
this.whileStanding = whileStanding;
|
||||
}
|
||||
|
||||
public boolean whileAttacking() {
|
||||
return this.whileAttacking;
|
||||
}
|
||||
|
||||
public void whileAttacking(boolean whileAttacking) {
|
||||
this.whileAttacking = whileAttacking;
|
||||
}
|
||||
|
||||
public boolean whileMoving() {
|
||||
return this.whileMoving;
|
||||
}
|
||||
|
||||
public void whileMoving(boolean whileMoving) {
|
||||
this.whileMoving = whileMoving;
|
||||
}
|
||||
|
||||
public IModelRotatePart getPart(int part) {
|
||||
switch (ValueUtil.clamp(part,0,5)) {
|
||||
case 0:
|
||||
return head;
|
||||
case 1:
|
||||
return body;
|
||||
case 2:
|
||||
return larm;
|
||||
case 3:
|
||||
return rarm;
|
||||
case 4:
|
||||
return lleg;
|
||||
case 5:
|
||||
return rleg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IModelRotatePart;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelRotatePart implements IModelRotatePart {
|
||||
public float rotationX = 0f, rotationY = 0f, rotationZ = 0f;
|
||||
public boolean disabled = false;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("Disabled", disabled);
|
||||
compound.setFloat("RotationX", rotationX);
|
||||
compound.setFloat("RotationY", rotationY);
|
||||
compound.setFloat("RotationZ", rotationZ);
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
disabled = compound.getBoolean("Disabled");
|
||||
rotationX = ValueUtil.clamp(compound.getFloat("RotationX"), -0.5f, 0.5f);
|
||||
rotationY = ValueUtil.clamp(compound.getFloat("RotationY"), -0.5f, 0.5f);
|
||||
rotationZ = ValueUtil.clamp(compound.getFloat("RotationZ"), -0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public void setRotation(float x, float y, float z) {
|
||||
this.rotationX = ValueUtil.clamp(x, -0.5f, 0.5f);
|
||||
this.rotationY = ValueUtil.clamp(y, -0.5f, 0.5f);
|
||||
this.rotationZ = ValueUtil.clamp(z, -0.5f, 0.5f);
|
||||
}
|
||||
|
||||
public float getRotateX() {
|
||||
return this.rotationX;
|
||||
}
|
||||
|
||||
public float getRotateY() {
|
||||
return this.rotationY;
|
||||
}
|
||||
|
||||
public float getRotateZ() {
|
||||
return this.rotationZ;
|
||||
}
|
||||
|
||||
public void disabled(boolean disabled) {
|
||||
this.disabled = disabled;
|
||||
}
|
||||
|
||||
public boolean disabled() {
|
||||
return this.disabled;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IModelScale;
|
||||
import noppes.npcs.api.entity.data.IModelScalePart;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelScale implements IModelScale {
|
||||
public ModelScalePart head = new ModelScalePart();
|
||||
public ModelScalePart body = new ModelScalePart();
|
||||
public ModelScalePart arms = new ModelScalePart();
|
||||
public ModelScalePart legs = new ModelScalePart();
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
|
||||
compound.setTag("HeadConfig", head.writeToNBT());
|
||||
compound.setTag("BodyConfig", body.writeToNBT());
|
||||
compound.setTag("ArmsConfig", arms.writeToNBT());
|
||||
compound.setTag("LegsConfig", legs.writeToNBT());
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
head.readFromNBT(compound.getCompoundTag("HeadConfig"));
|
||||
body.readFromNBT(compound.getCompoundTag("BodyConfig"));
|
||||
arms.readFromNBT(compound.getCompoundTag("ArmsConfig"));
|
||||
legs.readFromNBT(compound.getCompoundTag("LegsConfig"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelScalePart getPart(int part) {
|
||||
switch (ValueUtil.clamp(part,0,3)) {
|
||||
case 0:
|
||||
return head;
|
||||
case 1:
|
||||
return body;
|
||||
case 2:
|
||||
return arms;
|
||||
case 3:
|
||||
return legs;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+23
-13
@@ -1,41 +1,51 @@
|
||||
package noppes.npcs;
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.entity.data.IModelScalePart;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
public class ModelLimbConfig {
|
||||
|
||||
public class ModelScalePart implements IModelScalePart {
|
||||
public float scaleX = 1, scaleY = 1, scaleZ = 1;
|
||||
public boolean shared = false;
|
||||
|
||||
public NBTTagCompound writeToNBT(){
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setFloat("ScaleX", scaleX);
|
||||
compound.setFloat("ScaleY", scaleY);
|
||||
compound.setFloat("ScaleZ", scaleZ);
|
||||
compound.setBoolean("Shared", shared);
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
scaleX = ValueUtil.correctFloat(compound.getFloat("ScaleX"), 0.5f, 1.5f);
|
||||
scaleY = ValueUtil.correctFloat(compound.getFloat("ScaleY"), 0.5f, 1.5f);
|
||||
scaleZ = ValueUtil.correctFloat(compound.getFloat("ScaleZ"), 0.5f, 1.5f);
|
||||
scaleX = ValueUtil.clamp(compound.getFloat("ScaleX"), 0.5f, 1.5f);
|
||||
scaleY = ValueUtil.clamp(compound.getFloat("ScaleY"), 0.5f, 1.5f);
|
||||
scaleZ = ValueUtil.clamp(compound.getFloat("ScaleZ"), 0.5f, 1.5f);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "ScaleX: " + scaleX + " - ScaleY: " + scaleY + " - ScaleZ: " + scaleZ;
|
||||
}
|
||||
|
||||
public void setScale(float x, float y, float z) {
|
||||
scaleX = x;
|
||||
scaleY = y;
|
||||
scaleZ = z;
|
||||
}
|
||||
public void setScale(float x, float y) {
|
||||
scaleZ = scaleX = x;
|
||||
scaleY = y;
|
||||
}
|
||||
|
||||
public void setScale(float x, float y, float z) {
|
||||
scaleX = ValueUtil.clamp(x, 0.5f, 1.5f);
|
||||
scaleY = ValueUtil.clamp(y, 0.5f, 1.5f);
|
||||
scaleZ = ValueUtil.clamp(z, 0.5f, 1.5f);
|
||||
}
|
||||
|
||||
public float getScaleX() {
|
||||
return scaleX;
|
||||
}
|
||||
|
||||
public float getScaleY() {
|
||||
return scaleY;
|
||||
}
|
||||
|
||||
public float getScaleZ() {
|
||||
return scaleZ;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -35,10 +35,10 @@ public class EntityNPCDwarfFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(0.8f,1.05f);
|
||||
data.arms.setScale(0.8f,1.05f);
|
||||
data.body.setScale(0.8f,1.05f);
|
||||
data.head.setScale(0.8f,0.85f);
|
||||
data.modelScale.legs.setScale(0.8f,1.05f);
|
||||
data.modelScale.arms.setScale(0.8f,1.05f);
|
||||
data.modelScale.body.setScale(0.8f,1.05f);
|
||||
data.modelScale.head.setScale(0.8f,0.85f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -34,10 +34,10 @@ public class EntityNPCDwarfMale extends EntityNPCInterface
|
||||
EntityCustomNpc npc = new EntityCustomNpc(worldObj);
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.legs.setScale(1.1f,0.7f, 0.9f);
|
||||
data.arms.setScale(0.9f,0.7f);
|
||||
data.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.head.setScale(0.85f,0.85f);
|
||||
data.modelScale.legs.setScale(1.1f,0.7f, 0.9f);
|
||||
data.modelScale.arms.setScale(0.9f,0.7f);
|
||||
data.modelScale.body.setScale(1.2f, 0.7f, 1.5f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -37,10 +37,10 @@ public class EntityNPCElfFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(0.8f,1.05f);
|
||||
data.arms.setScale(0.8f,1.05f);
|
||||
data.body.setScale(0.8f,1.05f);
|
||||
data.head.setScale(0.8f,0.85f);
|
||||
data.modelScale.legs.setScale(0.8f,1.05f);
|
||||
data.modelScale.arms.setScale(0.8f,1.05f);
|
||||
data.modelScale.body.setScale(0.8f,1.05f);
|
||||
data.modelScale.head.setScale(0.8f,0.85f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -36,10 +36,10 @@ public class EntityNPCElfMale extends EntityNPCInterface
|
||||
EntityCustomNpc npc = new EntityCustomNpc(worldObj);
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.legs.setScale(0.85f,1.15f);
|
||||
data.arms.setScale(0.85f,1.15f);
|
||||
data.body.setScale(0.85f,1.15f);
|
||||
data.head.setScale(0.85f,0.95f);
|
||||
data.modelScale.legs.setScale(0.85f,1.15f);
|
||||
data.modelScale.arms.setScale(0.85f,1.15f);
|
||||
data.modelScale.body.setScale(0.85f,1.15f);
|
||||
data.modelScale.head.setScale(0.85f,0.95f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -7,7 +7,7 @@ package noppes.npcs.entity.old;
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
@@ -6,8 +6,8 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -35,10 +35,10 @@ public class EntityNPCFurryFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
ModelPartData hair = data.getOrCreatePart("ears");
|
||||
hair.playerTexture = true;
|
||||
ModelPartData snout = data.getOrCreatePart("snout");
|
||||
|
||||
@@ -6,8 +6,8 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -34,10 +34,10 @@ public class EntityNPCHumanFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -34,10 +34,10 @@ public class EntityNPCOrcFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.legs.setScale(0.9f,0.65f);
|
||||
data.arms.setScale(0.9f,0.65f);
|
||||
data.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.head.setScale(0.85f,0.85f);
|
||||
data.modelScale.legs.setScale(0.9f,0.65f);
|
||||
data.modelScale.arms.setScale(0.9f,0.65f);
|
||||
data.modelScale.body.setScale(1f, 0.65f, 1.1f);
|
||||
data.modelScale.head.setScale(0.85f,0.85f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -34,10 +34,10 @@ public class EntityNPCOrcMale extends EntityNPCInterface
|
||||
EntityCustomNpc npc = new EntityCustomNpc(worldObj);
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.legs.setScale(1.2f,1.05f);
|
||||
data.arms.setScale(1.2f,1.05f);
|
||||
data.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.head.setScale(1.2f,1.1f);
|
||||
data.modelScale.legs.setScale(1.2f,1.05f);
|
||||
data.modelScale.arms.setScale(1.2f,1.05f);
|
||||
data.modelScale.body.setScale(1.4f, 1.1f, 1.5f);
|
||||
data.modelScale.head.setScale(1.2f,1.1f);
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
super.onUpdate();
|
||||
|
||||
@@ -7,7 +7,7 @@ package noppes.npcs.entity.old;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -34,8 +34,8 @@ public class EntityNpcEnderchibi extends EntityNPCInterface
|
||||
EntityCustomNpc npc = new EntityCustomNpc(worldObj);
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.legs.setScale(0.65f,0.75f);
|
||||
data.arms.setScale(0.50f,1.45f);
|
||||
data.modelScale.legs.setScale(0.65f,0.75f);
|
||||
data.modelScale.arms.setScale(0.50f,1.45f);
|
||||
ModelPartData part = data.getOrCreatePart("particles");
|
||||
part.playerTexture = true;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -35,10 +35,10 @@ public class EntityNpcMonsterFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
npc.ai.animationType = EnumAnimation.HUG;
|
||||
worldObj.spawnEntityInWorld(npc);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -35,10 +35,10 @@ public class EntityNpcNagaFemale extends EntityNPCInterface
|
||||
npc.readFromNBT(compound);
|
||||
ModelData data = npc.modelData;
|
||||
data.breasts = 2;
|
||||
data.head.setScale(0.95f,0.95f);
|
||||
data.legs.setScale(0.92f,0.92f);
|
||||
data.arms.setScale(0.80f,0.92f);
|
||||
data.body.setScale(0.92f, 0.92f);
|
||||
data.modelScale.head.setScale(0.95f,0.95f);
|
||||
data.modelScale.legs.setScale(0.92f,0.92f);
|
||||
data.modelScale.arms.setScale(0.80f,0.92f);
|
||||
data.modelScale.body.setScale(0.92f, 0.92f);
|
||||
ModelPartData legs = data.legParts;
|
||||
legs.playerTexture = true;
|
||||
legs.type = 1;
|
||||
|
||||
@@ -6,8 +6,8 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.ModelPartData;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
Loaded 100 of 121 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user