mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 19:55:06 +00:00
Fixed SkinOverlay objects not having their parent object initialized correctly.
This commit is contained in:
1 parent
6220a8ce14
commit
b6c62332ed
14 files changed
+29
-40
No files matched your search
@@ -8,10 +8,9 @@ import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
import noppes.npcs.util.ValueUtil;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
@@ -140,7 +139,7 @@ public class DataDisplay {
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData") && !glowTexture.isEmpty()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("SkinOverlayID", 0); //unique glow texture ID
|
||||
(new SkinOverlayData(glowTexture)).writeToNBT(nbttagcompound);
|
||||
(new SkinOverlay(glowTexture)).writeToNBT(nbttagcompound);
|
||||
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData")) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
|
||||
@@ -12,12 +12,12 @@ import noppes.npcs.Server;
|
||||
import noppes.npcs.client.gui.customoverlay.OverlayCustom;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import cpw.mods.fml.common.network.internal.FMLProxyPacket;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
|
||||
public class Client {
|
||||
public static HashMap<Integer, OverlayCustom> customOverlays = new HashMap<>();
|
||||
|
||||
public static HashMap<UUID, HashMap<Integer, SkinOverlayData>> skinOverlays = new HashMap<>();
|
||||
public static HashMap<UUID, HashMap<Integer, SkinOverlay>> skinOverlays = new HashMap<>();
|
||||
public static HashMap<UUID, Long> entitySkinOverlayTicks = new HashMap<>();
|
||||
|
||||
public static void sendData(EnumPacketServer enu, Object... obs) {
|
||||
|
||||
@@ -36,7 +36,7 @@ import noppes.npcs.constants.EnumPlayerPacket;
|
||||
import noppes.npcs.controllers.Dialog;
|
||||
import noppes.npcs.controllers.DialogController;
|
||||
import noppes.npcs.controllers.Quest;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import org.lwjgl.Sys;
|
||||
@@ -73,12 +73,12 @@ public class NoppesUtil {
|
||||
}
|
||||
|
||||
public static void updateSkinOverlayData(EntityPlayer player, NBTTagCompound compound) {
|
||||
HashMap<Integer, SkinOverlayData> skinOverlays = new HashMap<>();
|
||||
HashMap<Integer, SkinOverlay> skinOverlays = new HashMap<>();
|
||||
NBTTagList skinOverlayList = compound.getTagList("SkinOverlayData",10);
|
||||
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
skinOverlays.put(tagID, (SkinOverlayData) SkinOverlayData.overlayFromNBT(skinOverlayList.getCompoundTagAt(i)));
|
||||
skinOverlays.put(tagID, (SkinOverlay) SkinOverlay.overlayFromNBT(skinOverlayList.getCompoundTagAt(i)));
|
||||
}
|
||||
Client.skinOverlays.put(player.getUniqueID(), skinOverlays);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -79,7 +79,7 @@ public class GuiNpcTextureOverlays extends GuiNpcSelectionInterface{
|
||||
//npc.display.glowTexture = assets.getAsset(slot.selected);
|
||||
npc.textureGlowLocation = null;
|
||||
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlayData(
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
|
||||
assets.getAsset(slot.selected), true, 1.0F, 1.0F, 0.0F, 0.0F,
|
||||
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
|
||||
));
|
||||
|
||||
@@ -15,7 +15,7 @@ import noppes.npcs.client.gui.SubGuiNpcName;
|
||||
import noppes.npcs.client.gui.model.GuiCreationScreen;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
@@ -131,7 +131,7 @@ public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListene
|
||||
else if(textfield.id == 9){
|
||||
npc.textureGlowLocation = null;
|
||||
//display.glowTexture = textfield.getText();
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlayData(
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(
|
||||
textfield.getText(), true, 1.0F, 1.0F, 0.0F, 0.0F,
|
||||
1.0F, 1.0F, 0.0F, 0.0F, 0.0F
|
||||
));
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagByte;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.client.gui.util.GuiCustomScroll;
|
||||
@@ -31,11 +30,9 @@ import noppes.npcs.client.gui.util.GuiNpcLabel;
|
||||
import noppes.npcs.client.gui.util.ICustomScrollListener;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.PixelmonHelper;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityFakeLiving;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
public class GuiCreationScreen extends GuiModelInterface implements ICustomScrollListener{
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package noppes.npcs.client.gui.model;
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
@@ -12,13 +11,11 @@ import net.minecraft.client.renderer.entity.NPCRendererHelper;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.client.gui.util.GuiNPCInterface;
|
||||
import noppes.npcs.client.gui.util.GuiNPCStringSlot;
|
||||
import noppes.npcs.client.gui.util.GuiNpcButton;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
@@ -21,7 +21,7 @@ import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.Client;
|
||||
import noppes.npcs.constants.EnumPacketServer;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.glu.Project;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
if (!p_77036_1_.isInvisible())
|
||||
{
|
||||
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
for (SkinOverlayData overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
if (overlayData.location == null) {
|
||||
overlayData.location = new ResourceLocation(overlayData.texture);
|
||||
} else {
|
||||
@@ -312,7 +312,7 @@ public class RenderCNPCPlayer extends RenderPlayer {
|
||||
renderplayer.renderFirstPersonArm(player);
|
||||
|
||||
if (Client.skinOverlays.containsKey(player.getUniqueID())) {
|
||||
for (SkinOverlayData overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
for (SkinOverlay overlayData : Client.skinOverlays.get(player.getUniqueID()).values()) {
|
||||
if (overlayData.location == null) {
|
||||
overlayData.location = new ResourceLocation(overlayData.texture);
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,6 @@ import noppes.npcs.client.ImageDownloadAlt;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.constants.EnumStandingType;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
|
||||
+6
-7
@@ -1,12 +1,11 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
|
||||
public class SkinOverlayData implements ISkinOverlay {
|
||||
public class SkinOverlay implements ISkinOverlay {
|
||||
public DataSkinOverlays parent;
|
||||
public ResourceLocation location = null;
|
||||
public String texture;
|
||||
@@ -24,15 +23,15 @@ public class SkinOverlayData implements ISkinOverlay {
|
||||
public float offsetY = 0.0F;
|
||||
public float offsetZ = 0.0F;
|
||||
|
||||
public SkinOverlayData() {
|
||||
public SkinOverlay() {
|
||||
}
|
||||
|
||||
public SkinOverlayData(String texture) {
|
||||
public SkinOverlay(String texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
public SkinOverlayData(String texture, boolean glow, float alpha, float size, float speedX, float speedY,
|
||||
float scaleX, float scaleY, float offsetX, float offsetY, float offsetZ) {
|
||||
public SkinOverlay(String texture, boolean glow, float alpha, float size, float speedX, float speedY,
|
||||
float scaleX, float scaleY, float offsetX, float offsetY, float offsetZ) {
|
||||
this.texture = texture;
|
||||
this.glow = glow;
|
||||
this.alpha = alpha;
|
||||
@@ -157,7 +156,7 @@ public class SkinOverlayData implements ISkinOverlay {
|
||||
}
|
||||
|
||||
public static ISkinOverlay overlayFromNBT(NBTTagCompound compound) {
|
||||
SkinOverlayData overlay = new SkinOverlayData();
|
||||
SkinOverlay overlay = new SkinOverlay();
|
||||
overlay.readFromNBT(compound);
|
||||
return overlay;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package noppes.npcs.entity.data;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.controllers.PlayerData;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
@@ -23,7 +23,8 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
NBTTagList skinOverlayList = nbtTagCompound.getTagList("SkinOverlayData",10);
|
||||
for (int i = 0; i < skinOverlayList.tagCount(); i++) {
|
||||
int tagID = skinOverlayList.getCompoundTagAt(i).getInteger("SkinOverlayID");
|
||||
SkinOverlayData skinOverlay = (SkinOverlayData) SkinOverlayData.overlayFromNBT(skinOverlayList.getCompoundTagAt(i));
|
||||
SkinOverlay skinOverlay = (SkinOverlay) SkinOverlay.overlayFromNBT(skinOverlayList.getCompoundTagAt(i));
|
||||
skinOverlay.parent = this;
|
||||
skinOverlays.put(tagID, skinOverlay);
|
||||
}
|
||||
|
||||
@@ -36,7 +37,7 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
for (Map.Entry<Integer,ISkinOverlay> overlayData : this.overlayList.entrySet()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("SkinOverlayID", overlayData.getKey());
|
||||
compound = ((SkinOverlayData) overlayData.getValue()).writeToNBT(compound);
|
||||
compound = ((SkinOverlay) overlayData.getValue()).writeToNBT(compound);
|
||||
overlayList.appendTag(compound);
|
||||
}
|
||||
}
|
||||
@@ -54,7 +55,7 @@ public class DataSkinOverlays implements IOverlayHandler {
|
||||
}
|
||||
|
||||
public void add(int id, ISkinOverlay data) {
|
||||
((SkinOverlayData) data).parent = this;
|
||||
((SkinOverlay) data).parent = this;
|
||||
this.overlayList.put(id, data);
|
||||
updateClient();
|
||||
}
|
||||
|
||||
@@ -6,11 +6,10 @@ package noppes.npcs.entity.old;
|
||||
|
||||
import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.ModelData;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
|
||||
public class EntityNPCEnderman extends EntityNpcEnderchibi
|
||||
@@ -20,7 +19,7 @@ public class EntityNPCEnderman extends EntityNpcEnderchibi
|
||||
super(world);
|
||||
display.texture = "customnpcs:textures/entity/enderman/enderman.png";
|
||||
//display.glowTexture = ;
|
||||
display.skinOverlayData.overlayList.put(0,new SkinOverlayData(
|
||||
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
|
||||
));
|
||||
|
||||
@@ -32,7 +32,7 @@ import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.controllers.*;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.items.ItemScripted;
|
||||
import noppes.npcs.containers.ContainerNpcInterface;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
@@ -355,6 +355,6 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
|
||||
public ISkinOverlay createSkinOverlay(String texture) {
|
||||
return new SkinOverlayData(texture);
|
||||
return new SkinOverlay(texture);
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,9 @@ import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.constants.*;
|
||||
import noppes.npcs.controllers.Line;
|
||||
import noppes.npcs.controllers.data.SkinOverlayData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.ScriptFaction;
|
||||
import noppes.npcs.scripted.interfaces.ISkinOverlay;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
|
||||
Reference in new issue
Block a user