mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 14:19:49 +00:00
Merge branch 'master' into dev
# Conflicts: # src/main/java/noppes/npcs/scripted/ScriptFaction.java # src/main/java/noppes/npcs/scripted/ScriptWorld.java # src/main/java/noppes/npcs/scripted/entity/ScriptNpc.java # src/main/java/noppes/npcs/scripted/entity/ScriptPlayer.java # src/main/java/noppes/npcs/scripted/interfaces/IEntity.java # src/main/java/noppes/npcs/scripted/interfaces/IWorld.java # src/main/java/noppes/npcs/scripted/interfaces/entity/ICustomNpc.java # src/main/java/noppes/npcs/scripted/interfaces/entity/IPlayer.java
This commit is contained in:
commit
ec5fc71413
300 files changed
+9920
-2959
No files matched your search
@@ -48,7 +48,7 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
}
|
||||
}
|
||||
|
||||
if(heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit){
|
||||
if (heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit) {
|
||||
super.moveEntityWithHeading(p_70612_1_,p_70612_2_);
|
||||
return;
|
||||
}
|
||||
@@ -57,9 +57,6 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
|
||||
super.moveEntityWithHeading(p_70612_1_, p_70612_2_);
|
||||
this.motionY = d3;
|
||||
|
||||
this.fallDistance = 0.0F;
|
||||
this.velocityChanged = true;
|
||||
|
||||
if(this.getNavigator().noPath())
|
||||
this.motionY = 0.0D;
|
||||
}
|
||||
|
||||
@@ -61,19 +61,18 @@ import noppes.npcs.constants.EnumNavType;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.constants.EnumPotionType;
|
||||
import noppes.npcs.constants.EnumRoleType;
|
||||
import noppes.npcs.constants.EnumScriptType;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.controllers.Dialog;
|
||||
import noppes.npcs.controllers.DialogOption;
|
||||
import noppes.npcs.controllers.Faction;
|
||||
import noppes.npcs.controllers.data.Dialog;
|
||||
import noppes.npcs.controllers.data.DialogOption;
|
||||
import noppes.npcs.controllers.data.Faction;
|
||||
import noppes.npcs.controllers.FactionController;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.controllers.data.Line;
|
||||
import noppes.npcs.controllers.LinkedNpcController;
|
||||
import noppes.npcs.controllers.LinkedNpcController.LinkedData;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
import noppes.npcs.controllers.PlayerQuestData;
|
||||
import noppes.npcs.controllers.QuestData;
|
||||
import noppes.npcs.controllers.TransformData;
|
||||
import noppes.npcs.controllers.data.PlayerQuestData;
|
||||
import noppes.npcs.controllers.data.QuestData;
|
||||
import noppes.npcs.controllers.data.DataTransform;
|
||||
import noppes.npcs.entity.data.DataTimers;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
@@ -86,7 +85,7 @@ import noppes.npcs.scripted.event.ScriptEventAttack;
|
||||
import noppes.npcs.scripted.event.ScriptEventDamaged;
|
||||
import noppes.npcs.scripted.event.ScriptEventKilled;
|
||||
import noppes.npcs.scripted.event.ScriptEventTarget;
|
||||
import noppes.npcs.scripted.interfaces.ICustomNpc;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
import noppes.npcs.util.GameProfileAlt;
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
|
||||
@@ -102,7 +101,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public DataAdvanced advanced;
|
||||
public DataInventory inventory;
|
||||
public DataScript script;
|
||||
public TransformData transform;
|
||||
public DataTransform transform;
|
||||
public DataTimers timers;
|
||||
|
||||
public String linkedName = "";
|
||||
@@ -165,8 +164,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
setSize(1, 1);
|
||||
this.updateTasks();
|
||||
|
||||
if (!this.isRemote()) {
|
||||
this.wrappedNPC = new ScriptNpc(this);
|
||||
if (!this.isRemote() && this.wrappedNPC == null) {
|
||||
this.wrappedNPC = new ScriptNpc<>(this);
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
@@ -183,7 +182,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
ai = new DataAI(this);
|
||||
advanced = new DataAdvanced(this);
|
||||
inventory = new DataInventory(this);
|
||||
transform = new TransformData(this);
|
||||
transform = new DataTransform(this);
|
||||
script = new DataScript(this);
|
||||
timers = new DataTimers(this);
|
||||
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage);
|
||||
@@ -232,7 +231,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
public int getMaxSafePointTries()
|
||||
{
|
||||
return 5;
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -426,13 +425,13 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
protected void updateAITasks()
|
||||
{
|
||||
this.getNavigator().onUpdateNavigation();
|
||||
this.getMoveHelper().onUpdateMoveHelper();
|
||||
|
||||
try {
|
||||
super.updateAITasks();
|
||||
} catch (ConcurrentModificationException ignored){
|
||||
}
|
||||
|
||||
this.getNavigator().onUpdateNavigation();
|
||||
this.getMoveHelper().onUpdateMoveHelper();
|
||||
}
|
||||
|
||||
public void addInteract(EntityLivingBase entity){
|
||||
@@ -631,7 +630,6 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
|
||||
if (canFly()) {
|
||||
this.getNavigator().setCanSwim(true);
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
} else {
|
||||
this.tasks.addTask(0, new EntityAIWaterNav(this));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package noppes.npcs.entity.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class DataSkinOverlays implements IOverlayHandler {
|
||||
public final Object parent;
|
||||
public HashMap<Integer, ISkinOverlay> overlayList = new HashMap<>();
|
||||
|
||||
public DataSkinOverlays(Object parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbtTagCompound) {
|
||||
HashMap<Integer,ISkinOverlay> skinOverlays = new HashMap<>();
|
||||
NBTTagList skinOverlayList = nbtTagCompound.getTagList("SkinOverlayData",10);
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
SkinOverlay skinOverlay = (SkinOverlay) SkinOverlay.overlayFromNBT(skinOverlayList.getCompoundTagAt(i));
|
||||
skinOverlay.parent = this;
|
||||
skinOverlays.put(tagID, skinOverlay);
|
||||
}
|
||||
this.overlayList = skinOverlays;
|
||||
this.updateClient();
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
NBTTagList overlayList = new NBTTagList();
|
||||
if (!this.overlayList.isEmpty()) {
|
||||
for (Map.Entry<Integer,ISkinOverlay> overlayData : this.overlayList.entrySet()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("SkinOverlayID", overlayData.getKey());
|
||||
compound = ((SkinOverlay) overlayData.getValue()).writeToNBT(compound);
|
||||
overlayList.appendTag(compound);
|
||||
}
|
||||
}
|
||||
nbttagcompound.setTag("SkinOverlayData",overlayList);
|
||||
return nbttagcompound;
|
||||
}
|
||||
|
||||
public void updateClient() {
|
||||
if (parent instanceof PlayerData) {
|
||||
NBTTagCompound compound = this.writeToNBT(new NBTTagCompound());
|
||||
((PlayerData) parent).player.getEntityData().setTag("SkinOverlayData", compound.getTagList("SkinOverlayData",10));
|
||||
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, ((PlayerData) parent).player.getEntityId(), compound);
|
||||
} else if (parent instanceof EntityNPCInterface) {
|
||||
((EntityNPCInterface) parent).updateClient = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void add(int id, ISkinOverlay data) {
|
||||
((SkinOverlay) data).parent = this;
|
||||
this.overlayList.put(id, data);
|
||||
updateClient();
|
||||
}
|
||||
|
||||
public ISkinOverlay get(int id) {
|
||||
return this.overlayList.get(id);
|
||||
}
|
||||
|
||||
public boolean has(int id) {
|
||||
return this.overlayList.containsKey(id);
|
||||
}
|
||||
|
||||
public boolean remove(int id) {
|
||||
boolean removed = this.overlayList.remove(id) != null;
|
||||
updateClient();
|
||||
return removed;
|
||||
}
|
||||
|
||||
public int size() { return this.overlayList.size(); }
|
||||
|
||||
public void clear() {
|
||||
this.overlayList.clear();
|
||||
updateClient();
|
||||
}
|
||||
}
|
||||
@@ -14,11 +14,11 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.EventHooks;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.interfaces.ITimers;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.data.PlayerData;
|
||||
import noppes.npcs.scripted.CustomNPCsException;
|
||||
|
||||
public class DataTimers implements ITimers {
|
||||
private Object parent;
|
||||
private final Object parent;
|
||||
private Map<Integer, DataTimers.Timer> timers = new HashMap();
|
||||
|
||||
public DataTimers(Object parent) {
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
public class EntityNPCEnderman extends EntityNpcEnderchibi
|
||||
@@ -17,7 +18,11 @@ public class EntityNPCEnderman extends EntityNpcEnderchibi
|
||||
{
|
||||
super(world);
|
||||
display.texture = "customnpcs:textures/entity/enderman/enderman.png";
|
||||
display.glowTexture = "customnpcs:textures/overlays/ender_eyes.png";
|
||||
//display.glowTexture = ;
|
||||
display.skinOverlayData.overlayList.put(0,new SkinOverlay(
|
||||
"customnpcs:textures/overlays/ender_eyes.png", true, 1.0F, 1.0F, 0.0F, 0.0F,
|
||||
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
|
||||
));
|
||||
this.width = 0.6F;
|
||||
this.height = 2.9F;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user