mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 04:04:28 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -19,61 +19,56 @@ import org.lwjgl.opengl.GL11;
|
||||
import java.util.Collections;
|
||||
import java.util.Vector;
|
||||
|
||||
public class GuiEntitySelection extends GuiNPCInterface
|
||||
{
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiCreationScreen parent;
|
||||
private Class<? extends EntityLivingBase> prevModel;
|
||||
private ModelData playerdata;
|
||||
private EntityCustomNpc npc;
|
||||
public class GuiEntitySelection extends GuiNPCInterface {
|
||||
private GuiNPCStringSlot slot;
|
||||
private GuiCreationScreen parent;
|
||||
private Class<? extends EntityLivingBase> prevModel;
|
||||
private ModelData playerdata;
|
||||
private EntityCustomNpc npc;
|
||||
|
||||
public GuiEntitySelection(GuiCreationScreen parent, ModelData playerdata, EntityCustomNpc npc)
|
||||
{
|
||||
this.parent = parent;
|
||||
this.playerdata = playerdata;
|
||||
this.npc = npc;
|
||||
drawDefaultBackground = false;
|
||||
prevModel = playerdata.getEntityClass();
|
||||
public GuiEntitySelection(GuiCreationScreen parent, ModelData playerdata, EntityCustomNpc npc) {
|
||||
this.parent = parent;
|
||||
this.playerdata = playerdata;
|
||||
this.npc = npc;
|
||||
drawDefaultBackground = false;
|
||||
prevModel = playerdata.getEntityClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
Vector<String> list = new Vector<String>(parent.data.keySet());
|
||||
list.add("CustomNPC");
|
||||
Collections.sort(list,String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list,this,false,18);
|
||||
if(playerdata.getEntityClass() != null){
|
||||
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
|
||||
slot = new GuiNPCStringSlot(list, this, false, 18);
|
||||
if (playerdata.getEntityClass() != null) {
|
||||
slot.selected = (String) EntityList.classToStringMapping.get(playerdata.getEntityClass());
|
||||
}
|
||||
else{
|
||||
slot.selected = "CustomNPC";
|
||||
} else {
|
||||
slot.selected = "CustomNPC";
|
||||
}
|
||||
slot.registerScrollButtons(4, 5);
|
||||
|
||||
this.buttonList.add(new GuiNpcButton(2, width / 2 - 100, height - 44,98, 20, "gui.back"));
|
||||
this.buttonList.add(new GuiNpcButton(2, width / 2 - 100, height - 44, 98, 20, "gui.back"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int i, int j, float f)
|
||||
{
|
||||
EntityLivingBase entity = playerdata.getEntity(npc);
|
||||
if(entity == null)
|
||||
entity = this.npc;
|
||||
else
|
||||
EntityUtil.Copy(npc, entity);
|
||||
public void drawScreen(int i, int j, float f) {
|
||||
EntityLivingBase entity = playerdata.getEntity(npc);
|
||||
if (entity == null)
|
||||
entity = this.npc;
|
||||
else
|
||||
EntityUtil.Copy(npc, entity);
|
||||
|
||||
int l = (width/2)-180;
|
||||
int i1 = (height/2) - 90;
|
||||
int l = (width / 2) - 180;
|
||||
int i1 = (height / 2) - 90;
|
||||
GL11.glEnable(32826 /*GL_RESCALE_NORMAL_EXT*/);
|
||||
GL11.glEnable(2903 /*GL_COLOR_MATERIAL*/);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(l + 33, i1 + 131, 50F);
|
||||
|
||||
float scale = 1;
|
||||
if(entity.height > 2.4)
|
||||
scale = 2 / entity.height;
|
||||
if (entity.height > 2.4)
|
||||
scale = 2 / entity.height;
|
||||
|
||||
GL11.glScalef(-50 * scale, 50 * scale, 50 * scale);
|
||||
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
||||
@@ -81,23 +76,22 @@ public class GuiEntitySelection extends GuiNPCInterface
|
||||
float f3 = entity.rotationYaw;
|
||||
float f4 = entity.rotationPitch;
|
||||
float f7 = entity.rotationYawHead;
|
||||
float f5 = (float)(l + 33) - i;
|
||||
float f6 = (float)((i1 + 131) - 50) - j;
|
||||
float f5 = (float) (l + 33) - i;
|
||||
float f6 = (float) ((i1 + 131) - 50) - j;
|
||||
GL11.glRotatef(135F, 0.0F, 1.0F, 0.0F);
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
GL11.glRotatef(-135F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(-(float)Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
entity.renderYawOffset = (float)Math.atan(f5 / 40F) * 20F;
|
||||
entity.rotationYaw = (float)Math.atan(f5 / 40F) * 40F;
|
||||
entity.rotationPitch = -(float)Math.atan(f6 / 40F) * 20F;
|
||||
GL11.glRotatef(-(float) Math.atan(f6 / 40F) * 20F, 1.0F, 0.0F, 0.0F);
|
||||
entity.renderYawOffset = (float) Math.atan(f5 / 40F) * 20F;
|
||||
entity.rotationYaw = (float) Math.atan(f5 / 40F) * 40F;
|
||||
entity.rotationPitch = -(float) Math.atan(f6 / 40F) * 20F;
|
||||
entity.rotationYawHead = entity.rotationYaw;
|
||||
GL11.glTranslatef(0.0F, entity.yOffset, 0.0F);
|
||||
RenderManager.instance.playerViewY = 180F;
|
||||
try{
|
||||
RenderManager.instance.playerViewY = 180F;
|
||||
try {
|
||||
RenderManager.instance.renderEntityWithPosYaw(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F);
|
||||
}
|
||||
catch(Exception e){
|
||||
playerdata.setEntityClass(null);
|
||||
} catch (Exception e) {
|
||||
playerdata.setEntityClass(null);
|
||||
}
|
||||
entity.renderYawOffset = f2;
|
||||
entity.rotationYaw = f3;
|
||||
@@ -110,18 +104,19 @@ public class GuiEntitySelection extends GuiNPCInterface
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
slot.drawScreen(i, j, f);
|
||||
super.drawScreen(i, j, f);
|
||||
}
|
||||
public void elementClicked(){
|
||||
|
||||
public void elementClicked() {
|
||||
if (playerdata.getEntityClass() != null && playerdata.getEntityClass().equals(parent.data.get(slot.selected))) {
|
||||
return;
|
||||
}
|
||||
|
||||
try{
|
||||
playerdata.setEntityClass(parent.data.get(slot.selected));
|
||||
EntityLivingBase entity = playerdata.getEntity(npc);
|
||||
if(entity != null){
|
||||
try {
|
||||
playerdata.setEntityClass(parent.data.get(slot.selected));
|
||||
EntityLivingBase entity = playerdata.getEntity(npc);
|
||||
if (entity != null) {
|
||||
npc.display.modelType = 0;
|
||||
if (entity instanceof EntityNpcCrystal) {
|
||||
npc.display.texture = "customnpcs:textures/entity/crystal/EnderCrystal.png";
|
||||
@@ -137,44 +132,42 @@ public class GuiEntitySelection extends GuiNPCInterface
|
||||
RendererLivingEntity render = (RendererLivingEntity) RenderManager.instance.getEntityRenderObject(entity);
|
||||
npc.display.texture = NPCRendererHelper.getTexture(render, entity);
|
||||
}
|
||||
}
|
||||
else{
|
||||
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
}
|
||||
//npc.display.glowTexture = "";
|
||||
} else {
|
||||
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
}
|
||||
//npc.display.glowTexture = "";
|
||||
npc.display.skinOverlayData.overlayList.remove(0);
|
||||
npc.textureLocation = null;
|
||||
npc.updateHitbox();
|
||||
} catch(Exception ex) {
|
||||
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
}
|
||||
npc.textureLocation = null;
|
||||
npc.updateHitbox();
|
||||
} catch (Exception ex) {
|
||||
npc.display.texture = "customnpcs:textures/entity/humanmale/Steve.png";
|
||||
}
|
||||
}
|
||||
public void doubleClicked(){
|
||||
|
||||
public void doubleClicked() {
|
||||
close();
|
||||
}
|
||||
|
||||
public void keyTyped(char par1, int par2)
|
||||
{
|
||||
if (par2 == 1)
|
||||
{
|
||||
public void keyTyped(char par1, int par2) {
|
||||
if (par2 == 1) {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
public void close() {
|
||||
this.mc.displayGuiScreen(parent);
|
||||
}
|
||||
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton)
|
||||
{
|
||||
close();
|
||||
this.mc.displayGuiScreen(parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
protected void actionPerformed(GuiButton guibutton) {
|
||||
close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user