Added high poly FNAW multiplayer skins

This commit is contained in:
LAX1DUDE 2022-06-11 15:30:18 -07:00
parent 02057847e0
commit 1cf8de3be6
36 changed files with 916 additions and 242 deletions

View File

@ -18,8 +18,6 @@ public class PluginEaglerSkins extends Plugin implements Listener {
private static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 1, 64*64*4, 128*128*4 }; private static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 1, 64*64*4, 128*128*4 };
private static final int VALID_DEFAULT_SKINS = 33;
public PluginEaglerSkins() { public PluginEaglerSkins() {
super(new PluginDescription("EaglerSkins", PluginEaglerSkins.class.getName(), "1.0.0", "LAX1DUDE", Collections.emptySet(), null)); super(new PluginDescription("EaglerSkins", PluginEaglerSkins.class.getName(), "1.0.0", "LAX1DUDE", Collections.emptySet(), null));
} }
@ -45,11 +43,6 @@ public class PluginEaglerSkins extends Plugin implements Listener {
if("EAG|MySkin".equals(event.getTag())) { if("EAG|MySkin".equals(event.getTag())) {
int t = (int)msg[0] & 0xFF; int t = (int)msg[0] & 0xFF;
if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) { if(t >= 0 && t < SKIN_DATA_SIZE.length && msg.length == (SKIN_DATA_SIZE[t] + 1)) {
if(msg.length == 2) {
if(((int)msg[1] & 0xFF) >= VALID_DEFAULT_SKINS) {
msg[1] = 0;
}
}
skinCollection.put(user, msg); skinCollection.put(user, msg);
} }
}else if("EAG|FetchSkin".equals(event.getTag())) { }else if("EAG|FetchSkin".equals(event.getTag())) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Binary file not shown.

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false; public static boolean profanity = false;
public static final String version = "22w22a"; public static final String version = "22w23a";
public static final String mainMenuString = "eaglercraft " + version; public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft"; public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -18,7 +18,6 @@ import net.minecraft.src.OpenGlHelper;
import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.RenderEnderman; import net.minecraft.src.RenderEnderman;
import net.minecraft.src.RenderHelper; import net.minecraft.src.RenderHelper;
import net.minecraft.src.RenderManager;
public class DefaultSkinRenderer { public class DefaultSkinRenderer {
@ -56,8 +55,16 @@ public class DefaultSkinRenderer {
new TextureLocation("/skins/28.squid.png"), new TextureLocation("/skins/28.squid.png"),
new TextureLocation("/skins/29.mooshroom.png"), new TextureLocation("/skins/29.mooshroom.png"),
new TextureLocation("/mob/villager/villager.png"), new TextureLocation("/mob/villager/villager.png"),
new TextureLocation("/skins/30.longarms.png"), null, null, null, null, null
new TextureLocation("/skins/31.laxdude.png") };
public static final HighPolySkin[] defaultHighPoly = new HighPolySkin[] {
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null,
null, null, null,
HighPolySkin.LONG_ARMS, HighPolySkin.WEIRD_CLIMBER_DUDE, HighPolySkin.LAXATIVE_DUDE,
HighPolySkin.BABY_CHARLES, HighPolySkin.BABY_WINSTON
}; };
public static final boolean[] defaultVanillaSkinClassicOrSlimVariants = new boolean[] { public static final boolean[] defaultVanillaSkinClassicOrSlimVariants = new boolean[] {
@ -181,7 +188,7 @@ public class DefaultSkinRenderer {
} }
public static boolean isNewSkin(int id) { public static boolean isNewSkin(int id) {
return !(id == 0 || id == 2 || id == 4 || id == 6 || id == 8 || id == 10 || id == 12 || id == 14 || id == 18 || id == 28); return !(id == 0 || id == 2 || id == 4 || id == 6 || id == 8 || id == 10 || id == 12 || id == 14 || id == 18 || id == 28) && !isHighPoly(id);
} }
public static boolean isAlexSkin(int id) { public static boolean isAlexSkin(int id) {
@ -189,13 +196,17 @@ public class DefaultSkinRenderer {
} }
public static boolean isStandardModel(int id) { public static boolean isStandardModel(int id) {
return !isZombieModel(id) && !(id == 19 || id == 20 || id == 21 || id == 32 || id == 33 || id == 34); return !isZombieModel(id) && !(id == 19 || id == 20 || id == 21 || id == 32 || id == 33 || id == 34) && !isHighPoly(id);
} }
public static boolean isZombieModel(int id) { public static boolean isZombieModel(int id) {
return id == 18 || id == 28; return id == 18 || id == 28;
} }
public static boolean isHighPoly(int id) {
return !(defaultVanillaSkins.length > id && id >= 0) ? false : defaultHighPoly[id] != null;
}
public static boolean isPlayerNewSkin(EntityPlayer p) { public static boolean isPlayerNewSkin(EntityPlayer p) {
if(p instanceof EntityClientPlayerMP) { if(p instanceof EntityClientPlayerMP) {
if(EaglerProfile.presetSkinId <= -1) { if(EaglerProfile.presetSkinId <= -1) {
@ -237,6 +248,26 @@ public class DefaultSkinRenderer {
return false; return false;
} }
public static boolean isPlayerHighPoly(EntityPlayer p) {
if(p instanceof EntityClientPlayerMP) {
if(EaglerProfile.presetSkinId == -1) {
return false;
}else {
return isHighPoly(EaglerProfile.presetSkinId);
}
}else if(p instanceof EntityOtherPlayerMP) {
EntityOtherPlayerMP pp = (EntityOtherPlayerMP) p;
if(pp.skinPacket != null) {
if(pp.skinPacket[0] != (byte)4) {
return false;
}else {
return isHighPoly((int)pp.skinPacket[1] & 0xFF);
}
}
}
return false;
}
public static boolean isPlayerStandard(EntityPlayer p) { public static boolean isPlayerStandard(EntityPlayer p) {
if(p instanceof EntityClientPlayerMP) { if(p instanceof EntityClientPlayerMP) {
if(EaglerProfile.presetSkinId == -1) { if(EaglerProfile.presetSkinId == -1) {
@ -269,11 +300,15 @@ public class DefaultSkinRenderer {
if(pp.skinPacket != null) { if(pp.skinPacket != null) {
if(pp.skinPacket[0] != (byte)4) { if(pp.skinPacket[0] != (byte)4) {
return 0; return 0;
}else {
if(((int)pp.skinPacket[1] & 0xFF) >= DefaultSkinRenderer.defaultVanillaSkins.length) {
return 0;
}else { }else {
return (int)pp.skinPacket[1] & 0xFF; return (int)pp.skinPacket[1] & 0xFF;
} }
} }
} }
}
return 0; return 0;
} }
@ -288,10 +323,15 @@ public class DefaultSkinRenderer {
public static void renderPlayerPreview(int x, int y, int mx, int my, int id2) { public static void renderPlayerPreview(int x, int y, int mx, int my, int id2) {
int id = id2 - EaglerProfile.skins.size(); int id = id2 - EaglerProfile.skins.size();
boolean highPoly = isHighPoly(id);
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D); EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
if(highPoly) {
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
}else {
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE); EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
}
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
EaglerAdapter.glPushMatrix(); EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef((float) x, (float) (y - 80), 100.0F); EaglerAdapter.glTranslatef((float) x, (float) (y - 80), 100.0F);
@ -305,6 +345,54 @@ public class DefaultSkinRenderer {
EaglerAdapter.glRotatef(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f); EaglerAdapter.glRotatef(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f);
EaglerAdapter.glTranslatef(0.0F, -1.0F, 0.0F); EaglerAdapter.glTranslatef(0.0F, -1.0F, 0.0F);
if(highPoly) {
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPushMatrix();
EaglerAdapter.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
EaglerAdapter.glTranslatef(0.0f, -1.5f, 0.0f);
EaglerAdapter.glScalef(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale, HighPolySkin.highPolyScale);
HighPolySkin msh = defaultHighPoly[id];
msh.texture.bindTexture();
if(msh.bodyModel != null) {
EaglerAdapter.drawHighPoly(msh.bodyModel.getModel());
}
if(msh.headModel != null) {
EaglerAdapter.drawHighPoly(msh.headModel.getModel());
}
if(msh.limbsModel != null && msh.limbsModel.length > 0) {
for(int i = 0; i < msh.limbsModel.length; ++i) {
float offset = 0.0f;
if(msh.limbsOffset != null) {
if(msh.limbsOffset.length == 1) {
offset = msh.limbsOffset[0];
}else {
offset = msh.limbsOffset[i];
}
}
if(offset != 0.0f || msh.limbsInitialRotation != 0.0f) {
EaglerAdapter.glPushMatrix();
if(offset != 0.0f) {
EaglerAdapter.glTranslatef(0.0f, offset, 0.0f);
}
if(msh.limbsInitialRotation != 0.0f) {
EaglerAdapter.glRotatef(msh.limbsInitialRotation, 1.0f, 0.0f, 0.0f);
}
}
EaglerAdapter.drawHighPoly(msh.limbsModel[i].getModel());
if(offset != 0.0f || msh.limbsInitialRotation != 0.0f) {
EaglerAdapter.glPopMatrix();
}
}
}
EaglerAdapter.glPopMatrix();
EaglerAdapter.flipLightMatrix();
}else {
if(id < 0) { if(id < 0) {
Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(id2).glTex); Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(id2).glTex);
}else { }else {
@ -374,6 +462,7 @@ public class DefaultSkinRenderer {
EaglerAdapter.glColor4f(1.5f, 1.5f, 1.5f, 1.0f); EaglerAdapter.glColor4f(1.5f, 1.5f, 1.5f, 1.0f);
blazeRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F); blazeRenderer.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 100000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625F);
} }
}
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

View File

@ -26,6 +26,8 @@ public class EaglerProfile {
public static int presetSkinId; public static int presetSkinId;
public static int customSkinId; public static int customSkinId;
public static int newSkinNotificationIndex = 0;
public static String myChannel; public static String myChannel;
public static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 2, 64*64*4, 128*128*4 }; public static final int[] SKIN_DATA_SIZE = new int[] { 64*32*4, 64*64*4, 128*64*4, 128*128*4, 2, 64*64*4, 128*128*4 };
@ -120,61 +122,14 @@ public class EaglerProfile {
static { static {
String[] usernameDefaultWords = ConfigConstants.profanity ? new String[] { String[] usernameDefaultWords = ConfigConstants.profanity ? new String[] {
"Eagler", "Eagler", "Eagler", "Bitch", "Cock", "Milf", "Milf", "Yeer", "Groon",
"Eagler", "Eag", "Deevis", "Chode", "Deev", "Deev", "Fucker", "Fucking",
"Bitch", "Dumpster", "Dumpster", "Cum", "Chad", "Egg", "Fudgler", "Fudgli",
"Cock", "Yee", "Yee", "Yee", "Yeet", "Flumpter", "Darvy", "Darver", "Darver",
"Milf", "Fuck", "Fuck", "Frick", "Eagler", "Vigg", "Vigg", "Cunt", "Darvig"
"Milf",
"Yeer",
"Groon",
"Eag",
"Deevis",
"Chode",
"Deev",
"Deev",
"Fucker",
"Fucking",
"Dumpster",
"Dumpster",
"Cum",
"Chad",
"Egg",
"Fudgler",
"Fudgli",
"Yee",
"Yee",
"Yee",
"Yeet",
"Flumpter",
"Darvy",
"Darver",
"Darver",
"Fuck",
"Fuck",
"Frick",
"Eagler",
"Vigg",
"Vigg",
"Cunt",
"Darvig"
} : new String[] { } : new String[] {
"Yeeish", "Yeeish", "Yeeish", "Yee", "Yee", "Yeer", "Yeeler", "Eagler", "Eagl",
"Yeeish", "Darver", "Darvler", "Vool", "Vigg", "Vigg", "Deev", "Yigg", "Yeeg"
"Yee",
"Yee",
"Yeer",
"Yeeler",
"Eagler",
"Eagl",
"Darver",
"Darvler",
"Vool",
"Vigg",
"Vigg",
"Deev",
"Yigg",
"Yeeg"
}; };
rand = new EaglercraftRandom(); rand = new EaglercraftRandom();
@ -193,6 +148,10 @@ public class EaglerProfile {
presetSkinId = LocalStorageManager.profileSettingsStorage.getInteger("ps"); presetSkinId = LocalStorageManager.profileSettingsStorage.getInteger("ps");
customSkinId = LocalStorageManager.profileSettingsStorage.getInteger("cs"); customSkinId = LocalStorageManager.profileSettingsStorage.getInteger("cs");
username = LocalStorageManager.profileSettingsStorage.getString("name"); username = LocalStorageManager.profileSettingsStorage.getString("name");
newSkinNotificationIndex = LocalStorageManager.profileSettingsStorage.getInteger("nsi");
if(newSkinNotificationIndex == 0) {
newSkinNotificationIndex = GuiScreenEditProfile.newDefaultNotice;
}
myChannel = username + "_" + (100 + rand.nextInt(900)); myChannel = username + "_" + (100 + rand.nextInt(900));
NBTTagCompound n = LocalStorageManager.profileSettingsStorage.getCompoundTag("skins"); NBTTagCompound n = LocalStorageManager.profileSettingsStorage.getCompoundTag("skins");
for(Object s : NBTTagCompound.getTagMap(n).keySet()) { for(Object s : NBTTagCompound.getTagMap(n).keySet()) {

View File

@ -16,6 +16,7 @@ public class GuiScreenEditProfile extends GuiScreen {
private String[] dropDownOptions; private String[] dropDownOptions;
private int slotsVisible = 0; private int slotsVisible = 0;
private int selectedSlot = 0; private int selectedSlot = 0;
private int newSkinNotificationIndexCurrent = 0;
private int scrollPos = -1; private int scrollPos = -1;
private int skinsHeight = 0; private int skinsHeight = 0;
private boolean dragging = false; private boolean dragging = false;
@ -59,13 +60,21 @@ public class GuiScreenEditProfile extends GuiScreen {
"Pig", "Pig",
"Squid", "Squid",
"Mooshroom", "Mooshroom",
"Villager" "Villager",
"Long Arms",
"Weird Climber",
"Laxative Dude",
"Baby Charles",
"Baby Winston"
}; };
public static final int newDefaultNotice = defaultOptions.length - 5;
protected String screenTitle = "Edit Profile"; protected String screenTitle = "Edit Profile";
public GuiScreenEditProfile(GuiScreen parent) { public GuiScreenEditProfile(GuiScreen parent) {
this.parent = parent; this.parent = parent;
newSkinNotificationIndexCurrent = EaglerProfile.newSkinNotificationIndex;
reconcatDD(); reconcatDD();
} }
@ -101,7 +110,11 @@ public class GuiScreenEditProfile extends GuiScreen {
this.drawDefaultBackground(); this.drawDefaultBackground();
this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 15, 16777215); this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 15, 16777215);
this.drawString(this.fontRenderer, var1.translateKey("profile.screenname"), this.width / 2 - 20, this.height / 6 + 8, 10526880); this.drawString(this.fontRenderer, var1.translateKey("profile.screenname"), this.width / 2 - 20, this.height / 6 + 8, 10526880);
int cnt = defaultOptions.length - newSkinNotificationIndexCurrent;
if(cnt <= 0) {
this.drawString(this.fontRenderer, var1.translateKey("profile.playerSkin"), this.width / 2 - 20, this.height / 6 + 66, 10526880); this.drawString(this.fontRenderer, var1.translateKey("profile.playerSkin"), this.width / 2 - 20, this.height / 6 + 66, 10526880);
}
mousex = mx; mousex = mx;
mousey = my; mousey = my;
@ -136,6 +149,14 @@ public class GuiScreenEditProfile extends GuiScreen {
this.fontRenderer.drawStringWithShadow(dropDownOptions[selectedSlot], skinX + 5, skinY + 7, 14737632); this.fontRenderer.drawStringWithShadow(dropDownOptions[selectedSlot], skinX + 5, skinY + 7, 14737632);
if(cnt > 0) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(skinX, skinY - 11, 0.0f);
EaglerAdapter.glScalef(0.9f, 0.9f, 0.9f);
drawString(fontRenderer, "" + cnt + " new skin" + (cnt != 1 ? "" : "s") + " have been added:", 0, 0, 0xFFDDDDAA);
EaglerAdapter.glPopMatrix();
}
skinX = this.width / 2 - 20; skinX = this.width / 2 - 20;
skinY = this.height / 6 + 103; skinY = this.height / 6 + 103;
skinWidth = 140; skinWidth = 140;
@ -158,12 +179,19 @@ public class GuiScreenEditProfile extends GuiScreen {
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216); drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216);
for(int i = 0; i < slotsVisible; i++) { for(int i = 0; i < slotsVisible; i++) {
if(i + scrollPos < dropDownOptions.length) { if(i + scrollPos < dropDownOptions.length) {
int idx = i + scrollPos - EaglerProfile.skins.size();
if(idx >= newSkinNotificationIndexCurrent) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x77ffdd88);
}
if(selectedSlot == i + scrollPos) { if(selectedSlot == i + scrollPos) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x77ffffff); drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x77ffffff);
}else if(mx >= skinX && mx < (skinX + skinWidth - 10) && my >= (skinY + i*10 + 5) && my < (skinY + i*10 + 15)) { }else if(mx >= skinX && mx < (skinX + skinWidth - 10) && my >= (skinY + i*10 + 5) && my < (skinY + i*10 + 15)) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x55ffffff); drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x55ffffff);
} }
this.fontRenderer.drawStringWithShadow(dropDownOptions[i + scrollPos], skinX + 5, skinY + 5 + i*10, 14737632); this.fontRenderer.drawStringWithShadow(dropDownOptions[i + scrollPos], skinX + 5, skinY + 5 + i*10, 14737632);
if(EaglerProfile.newSkinNotificationIndex <= idx) {
EaglerProfile.newSkinNotificationIndex = idx + 1;
}
} }
} }
int scrollerSize = skinHeight * slotsVisible / dropDownOptions.length; int scrollerSize = skinHeight * slotsVisible / dropDownOptions.length;
@ -273,6 +301,7 @@ public class GuiScreenEditProfile extends GuiScreen {
LocalStorageManager.profileSettingsStorage.setInteger("ps", EaglerProfile.presetSkinId); LocalStorageManager.profileSettingsStorage.setInteger("ps", EaglerProfile.presetSkinId);
LocalStorageManager.profileSettingsStorage.setInteger("cs", EaglerProfile.customSkinId); LocalStorageManager.profileSettingsStorage.setInteger("cs", EaglerProfile.customSkinId);
LocalStorageManager.profileSettingsStorage.setInteger("nsi", EaglerProfile.newSkinNotificationIndex);
LocalStorageManager.profileSettingsStorage.setString("name", EaglerProfile.username); LocalStorageManager.profileSettingsStorage.setString("name", EaglerProfile.username);
NBTTagCompound skins = new NBTTagCompound(); NBTTagCompound skins = new NBTTagCompound();
@ -427,6 +456,9 @@ public class GuiScreenEditProfile extends GuiScreen {
if(par1 >= skinX && par1 < (skinX + 20) && par2 >= skinY && par2 < (skinY + 22)) { if(par1 >= skinX && par1 < (skinX + 20) && par2 >= skinY && par2 < (skinY + 22)) {
dropDownOpen = !dropDownOpen; dropDownOpen = !dropDownOpen;
if(!dropDownOpen) {
newSkinNotificationIndexCurrent = EaglerProfile.newSkinNotificationIndex;
}
} }
skinX = this.width / 2 - 20; skinX = this.width / 2 - 20;
@ -437,6 +469,9 @@ public class GuiScreenEditProfile extends GuiScreen {
if(!(par1 >= skinX && par1 < (skinX + skinWidth) && par2 >= skinY && par2 < (skinY + skinHeight + 22))) { if(!(par1 >= skinX && par1 < (skinX + skinWidth) && par2 >= skinY && par2 < (skinY + skinHeight + 22))) {
dropDownOpen = false; dropDownOpen = false;
dragging = false; dragging = false;
if(!dropDownOpen) {
newSkinNotificationIndexCurrent = EaglerProfile.newSkinNotificationIndex;
}
} }
skinY += 21; skinY += 21;
@ -449,6 +484,9 @@ public class GuiScreenEditProfile extends GuiScreen {
selectedSlot = i + scrollPos; selectedSlot = i + scrollPos;
dropDownOpen = false; dropDownOpen = false;
dragging = false; dragging = false;
if(!dropDownOpen) {
newSkinNotificationIndexCurrent = EaglerProfile.newSkinNotificationIndex;
}
} }
} }
} }

View File

@ -0,0 +1,91 @@
package net.lax1dude.eaglercraft;
public enum HighPolySkin {
LONG_ARMS(
new TextureLocation("/mesh/longarms.png"),
new ModelLocation("/mesh/longarms0.mdl"),
null,
new ModelLocation("/mesh/longarms2.mdl"),
new ModelLocation[] {
new ModelLocation("/mesh/longarms1.mdl")
},
new float[] {
1.325f
},
0.0f
),
WEIRD_CLIMBER_DUDE(
new TextureLocation("/mesh/weirdclimber.png"),
new ModelLocation("/mesh/weirdclimber0.mdl"),
null,
new ModelLocation("/mesh/weirdclimber2.mdl"),
new ModelLocation[] {
new ModelLocation("/mesh/weirdclimber1.mdl")
},
new float[] {
2.62f
},
-90.0f
),
LAXATIVE_DUDE(
new TextureLocation("/mesh/laxativedude.png"),
new ModelLocation("/mesh/laxativedude0.mdl"),
null,
new ModelLocation("/mesh/laxativedude3.mdl"),
new ModelLocation[] {
new ModelLocation("/mesh/laxativedude1.mdl"),
new ModelLocation("/mesh/laxativedude2.mdl")
},
new float[] {
2.04f
},
0.0f
),
BABY_CHARLES(
new TextureLocation("/mesh/charles.png"),
new ModelLocation("/mesh/charles0.mdl"),
new ModelLocation("/mesh/charles1.mdl"),
new ModelLocation("/mesh/charles2.mdl"),
new ModelLocation[] {},
new float[] {},
0.0f
),
BABY_WINSTON(
new TextureLocation("/mesh/winston.png"),
new ModelLocation("/mesh/winston0.mdl"),
null,
new ModelLocation("/mesh/winston1.mdl"),
new ModelLocation[] {},
new float[] {},
0.0f
);
public static float highPolyScale = 0.5f;
public final TextureLocation texture;
public final ModelLocation bodyModel;
public final ModelLocation headModel;
public final ModelLocation eyesModel;
public final ModelLocation[] limbsModel;
public final float[] limbsOffset;
public final float limbsInitialRotation;
HighPolySkin(TextureLocation texture, ModelLocation bodyModel, ModelLocation headModel,
ModelLocation eyesModel, ModelLocation[] limbsModel, float[] limbsOffset, float limbsInitialRotation) {
this.texture = texture;
this.bodyModel = bodyModel;
this.headModel = headModel;
this.eyesModel = eyesModel;
this.limbsModel = limbsModel;
this.limbsOffset = limbsOffset;
this.limbsInitialRotation = limbsInitialRotation;
}
}

View File

@ -0,0 +1,23 @@
package net.lax1dude.eaglercraft;
import net.lax1dude.eaglercraft.glemu.HighPolyMesh;
public class ModelLocation {
public final String path;
private boolean loadAttempted = false;
private HighPolyMesh mesh;
public ModelLocation(String path) {
this.path = path;
}
public HighPolyMesh getModel() {
if(!loadAttempted) {
mesh = EaglerAdapter.loadMesh(path);
loadAttempted = true;
}
return mesh;
}
}

View File

@ -1,5 +1,6 @@
package net.lax1dude.eaglercraft.glemu; package net.lax1dude.eaglercraft.glemu;
import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
@ -695,6 +696,15 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
} }
} }
} }
public static final HighPolyMesh loadMesh(String path) {
try {
return HighPolyMesh.loadMeshData(EaglerAdapter.loadResourceBytes(path));
}catch(IOException ex) {
System.err.println("Could not load HighPolyMesh! " + ex.toString());
ex.printStackTrace();
return null;
}
}
public static final void glColor3f(float p1, float p2, float p3) { public static final void glColor3f(float p1, float p2, float p3) {
colorR = p1; colorR = p1;
colorG = p2; colorG = p2;
@ -920,6 +930,13 @@ public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
s.setAnisotropicFix(anisotropicFixX, anisotropicFixY); s.setAnisotropicFix(anisotropicFixX, anisotropicFixY);
} }
} }
public static final void drawHighPoly(HighPolyMesh msh) {
bindTheShader((msh.hasTexture ? (FixedFunctionShader.NORMAL | FixedFunctionShader.TEXTURE0) : FixedFunctionShader.NORMAL) | getShaderModeFlag1());
_wglBindVertexArray(msh.vertexArray);
_wglDrawElements(_wGL_TRIANGLES, msh.indexCount, _wGL_UNSIGNED_SHORT, 0);
triangleDrawn += msh.indexCount / 3;
shader.unuseProgram();
}
private static Object blankUploadArray = _wCreateLowLevelIntBuffer(525000); private static Object blankUploadArray = _wCreateLowLevelIntBuffer(525000);
public static final void glDrawArrays(int p1, int p2, int p3, Object buffer) { public static final void glDrawArrays(int p1, int p2, int p3, Object buffer) {
if(isCompilingDisplayList) { if(isCompilingDisplayList) {

View File

@ -0,0 +1,119 @@
package net.lax1dude.eaglercraft.glemu;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import net.minecraft.src.GLAllocation;
import static net.lax1dude.eaglercraft.EaglerAdapter.*;
public class HighPolyMesh {
final BufferArrayGL vertexArray;
final BufferGL vertexBuffer;
final BufferGL indexBuffer;
public final int vertexCount;
public final int indexCount;
public final boolean hasTexture;
public HighPolyMesh(BufferArrayGL vertexArray, BufferGL vertexBuffer, BufferGL indexBuffer, int vertexCount,
int indexCount, boolean hasTexture) {
this.vertexArray = vertexArray;
this.vertexBuffer = vertexBuffer;
this.indexBuffer = indexBuffer;
this.vertexCount = vertexCount;
this.indexCount = indexCount;
this.hasTexture = hasTexture;
}
public void free() {
_wglDeleteVertexArray(vertexArray);
_wglDeleteBuffer(vertexBuffer);
_wglDeleteBuffer(indexBuffer);
}
static final byte[] headerSequence = "!EAG%mdl".getBytes(StandardCharsets.UTF_8);
static HighPolyMesh loadMeshData(byte[] mesh) throws IOException {
DataInputStream mdlIn = new DataInputStream(new ByteArrayInputStream(mesh));
byte[] hd = new byte[headerSequence.length];
mdlIn.read(hd);
if(!Arrays.equals(headerSequence, hd)) {
throw new IOException("Not an Eaglercraft HighPoly Mesh");
}
char CT = (char)mdlIn.read();
boolean textureEnabled;
if(CT == 'C') {
textureEnabled = false;
}else if(CT == 'T') {
textureEnabled = true;
}else {
throw new IOException("Unsupported mesh type '" + CT + "'!");
}
mdlIn.skipBytes(mdlIn.readUnsignedShort());
int vertexCount = mdlIn.readInt();
int indexCount = mdlIn.readInt();
int byteIndexCount = indexCount;
if(byteIndexCount % 2 != 0) { // must round up to int
byteIndexCount += 1;
}
int stride = textureEnabled ? 24 : 16;
int intsOfVertex = vertexCount * stride / 4;
int intsOfIndex = byteIndexCount / 2;
int intsTotal = intsOfIndex + intsOfVertex;
IntBuffer up1 = GLAllocation.createDirectIntBuffer(intsTotal);
for(int i = 0; i < intsTotal; ++i) {
int ch1 = mdlIn.read();
int ch2 = mdlIn.read();
int ch3 = mdlIn.read();
int ch4 = mdlIn.read();
if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); // rip
up1.put((ch4 << 24) + (ch3 << 16) + (ch2 << 8) + (ch1 << 0));
}
BufferArrayGL vertexArray = _wglCreateVertexArray();
_wglBindVertexArray(vertexArray);
up1.position(0).limit(intsOfVertex);
BufferGL vertexBuffer = _wglCreateBuffer();
_wglBindBuffer(_wGL_ARRAY_BUFFER, vertexBuffer);
_wglBufferData0(_wGL_ARRAY_BUFFER, up1, _wGL_STATIC_DRAW);
up1.position(intsOfVertex).limit(intsTotal);
BufferGL indexBuffer = _wglCreateBuffer();
_wglBindBuffer(_wGL_ELEMENT_ARRAY_BUFFER, indexBuffer);
_wglBufferData0(_wGL_ELEMENT_ARRAY_BUFFER, up1, _wGL_STATIC_DRAW);
_wglEnableVertexAttribArray(0);
_wglVertexAttribPointer(0, 3, _wGL_FLOAT, false, stride, 0);
if(textureEnabled) {
_wglEnableVertexAttribArray(1);
_wglVertexAttribPointer(1, 2, _wGL_FLOAT, false, stride, 16);
}
_wglEnableVertexAttribArray(textureEnabled ? 2 : 1);
_wglVertexAttribPointer(textureEnabled ? 2 : 1, 4, _wGL_UNSIGNED_BYTE, true, stride, 12);
return new HighPolyMesh(vertexArray, vertexBuffer, indexBuffer, vertexCount, indexCount, textureEnabled);
}
}

View File

@ -5,7 +5,9 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import net.lax1dude.eaglercraft.DefaultSkinRenderer;
import net.lax1dude.eaglercraft.EaglercraftRandom; import net.lax1dude.eaglercraft.EaglercraftRandom;
import net.lax1dude.eaglercraft.HighPolySkin;
@ -2166,8 +2168,15 @@ public abstract class EntityLiving extends Entity {
* enchantments into account. * enchantments into account.
*/ */
private int getArmSwingAnimationEnd() { private int getArmSwingAnimationEnd() {
return this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1 int ret = this.isPotionActive(Potion.digSpeed) ? 6 - (1 + this.getActivePotionEffect(Potion.digSpeed).getAmplifier()) * 1
: (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6); : (this.isPotionActive(Potion.digSlowdown) ? 6 + (1 + this.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2 : 6);
if(this instanceof EntityPlayer && DefaultSkinRenderer.isPlayerHighPoly((EntityPlayer)this)) {
HighPolySkin msh = DefaultSkinRenderer.defaultHighPoly[DefaultSkinRenderer.getPlayerRenderer((EntityPlayer)this)];
if(msh == HighPolySkin.WEIRD_CLIMBER_DUDE) {
ret *= 2;
}
}
return ret;
} }
/** /**

View File

@ -36,6 +36,14 @@ public abstract class EntityPlayer extends EntityLiving implements ICommandSende
public float cameraYaw; public float cameraYaw;
public String username; public String username;
public long eaglerHighPolyAnimationTick = System.currentTimeMillis();
public float eaglerHighPolyAnimationFloat1 = 0.0f;
public float eaglerHighPolyAnimationFloat2 = 0.0f;
public float eaglerHighPolyAnimationFloat3 = 0.0f;
public float eaglerHighPolyAnimationFloat4 = 0.0f;
public float eaglerHighPolyAnimationFloat5 = 0.0f;
public float eaglerHighPolyAnimationFloat6 = 0.0f;
/** /**
* Used by EntityPlayer to prevent too many xp orbs from getting absorbed at * Used by EntityPlayer to prevent too many xp orbs from getting absorbed at
* once. * once.

View File

@ -974,8 +974,13 @@ public class EntityRenderer {
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND); EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
terrain.bindTexture(); terrain.bindTexture();
if(EaglerAdapter.isKeyDown(34)) {
EaglerAdapter.glTexParameterf(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAX_ANISOTROPY, 1.0f);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST);
}else {
EaglerAdapter.glTexParameterf(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAX_ANISOTROPY, 16.0f); EaglerAdapter.glTexParameterf(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MAX_ANISOTROPY, 16.0f);
EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR); EaglerAdapter.glTexParameteri(EaglerAdapter.GL_TEXTURE_2D, EaglerAdapter.GL_TEXTURE_MIN_FILTER, EaglerAdapter.GL_NEAREST_MIPMAP_LINEAR);
}
EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.6f); EaglerAdapter.glAlphaFunc(EaglerAdapter.GL_GREATER, 0.6f);
this.mc.mcProfiler.endStartSection("terrain"); this.mc.mcProfiler.endStartSection("terrain");
var5.sortAndRender(var4, 0, (double) par1); var5.sortAndRender(var4, 0, (double) par1);

View File

@ -69,7 +69,7 @@ public class GLAllocation {
* native ordering to speed up access. * native ordering to speed up access.
*/ */
public static ByteBuffer createDirectByteBuffer(int par0) { public static ByteBuffer createDirectByteBuffer(int par0) {
return EaglerAdapter.isWebGL ? ByteBuffer.wrap(new byte[par0]).order(ByteOrder.nativeOrder()) : ByteBuffer.allocateDirect(par0).order(ByteOrder.nativeOrder()); return EaglerAdapter.isWebGL ? ByteBuffer.wrap(new byte[par0]) : ByteBuffer.allocateDirect(par0).order(ByteOrder.nativeOrder());
} }
/** /**

View File

@ -1,7 +1,7 @@
package net.minecraft.src; package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglerProfile; import net.lax1dude.eaglercraft.EaglerProfile;
import net.lax1dude.eaglercraft.HighPolySkin;
import net.lax1dude.eaglercraft.ModelBipedNewSkins; import net.lax1dude.eaglercraft.ModelBipedNewSkins;
import net.lax1dude.eaglercraft.TextureLocation; import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.DefaultSkinRenderer; import net.lax1dude.eaglercraft.DefaultSkinRenderer;
@ -110,7 +110,299 @@ public class RenderPlayer extends RenderLiving {
private boolean renderPass2 = false; private boolean renderPass2 = false;
public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) { public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) {
if(DefaultSkinRenderer.isPlayerStandard(par1EntityPlayer)) { if(DefaultSkinRenderer.isPlayerHighPoly(par1EntityPlayer)) {
HighPolySkin msh = DefaultSkinRenderer.defaultHighPoly[DefaultSkinRenderer.getPlayerRenderer(par1EntityPlayer)];
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPushMatrix();
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glTranslatef((float)par2, (float)par4 - par1EntityPlayer.yOffset, (float)par6);
float var13 = this.handleRotationFloat(par1EntityPlayer, par9);
float var10 = par1EntityPlayer.prevRenderYawOffset + (par1EntityPlayer.renderYawOffset - par1EntityPlayer.prevRenderYawOffset) * par9;
float var11 = par1EntityPlayer.prevRotationYawHead + (par1EntityPlayer.rotationYawHead - par1EntityPlayer.prevRotationYawHead) * par9;
float var12 = par1EntityPlayer.prevRotationPitch + (par1EntityPlayer.rotationPitch - par1EntityPlayer.prevRotationPitch) * par9;
this.rotateCorpse(par1EntityPlayer, var13, var10, par9);
EaglerAdapter.glScalef(HighPolySkin.highPolyScale, HighPolySkin.highPolyScale, HighPolySkin.highPolyScale);
msh.texture.bindTexture();
float var15 = par1EntityPlayer.prevLimbYaw + (par1EntityPlayer.limbYaw - par1EntityPlayer.prevLimbYaw) * par9;
float var16 = par1EntityPlayer.limbSwing - par1EntityPlayer.limbYaw * (1.0F - par9);
if(msh == HighPolySkin.LONG_ARMS) {
EaglerAdapter.glRotatef(MathHelper.sin(var16) * 20f * var15, 0.0f, 1.0f, 0.0f);
EaglerAdapter.glRotatef(MathHelper.cos(var16) * 7f * var15, 0.0f, 0.0f, 1.0f);
}else if(msh == HighPolySkin.WEIRD_CLIMBER_DUDE) {
EaglerAdapter.glRotatef(MathHelper.sin(var16) * 7f * var15, 0.0f, 1.0f, 0.0f);
EaglerAdapter.glRotatef(MathHelper.cos(var16) * 3f * var15, 0.0f, 0.0f, 1.0f);
EaglerAdapter.glRotatef(-var11, 0.0f, 1.0f, 0.0f);
float xd = (float)(par1EntityPlayer.posX - par1EntityPlayer.prevPosX);
EaglerAdapter.glRotatef(xd * 70.0f * var15, 0.0f, 0.0f, 1.0f);
float zd = (float)(par1EntityPlayer.posZ - par1EntityPlayer.prevPosZ);
EaglerAdapter.glRotatef(zd * 70.0f * var15, 1.0f, 0.0f, 0.0f);
EaglerAdapter.glRotatef(var11, 0.0f, 1.0f, 0.0f);
}else if(msh == HighPolySkin.LAXATIVE_DUDE) {
EaglerAdapter.glRotatef(-var11, 0.0f, 1.0f, 0.0f);
float xd = (float)(par1EntityPlayer.posX - par1EntityPlayer.prevPosX);
EaglerAdapter.glRotatef(-xd * 40.0f * var15, 0.0f, 0.0f, 1.0f);
float zd = (float)(par1EntityPlayer.posZ - par1EntityPlayer.prevPosZ);
EaglerAdapter.glRotatef(-zd * 40.0f * var15, 1.0f, 0.0f, 0.0f);
EaglerAdapter.glRotatef(var11, 0.0f, 1.0f, 0.0f);
}else if(msh == HighPolySkin.BABY_WINSTON) {
EaglerAdapter.glTranslatef(0.0f, (MathHelper.cos(var13 % 100000.0f) + 1.0f) * var15 * 0.2f, 0.0f);
EaglerAdapter.glRotatef(MathHelper.sin(var16) * 5f * var15, 0.0f, 1.0f, 0.0f);
EaglerAdapter.glRotatef(MathHelper.cos(var16) * 5f * var15, 0.0f, 0.0f, 1.0f);
}
if (par1EntityPlayer.hurtTime > 0 || par1EntityPlayer.deathTime > 0) {
EaglerAdapter.glColor4f(1.2f, 0.8F, 0.8F, 1.0F);
}
if(msh.bodyModel != null) {
EaglerAdapter.drawHighPoly(msh.bodyModel.getModel());
}
float jumpFactor = 0.0f;
if(msh.headModel != null) {
if(msh == HighPolySkin.BABY_CHARLES) {
long millis = System.currentTimeMillis();
float partialTicks = (float) ((millis - par1EntityPlayer.eaglerHighPolyAnimationTick) * 0.02);
//long l50 = millis / 50l * 50l;
//boolean runTick = par1EntityPlayer.eaglerHighPolyAnimationTick < l50 && millis >= l50;
par1EntityPlayer.eaglerHighPolyAnimationTick = millis;
if(partialTicks < 0.0f) {
partialTicks = 0.0f;
}
if(partialTicks > 1.0f) {
partialTicks = 1.0f;
}
float jumpFac = (float)(par1EntityPlayer.posY - par1EntityPlayer.prevPosY);
if(jumpFac < 0.0f && !par1EntityPlayer.isCollidedVertically) {
jumpFac = -jumpFac;
jumpFac *= 0.1f;
}
jumpFac -= 0.05f;
if(jumpFac > 0.1f && !par1EntityPlayer.isCollidedVertically) {
jumpFac = 0.1f;
}else if(jumpFac < 0.0f) {
jumpFac = 0.0f;
}else if(jumpFac > 0.1f && par1EntityPlayer.isCollidedVertically) {
jumpFac = 0.1f;
}else if(jumpFac > 0.4f) {
jumpFac = 0.4f;
}
jumpFac *= 10.0f;
par1EntityPlayer.eaglerHighPolyAnimationFloat3 += (jumpFac / (jumpFac + 1.0f)) * 6.0f * partialTicks;
if(Float.isInfinite(par1EntityPlayer.eaglerHighPolyAnimationFloat3)) {
par1EntityPlayer.eaglerHighPolyAnimationFloat3 = 1.0f;
}else if(par1EntityPlayer.eaglerHighPolyAnimationFloat3 > 1.0f) {
par1EntityPlayer.eaglerHighPolyAnimationFloat3 = 1.0f;
}else if(par1EntityPlayer.eaglerHighPolyAnimationFloat3 < -1.0f) {
par1EntityPlayer.eaglerHighPolyAnimationFloat3 = -1.0f;
}
par1EntityPlayer.eaglerHighPolyAnimationFloat2 += par1EntityPlayer.eaglerHighPolyAnimationFloat3 * partialTicks;
par1EntityPlayer.eaglerHighPolyAnimationFloat5 += partialTicks;
while(par1EntityPlayer.eaglerHighPolyAnimationFloat5 > 0.05f) {
par1EntityPlayer.eaglerHighPolyAnimationFloat5 -= 0.05f;
par1EntityPlayer.eaglerHighPolyAnimationFloat3 *= 0.99f;
par1EntityPlayer.eaglerHighPolyAnimationFloat2 *= 0.9f;
}
jumpFactor = par1EntityPlayer.eaglerHighPolyAnimationFloat2; //(par1EntityPlayer.eaglerHighPolyAnimationFloat1 - par1EntityPlayer.eaglerHighPolyAnimationFloat2) * partialTicks + par1EntityPlayer.eaglerHighPolyAnimationFloat2;
jumpFactor -= 0.12f;
if(jumpFactor < 0.0f) {
jumpFactor = 0.0f;
}
jumpFactor = jumpFactor / (jumpFactor + 2.0f);
if(jumpFactor > 1.0f) {
jumpFactor = 1.0f;
}
}
if(jumpFactor > 0.0f) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(0.0f, jumpFactor * 3.0f, 0.0f);
}
EaglerAdapter.drawHighPoly(msh.headModel.getModel());
if(jumpFactor > 0.0f) {
EaglerAdapter.glPopMatrix();
}
}
if(msh.limbsModel != null && msh.limbsModel.length > 0) {
for(int i = 0; i < msh.limbsModel.length; ++i) {
float offset = 0.0f;
if(msh.limbsOffset != null) {
if(msh.limbsOffset.length == 1) {
offset = msh.limbsOffset[0];
}else {
offset = msh.limbsOffset[i];
}
}
EaglerAdapter.glPushMatrix();
if(offset != 0.0f || msh.limbsInitialRotation != 0.0f) {
if(offset != 0.0f) {
EaglerAdapter.glTranslatef(0.0f, offset, 0.0f);
}
if(msh.limbsInitialRotation != 0.0f) {
EaglerAdapter.glRotatef(msh.limbsInitialRotation, 1.0f, 0.0f, 0.0f);
}
}
if(msh == HighPolySkin.LONG_ARMS) {
if(par1EntityPlayer.isSwingInProgress) {
float var17 = MathHelper.cos(-par1EntityPlayer.getSwingProgress(par9) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
var17 *= var17;
EaglerAdapter.glRotatef(-var17 * 20.0f, 1.0f, 0.0f, 0.0f);
}
}else if(msh == HighPolySkin.WEIRD_CLIMBER_DUDE) {
if(par1EntityPlayer.isSwingInProgress) {
float var17 = MathHelper.cos(-par1EntityPlayer.getSwingProgress(par9) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
var17 *= var17;
EaglerAdapter.glRotatef(var17 * 60.0f, 1.0f, 0.0f, 0.0f);
}
EaglerAdapter.glRotatef(40.0f * var15, 1.0f, 0.0f, 0.0f);
}else if(msh == HighPolySkin.LAXATIVE_DUDE) {
float fff = (i == 0) ? 1.0f : -1.0f;
float swing = (MathHelper.cos(var13 % 100000.0f) * fff + 0.2f) * var15;
float swing2 = (MathHelper.sin(var13 % 100000.0f) * fff + 1.2f) * var15;
EaglerAdapter.glRotatef(swing * 13.0f, 1.0f, 0.0f, 0.0f);
if(par1EntityPlayer.isSwingInProgress) {
float var17 = MathHelper.cos(-par1EntityPlayer.getSwingProgress(par9) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
var17 *= var17;
EaglerAdapter.glRotatef(-var17 * 25.0f, 1.0f, 0.0f, 0.0f);
}
EaglerAdapter.glScalef(1.0f, 1.0f, 1.0f - swing2 * 0.4f);
}
if(i != 0) {
msh.texture.bindTexture();
if (par1EntityPlayer.hurtTime > 0 || par1EntityPlayer.deathTime > 0) {
EaglerAdapter.glColor4f(1.2f, 0.8F, 0.8F, 1.0F);
}
}
EaglerAdapter.drawHighPoly(msh.limbsModel[i].getModel());
if(i == 0) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.flipLightMatrix();
if(msh == HighPolySkin.LONG_ARMS) {
EaglerAdapter.glTranslatef(1.72f, 2.05f, -0.24f);
ItemStack stk = par1EntityPlayer.getHeldItem();
if(stk != null) {
if(stk.itemID == Item.bow.itemID) {
EaglerAdapter.glTranslatef(-0.22f, 0.9f, 0.7f);
EaglerAdapter.glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
}else if(stk.itemID < 256 && !(Item.itemsList[stk.itemID] != null && Item.itemsList[stk.itemID] instanceof ItemBlock &&
!Block.blocksList[((ItemBlock)Item.itemsList[stk.itemID]).getBlockID()].renderAsNormalBlock())) {
EaglerAdapter.glTranslatef(0.0f, -0.1f, 0.13f);
}else if(Item.itemsList[stk.itemID] != null && !Item.itemsList[stk.itemID].isFull3D()) {
EaglerAdapter.glTranslatef(-0.08f, -0.1f, 0.16f);
}
}
}else if(msh == HighPolySkin.WEIRD_CLIMBER_DUDE) {
EaglerAdapter.glTranslatef(-0.029f, 1.2f, -3f);
EaglerAdapter.glRotatef(-5.0f, 0.0f, 1.0f, 0.0f);
float var17 = -1.2f * var15;
if(par1EntityPlayer.isSwingInProgress) {
float vvar17 = MathHelper.cos(-par1EntityPlayer.getSwingProgress(par9) * (float)Math.PI * 2.0f - 1.2f) - 0.362f;
var17 = vvar17 < var17 ? vvar17 : var17;
}
EaglerAdapter.glTranslatef(-0.02f * var17, 0.42f * var17, var17 * 0.35f);
EaglerAdapter.glRotatef(var17 * 30.0f, 1.0f, 0.0f, 0.0f);
EaglerAdapter.glRotatef(110.0f, 1.0f, 0.0f, 0.0f);
ItemStack stk = par1EntityPlayer.getHeldItem();
if(stk != null) {
if(stk.itemID == Item.bow.itemID) {
EaglerAdapter.glTranslatef(-0.18f, 1.0f, 0.4f);
EaglerAdapter.glRotatef(-95.0f, 1.0f, 0.0f, 0.0f);
}else if(stk.itemID < 256 && !(Item.itemsList[stk.itemID] != null && Item.itemsList[stk.itemID] instanceof ItemBlock &&
!Block.blocksList[((ItemBlock)Item.itemsList[stk.itemID]).getBlockID()].renderAsNormalBlock())) {
EaglerAdapter.glTranslatef(0.0f, -0.1f, 0.13f);
}else if(Item.itemsList[stk.itemID] != null && !Item.itemsList[stk.itemID].isFull3D()) {
EaglerAdapter.glTranslatef(-0.08f, -0.1f, 0.16f);
}
}
}else if(msh == HighPolySkin.LAXATIVE_DUDE) {
EaglerAdapter.glTranslatef(1.291f, 2.44f, -2.18f);
EaglerAdapter.glRotatef(95.0f, 1.0f, 0.0f, 0.0f);
ItemStack stk = par1EntityPlayer.getHeldItem();
if(stk != null) {
if(stk.itemID == Item.bow.itemID) {
EaglerAdapter.glTranslatef(-0.65f, 1.3f, -0.1f);
EaglerAdapter.glRotatef(180.0f, 0.0f, 0.0f, 1.0f);
EaglerAdapter.glRotatef(20.0f, 1.0f, 0.0f, 0.0f);
}else if(stk.itemID < 256 && !(Item.itemsList[stk.itemID] != null && Item.itemsList[stk.itemID] instanceof ItemBlock &&
!Block.blocksList[((ItemBlock)Item.itemsList[stk.itemID]).getBlockID()].renderAsNormalBlock())) {
EaglerAdapter.glTranslatef(0.0f, -0.35f, 0.4f);
}else if(Item.itemsList[stk.itemID] != null && !Item.itemsList[stk.itemID].isFull3D()) {
EaglerAdapter.glTranslatef(-0.1f, -0.1f, 0.16f);
}
}
}
renderSpecials(par1EntityPlayer, par9);
EaglerAdapter.flipLightMatrix();
EaglerAdapter.glPopMatrix();
}
EaglerAdapter.glPopMatrix();
}
}
if(msh.eyesModel != null) {
float f = 0.00416f;
int brightness = par1EntityPlayer.getBrightnessForRender(0.0f);
float blockLight = (brightness % 65536) * f;
float skyLight = (brightness / 65536) * f;
float sunCurve = (float)((par1EntityPlayer.worldObj.getWorldTime() + 4400l) % 24000) / 24000.0f;
sunCurve = MathHelper.clamp_float(9.8f - MathHelper.abs(sunCurve * 5.0f + sunCurve * sunCurve * 45.0f - 14.3f) * 0.7f, 0.0f, 1.0f);
skyLight = skyLight * (sunCurve * 0.85f + 0.15f);
blockLight = blockLight * (sunCurve * 0.3f + 0.7f);
float eyeBrightness = blockLight;
if(skyLight > eyeBrightness) {
eyeBrightness = skyLight;
}
eyeBrightness += blockLight * 0.2f;
eyeBrightness = 1.0f - eyeBrightness;
eyeBrightness = MathHelper.clamp_float(eyeBrightness * 1.9f - 1.0f, 0.0f, 1.0f);
if(eyeBrightness > 0.1f) {
EaglerAdapter.glEnable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_ONE, EaglerAdapter.GL_ONE);
EaglerAdapter.glColor4f(eyeBrightness * 7.0f, eyeBrightness * 7.0f, eyeBrightness * 7.0f, 1.0f);
if(jumpFactor > 0.0f) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef(0.0f, jumpFactor * 3.0f, 0.0f);
}
EaglerAdapter.glDisable(EaglerAdapter.GL_TEXTURE_2D);
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.drawHighPoly(msh.eyesModel.getModel());
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
if(jumpFactor > 0.0f) {
EaglerAdapter.glPopMatrix();
}
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
}
}
EaglerAdapter.glPopMatrix();
EaglerAdapter.flipLightMatrix();
}else if(DefaultSkinRenderer.isPlayerStandard(par1EntityPlayer)) {
float var10 = 1.0F; float var10 = 1.0F;
EaglerAdapter.glColor3f(var10, var10, var10); EaglerAdapter.glColor3f(var10, var10, var10);
ItemStack var11 = par1EntityPlayer.inventory.getCurrentItem(); ItemStack var11 = par1EntityPlayer.inventory.getCurrentItem();
@ -240,6 +532,7 @@ public class RenderPlayer extends RenderLiving {
boolean isSlim = DefaultSkinRenderer.isPlayerNewSkinSlim(par1EntityPlayer); boolean isSlim = DefaultSkinRenderer.isPlayerNewSkinSlim(par1EntityPlayer);
int renderType = DefaultSkinRenderer.getPlayerRenderer(par1EntityPlayer); int renderType = DefaultSkinRenderer.getPlayerRenderer(par1EntityPlayer);
if(!DefaultSkinRenderer.isPlayerHighPoly(par1EntityPlayer)) {
if (var4 != null) { if (var4 != null) {
EaglerAdapter.glPushMatrix(); EaglerAdapter.glPushMatrix();
(isNew ? (isSlim ? this.modelBipedMainNewSkinSlim : this.modelBipedMainNewSkin) : this.modelBipedMain).bipedHead.postRender(0.0625F); (isNew ? (isSlim ? this.modelBipedMainNewSkinSlim : this.modelBipedMainNewSkin) : this.modelBipedMain).bipedHead.postRender(0.0625F);
@ -339,6 +632,7 @@ public class RenderPlayer extends RenderLiving {
this.modelBipedMain.renderCloak(0.0625F); this.modelBipedMain.renderCloak(0.0625F);
EaglerAdapter.glPopMatrix(); EaglerAdapter.glPopMatrix();
} }
}
ItemStack var22 = par1EntityPlayer.inventory.getCurrentItem(); ItemStack var22 = par1EntityPlayer.inventory.getCurrentItem();
@ -363,6 +657,9 @@ public class RenderPlayer extends RenderLiving {
var25 = var22.getItemUseAction(); var25 = var22.getItemUseAction();
} }
float var7 = 0.0f;
float var8 = 0.0f;
float var11 = 0.0f;
if (var22.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var22.itemID].getRenderType())) { if (var22.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var22.itemID].getRenderType())) {
var7 = 0.5F; var7 = 0.5F;
EaglerAdapter.glTranslatef(0.0F, 0.1875F, -0.3125F); EaglerAdapter.glTranslatef(0.0F, 0.1875F, -0.3125F);
@ -590,7 +887,17 @@ public class RenderPlayer extends RenderLiving {
if(EaglerProfile.presetSkinId < 0) { if(EaglerProfile.presetSkinId < 0) {
Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(EaglerProfile.customSkinId).glTex); Minecraft.getMinecraft().renderEngine.bindTexture(EaglerProfile.skins.get(EaglerProfile.customSkinId).glTex);
}else { }else {
DefaultSkinRenderer.defaultVanillaSkins[EaglerProfile.presetSkinId].bindTexture(); TextureLocation tx = null;
if(DefaultSkinRenderer.defaultVanillaSkins[EaglerProfile.presetSkinId] == null) {
if(DefaultSkinRenderer.defaultHighPoly[EaglerProfile.presetSkinId] == null) {
tx = entityTexture;
}else {
tx = DefaultSkinRenderer.defaultHighPoly[EaglerProfile.presetSkinId].texture;
}
}else {
tx = DefaultSkinRenderer.defaultVanillaSkins[EaglerProfile.presetSkinId];
}
tx.bindTexture();
} }
}else if(par1EntityLiving instanceof EntityOtherPlayerMP) { }else if(par1EntityLiving instanceof EntityOtherPlayerMP) {
if(!DefaultSkinRenderer.bindSyncedSkin((EntityOtherPlayerMP)par1EntityLiving)) { if(!DefaultSkinRenderer.bindSyncedSkin((EntityOtherPlayerMP)par1EntityLiving)) {

View File

@ -97,6 +97,7 @@ public class Client {
str.append("eaglercraft.username = \"").append(EaglerProfile.username).append("\"\n"); str.append("eaglercraft.username = \"").append(EaglerProfile.username).append("\"\n");
str.append("eaglercraft.channel = \"").append(EaglerProfile.myChannel).append("\"\n"); str.append("eaglercraft.channel = \"").append(EaglerProfile.myChannel).append("\"\n");
str.append('\n'); str.append('\n');
shortenMinecraftOpts();
addArray(str, "window.minecraftOpts"); addArray(str, "window.minecraftOpts");
str.append('\n'); str.append('\n');
addDebug(str, "window.navigator.userAgent"); addDebug(str, "window.navigator.userAgent");
@ -146,6 +147,9 @@ public class Client {
@JSBody(params = { "v" }, script = "try { return \"\"+window.eval(v); } catch(e) { return \"<error>\"; }") @JSBody(params = { "v" }, script = "try { return \"\"+window.eval(v); } catch(e) { return \"<error>\"; }")
private static native String getString(String var); private static native String getString(String var);
@JSBody(params = { }, script = "for(var i = 0; i < window.minecraftOpts.length; ++i) { if(window.minecraftOpts[i].length > 2048) window.minecraftOpts[i] = \"[\" + Math.floor(window.minecraftOpts[i].length * 0.001) + \"k characters]\"; }")
private static native void shortenMinecraftOpts();
private static void addDebug(StringBuilder str, String var) { private static void addDebug(StringBuilder str, String var) {
str.append(var).append(" = ").append(getString(var)).append('\n'); str.append(var).append(" = ").append(getString(var)).append('\n');
} }

View File

@ -23,6 +23,7 @@ import org.teavm.jso.JSFunctor;
import org.teavm.jso.JSObject; import org.teavm.jso.JSObject;
import org.teavm.jso.ajax.ReadyStateChangeHandler; import org.teavm.jso.ajax.ReadyStateChangeHandler;
import org.teavm.jso.ajax.XMLHttpRequest; import org.teavm.jso.ajax.XMLHttpRequest;
import org.teavm.jso.browser.Storage;
import org.teavm.jso.browser.TimerHandler; import org.teavm.jso.browser.TimerHandler;
import org.teavm.jso.browser.Window; import org.teavm.jso.browser.Window;
import org.teavm.jso.canvas.CanvasRenderingContext2D; import org.teavm.jso.canvas.CanvasRenderingContext2D;
@ -260,6 +261,9 @@ public class EaglerAdapterImpl2 {
mouseY = canvas.getClientHeight() - getOffsetY(evt); mouseY = canvas.getClientHeight() - getOffsetY(evt);
mouseDX += evt.getMovementX(); mouseDX += evt.getMovementX();
mouseDY += -evt.getMovementY(); mouseDY += -evt.getMovementY();
if(hasBeenActive()) {
mouseEvents.add(evt);
}
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
} }
@ -1443,7 +1447,7 @@ public class EaglerAdapterImpl2 {
return !mouseEvents.isEmpty() && (currentEvent = mouseEvents.remove(0)) != null; return !mouseEvents.isEmpty() && (currentEvent = mouseEvents.remove(0)) != null;
} }
public static final int mouseGetEventButton() { public static final int mouseGetEventButton() {
if(currentEvent == null) return -1; if(currentEvent == null || currentEvent.getType().equals(MouseEvent.MOUSEMOVE)) return -1;
int b = currentEvent.getButton(); int b = currentEvent.getButton();
return b == 1 ? 2 : (b == 2 ? 1 : b); return b == 1 ? 2 : (b == 2 ? 1 : b);
} }
@ -1783,15 +1787,23 @@ public class EaglerAdapterImpl2 {
} }
} }
public static final byte[] loadLocalStorage(String key) { public static final byte[] loadLocalStorage(String key) {
String s = win.getLocalStorage().getItem("_eaglercraft."+key); Storage strg = win.getLocalStorage();
if(strg != null) {
String s =strg.getItem("_eaglercraft."+key);
if(s != null) { if(s != null) {
return Base64.decodeBase64(s); return Base64.decodeBase64(s);
}else { }else {
return null; return null;
} }
}else {
return null;
}
} }
public static final void saveLocalStorage(String key, byte[] data) { public static final void saveLocalStorage(String key, byte[] data) {
win.getLocalStorage().setItem("_eaglercraft."+key, Base64.encodeBase64String(data)); Storage strg = win.getLocalStorage();
if(strg != null) {
strg.setItem("_eaglercraft."+key, Base64.encodeBase64String(data));
}
} }
public static final void openLink(String url) { public static final void openLink(String url) {
win.open(url, "_blank"); win.open(url, "_blank");