mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-11 23:07:37 +00:00
More Class Refactoring for TintData and HitboxData
This commit is contained in:
1 parent
982ceb4aa4
commit
0b73ae91bb
10 files changed
+379
-387
No files matched your search
@@ -11,8 +11,8 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StringUtils;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
import noppes.npcs.controllers.data.AnimationData;
|
||||
import noppes.npcs.controllers.data.CustomHitboxData;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.HitboxData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.entity.data.DataSkinOverlays;
|
||||
@@ -23,192 +23,187 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataDisplay {
|
||||
public EntityNPCInterface npc;
|
||||
public EntityNPCInterface npc;
|
||||
|
||||
public String name;
|
||||
public String title = "";
|
||||
public String name;
|
||||
public String title = "";
|
||||
|
||||
private int markovGeneratorId = 8; //roman,japanese,slavic,welsh,sami,oldnorse,ancientgreek,aztec,classic,spanish (0 - 9 inclusively)
|
||||
private int markovGender = 0; //0:random, 1:male, 2:female
|
||||
private int markovGeneratorId = 8; //roman,japanese,slavic,welsh,sami,oldnorse,ancientgreek,aztec,classic,spanish (0 - 9 inclusively)
|
||||
private int markovGender = 0; //0:random, 1:male, 2:female
|
||||
|
||||
public byte skinType = 0; //0:normal, 1:player, 2:url, 3:url64
|
||||
public byte skinType = 0; //0:normal, 1:player, 2:url, 3:url64
|
||||
|
||||
public String url = "";
|
||||
public String url = "";
|
||||
|
||||
public GameProfile playerProfile;
|
||||
public String texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
public String cloakTexture = "";
|
||||
public GameProfile playerProfile;
|
||||
public String texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
public String cloakTexture = "";
|
||||
|
||||
public DataSkinOverlays skinOverlayData;
|
||||
public long overlayRenderTicks = 0;
|
||||
public DataSkinOverlays skinOverlayData;
|
||||
public long overlayRenderTicks = 0;
|
||||
|
||||
public AnimationData animationData;
|
||||
public AnimationData animationData;
|
||||
public HitboxData hitboxData;
|
||||
public TintData tintData;
|
||||
|
||||
public String glowTexture = "";
|
||||
public String glowTexture = "";
|
||||
|
||||
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible
|
||||
public int visible = 0; //0:visible 1:Invisible 2:semi-invisible
|
||||
public int modelSize = 5;
|
||||
public int showName = 0;
|
||||
public int modelType = 0;
|
||||
|
||||
public int modelSize = 5;
|
||||
public boolean disableLivingAnimation = false;
|
||||
public byte showBossBar = 0;
|
||||
|
||||
public int showName = 0;
|
||||
public ArrayList<UUID> invisibleToList = new ArrayList<>();
|
||||
|
||||
public int modelType = 0;
|
||||
// 0 - Yes, 1 - No, 2 - Only NPCs, 3 - Only Players, 4 - NPCs and Players
|
||||
public int collidesWith = 1;
|
||||
|
||||
public boolean disableLivingAnimation = false;
|
||||
public DataDisplay(EntityNPCInterface npc){
|
||||
this.npc = npc;
|
||||
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
skinOverlayData = new DataSkinOverlays(npc);
|
||||
name = getRandomName();
|
||||
animationData = new AnimationData(this);
|
||||
hitboxData = new HitboxData();
|
||||
tintData = new TintData();
|
||||
}
|
||||
|
||||
public byte showBossBar = 0;
|
||||
public String getRandomName() {
|
||||
return CustomNpcs.MARKOV_GENERATOR[markovGeneratorId].fetch(markovGender);
|
||||
}
|
||||
|
||||
public ArrayList<UUID> invisibleToList = new ArrayList<>();
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setString("Name", name);
|
||||
nbttagcompound.setInteger("MarkovGeneratorId", markovGeneratorId);
|
||||
nbttagcompound.setInteger("MarkovGender", markovGender);
|
||||
nbttagcompound.setString("Title", title);
|
||||
nbttagcompound.setString("SkinUrl", url);
|
||||
nbttagcompound.setString("Texture", texture);
|
||||
|
||||
//0 - Yes, 1 - No, 2 - Only NPCs, 3 - Only Players, 4 - NPCs and Players
|
||||
public int collidesWith = 1;
|
||||
|
||||
public CustomHitboxData customHitboxData;
|
||||
public CustomTintData customTintData;
|
||||
nbttagcompound.setString("CloakTexture", cloakTexture);
|
||||
nbttagcompound.setByte("UsingSkinUrl", skinType);
|
||||
nbttagcompound.setString("GlowTexture", glowTexture);
|
||||
|
||||
public DataDisplay(EntityNPCInterface npc){
|
||||
this.npc = npc;
|
||||
markovGeneratorId = new Random().nextInt(CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
skinOverlayData = new DataSkinOverlays(npc);
|
||||
name = getRandomName();
|
||||
animationData = new AnimationData(this);
|
||||
customHitboxData = new CustomHitboxData();
|
||||
customTintData = new CustomTintData();
|
||||
}
|
||||
nbttagcompound = skinOverlayData.writeToNBT(nbttagcompound);
|
||||
|
||||
public String getRandomName() {
|
||||
return CustomNpcs.MARKOV_GENERATOR[markovGeneratorId].fetch(markovGender);
|
||||
}
|
||||
nbttagcompound = animationData.writeToNBT(nbttagcompound);
|
||||
nbttagcompound = hitboxData.writeToNBT(nbttagcompound);
|
||||
nbttagcompound = tintData.writeToNBT(nbttagcompound);
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setString("Name", name);
|
||||
nbttagcompound.setInteger("MarkovGeneratorId", markovGeneratorId);
|
||||
nbttagcompound.setInteger("MarkovGender", markovGender);
|
||||
nbttagcompound.setString("Title", title);
|
||||
nbttagcompound.setString("SkinUrl", url);
|
||||
nbttagcompound.setString("Texture", texture);
|
||||
|
||||
nbttagcompound.setString("CloakTexture", cloakTexture);
|
||||
nbttagcompound.setByte("UsingSkinUrl", skinType);
|
||||
nbttagcompound.setString("GlowTexture", glowTexture);
|
||||
|
||||
nbttagcompound = skinOverlayData.writeToNBT(nbttagcompound);
|
||||
|
||||
nbttagcompound = animationData.writeToNBT(nbttagcompound);
|
||||
nbttagcompound = customHitboxData.writeToNBT(nbttagcompound);
|
||||
nbttagcompound = customTintData.writeToNBT(nbttagcompound);
|
||||
|
||||
if (this.playerProfile != null)
|
||||
if (this.playerProfile != null)
|
||||
{
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
NBTUtil.func_152460_a(nbttagcompound1, this.playerProfile);
|
||||
nbttagcompound.setTag("SkinUsername", nbttagcompound1);
|
||||
}
|
||||
|
||||
nbttagcompound.setInteger("Size", modelSize);
|
||||
nbttagcompound.setInteger("modelType", modelType);
|
||||
nbttagcompound.setInteger("Size", modelSize);
|
||||
nbttagcompound.setInteger("modelType", modelType);
|
||||
|
||||
nbttagcompound.setInteger("ShowName", showName);
|
||||
nbttagcompound.setInteger("NpcVisible", visible);
|
||||
nbttagcompound.setInteger("ShowName", showName);
|
||||
nbttagcompound.setInteger("NpcVisible", visible);
|
||||
|
||||
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
|
||||
nbttagcompound.setByte("BossBar", showBossBar);
|
||||
nbttagcompound.setBoolean("NoLivingAnimation", disableLivingAnimation);
|
||||
nbttagcompound.setByte("BossBar", showBossBar);
|
||||
|
||||
nbttagcompound.setInteger("CollidesWith",collidesWith);
|
||||
nbttagcompound.setInteger("CollidesWith",collidesWith);
|
||||
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(UUID uuid : invisibleToList){
|
||||
list.appendTag(new NBTTagString(uuid.toString()));
|
||||
}
|
||||
NBTTagList list = new NBTTagList();
|
||||
for(UUID uuid : invisibleToList){
|
||||
list.appendTag(new NBTTagString(uuid.toString()));
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("InvisibleToList", list);
|
||||
return nbttagcompound;
|
||||
}
|
||||
public void readToNBT(NBTTagCompound nbttagcompound) {
|
||||
setName(nbttagcompound.getString("Name"));
|
||||
setMarkovGeneratorId(nbttagcompound.getInteger("MarkovGeneratorId"));
|
||||
setMarkovGender(nbttagcompound.getInteger("MarkovGender"));
|
||||
nbttagcompound.setTag("InvisibleToList", list);
|
||||
return nbttagcompound;
|
||||
}
|
||||
public void readToNBT(NBTTagCompound nbttagcompound) {
|
||||
setName(nbttagcompound.getString("Name"));
|
||||
setMarkovGeneratorId(nbttagcompound.getInteger("MarkovGeneratorId"));
|
||||
setMarkovGender(nbttagcompound.getInteger("MarkovGender"));
|
||||
|
||||
title = nbttagcompound.getString("Title");
|
||||
title = nbttagcompound.getString("Title");
|
||||
|
||||
url = nbttagcompound.getString("SkinUrl");
|
||||
url = nbttagcompound.getString("SkinUrl");
|
||||
|
||||
int prevSkinType = skinType;
|
||||
skinType = nbttagcompound.getByte("UsingSkinUrl");
|
||||
int prevSkinType = skinType;
|
||||
skinType = nbttagcompound.getByte("UsingSkinUrl");
|
||||
|
||||
this.playerProfile = null;
|
||||
if(skinType == 1){
|
||||
if (nbttagcompound.hasKey("SkinUsername", 10)){
|
||||
this.playerProfile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkinUsername"));
|
||||
}
|
||||
else if (nbttagcompound.hasKey("SkinUsername", 8) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkinUsername"))){
|
||||
this.playerProfile = new GameProfile(null, nbttagcompound.getString("SkinUsername"));
|
||||
}
|
||||
this.loadProfile();
|
||||
}
|
||||
this.playerProfile = null;
|
||||
if(skinType == 1){
|
||||
if (nbttagcompound.hasKey("SkinUsername", 10)){
|
||||
this.playerProfile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkinUsername"));
|
||||
}
|
||||
else if (nbttagcompound.hasKey("SkinUsername", 8) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkinUsername"))){
|
||||
this.playerProfile = new GameProfile(null, nbttagcompound.getString("SkinUsername"));
|
||||
}
|
||||
this.loadProfile();
|
||||
}
|
||||
|
||||
String prevTexture = texture;
|
||||
|
||||
texture = nbttagcompound.getString("Texture");
|
||||
texture = nbttagcompound.getString("Texture");
|
||||
|
||||
cloakTexture = nbttagcompound.getString("CloakTexture");
|
||||
glowTexture = nbttagcompound.getString("GlowTexture");
|
||||
cloakTexture = nbttagcompound.getString("CloakTexture");
|
||||
glowTexture = nbttagcompound.getString("GlowTexture");
|
||||
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData") && !glowTexture.isEmpty()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("SkinOverlayID", 0); //unique glow texture ID
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData") && !glowTexture.isEmpty()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setInteger("SkinOverlayID", 0); //unique glow texture ID
|
||||
|
||||
(new SkinOverlay(glowTexture)).writeToNBT(compound);
|
||||
(new SkinOverlay(glowTexture)).writeToNBT(compound);
|
||||
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData")) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
tagList.appendTag(compound);
|
||||
nbttagcompound.setTag("SkinOverlayData", tagList);
|
||||
} else if (!glowTexture.isEmpty()) {
|
||||
nbttagcompound.getTagList("SkinOverlayData", 10).appendTag(compound);
|
||||
glowTexture = "";
|
||||
}
|
||||
}
|
||||
if (!nbttagcompound.hasKey("SkinOverlayData")) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
tagList.appendTag(compound);
|
||||
nbttagcompound.setTag("SkinOverlayData", tagList);
|
||||
} else if (!glowTexture.isEmpty()) {
|
||||
nbttagcompound.getTagList("SkinOverlayData", 10).appendTag(compound);
|
||||
glowTexture = "";
|
||||
}
|
||||
}
|
||||
|
||||
skinOverlayData.readFromNBT(nbttagcompound);
|
||||
skinOverlayData.readFromNBT(nbttagcompound);
|
||||
|
||||
animationData.readFromNBT(nbttagcompound);
|
||||
customHitboxData.readFromNBT(nbttagcompound);
|
||||
customTintData.readFromNBT(nbttagcompound);
|
||||
|
||||
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
if(modelSize > ConfigMain.NpcSizeLimit)
|
||||
modelSize = ConfigMain.NpcSizeLimit;
|
||||
animationData.readFromNBT(nbttagcompound);
|
||||
hitboxData.readFromNBT(nbttagcompound);
|
||||
tintData.readFromNBT(nbttagcompound);
|
||||
|
||||
modelType = nbttagcompound.getInteger("modelType");
|
||||
modelSize = ValueUtil.clamp(nbttagcompound.getInteger("Size"), 1, Integer.MAX_VALUE);
|
||||
if(modelSize > ConfigMain.NpcSizeLimit)
|
||||
modelSize = ConfigMain.NpcSizeLimit;
|
||||
|
||||
showName = nbttagcompound.getInteger("ShowName");
|
||||
visible = nbttagcompound.getInteger("NpcVisible");
|
||||
modelType = nbttagcompound.getInteger("modelType");
|
||||
|
||||
disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation");
|
||||
showBossBar = nbttagcompound.getByte("BossBar");
|
||||
showName = nbttagcompound.getInteger("ShowName");
|
||||
visible = nbttagcompound.getInteger("NpcVisible");
|
||||
|
||||
NBTTagList tagList = (NBTTagList)nbttagcompound.getTag("InvisibleToList");
|
||||
if(tagList != null) {
|
||||
invisibleToList.clear();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
String nbtTagString = tagList.getStringTagAt(i);
|
||||
invisibleToList.add(UUID.fromString(nbtTagString));
|
||||
}
|
||||
}
|
||||
else {
|
||||
invisibleToList = new ArrayList<>();
|
||||
}
|
||||
disableLivingAnimation = nbttagcompound.getBoolean("NoLivingAnimation");
|
||||
showBossBar = nbttagcompound.getByte("BossBar");
|
||||
|
||||
if(nbttagcompound.hasKey("CollidesWith"))
|
||||
collidesWith = nbttagcompound.getInteger("CollidesWith");
|
||||
else
|
||||
collidesWith = 1;
|
||||
NBTTagList tagList = (NBTTagList)nbttagcompound.getTag("InvisibleToList");
|
||||
if(tagList != null) {
|
||||
invisibleToList.clear();
|
||||
for (int i = 0; i < tagList.tagCount(); i++) {
|
||||
String nbtTagString = tagList.getStringTagAt(i);
|
||||
invisibleToList.add(UUID.fromString(nbtTagString));
|
||||
}
|
||||
}
|
||||
else {
|
||||
invisibleToList = new ArrayList<>();
|
||||
}
|
||||
|
||||
if(prevSkinType != skinType || !texture.equals(prevTexture))
|
||||
npc.textureLocation = null;
|
||||
npc.updateHitbox();
|
||||
}
|
||||
if(nbttagcompound.hasKey("CollidesWith"))
|
||||
collidesWith = nbttagcompound.getInteger("CollidesWith");
|
||||
else
|
||||
collidesWith = 1;
|
||||
|
||||
if(prevSkinType != skinType || !texture.equals(prevTexture))
|
||||
npc.textureLocation = null;
|
||||
npc.updateHitbox();
|
||||
}
|
||||
|
||||
public void loadProfile(){
|
||||
if (this.playerProfile != null && !StringUtils.isNullOrEmpty(this.playerProfile.getName()) && MinecraftServer.getServer() != null){
|
||||
@@ -228,53 +223,53 @@ public class DataDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean showName() {
|
||||
if(npc.isKilled())
|
||||
return false;
|
||||
return showName == 0 || (showName == 2 && npc.isAttacking());
|
||||
}
|
||||
public boolean showName() {
|
||||
if(npc.isKilled())
|
||||
return false;
|
||||
return showName == 0 || (showName == 2 && npc.isAttacking());
|
||||
}
|
||||
|
||||
public String getSkinTexture(){
|
||||
return texture;
|
||||
}
|
||||
public String getSkinTexture(){
|
||||
return texture;
|
||||
}
|
||||
|
||||
public void setSkinTexture(String texture){
|
||||
if(this.texture.equals(texture))
|
||||
return;
|
||||
this.texture = texture;
|
||||
npc.textureLocation = null;
|
||||
skinType = 0;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
public void setSkinTexture(String texture){
|
||||
if(this.texture.equals(texture))
|
||||
return;
|
||||
this.texture = texture;
|
||||
npc.textureLocation = null;
|
||||
skinType = 0;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name){
|
||||
if(this.name.equals(name))
|
||||
return;
|
||||
this.name = name;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
public void setName(String name){
|
||||
if(this.name.equals(name))
|
||||
return;
|
||||
this.name = name;
|
||||
npc.updateClient = true;
|
||||
}
|
||||
|
||||
public int getMarkovGender(){
|
||||
return markovGender;
|
||||
}
|
||||
public int getMarkovGender(){
|
||||
return markovGender;
|
||||
}
|
||||
|
||||
public void setMarkovGender(int gender) {
|
||||
if(markovGender == gender)
|
||||
return;
|
||||
this.markovGender = ValueUtil.clamp(gender, 0, 2);
|
||||
}
|
||||
public void setMarkovGender(int gender) {
|
||||
if(markovGender == gender)
|
||||
return;
|
||||
this.markovGender = ValueUtil.clamp(gender, 0, 2);
|
||||
}
|
||||
|
||||
public int getMarkovGeneratorId(){
|
||||
return markovGeneratorId;
|
||||
}
|
||||
public int getMarkovGeneratorId(){
|
||||
return markovGeneratorId;
|
||||
}
|
||||
|
||||
public void setMarkovGeneratorId(int id) {
|
||||
if(markovGeneratorId == id)
|
||||
return;
|
||||
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
}
|
||||
public void setMarkovGeneratorId(int id) {
|
||||
if(markovGeneratorId == id)
|
||||
return;
|
||||
this.markovGeneratorId = ValueUtil.clamp(id, 0, CustomNpcs.MARKOV_GENERATOR.length-1);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,12 @@ package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.CustomHitboxData;
|
||||
import noppes.npcs.controllers.data.HitboxData;
|
||||
|
||||
public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldListener
|
||||
{
|
||||
private CustomHitboxData hitboxData;
|
||||
public SubGuiCustomHitbox(CustomHitboxData hitboxData){
|
||||
private HitboxData hitboxData;
|
||||
public SubGuiCustomHitbox(HitboxData hitboxData){
|
||||
this.hitboxData = hitboxData;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
@@ -19,8 +19,8 @@ public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldLis
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
addLabel(new GuiNpcLabel(0,"Custom hitbox", guiLeft + 5, guiTop + 35));
|
||||
addButton(new GuiNpcButtonYesNo(0,guiLeft + 122, guiTop + 30, 56, 20 ,hitboxData.isCustomHitbox()));
|
||||
if(hitboxData.isCustomHitbox()){
|
||||
addButton(new GuiNpcButtonYesNo(0,guiLeft + 122, guiTop + 30, 56, 20 ,hitboxData.isHitboxEnabled()));
|
||||
if(hitboxData.isHitboxEnabled()){
|
||||
addLabel(new GuiNpcLabel(3,"Width", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, hitboxData.getWidth() + ""));
|
||||
getTextField(2).floatsOnly = true;
|
||||
@@ -39,7 +39,7 @@ public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldLis
|
||||
int id = guibutton.id;
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
hitboxData.setCustomHitbox(((GuiNpcButtonYesNo)button).getBoolean());
|
||||
hitboxData.setHitboxEnabled(((GuiNpcButtonYesNo)button).getBoolean());
|
||||
initGui();
|
||||
}
|
||||
if(id == 66){
|
||||
|
||||
@@ -2,13 +2,13 @@ package noppes.npcs.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import noppes.npcs.client.gui.util.*;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
|
||||
public class SubGuiNpcTint extends SubGuiInterface implements ISubGuiListener, ITextfieldListener {
|
||||
private CustomTintData tintData;
|
||||
private TintData tintData;
|
||||
private int lastColorClicked = -1;
|
||||
|
||||
public SubGuiNpcTint(CustomTintData tintData) {
|
||||
public SubGuiNpcTint(TintData tintData) {
|
||||
this.tintData = tintData;
|
||||
setBackground("menubg.png");
|
||||
xSize = 256;
|
||||
|
||||
@@ -18,204 +18,201 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
|
||||
public class GuiNpcDisplay extends GuiNPCInterface2 implements ITextfieldListener, IGuiData{
|
||||
|
||||
private DataDisplay display;
|
||||
public GuiNpcTextField nameText;
|
||||
private DataDisplay display;
|
||||
public GuiNpcTextField nameText;
|
||||
|
||||
public GuiNpcDisplay(EntityNPCInterface npc) {
|
||||
super(npc,1);
|
||||
display = npc.display;
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplayGet);
|
||||
}
|
||||
public GuiNpcDisplay(EntityNPCInterface npc) {
|
||||
super(npc,1);
|
||||
display = npc.display;
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplayGet);
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
int y = guiTop + 4;
|
||||
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
|
||||
nameText = new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.name);
|
||||
addTextField(nameText);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 253+52, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
|
||||
addLabel(new GuiNpcLabel(0,"gui.name", guiLeft + 5, y + 5));
|
||||
nameText = new GuiNpcTextField(0,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.name);
|
||||
addTextField(nameText);
|
||||
this.addButton(new GuiNpcButton(0, guiLeft + 253+52, y , 110, 20, new String[]{"display.show","display.hide","display.showAttacking"} ,display.showName));
|
||||
|
||||
|
||||
this.addButton(new GuiNpcButton(14, guiLeft + 259, y , 20, 20, Character.toString('\u21bb')));
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 259 + 22, y , 20, 20, Character.toString('\u22EE')));
|
||||
this.addButton(new GuiNpcButton(14, guiLeft + 259, y , 20, 20, Character.toString('\u21bb')));
|
||||
this.addButton(new GuiNpcButton(15, guiLeft + 259 + 22, y , 20, 20, Character.toString('\u22EE')));
|
||||
|
||||
y+=23;
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(11,"gui.title", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(11,this, fontRendererObj, guiLeft + 50, y, 206, 20, display.title));
|
||||
y+=23;
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(1,"display.model", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 50, y,110,20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5));
|
||||
this.addButton(new GuiNpcButton(1, guiLeft + 50, y,110,20, "selectServer.edit"));
|
||||
addLabel(new GuiNpcLabel(2,"display.size", guiLeft + 175, y + 5));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 203, y, 40, 20, display.modelSize + ""));
|
||||
getTextField(2).integersOnly = true;
|
||||
getTextField(2).setMinMaxDefault(1, ConfigMain.NpcSizeLimit, 5);
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(4,"display.texture", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.skinType == 0?display.texture:display.url));
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "gui.select"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url", "display.urlSix"},display.skinType));
|
||||
getButton(3).setEnabled(display.skinType == 0);
|
||||
if(display.skinType == 1 && display.playerProfile != null)
|
||||
getTextField(3).setText(display.playerProfile.getName());
|
||||
this.addButton(new GuiNpcButton(3, guiLeft + 325, y, 38, 20, "gui.select"));
|
||||
this.addButton(new GuiNpcButton(2, guiLeft + 283, y, 40, 20, new String[]{"display.texture","display.player", "display.url", "display.urlSix"},display.skinType));
|
||||
getButton(3).setEnabled(display.skinType == 0);
|
||||
if(display.skinType == 1 && display.playerProfile != null)
|
||||
getTextField(3).setText(display.playerProfile.getName());
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(8,"display.cape", guiLeft + 5, y + 5));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(8,"display.cape", guiLeft + 5, y + 5));
|
||||
addTextField(new GuiNpcTextField(8,this, fontRendererObj, guiLeft + 80, y, 200, 20, display.cloakTexture));
|
||||
this.addButton(new GuiNpcButton(8, guiLeft + 283, y, 80, 20, "display.selectTexture"));
|
||||
this.addButton(new GuiNpcButton(8, guiLeft + 283, y, 80, 20, "display.selectTexture"));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(9,"display.overlay", guiLeft + 5, y + 5));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(9,"display.overlay", guiLeft + 5, y + 5));
|
||||
|
||||
addTextField(new GuiNpcTextField(9,this, fontRendererObj, guiLeft + 80, y, 200, 20, npc.display.skinOverlayData.overlayList.containsKey(0) ? npc.display.skinOverlayData.overlayList.get(0).getTexture() : ""));
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 283, y, 80, 20, "display.selectTexture"));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 365, y, 50, 20, new String[]{"display.glow","display.solid"}, !npc.display.skinOverlayData.overlayList.containsKey(0) ? 1 : npc.display.skinOverlayData.overlayList.get(0).getGlow() ? 0 : 1));
|
||||
if (!npc.display.skinOverlayData.overlayList.containsKey(0)) {
|
||||
this.getButton(11).setVisible(false);
|
||||
this.getButton(11).setEnabled(false);
|
||||
}
|
||||
this.addButton(new GuiNpcButton(9, guiLeft + 283, y, 80, 20, "display.selectTexture"));
|
||||
this.addButton(new GuiNpcButton(11, guiLeft + 365, y, 50, 20, new String[]{"display.glow","display.solid"}, !npc.display.skinOverlayData.overlayList.containsKey(0) ? 1 : npc.display.skinOverlayData.overlayList.get(0).getGlow() ? 0 : 1));
|
||||
if (!npc.display.skinOverlayData.overlayList.containsKey(0)) {
|
||||
this.getButton(11).setVisible(false);
|
||||
this.getButton(11).setEnabled(false);
|
||||
}
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(5,"display.livingAnimation", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(5, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no"}, display.disableLivingAnimation?1:0));
|
||||
|
||||
addLabel(new GuiNpcLabel(6,"display.collides", guiLeft + 185, y + 5));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 300, y, 100, 20, new String[]{"gui.yes","gui.no","Only CNPCs","Only Players","CNPCs & Players"}, display.collidesWith));
|
||||
addLabel(new GuiNpcLabel(6,"display.collides", guiLeft + 185, y + 5));
|
||||
this.addButton(new GuiNpcButton(6, guiLeft + 300, y, 100, 20, new String[]{"gui.yes","gui.no","Only CNPCs","Only Players","CNPCs & Players"}, display.collidesWith));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 185, y , 100, 20, "display.tintsettings"));
|
||||
this.addButton(new GuiNpcButton(12,guiLeft + 300, y, 100, 20, "display.hitbox"));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(7,"display.visible", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(7, guiLeft + 120, y, 50, 20, new String[]{"gui.yes","gui.no","gui.partly"}, display.visible));
|
||||
this.addButton(new GuiNpcButton(13, guiLeft + 185, y , 100, 20, "display.tintsettings"));
|
||||
this.addButton(new GuiNpcButton(12,guiLeft + 300, y, 100, 20, "display.hitbox"));
|
||||
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 60, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
|
||||
y+=23;
|
||||
addLabel(new GuiNpcLabel(10,"display.bossbar", guiLeft + 5, y + 5));
|
||||
this.addButton(new GuiNpcButton(10, guiLeft + 60, y, 110, 20, new String[]{"display.hide","display.show","display.showAttacking"}, display.showBossBar));
|
||||
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield){
|
||||
if(textfield.id == 0){
|
||||
if(!textfield.isEmpty())
|
||||
display.name = textfield.getText();
|
||||
else
|
||||
textfield.setText(display.name);
|
||||
}
|
||||
else if(textfield.id == 2){
|
||||
display.modelSize = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
// SKIN CHANGE
|
||||
if(display.skinType == 2 || display.skinType == 3){
|
||||
display.url = textfield.getText();
|
||||
}
|
||||
else if(display.skinType == 1){
|
||||
if(!textfield.isEmpty()){
|
||||
display.playerProfile = new GameProfile(null, textfield.getText());
|
||||
}
|
||||
else
|
||||
display.playerProfile = null;
|
||||
}
|
||||
else
|
||||
display.texture = textfield.getText();
|
||||
}
|
||||
else if(textfield.id == 8){
|
||||
display.cloakTexture = textfield.getText();
|
||||
}
|
||||
else if(textfield.id == 9){
|
||||
if (!textfield.getText().isEmpty()) {
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(textfield.getText()));
|
||||
} else {
|
||||
npc.display.skinOverlayData.overlayList.remove(0);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
else if(textfield.id == 11){
|
||||
display.title = textfield.getText();
|
||||
}
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
display.showName = button.getValue();
|
||||
}
|
||||
if(button.id == 1){
|
||||
NoppesUtil.openGUI(player, new GuiCreationScreen(this, (EntityCustomNpc) npc));
|
||||
//NoppesUtil.openGUI(player, new GuiNpcModelSelection(npc,this));
|
||||
}
|
||||
if(button.id == 2){
|
||||
display.skinType = (byte) button.getValue();
|
||||
if (display.skinType != 3){
|
||||
display.url = "";
|
||||
}
|
||||
display.playerProfile = null;
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 3){
|
||||
NoppesUtil.openGUI(player, new GuiNPCTextures(npc, this));
|
||||
}
|
||||
else if(button.id == 5){
|
||||
display.disableLivingAnimation = button.getValue() == 1;
|
||||
}
|
||||
else if(button.id == 6){
|
||||
display.collidesWith = button.getValue();
|
||||
}
|
||||
else if(button.id == 7){
|
||||
display.visible = button.getValue();
|
||||
}
|
||||
// else if(button.id == 300){
|
||||
// display.squareTexture = (byte)button.getValue();
|
||||
// }
|
||||
else if(button.id == 8){
|
||||
NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this));
|
||||
}
|
||||
else if(button.id == 9){
|
||||
NoppesUtil.openGUI(player, new GuiNpcTextureOverlays(npc, this));
|
||||
}
|
||||
else if(button.id == 10){
|
||||
display.showBossBar = (byte)button.getValue();
|
||||
}
|
||||
else if(button.id == 11){
|
||||
npc.display.skinOverlayData.overlayList.get(0).setGlow(button.getValue() == 0);
|
||||
npc.display.skinOverlayData.overlayList.get(0).setBlend(button.getValue() == 0);
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 12){
|
||||
setSubGui(new SubGuiCustomHitbox(display.customHitboxData));
|
||||
}
|
||||
else if (button.id == 13){
|
||||
setSubGui(new SubGuiNpcTint(display.customTintData));
|
||||
}
|
||||
else if(button.id == 14){
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
getTextField(0).setText(name);
|
||||
}
|
||||
else if(button.id == 15){
|
||||
setSubGui(new SubGuiNpcName(display));
|
||||
}
|
||||
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayActionPerformed(this, button);
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayInitGui(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
if(display.skinType == 1)
|
||||
display.loadProfile();
|
||||
npc.textureLocation = null;
|
||||
mc.renderGlobal.onEntityDestroy(npc);
|
||||
mc.renderGlobal.onEntityCreate(npc);
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplaySave, display.writeToNBT(new NBTTagCompound()));
|
||||
@Override
|
||||
public void unFocused(GuiNpcTextField textfield){
|
||||
if(textfield.id == 0){
|
||||
if(!textfield.isEmpty())
|
||||
display.name = textfield.getText();
|
||||
else
|
||||
textfield.setText(display.name);
|
||||
}
|
||||
else if(textfield.id == 2){
|
||||
display.modelSize = textfield.getInteger();
|
||||
}
|
||||
else if(textfield.id == 3){
|
||||
// SKIN CHANGE
|
||||
if(display.skinType == 2 || display.skinType == 3){
|
||||
display.url = textfield.getText();
|
||||
}
|
||||
else if(display.skinType == 1){
|
||||
if(!textfield.isEmpty()){
|
||||
display.playerProfile = new GameProfile(null, textfield.getText());
|
||||
}
|
||||
else
|
||||
display.playerProfile = null;
|
||||
}
|
||||
else
|
||||
display.texture = textfield.getText();
|
||||
}
|
||||
else if(textfield.id == 8){
|
||||
display.cloakTexture = textfield.getText();
|
||||
}
|
||||
else if(textfield.id == 9){
|
||||
if (!textfield.getText().isEmpty()) {
|
||||
npc.display.skinOverlayData.overlayList.put(0,new SkinOverlay(textfield.getText()));
|
||||
} else {
|
||||
npc.display.skinOverlayData.overlayList.remove(0);
|
||||
}
|
||||
initGui();
|
||||
}
|
||||
else if(textfield.id == 11){
|
||||
display.title = textfield.getText();
|
||||
}
|
||||
}
|
||||
protected void actionPerformed(GuiButton guibutton){
|
||||
GuiNpcButton button = (GuiNpcButton) guibutton;
|
||||
if(button.id == 0){
|
||||
display.showName = button.getValue();
|
||||
}
|
||||
if(button.id == 1){
|
||||
NoppesUtil.openGUI(player, new GuiCreationScreen(this, (EntityCustomNpc) npc));
|
||||
//NoppesUtil.openGUI(player, new GuiNpcModelSelection(npc,this));
|
||||
}
|
||||
if(button.id == 2){
|
||||
display.skinType = (byte) button.getValue();
|
||||
if (display.skinType != 3){
|
||||
display.url = "";
|
||||
}
|
||||
display.playerProfile = null;
|
||||
initGui();
|
||||
}
|
||||
else if(button.id == 3){
|
||||
NoppesUtil.openGUI(player, new GuiNPCTextures(npc, this));
|
||||
}
|
||||
else if(button.id == 5){
|
||||
display.disableLivingAnimation = button.getValue() == 1;
|
||||
}
|
||||
else if(button.id == 6){
|
||||
display.collidesWith = button.getValue();
|
||||
}
|
||||
else if(button.id == 7){
|
||||
display.visible = button.getValue();
|
||||
}
|
||||
else if(button.id == 8){
|
||||
NoppesUtil.openGUI(player, new GuiNpcTextureCloaks(npc, this));
|
||||
}
|
||||
else if(button.id == 9){
|
||||
NoppesUtil.openGUI(player, new GuiNpcTextureOverlays(npc, this));
|
||||
}
|
||||
else if(button.id == 10){
|
||||
display.showBossBar = (byte)button.getValue();
|
||||
}
|
||||
else if(button.id == 11){
|
||||
npc.display.skinOverlayData.overlayList.get(0).setGlow(button.getValue() == 0);
|
||||
npc.display.skinOverlayData.overlayList.get(0).setBlend(button.getValue() == 0);
|
||||
initGui();
|
||||
}
|
||||
else if (button.id == 12){
|
||||
setSubGui(new SubGuiCustomHitbox(display.hitboxData));
|
||||
}
|
||||
else if (button.id == 13){
|
||||
setSubGui(new SubGuiNpcTint(display.tintData));
|
||||
}
|
||||
else if(button.id == 14){
|
||||
String name = display.getRandomName();
|
||||
display.setName(name);
|
||||
getTextField(0).setText(name);
|
||||
}
|
||||
else if(button.id == 15){
|
||||
setSubGui(new SubGuiNpcName(display));
|
||||
}
|
||||
|
||||
}
|
||||
GeckoAddonClient.Instance.geckoNpcDisplayActionPerformed(this, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
display.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
@Override
|
||||
public void save() {
|
||||
if(display.skinType == 1)
|
||||
display.loadProfile();
|
||||
npc.textureLocation = null;
|
||||
mc.renderGlobal.onEntityDestroy(npc);
|
||||
mc.renderGlobal.onEntityCreate(npc);
|
||||
Client.sendData(EnumPacketServer.MainmenuDisplaySave, display.writeToNBT(new NBTTagCompound()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGuiData(NBTTagCompound compound) {
|
||||
display.readToNBT(compound);
|
||||
initGui();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import noppes.npcs.client.model.part.legs.ModelMermaidLegs2;
|
||||
import noppes.npcs.client.model.part.legs.ModelNagaLegs;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -387,9 +387,9 @@ public class ModelLegs extends ModelScaleRenderer{
|
||||
y *= 2f;
|
||||
}
|
||||
}
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
TintData tintData = entity.display.tintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isTintEnabled() && customTintData.isGeneralTintEnabled());
|
||||
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
|
||||
if(bo){
|
||||
float red = (entity.modelData.legParts.color >> 16 & 255) / 255f;
|
||||
float green = (entity.modelData.legParts.color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -10,7 +10,7 @@ import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.client.model.part.tails.*;
|
||||
import noppes.npcs.client.model.util.ModelScaleRenderer;
|
||||
import noppes.npcs.constants.EnumAnimation;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -151,9 +151,9 @@ public class ModelTail extends ModelScaleRenderer {
|
||||
base.currentlyPlayerTexture = true;
|
||||
}
|
||||
}
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
TintData tintData = entity.display.tintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isTintEnabled() && customTintData.isGeneralTintEnabled());
|
||||
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
|
||||
if(bo){
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.model.ModelMPM;
|
||||
import noppes.npcs.controllers.data.CustomTintData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
@@ -60,9 +60,9 @@ public abstract class ModelPartInterface extends ModelRenderer {
|
||||
base.currentlyPlayerTexture = true;
|
||||
}
|
||||
}
|
||||
CustomTintData customTintData = entity.display.customTintData;
|
||||
TintData tintData = entity.display.tintData;
|
||||
boolean bo = entity.hurtTime <= 0 && entity.deathTime <= 0 && !base.isArmor &&
|
||||
!(customTintData.isTintEnabled() && customTintData.isGeneralTintEnabled());
|
||||
!(tintData.isTintEnabled() && tintData.isGeneralTintEnabled());
|
||||
if(bo){
|
||||
float red = (color >> 16 & 255) / 255f;
|
||||
float green = (color >> 8 & 255) / 255f;
|
||||
|
||||
@@ -28,7 +28,7 @@ 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.CustomTintData;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import noppes.npcs.controllers.data.SkinOverlay;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -372,8 +372,8 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
CustomTintData customTintData = p_76986_1_.display.customTintData;
|
||||
if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0 || (customTintData.isTintEnabled() && customTintData.isGeneralTintEnabled()))
|
||||
TintData tintData = p_76986_1_.display.tintData;
|
||||
if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0 || (tintData.isTintEnabled() && tintData.isGeneralTintEnabled()))
|
||||
{
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
@@ -381,13 +381,13 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
|
||||
if ((p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) && (!customTintData.isTintEnabled() || customTintData.isHurtTintEnabled()))
|
||||
if ((p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) && (!tintData.isTintEnabled() || tintData.isHurtTintEnabled()))
|
||||
{
|
||||
float r, g, b;
|
||||
if(customTintData.isTintEnabled()) {
|
||||
r = (float) (customTintData.getHurtTint() >> 16 & 255) / 255.0F * f14;
|
||||
g = (float) (customTintData.getHurtTint() >> 8 & 255) / 255.0F * f14;
|
||||
b = (float) (customTintData.getHurtTint() & 255) / 255.0F * f14;
|
||||
if(tintData.isTintEnabled()) {
|
||||
r = (float) (tintData.getHurtTint() >> 16 & 255) / 255.0F * f14;
|
||||
g = (float) (tintData.getHurtTint() >> 8 & 255) / 255.0F * f14;
|
||||
b = (float) (tintData.getHurtTint() & 255) / 255.0F * f14;
|
||||
}else{
|
||||
r=f14;
|
||||
g=0;
|
||||
@@ -468,7 +468,7 @@ public class RenderNPCInterface extends RenderLiving{
|
||||
protected int getColorMultiplier(EntityLivingBase p_77030_1_, float p_77030_2_, float p_77030_3_)
|
||||
{
|
||||
EntityNPCInterface npc = (EntityNPCInterface) p_77030_1_;
|
||||
CustomTintData tintData = npc.display.customTintData;
|
||||
TintData tintData = npc.display.tintData;
|
||||
int alpha = (int) (0xff*((double)tintData.getGeneralAlpha()/100d)) << 24;
|
||||
return (tintData.isTintEnabled() && tintData.isGeneralTintEnabled())?tintData.getGeneralTint()+alpha:0;
|
||||
}
|
||||
|
||||
+11
-11
@@ -2,15 +2,15 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CustomHitboxData {
|
||||
public class HitboxData {
|
||||
|
||||
private float width = 1f;
|
||||
private float height = 1.8f;
|
||||
|
||||
private boolean customHitbox = false;
|
||||
private boolean hitboxEnabled = false;
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setBoolean("CustomHitbox", customHitbox);
|
||||
if(customHitbox) {
|
||||
nbttagcompound.setBoolean("HitboxEnabled", hitboxEnabled);
|
||||
if(hitboxEnabled) {
|
||||
nbttagcompound.setFloat("HitboxWidth", width);
|
||||
nbttagcompound.setFloat("HitboxHeight", height);
|
||||
}
|
||||
@@ -18,8 +18,8 @@ public class CustomHitboxData {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
customHitbox = nbttagcompound.getBoolean("CustomHitbox");
|
||||
if(customHitbox) {
|
||||
hitboxEnabled = nbttagcompound.getBoolean("CustomHitbox");
|
||||
if(hitboxEnabled) {
|
||||
width = nbttagcompound.getFloat("HitboxWidth");
|
||||
height = nbttagcompound.getFloat("HitboxHeight");
|
||||
}
|
||||
@@ -41,11 +41,11 @@ public class CustomHitboxData {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public boolean isCustomHitbox() {
|
||||
return customHitbox;
|
||||
public boolean isHitboxEnabled() {
|
||||
return hitboxEnabled;
|
||||
}
|
||||
|
||||
public void setCustomHitbox(boolean customHitbox) {
|
||||
this.customHitbox = customHitbox;
|
||||
public void setHitboxEnabled(boolean hitboxEnabled) {
|
||||
this.hitboxEnabled = hitboxEnabled;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class CustomTintData {
|
||||
public class TintData {
|
||||
private boolean tintEnabled = false;
|
||||
private boolean hurtTintEnabled = true;
|
||||
private boolean generalTintEnabled = false;
|
||||
Reference in new issue
Block a user