Fix some bugs, FPS boost, Chunk Borders, Other Settings

This commit is contained in:
PeytonPlayz595 2024-01-07 20:03:01 +00:00
parent 71d2fe5fc9
commit f2fcab87ca
41 changed files with 109857 additions and 109920 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,246 @@
package net.PeytonPlayz585.shadow;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.profiler.Profiler;
public class Lagometer {
private static Minecraft mc;
private static GameSettings gameSettings;
private static Profiler profiler;
public static boolean active = false;
public static Lagometer.TimerNano timerTick = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerScheduledExecutables = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerChunkUpload = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerChunkUpdate = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerVisibility = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerTerrain = new Lagometer.TimerNano();
public static Lagometer.TimerNano timerServer = new Lagometer.TimerNano();
private static long[] timesFrame = new long[512];
private static long[] timesTick = new long[512];
private static long[] timesScheduledExecutables = new long[512];
private static long[] timesChunkUpload = new long[512];
private static long[] timesChunkUpdate = new long[512];
private static long[] timesVisibility = new long[512];
private static long[] timesTerrain = new long[512];
private static long[] timesServer = new long[512];
private static boolean[] gcs = new boolean[512];
private static int numRecordedFrameTimes = 0;
private static long prevFrameTimeNano = -1L;
private static long renderTimeNano = 0L;
private static long memTimeStartMs = System.currentTimeMillis();
private static long memStart = getMemoryUsed();
private static long memTimeLast = memTimeStartMs;
private static long memLast = memStart;
private static long memTimeDiffMs = 1L;
private static long memDiff = 0L;
private static int memMbSec = 0;
public static boolean updateMemoryAllocation() {
long i = System.currentTimeMillis();
long j = getMemoryUsed();
boolean flag = false;
if (j < memLast) {
double d0 = (double)memDiff / 1000000.0D;
double d1 = (double)memTimeDiffMs / 1000.0D;
int k = (int)(d0 / d1);
if (k > 0) {
memMbSec = k;
}
memTimeStartMs = i;
memStart = j;
memTimeDiffMs = 0L;
memDiff = 0L;
flag = true;
} else {
memTimeDiffMs = i - memTimeStartMs;
memDiff = j - memStart;
}
memTimeLast = i;
memLast = j;
return flag;
}
private static long getMemoryUsed() {
return EagRuntime.totalMemory() - EagRuntime.freeMemory();
}
public static void updateLagometer() {
if (mc == null) {
mc = Minecraft.getMinecraft();
gameSettings = mc.gameSettings;
profiler = mc.mcProfiler;
}
if (gameSettings.showDebugInfo && (gameSettings.ofLagometer || gameSettings.field_181657_aC)) {
active = true;
long timeNowNano = System.nanoTime();
if (prevFrameTimeNano == -1L) {
prevFrameTimeNano = timeNowNano;
} else {
int j = numRecordedFrameTimes & timesFrame.length - 1;
++numRecordedFrameTimes;
boolean flag = updateMemoryAllocation();
timesFrame[j] = timeNowNano - prevFrameTimeNano - renderTimeNano;
timesTick[j] = timerTick.timeNano;
timesScheduledExecutables[j] = timerScheduledExecutables.timeNano;
timesChunkUpload[j] = timerChunkUpload.timeNano;
timesChunkUpdate[j] = timerChunkUpdate.timeNano;
timesVisibility[j] = timerVisibility.timeNano;
timesTerrain[j] = timerTerrain.timeNano;
timesServer[j] = timerServer.timeNano;
gcs[j] = flag;
timerTick.reset();
timerScheduledExecutables.reset();
timerVisibility.reset();
timerChunkUpdate.reset();
timerChunkUpload.reset();
timerTerrain.reset();
timerServer.reset();
prevFrameTimeNano = System.nanoTime();
}
} else {
active = false;
prevFrameTimeNano = -1L;
}
}
public static void showLagometer(ScaledResolution p_showLagometer_0_) {
if (gameSettings != null) {
if (gameSettings.ofLagometer || gameSettings.field_181657_aC) {
long i = System.nanoTime();
GlStateManager.clear(256);
GlStateManager.matrixMode(5889);
GlStateManager.pushMatrix();
GlStateManager.enableColorMaterial();
GlStateManager.loadIdentity();
GlStateManager.ortho(0.0D, (double)mc.displayWidth, (double)mc.displayHeight, 0.0D, 1000.0D, 3000.0D);
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.loadIdentity();
GlStateManager.translate(0.0F, 0.0F, -2000.0F);
EaglercraftGPU.glLineWidth(1.0F);
GlStateManager.disableTexture2D();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(1, DefaultVertexFormats.POSITION_COLOR);
for (int j = 0; j < timesFrame.length; ++j) {
int k = (j - numRecordedFrameTimes & timesFrame.length - 1) * 100 / timesFrame.length;
k = k + 155;
float f = (float)mc.displayHeight;
long l = 0L;
if (gcs[j]) {
renderTime(j, timesFrame[j], k, k / 2, 0, f, worldrenderer);
} else {
renderTime(j, timesFrame[j], k, k, k, f, worldrenderer);
f = f - (float)renderTime(j, timesServer[j], k / 2, k / 2, k / 2, f, worldrenderer);
f = f - (float)renderTime(j, timesTerrain[j], 0, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesVisibility[j], k, k, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpdate[j], k, 0, 0, f, worldrenderer);
f = f - (float)renderTime(j, timesChunkUpload[j], k, 0, k, f, worldrenderer);
f = f - (float)renderTime(j, timesScheduledExecutables[j], 0, 0, k, f, worldrenderer);
float f2 = f - (float)renderTime(j, timesTick[j], 0, k, k, f, worldrenderer);
}
}
renderTimeDivider(0, timesFrame.length, 33333333L, 196, 196, 196, (float)mc.displayHeight, worldrenderer);
renderTimeDivider(0, timesFrame.length, 16666666L, 196, 196, 196, (float)mc.displayHeight, worldrenderer);
tessellator.draw();
GlStateManager.enableTexture2D();
int j2 = mc.displayHeight - 80;
int k2 = mc.displayHeight - 160;
mc.fontRendererObj.drawString("30", 2, k2 + 1, -8947849);
mc.fontRendererObj.drawString("30", 1, k2, -3881788);
mc.fontRendererObj.drawString("60", 2, j2 + 1, -8947849);
mc.fontRendererObj.drawString("60", 1, j2, -3881788);
GlStateManager.matrixMode(5889);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
float f1 = 1.0F - (float)((double)(System.currentTimeMillis() - memTimeStartMs) / 1000.0D);
f1 = Config.limit(f1, 0.0F, 1.0F);
int l2 = (int)(170.0F + f1 * 85.0F);
int i1 = (int)(100.0F + f1 * 55.0F);
int j1 = (int)(10.0F + f1 * 10.0F);
int k1 = l2 << 16 | i1 << 8 | j1;
int l1 = 512 / p_showLagometer_0_.getScaleFactor() + 2;
int i2 = mc.displayHeight / p_showLagometer_0_.getScaleFactor() - 8;
GuiIngame guiingame = mc.ingameGUI;
GuiIngame.drawRect(l1 - 1, i2 - 1, l1 + 50, i2 + 10, -1605349296);
mc.fontRendererObj.drawString(" " + memMbSec + " MB/s", l1, i2, k1);
renderTimeNano = System.nanoTime() - i;
}
}
}
private static long renderTime(int p_renderTime_0_, long p_renderTime_1_, int p_renderTime_3_, int p_renderTime_4_, int p_renderTime_5_, float p_renderTime_6_, WorldRenderer p_renderTime_7_) {
long i = p_renderTime_1_ / 200000L;
if (i < 3L) {
return 0L;
} else {
p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ - (float)i + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex();
p_renderTime_7_.pos((double)((float)p_renderTime_0_ + 0.5F), (double)(p_renderTime_6_ + 0.5F), 0.0D).color(p_renderTime_3_, p_renderTime_4_, p_renderTime_5_, 255).endVertex();
return i;
}
}
private static long renderTimeDivider(int p_renderTimeDivider_0_, int p_renderTimeDivider_1_, long p_renderTimeDivider_2_, int p_renderTimeDivider_4_, int p_renderTimeDivider_5_, int p_renderTimeDivider_6_, float p_renderTimeDivider_7_, WorldRenderer p_renderTimeDivider_8_) {
long i = p_renderTimeDivider_2_ / 200000L;
if (i < 3L) {
return 0L;
} else {
p_renderTimeDivider_8_.pos((double)((float)p_renderTimeDivider_0_ + 0.5F), (double)(p_renderTimeDivider_7_ - (float)i + 0.5F), 0.0D).color(p_renderTimeDivider_4_, p_renderTimeDivider_5_, p_renderTimeDivider_6_, 255).endVertex();
p_renderTimeDivider_8_.pos((double)((float)p_renderTimeDivider_1_ + 0.5F), (double)(p_renderTimeDivider_7_ - (float)i + 0.5F), 0.0D).color(p_renderTimeDivider_4_, p_renderTimeDivider_5_, p_renderTimeDivider_6_, 255).endVertex();
return i;
}
}
public static boolean isActive() {
return active;
}
public static class TimerNano {
public long timeStartNano = 0L;
public long timeNano = 0L;
public void start() {
if (Lagometer.active) {
if (this.timeStartNano == 0L) {
this.timeStartNano = System.nanoTime();
}
}
}
public void end() {
if (Lagometer.active) {
if (this.timeStartNano != 0L) {
this.timeNano += System.nanoTime() - this.timeStartNano;
this.timeStartNano = 0L;
}
}
}
private void reset() {
this.timeNano = 0L;
this.timeStartNano = 0L;
}
}
}

View File

@ -0,0 +1,105 @@
package net.PeytonPlayz585.shadow.chunk;
import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.player.EntityPlayer;
public class ChunkBorders {
public ChunkBorders() {
}
public void render(float partialTicks, long finishTimeNano) {
EntityPlayer entityplayer = Minecraft.getMinecraft().thePlayer;
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer bufferbuilder = tessellator.getWorldRenderer();
double d0 = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double)partialTicks;
double d1 = entityplayer.lastTickPosY + (entityplayer.posY - entityplayer.lastTickPosY) * (double)partialTicks;
double d2 = entityplayer.lastTickPosZ + (entityplayer.posZ - entityplayer.lastTickPosZ) * (double)partialTicks;
double d3 = 0.0D - d1;
double d4 = 256.0D - d1;
GlStateManager.disableTexture2D();
GlStateManager.disableBlend();
double d5 = (double)(entityplayer.chunkCoordX << 4) - d0;
double d6 = (double)(entityplayer.chunkCoordZ << 4) - d2;
EaglercraftGPU.glLineWidth(1.0F);
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
for (int i = -16; i <= 32; i += 16) {
for (int j = -16; j <= 32; j += 16) {
bufferbuilder.pos(d5 + (double)i, d3, d6 + (double)j).color(1.0F, 0.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + (double)i, d3, d6 + (double)j).color(1.0F, 0.0F, 0.0F, 0.5F).endVertex();
bufferbuilder.pos(d5 + (double)i, d4, d6 + (double)j).color(1.0F, 0.0F, 0.0F, 0.5F).endVertex();
bufferbuilder.pos(d5 + (double)i, d4, d6 + (double)j).color(1.0F, 0.0F, 0.0F, 0.0F).endVertex();
}
}
for (int k = 2; k < 16; k += 2) {
bufferbuilder.pos(d5 + (double)k, d3, d6).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d3, d6).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d4, d6).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d4, d6).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d3, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d3, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d4, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)k, d4, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
}
for (int l = 2; l < 16; l += 2) {
bufferbuilder.pos(d5, d3, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5, d3, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d4, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d4, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d3, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d3, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d4, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d4, d6 + (double)l).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
}
for (int i1 = 0; i1 <= 256; i1 += 2) {
double d7 = (double)i1 - d1;
bufferbuilder.pos(d5, d7, d6).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
bufferbuilder.pos(d5, d7, d6).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d7, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d7, d6 + 16.0D).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d7, d6).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d7, d6).color(1.0F, 1.0F, 0.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d7, d6).color(1.0F, 1.0F, 0.0F, 0.0F).endVertex();
}
tessellator.draw();
EaglercraftGPU.glLineWidth(2.0F);
bufferbuilder.begin(3, DefaultVertexFormats.POSITION_COLOR);
for (int j1 = 0; j1 <= 16; j1 += 16) {
for (int l1 = 0; l1 <= 16; l1 += 16) {
bufferbuilder.pos(d5 + (double)j1, d3, d6 + (double)l1).color(0.25F, 0.25F, 1.0F, 0.0F).endVertex();
bufferbuilder.pos(d5 + (double)j1, d3, d6 + (double)l1).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)j1, d4, d6 + (double)l1).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + (double)j1, d4, d6 + (double)l1).color(0.25F, 0.25F, 1.0F, 0.0F).endVertex();
}
}
for (int k1 = 0; k1 <= 256; k1 += 16) {
double d8 = (double)k1 - d1;
bufferbuilder.pos(d5, d8, d6).color(0.25F, 0.25F, 1.0F, 0.0F).endVertex();
bufferbuilder.pos(d5, d8, d6).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d8, d6 + 16.0D).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d8, d6 + 16.0D).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5 + 16.0D, d8, d6).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d8, d6).color(0.25F, 0.25F, 1.0F, 1.0F).endVertex();
bufferbuilder.pos(d5, d8, d6).color(0.25F, 0.25F, 1.0F, 0.0F).endVertex();
}
tessellator.draw();
EaglercraftGPU.glLineWidth(1.0F);
GlStateManager.enableBlend();
GlStateManager.enableTexture2D();
}
}

View File

@ -0,0 +1,22 @@
package net.PeytonPlayz585.shadow.debug;
import net.PeytonPlayz585.shadow.chunk.ChunkBorders;
import net.minecraft.client.Minecraft;
public class DebugChunkRenderer {
private ChunkBorders chunkBorders;
public DebugChunkRenderer() {
this.chunkBorders = new ChunkBorders();
}
public boolean shouldRender() {
return Minecraft.getMinecraft().gameSettings.chunkBorders;
}
public void render(float partialTicks, long finishTimeNano) {
chunkBorders.render(partialTicks, finishTimeNano);
}
}

View File

@ -0,0 +1,85 @@
package net.PeytonPlayz585.shadow.gui;
import net.PeytonPlayz585.shadow.Config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiOptionButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
public class GuiOther extends GuiScreen implements GuiYesNoCallback {
private GuiScreen prevScreen;
protected String title;
private GameSettings settings;
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.LAGOMETER, GameSettings.Options.PROFILER, GameSettings.Options.FULLSCREEN, GameSettings.Options.HUD_FPS, GameSettings.Options.HUD_COORDS, GameSettings.Options.HUD_STATS, GameSettings.Options.HUD_WORLD, GameSettings.Options.HUD_PLAYER, GameSettings.Options.HUD_24H, GameSettings.Options.ANAGLYPH};
public GuiOther(GuiScreen p_i51_1_) {
this.prevScreen = p_i51_1_;
this.settings = Minecraft.getMinecraft().gameSettings;
}
/**
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the
* window resizes, the buttonList is cleared beforehand.
*/
public void initGui() {
this.title = I18n.format("Other Settings", new Object[0]);
this.buttonList.clear();
for (int i = 0; i < enumOptions.length; ++i) {
GameSettings.Options gamesettings$options = enumOptions[i];
int j = width / 2 - 155 + i % 2 * 160;
int k = height / 6 + 21 * (i / 2) - 12;
if (!gamesettings$options.getEnumFloat()) {
this.buttonList.add(new GuiOptionButton(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options, this.settings.getKeyBinding(gamesettings$options)));
}
}
this.buttonList.add(new GuiButton(210, width / 2 - 100, height / 6 + 168 + 11 - 44, I18n.format("Reset Video Settings", new Object[0])));
this.buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168 + 11, I18n.format("gui.done", new Object[0])));
}
/**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/
protected void actionPerformed(GuiButton button) {
if (button.enabled) {
if (button.id < 200 && button instanceof GuiOptionButton) {
this.settings.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
button.displayString = this.settings.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
}
if (button.id == 200) {
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.prevScreen);
}
if (button.id == 210) {
this.mc.gameSettings.saveOptions();
GuiYesNo guiyesno = new GuiYesNo(this, I18n.format("Reset all video settings to their default values?", new Object[0]), "", 9999);
this.mc.displayGuiScreen(guiyesno);
}
}
}
public void confirmClicked(boolean result, int id) {
if (result) {
this.mc.gameSettings.resetSettings();
}
this.mc.displayGuiScreen(this);
}
/**
* Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
*/
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, this.title, width / 2, 15, 16777215);
super.drawScreen(mouseX, mouseY, partialTicks);
}
}

View File

@ -10,7 +10,7 @@ public class GuiQuality extends GuiScreen {
protected String title; protected String title;
private GameSettings settings; private GameSettings settings;
//private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS}; //private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.AF_LEVEL, GameSettings.Options.AA_LEVEL, GameSettings.Options.CLEAR_WATER, GameSettings.Options.RANDOM_MOBS, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_COLORS, GameSettings.Options.SWAMP_COLORS, GameSettings.Options.SMOOTH_BIOMES, GameSettings.Options.CONNECTED_TEXTURES, GameSettings.Options.NATURAL_TEXTURES, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.CUSTOM_ITEMS, GameSettings.Options.DYNAMIC_LIGHTS};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.DYNAMIC_LIGHTS}; private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.MIPMAP_LEVELS, GameSettings.Options.MIPMAP_TYPE, GameSettings.Options.FXAA, GameSettings.Options.CLEAR_WATER, GameSettings.Options.BETTER_GRASS, GameSettings.Options.BETTER_SNOW, GameSettings.Options.CUSTOM_FONTS, GameSettings.Options.CUSTOM_SKY, GameSettings.Options.DYNAMIC_LIGHTS};
public GuiQuality(GuiScreen p_i53_1_) { public GuiQuality(GuiScreen p_i53_1_) {
this.prevScreen = p_i53_1_; this.prevScreen = p_i53_1_;

View File

@ -49,12 +49,15 @@ public class ImageButton extends MainButton {
float f3 = (color >> 8 & 0xFF) / 255.0F; float f3 = (color >> 8 & 0xFF) / 255.0F;
float f4 = (color & 0xFF) / 255.0F; float f4 = (color & 0xFF) / 255.0F;
GlStateManager.color(f2, f3, f4, f1); GlStateManager.color(f2, f3, f4, f1);
boolean isAlpha = GlStateManager.isAlpha();
boolean isBlend = GlStateManager.isBlend();
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
Minecraft.getMinecraft().getTextureManager().bindTexture(image); Minecraft.getMinecraft().getTextureManager().bindTexture(image);
Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0, 0, 6, 6, 6, 6); Gui.drawModalRectWithCustomSizedTexture(this.xPosition + 3, this.yPosition + 3, 0, 0, 6, 6, 6, 6);
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
} }

View File

@ -137,10 +137,5 @@ public class MainButton extends GuiButton {
if (width != 1.0F) { if (width != 1.0F) {
EaglercraftGPU.glLineWidth(1.0F); EaglercraftGPU.glLineWidth(1.0F);
} }
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.disableColorMaterial();
GlStateManager.enableTexture2D();
} }
} }

View File

@ -1,30 +0,0 @@
package net.PeytonPlayz585.shadow.opengl;
import net.lax1dude.eaglercraft.v1_8.internal.IBufferGL;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.ByteBuffer;
import net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums;
public class OpenGLManager {
public static void setClientActiveTexture(int lightmaptexunit) {
PlatformOpenGL._wglActiveTexture(lightmaptexunit);
}
public static void glBindBuffer(int glArrayBuffer, IBufferGL vbo) {
PlatformOpenGL._wglBindBuffer(glArrayBuffer, vbo);
}
public static void glBufferData(int glArrayBuffer, ByteBuffer p_181722_1_, int i) {
PlatformOpenGL._wglBufferData(glArrayBuffer, p_181722_1_, i);
}
public static void glDrawArrays(int glTriangles, int i, int j) {
PlatformOpenGL._wglDrawArrays(RealOpenGLEnums.GL_TRIANGLES, 0, 6);
}
public static void glEnableClientState(int i) {
//PlatformOpenGL._wglEnableVertexAttribArray(i);
}
}

View File

@ -11,13 +11,29 @@ import net.lax1dude.eaglercraft.v1_8.opengl.VertexFormat;
import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer; import net.lax1dude.eaglercraft.v1_8.opengl.WorldRenderer;
public class VertexBuffer { public class VertexBuffer {
public void func_181722_a(WorldRenderer p_181722_1_, int parInt1) {
if(p_181722_1_.getVertexCount() > 0) { private ByteBuffer buffer;
EaglercraftGPU.glNewList(parInt1, GL_COMPILE);
VertexFormat fmt = p_181722_1_.getVertexFormat(); public VertexBuffer() {
ByteBuffer buf = p_181722_1_.getByteBuffer();
EaglercraftGPU.renderBuffer(buf, fmt.eaglercraftAttribBits, 7, p_181722_1_.getVertexCount());
EaglercraftGPU.glEndList();
}
} }
public void func_181722_a(WorldRenderer parWorldRenderer) {
int count = parWorldRenderer.getVertexCount();
if (count > 0) {
VertexFormat format = parWorldRenderer.getVertexFormat();
buffer = parWorldRenderer.getByteBuffer();
buffer.clear();
buffer.limit(count * format.attribStride);
EaglercraftGPU.renderBuffer(
buffer,
format.eaglercraftAttribBits,
parWorldRenderer.getDrawMode(),
count
);
parWorldRenderer.reset();
}
}
} }

View File

@ -6,7 +6,7 @@ public class VertexBufferUploader {
private VertexBuffer vertexBuffer = new VertexBuffer(); private VertexBuffer vertexBuffer = new VertexBuffer();
public void func_181679_a(WorldRenderer p_181679_1_, int parInt1) { public void func_181679_a(WorldRenderer p_181679_1_) {
this.vertexBuffer.func_181722_a(p_181679_1_, parInt1); this.vertexBuffer.func_181722_a(p_181679_1_);
} }
} }

View File

@ -212,7 +212,7 @@ public class ChunkUpdateManager {
} }
private void uploadVertexBuffer(WorldRenderer p_178506_1_, int parInt1) { private void uploadVertexBuffer(WorldRenderer p_178506_1_, int parInt1) {
this.vertexUploader.func_181679_a(p_178506_1_, parInt1); this.vertexUploader.func_181679_a(p_178506_1_);
} }
public boolean isAlreadyQueued(RenderChunk update) { public boolean isAlreadyQueued(RenderChunk update) {

View File

@ -230,6 +230,10 @@ public class GlStateManager {
stateAlphaTest = true; stateAlphaTest = true;
} }
public static final boolean isAlpha() {
return stateAlphaTest;
}
public static final void alphaFunc(int func, float ref) { public static final void alphaFunc(int func, float ref) {
if(func != GL_GREATER) { if(func != GL_GREATER) {
throw new UnsupportedOperationException("Only GL_GREATER alphaFunc is supported"); throw new UnsupportedOperationException("Only GL_GREATER alphaFunc is supported");
@ -356,6 +360,10 @@ public class GlStateManager {
} }
} }
public static final boolean isBlend() {
return stateBlend;
}
public static final void globalDisableBlend() { public static final void globalDisableBlend() {
if(stateBlend) { if(stateBlend) {
_wglDisable(GL_BLEND); _wglDisable(GL_BLEND);
@ -444,6 +452,10 @@ public class GlStateManager {
stateFog = true; stateFog = true;
} }
public static final boolean isFogEnabled() {
return stateFog;
}
public static final void disableFog() { public static final void disableFog() {
stateFog = false; stateFog = false;
} }

View File

@ -1,136 +1,161 @@
package net.lax1dude.eaglercraft.v1_8.opengl; package net.lax1dude.eaglercraft.v1_8.opengl;
import java.io.InputStream; import java.io.*;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Arrays;
import java.util.HashMap;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.internal.PlatformAssets; import net.lax1dude.eaglercraft.v1_8.internal.PlatformAssets;
public class ImageData { public class ImageData {
public final int width;
public final int height;
public final int[] pixels;
public final boolean alpha;
public ImageData(int width, int height, int[] pixels, boolean alpha) {
this.width = width;
this.height = height;
this.pixels = pixels;
this.alpha = alpha;
}
public ImageData(int width, int height, boolean alpha) {
this.width = width;
this.height = height;
this.pixels = new int[width * height];
this.alpha = alpha;
}
public ImageData fillAlpha() {
for(int i = 0; i < pixels.length; ++i) {
pixels[i] = pixels[i] | 0xFF000000;
}
return this;
}
public ImageData getSubImage(int x, int y, int pw, int ph) {
int[] img = new int[pw * ph];
for(int i = 0; i < ph; ++i) {
System.arraycopy(pixels, (i + y) * this.width + x, img, i * pw, pw);
}
return new ImageData(pw, ph, img, alpha);
}
public static final ImageData loadImageFile(String path) { public final int width;
byte[] fileData = EagRuntime.getResourceBytes(path); public final int height;
if(fileData != null) { public final IntBuffer pixels;
return loadImageFile(fileData); public final boolean alpha;
}else {
return null;
}
}
public static final ImageData loadImageFile(InputStream data) { public ImageData(int width, int height, int[] pixels, boolean alpha) {
return PlatformAssets.loadImageFile(data); this.width = width;
} this.height = height;
this.pixels = ByteBuffer.allocateDirect(pixels.length * 4)
.asIntBuffer()
.put(pixels)
.flip();
this.alpha = alpha;
}
public static final ImageData loadImageFile(byte[] data) { public ImageData(int width, int height, boolean alpha) {
return PlatformAssets.loadImageFile(data); this.width = width;
} this.height = height;
this.pixels = ByteBuffer.allocateDirect(width * height * 4)
.asIntBuffer();
this.alpha = alpha;
}
public void getRGB(int startX, int startY, int w, int h, public ImageData fillAlpha() {
int[] rgbArray, int offset, int scansize) { for (int i = 0; i < pixels.limit(); i++) {
for(int y = 0; y < h; ++y) { pixels.put(i, pixels.get(i) | 0xFF000000);
System.arraycopy(pixels, offset + (y + startY) * scansize + startX, rgbArray, y * w, w); }
} return this;
} }
public void copyPixelsFrom(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
if(sx2 - sx1 != dx2 - dx1) {
throw new IllegalArgumentException("Width of the copied region must match the"
+ "width of the pasted region");
}
int cw = sx2 - sx1;
if(sy2 - sy1 != dy2 - dy1) {
throw new IllegalArgumentException("Height of the copied region must match the"
+ "height of the pasted region");
}
int ch = sy2 - sy1;
for(int y = 0; y < ch; ++y) {
System.arraycopy(input.pixels, sx1 + (sy1 + y) * cw, pixels, dx1 + (dy1 + y) * cw, cw);
}
}
public void drawLayer(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
if(sx2 - sx1 != dx2 - dx1) {
throw new IllegalArgumentException("Width of the copied region must match the"
+ "width of the pasted region");
}
int cw = sx2 - sx1;
if(sy2 - sy1 != dy2 - dy1) {
throw new IllegalArgumentException("Height of the copied region must match the"
+ "height of the pasted region");
}
int ch = sy2 - sy1;
for(int y = 0; y < ch; ++y) {
for(int x = 0; x < cw; ++x) {
int si = (sy1 + y) * cw + sx1 + x;
int di = (dy1 + y) * cw + dx1 + x;
int spx = input.pixels[si];
int dpx = pixels[di];
if((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
pixels[di] = spx;
}else {
int sa = (spx >> 24) & 0xFF;
int da = (dpx >> 24) & 0xFF;
int r = ((spx >> 16) & 0xFF) * sa / 255;
int g = ((spx >> 8) & 0xFF) * sa / 255;
int b = (spx & 0xFF) * sa / 255;
int aa = (255 - sa) * da;
r += ((dpx >> 16) & 0xFF) * aa / 65025;
g += ((dpx >> 8) & 0xFF) * aa / 65025;
b += (dpx & 0xFF) * aa / 65025;
sa += da;
if(sa > 0xFF) sa = 0xFF;
pixels[di] = ((sa) << 24) | (r << 16) | (g << 8) | b;
}
}
}
}
public ImageData swapRB() {
for(int i = 0; i < pixels.length; ++i) {
int j = pixels[i];
pixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) |
((j & 0x000000FF) << 16);
}
return this;
}
public static int swapRB(int c) {
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
}
} public ImageData getSubImage(int x, int y, int pw, int ph) {
int[] img = new int[pw * ph];
for (int i = 0; i < ph; i++) {
pixels.position((i + y) * this.width + x);
pixels.get(img, i * pw, pw);
}
return new ImageData(pw, ph, img, alpha);
}
public static final ImageData loadImageFile(String path) {
try (InputStream inputStream = EagRuntime.getResourceStream(path)) {
if (inputStream != null) {
return loadImageFile(inputStream);
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static final ImageData loadImageFile(InputStream data) {
return PlatformAssets.loadImageFile(data);
}
public static final ImageData loadImageFile(byte[] data) {
return PlatformAssets.loadImageFile(data);
}
public void getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
for (int y = 0; y < h; y++) {
pixels.position(offset + (y + startY) * scansize + startX);
pixels.get(rgbArray, y * w, w);
}
}
public void copyPixelsFrom(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
int cw = sx2 - sx1;
int ch = sy2 - sy1;
if (cw != dx2 - dx1 || ch != dy2 - dy1) {
throw new IllegalArgumentException("Width and height of the copied region must match the width and height of the pasted region");
}
int[] srcPixels = input.pixels.array();
int[] dstPixels = pixels.array();
int srcOffset = sx1 + sy1 * input.width;
int dstOffset = dx1 + dy1 * width;
for (int y = 0; y < ch; y++) {
System.arraycopy(srcPixels, srcOffset, dstPixels, dstOffset, cw);
srcOffset += input.width;
dstOffset += width;
}
}
public void drawLayer(ImageData input, int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2) {
int cw = sx2 - sx1;
int ch = sy2 - sy1;
if (cw != dx2 - dx1 || ch != dy2 - dy1) {
throw new IllegalArgumentException("Width and height of the copied region must match the width and height of the pasted region");
}
int[] srcPixels = input.pixels.array();
int[] dstPixels = pixels.array();
int srcOffset = sx1 + sy1 * input.width;
int dstOffset = dx1 + dy1 * width;
for (int y = 0; y < ch; y++) {
for (int x = 0; x < cw; x++) {
int si = srcOffset + x;
int di = dstOffset + x;
int spx = srcPixels[si];
int dpx = dstPixels[di];
if ((spx & 0xFF000000) == 0xFF000000 || (dpx & 0xFF000000) == 0) {
dstPixels[di] = spx;
} else {
int sa = (spx >> 24) & 0xFF;
int da = (dpx >> 24) & 0xFF;
int r = ((spx >> 16) & 0xFF) * sa / 255;
int g = ((spx >> 8) & 0xFF) * sa / 255;
int b = (spx & 0xFF) * sa / 255;
int aa = (255 - sa) * da;
r += ((dpx >> 16) & 0xFF) * aa / 65025;
g += ((dpx >> 8) & 0xFF) * aa / 65025;
b += (dpx & 0xFF) * aa / 65025;
sa += da;
if (sa > 0xFF) sa = 0xFF;
dstPixels[di] = (sa << 24) | (r << 16) | (g << 8) | b;
}
}
srcOffset += input.width;
dstOffset += width;
}
}
public ImageData swapRB() {
int[] dstPixels = pixels.array();
for (int i = 0; i < dstPixels.length; i++) {
int j = dstPixels[i];
dstPixels[i] = (j & 0xFF00FF00) | ((j & 0x00FF0000) >> 16) | ((j & 0x000000FF) << 16);
}
return this;
}
public static int swapRB(int c) {
return (c & 0xFF00FF00) | ((c & 0x00FF0000) >> 16) | ((c & 0x000000FF) << 16);
}
HashMap<IntBuffer, int[]> pixelArray = new HashMap<IntBuffer, int[]>();
public int[] getPixels() {
if(pixelArray.containsKey(pixels)) {
return pixelArray.get(pixels);
}
int[] dstPixels = new int[pixels.limit()];
pixels.get(dstPixels);
pixelArray.put(pixels, dstPixels);
return dstPixels;
}
}

View File

@ -49,7 +49,7 @@ public class EaglerBitwisePackedTexture {
v = is.read(); v = is.read();
if(v == 0) { if(v == 0) {
for(int i = 0, l = w * h; i < l; ++i) { for(int i = 0, l = w * h; i < l; ++i) {
img.pixels[i] = is.read() | (is.read() << 8) | (is.read() << 16) | alpha; img.getPixels()[i] = is.read() | (is.read() << 8) | (is.read() << 16) | alpha;
} }
}else if(v == 1) { }else if(v == 1) {
int paletteSize = is.read(); int paletteSize = is.read();
@ -62,7 +62,7 @@ public class EaglerBitwisePackedTexture {
byte[] readSet = new byte[is.read() | (is.read() << 8) | (is.read() << 16)]; byte[] readSet = new byte[is.read() | (is.read() << 8) | (is.read() << 16)];
is.read(readSet); is.read(readSet);
for(int i = 0, l = w * h; i < l; ++i) { for(int i = 0, l = w * h; i < l; ++i) {
img.pixels[i] = palette[getFromBits(i * bpp, bpp, readSet)]; img.getPixels()[i] = palette[getFromBits(i * bpp, bpp, readSet)];
} }
}else { }else {
throw new IOException("Unknown EBP storage type: " + v); throw new IOException("Unknown EBP storage type: " + v);

View File

@ -48,11 +48,11 @@ public class PBRTextureMapUtils {
if(res.getResourcePackName().equals(resourcePack)) { if(res.getResourcePackName().equals(resourcePack)) {
ImageData toRet = TextureUtil.readBufferedImage(res.getInputStream()); ImageData toRet = TextureUtil.readBufferedImage(res.getInputStream());
if(ext.equals("_s")) { if(ext.equals("_s")) {
for(int i = 0, j; i < toRet.pixels.length; ++i) { for(int i = 0, j; i < toRet.getPixels().length; ++i) {
// swap B and A, because labPBR support // swap B and A, because labPBR support
int a = (toRet.pixels[i] >>> 24) & 0xFF; int a = (toRet.getPixels()[i] >>> 24) & 0xFF;
if(a == 0xFF) a = 0; if(a == 0xFF) a = 0;
toRet.pixels[i] = (toRet.pixels[i] & 0x0000FFFF) | Math.min(a << 18, 0xFF0000) | 0xFF000000; toRet.getPixels()[i] = (toRet.getPixels()[i] & 0x0000FFFF) | Math.min(a << 18, 0xFF0000) | 0xFF000000;
} }
} }
return toRet; return toRet;
@ -104,14 +104,14 @@ public class PBRTextureMapUtils {
if(in.width != resX || in.height != resY) { if(in.width != resX || in.height != resY) {
out = new ImageData(resX, resY, true); out = new ImageData(resX, resY, true);
if(in.width == 1 && in.height == 1) { if(in.width == 1 && in.height == 1) {
int px = in.pixels[0]; int px = in.getPixels()[0];
for(int j = 0; j < out.pixels.length; ++j) { for(int j = 0; j < out.getPixels().length; ++j) {
out.pixels[j] = px; out.getPixels()[j] = px;
} }
}else { }else {
for(int y = 0; y < resY; ++y) { for(int y = 0; y < resY; ++y) {
for(int x = 0; x < resX; ++x) { for(int x = 0; x < resX; ++x) {
out.pixels[y * resX + x] = in.pixels[((y * in.height / resY)) * in.width + (x * in.width / resX)]; out.getPixels()[y * resX + x] = in.getPixels()[((y * in.height / resY)) * in.width + (x * in.width / resX)];
} }
} }
} }

View File

@ -35,9 +35,6 @@ public class EaglerProfile {
public static int presetSkinId; public static int presetSkinId;
public static int customSkinId; public static int customSkinId;
public static int presetCapeId;
public static final int[] CAPE_DATA_SIZE = new int[] { 32*32*4, -9, 1 };
public static final List<CustomSkin> customSkins = new ArrayList(); public static final List<CustomSkin> customSkins = new ArrayList();
@ -61,16 +58,7 @@ public class EaglerProfile {
} }
} }
} }
public static int getCapeSize(int len) {
for(int i = 0; i < CAPE_DATA_SIZE.length; ++i) {
if(len == CAPE_DATA_SIZE[i]) {
return i;
}
}
return -1;
}
public static SkinModel getActiveSkinModel() { public static SkinModel getActiveSkinModel() {
if(presetSkinId == -1) { if(presetSkinId == -1) {
if(customSkinId >= 0 && customSkinId < customSkins.size()) { if(customSkinId >= 0 && customSkinId < customSkins.size()) {
@ -177,7 +165,6 @@ public class EaglerProfile {
presetSkinId = profile.getInteger("presetSkin"); presetSkinId = profile.getInteger("presetSkin");
customSkinId = profile.getInteger("customSkin"); customSkinId = profile.getInteger("customSkin");
presetCapeId = profile.getInteger("presetCape");
String loadUsername = profile.getString("username").trim(); String loadUsername = profile.getString("username").trim();
@ -222,7 +209,6 @@ public class EaglerProfile {
NBTTagCompound profile = new NBTTagCompound(); NBTTagCompound profile = new NBTTagCompound();
profile.setInteger("presetSkin", presetSkinId); profile.setInteger("presetSkin", presetSkinId);
profile.setInteger("customSkin", customSkinId); profile.setInteger("customSkin", customSkinId);
profile.setInteger("presetCape", presetCapeId);
profile.setString("username", username); profile.setString("username", username);
NBTTagList skinsList = new NBTTagList(); NBTTagList skinsList = new NBTTagList();
for(int i = 0, l = customSkins.size(); i < l; ++i) { for(int i = 0, l = customSkins.size(); i < l; ++i) {

View File

@ -1,253 +0,0 @@
package net.lax1dude.eaglercraft.v1_8.profile;
import java.io.IOException;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
public class GuiScreenEditCape extends GuiScreen {
GuiScreen parent;
private int skinToShow;
private int mousex = 0;
private int mousey = 0;
private boolean dropDownOpen = false;
private String[] dropDownOptions;
private int slotsVisible = 0;
private int selectedSlot = 0;
private int scrollPos = -1;
private int skinsHeight = 0;
private boolean dragging = false;
SkinModel model = null;
public static final String[] defaultVanillaCapeNames = new String[] {
"No Cape",
"Minecon 2011",
"Minecon 2012",
"Minecon 2013",
"Minecon 2015",
"Minecon 2016",
"Microsoft Account",
"Realms Mapmaker",
"Mojang Old",
"Mojang New",
"Jira Moderator",
"Mojang Very Old",
"Scrolls",
"Cobalt",
"Lang Translator",
"Millionth Player",
"Prismarine",
"Snowman",
"Spade",
"Birthday",
"dB"
};
public GuiScreenEditCape(GuiScreen parent, int skinToShow, SkinModel model) {
this.parent = parent;
this.skinToShow = skinToShow;
this.dropDownOptions = defaultVanillaCapeNames;
this.selectedSlot = EaglerProfile.presetCapeId;
this.model = model;
}
public void initGui() {
Keyboard.enableRepeatEvents(true);
this.buttonList.add(new GuiButton(200, width / 2 - 100, height / 6 + 168, I18n.format("gui.done")));
}
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
private static final ResourceLocation eaglerGui = new ResourceLocation("eagler:gui/eagler_gui.png");
public void drawScreen(int mx, int my, float par3) {
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, "Select Cape", this.width / 2, 15, 16777215);
mousex = mx;
mousey = my;
int skinX = width / 2 - 120;
int skinY = height / 6 + 8;
int skinWidth = 80;
int skinHeight = 130;
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, 0xff000015);
if(dropDownOpen) {
super.drawScreen(-1, -1, par3);
} else {
super.drawScreen(mx, my, par3);
}
skinX = width / 2 - 20;
skinY = height / 6 + 53;
skinWidth = 140;
skinHeight = 22;
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 21, skinY + skinHeight - 1, -16777216);
drawRect(skinX + skinWidth - 20, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216);
GlStateManager.color(1f, 1f, 1f, 1f);
mc.getTextureManager().bindTexture(eaglerGui);
drawTexturedModalRect(skinX + skinWidth - 18, skinY + 3, 0, 240, 16, 16);
this.fontRendererObj.drawStringWithShadow(dropDownOptions[selectedSlot], skinX + 5, skinY + 7, 14737632);
EaglerProfile.presetCapeId = selectedSlot;
skinX = width / 2 - 20;
skinY = height / 6 + 74;
skinWidth = 140;
skinHeight = (height - skinY - 4);
slotsVisible = (skinHeight / 10);
if(slotsVisible > dropDownOptions.length) slotsVisible = dropDownOptions.length;
skinHeight = slotsVisible * 10 + 7;
skinsHeight = skinHeight;
if(scrollPos == -1) {
scrollPos = selectedSlot - 2;
}
if(scrollPos > (dropDownOptions.length - slotsVisible)) {
scrollPos = (dropDownOptions.length - slotsVisible);
}
if(scrollPos < 0) {
scrollPos = 0;
}
if(dropDownOpen) {
drawRect(skinX, skinY, skinX + skinWidth, skinY + skinHeight, -6250336);
drawRect(skinX + 1, skinY + 1, skinX + skinWidth - 1, skinY + skinHeight - 1, -16777216);
for(int i = 0; i < slotsVisible; i++) {
if(i + scrollPos < dropDownOptions.length) {
int idx = i + scrollPos;
if(selectedSlot == i + scrollPos) {
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)) {
drawRect(skinX + 1, skinY + i*10 + 4, skinX + skinWidth - 1, skinY + i*10 + 14, 0x55ffffff);
}
this.fontRendererObj.drawStringWithShadow(dropDownOptions[i + scrollPos], skinX + 5, skinY + 5 + i*10, 14737632);
}
}
int scrollerSize = skinHeight * slotsVisible / dropDownOptions.length;
int scrollerPos = skinHeight * scrollPos / dropDownOptions.length;
drawRect(skinX + skinWidth - 4, skinY + scrollerPos + 1, skinX + skinWidth - 1, skinY + scrollerPos + scrollerSize, 0xff888888);
}
int xx = width / 2 - 80;
int yy = height / 6 + 130;
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, model, true);
}
protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 200) {
mc.displayGuiScreen((GuiScreen) parent);
}
}
public void updateScreen() {
if(dropDownOpen) {
if(Mouse.isButtonDown(0)) {
int skinX = this.width / 2 - 20;
int skinY = this.height / 6 + 74;
int skinWidth = 140;
if(mousex >= (skinX + skinWidth - 10) && mousex < (skinX + skinWidth) && mousey >= skinY && mousey < (skinY + skinsHeight)) {
dragging = true;
}
if(dragging) {
int scrollerSize = skinsHeight * slotsVisible / dropDownOptions.length;
scrollPos = (mousey - skinY - (scrollerSize / 2)) * dropDownOptions.length / skinsHeight;
}
} else {
dragging = false;
}
} else {
dragging = false;
}
}
private int[] grabPiece(int[] input, int w, int h, int sw) {
int[] ret = new int[w * h];
for(int i = 0; i < h; ++i) {
System.arraycopy(input, i * sw, ret, i * w, w);
}
return ret;
}
public void handleMouseInput() throws IOException {
super.handleMouseInput();
if(dropDownOpen) {
int var1 = Mouse.getEventDWheel();
if(var1 < 0) {
scrollPos += 3;
}
if(var1 > 0) {
scrollPos -= 3;
if(scrollPos < 0) {
scrollPos = 0;
}
}
}
}
protected void keyTyped(char par1, int par2) {
if(par2 == 200 && selectedSlot > 0) {
--selectedSlot;
scrollPos = selectedSlot - 2;
}
if(par2 == 208 && selectedSlot < (dropDownOptions.length - 1)) {
++selectedSlot;
scrollPos = selectedSlot - 2;
}
}
protected void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3);
if (par3 == 0) {
int skinX = this.width / 2 + 140 - 40;
int skinY = this.height / 6 + 53;
if(par1 >= skinX && par1 < (skinX + 20) && par2 >= skinY && par2 < (skinY + 22)) {
dropDownOpen = !dropDownOpen;
}
skinX = this.width / 2 - 20;
skinY = this.height / 6 + 53;
int skinWidth = 140;
int skinHeight = skinsHeight;
if(!(par1 >= skinX && par1 < (skinX + skinWidth) && par2 >= skinY && par2 < (skinY + skinHeight + 22))) {
dropDownOpen = false;
dragging = false;
}
skinY += 21;
if(dropDownOpen && !dragging) {
for(int i = 0; i < slotsVisible; i++) {
if(i + scrollPos < dropDownOptions.length) {
if(selectedSlot != i + scrollPos) {
if(par1 >= skinX && par1 < (skinX + skinWidth - 10) && par2 >= (skinY + i*10 + 5) && par2 < (skinY + i*10 + 15) && selectedSlot != i + scrollPos) {
selectedSlot = i + scrollPos;
dropDownOpen = false;
dragging = false;
}
}
}
}
}
}
}
}

View File

@ -53,7 +53,6 @@ public class GuiScreenEditProfile extends GuiScreen {
private boolean dragging = false; private boolean dragging = false;
private int mousex = 0; private int mousex = 0;
private int mousey = 0; private int mousey = 0;
private SkinModel globalModel = null;
private boolean newSkinWaitSteveOrAlex = false; private boolean newSkinWaitSteveOrAlex = false;
@ -67,7 +66,6 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
public void initGui() { public void initGui() {
startWebsocketConnection(configureServerIP());
Keyboard.enableRepeatEvents(true); Keyboard.enableRepeatEvents(true);
screenTitle = I18n.format("editProfile.title"); screenTitle = I18n.format("editProfile.title");
usernameField = new GuiTextField(0, fontRendererObj, width / 2 - 20 + 1, height / 6 + 24 + 1, 138, 20); usernameField = new GuiTextField(0, fontRendererObj, width / 2 - 20 + 1, height / 6 + 24 + 1, 138, 20);
@ -77,7 +75,6 @@ public class GuiScreenEditProfile extends GuiScreen {
buttonList.add(new GuiButton(0, width / 2 - 100, height / 6 + 168, I18n.format("gui.done"))); buttonList.add(new GuiButton(0, width / 2 - 100, height / 6 + 168, I18n.format("gui.done")));
buttonList.add(new GuiButton(1, width / 2 - 21, height / 6 + 110, 71, 20, I18n.format("editProfile.addSkin"))); buttonList.add(new GuiButton(1, width / 2 - 21, height / 6 + 110, 71, 20, I18n.format("editProfile.addSkin")));
buttonList.add(new GuiButton(2, width / 2 - 21 + 71, height / 6 + 110, 72, 20, I18n.format("editProfile.clearSkin"))); buttonList.add(new GuiButton(2, width / 2 - 21 + 71, height / 6 + 110, 72, 20, I18n.format("editProfile.clearSkin")));
buttonList.add(new GuiButton(3, width / 2 - 100, height / 6 + 128, I18n.format("Capes")));
} }
private void updateOptions() { private void updateOptions() {
@ -209,7 +206,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(newSkin.getResource()); mc.getTextureManager().bindTexture(newSkin.getResource());
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.STEVE, false); SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.STEVE);
skinX = width / 2 + 20; skinX = width / 2 + 20;
skinY = height / 4; skinY = height / 4;
@ -234,7 +231,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(newSkin.getResource()); mc.getTextureManager().bindTexture(newSkin.getResource());
SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.ALEX, false); SkinPreviewRenderer.renderBiped(xx, yy, mx, my, SkinModel.ALEX);
}else { }else {
skinX = this.width / 2 - 120; skinX = this.width / 2 - 120;
skinY = this.height / 6 + 8; skinY = this.height / 6 + 8;
@ -254,8 +251,7 @@ public class GuiScreenEditProfile extends GuiScreen {
} }
mc.getTextureManager().bindTexture(texture); mc.getTextureManager().bindTexture(texture);
globalModel = model; SkinPreviewRenderer.renderBiped(xx, yy, newSkinWaitSteveOrAlex ? width / 2 : mx, newSkinWaitSteveOrAlex ? height / 2 : my, model);
SkinPreviewRenderer.renderBiped(xx, yy, newSkinWaitSteveOrAlex ? width / 2 : mx, newSkinWaitSteveOrAlex ? height / 2 : my, model, false);
} }
} }
@ -279,9 +275,6 @@ public class GuiScreenEditProfile extends GuiScreen {
if(!dropDownOpen) { if(!dropDownOpen) {
if(par1GuiButton.id == 0) { if(par1GuiButton.id == 0) {
safeProfile(); safeProfile();
if(EaglerProfile.presetCapeId != 0 && !(EaglerProfile.presetCapeId < 0)) {
socket.send("login:" + EaglerProfile.getName() + ":" + EaglerProfile.presetCapeId);
}
this.mc.displayGuiScreen((GuiScreen) parent); this.mc.displayGuiScreen((GuiScreen) parent);
}else if(par1GuiButton.id == 1) { }else if(par1GuiButton.id == 1) {
EagRuntime.displayFileChooser("image/png", "png"); EagRuntime.displayFileChooser("image/png", "png");
@ -290,9 +283,6 @@ public class GuiScreenEditProfile extends GuiScreen {
safeProfile(); safeProfile();
updateOptions(); updateOptions();
selectedSlot = 0; selectedSlot = 0;
} else if(par1GuiButton.id == 3) {
safeProfile();
this.mc.displayGuiScreen(new GuiScreenEditCape(this, selectedSlot, globalModel));
} }
} }
} }
@ -316,7 +306,7 @@ public class GuiScreenEditProfile extends GuiScreen {
byte[] rawSkin = new byte[16384]; byte[] rawSkin = new byte[16384];
for(int i = 0, j, k; i < 4096; ++i) { for(int i = 0, j, k; i < 4096; ++i) {
j = i << 2; j = i << 2;
k = loadedSkin.pixels[i]; k = loadedSkin.getPixels()[i];
rawSkin[j] = (byte)(k >> 24); rawSkin[j] = (byte)(k >> 24);
rawSkin[j + 1] = (byte)(k >> 16); rawSkin[j + 1] = (byte)(k >> 16);
rawSkin[j + 2] = (byte)(k >> 8); rawSkin[j + 2] = (byte)(k >> 8);
@ -479,87 +469,4 @@ public class GuiScreenEditProfile extends GuiScreen {
EaglerProfile.setName(name); EaglerProfile.setName(name);
EaglerProfile.write(); EaglerProfile.write();
} }
public static String configureServerIP() {
String uri = "play.mrpolog.tk:25565";
String uria = null;
if(!uri.contains("://")){
uri = ( isSSLPage() ? "wss://" : "ws://") + uri;
uria = uri;
} else {
System.err.println("Invalid URI WebSocket Protocol!");
}
int i = uria.lastIndexOf(':');
int port = -1;
if(i > 0 && uria.startsWith("[") && uria.charAt(i - 1) != ']') {
i = -1;
}
if(i == -1) port = uri.startsWith("wss") ? 443 : 80;
if(uria.endsWith("/")) uria = uria.substring(0, uria.length() - 1);
if(port == -1) {
try {
int i2 = uria.indexOf('/');
port = Integer.parseInt(uria.substring(i + 1, i2 == -1 ? uria.length() : i2 - 1));
}catch(Throwable t) {
System.err.println("Invalid Port!");
}
}
return uria;
}
public static WebSocket socket;
public static boolean isConnected = false;
public static HashMap<String, Integer> capes = new HashMap<String, Integer>();
@SuppressWarnings("unchecked")
public static final void startWebsocketConnection(String s) {
socket = WebSocket.create(s);
socket.onOpen(new EventListener() {
@Override
public void handleEvent(Event event) {
isConnected = true;
}
});
socket.onMessage(new EventListener() {
@Override
public void handleEvent(Event event) {
MessageEvent messageEvent = (MessageEvent) event;
String message = messageEvent.getData().toString();
String[] message1 = message.split(":");
capes.put(message1[0], Integer.parseInt(message1[1]));
}
});
socket.onClose(new EventListener() {
@Override
public void handleEvent(Event event) {
isConnected = false;
}
});
socket.onError(new EventListener() {
@Override
public void handleEvent(Event event) {
socket.close();
isConnected = false;
System.err.println("WebSocket error occurred");
}
});
}
@JSBody(params = { }, script = "return window.location.href;")
private static native String getLocationString();
public static final boolean isSSLPage() {
return getLocationString().startsWith("https");
}
} }

View File

@ -18,19 +18,19 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
public class SkinConverter { public class SkinConverter {
public static void convert64x32to64x64(ImageData skinIn, ImageData skinOut) { public static void convert64x32to64x64(ImageData skinIn, ImageData skinOut) {
copyRawPixels(skinIn.pixels, skinOut.pixels, 0, 0, 0, 0, 64, 32, 64, 64, false); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 0, 0, 0, 0, 64, 32, 64, 64, false);
copyRawPixels(skinIn.pixels, skinOut.pixels, 24, 48, 20, 52, 4, 16, 8, 20, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 24, 48, 20, 52, 4, 16, 8, 20, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 28, 48, 24, 52, 8, 16, 12, 20, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 28, 48, 24, 52, 8, 16, 12, 20, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 20, 52, 16, 64, 8, 20, 12, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 20, 52, 16, 64, 8, 20, 12, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 24, 52, 20, 64, 4, 20, 8, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 24, 52, 20, 64, 4, 20, 8, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 28, 52, 24, 64, 0, 20, 4, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 28, 52, 24, 64, 0, 20, 4, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 32, 52, 28, 64, 12, 20, 16, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 32, 52, 28, 64, 12, 20, 16, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 40, 48, 36, 52, 44, 16, 48, 20, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 40, 48, 36, 52, 44, 16, 48, 20, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 44, 48, 40, 52, 48, 16, 52, 20, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 44, 48, 40, 52, 48, 16, 52, 20, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 36, 52, 32, 64, 48, 20, 52, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 36, 52, 32, 64, 48, 20, 52, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 40, 52, 36, 64, 44, 20, 48, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 40, 52, 36, 64, 44, 20, 48, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 44, 52, 40, 64, 40, 20, 44, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 44, 52, 40, 64, 40, 20, 44, 32, 64, 64);
copyRawPixels(skinIn.pixels, skinOut.pixels, 48, 52, 44, 64, 52, 20, 56, 32, 64, 64); copyRawPixels(skinIn.getPixels(), skinOut.getPixels(), 48, 52, 44, 64, 52, 20, 56, 32, 64, 64);
} }
private static void copyRawPixels(int[] imageIn, int[] imageOut, int dx1, int dy1, int dx2, int dy2, int sx1, private static void copyRawPixels(int[] imageIn, int[] imageOut, int dx1, int dy1, int dx2, int dy2, int sx1,

View File

@ -28,30 +28,6 @@ public class SkinPreviewRenderer {
private static ModelPlayer playerModelAlex = null; private static ModelPlayer playerModelAlex = null;
private static ModelZombie playerModelZombie = null; private static ModelZombie playerModelZombie = null;
public static final ResourceLocation[] defaultVanillaCapes = new ResourceLocation[] {
null,
new ResourceLocation("/capes/c01.minecon_2011.png"),
new ResourceLocation("/capes/c02.minecon_2012.png"),
new ResourceLocation("/capes/c03.minecon_2013.png"),
new ResourceLocation("/capes/c04.minecon_2015.png"),
new ResourceLocation("/capes/c05.minecon_2016.png"),
new ResourceLocation("/capes/c06.microsoft_account.png"),
new ResourceLocation("/capes/c07.mapmaker.png"),
new ResourceLocation("/capes/c08.mojang_old.png"),
new ResourceLocation("/capes/c09.mojang_new.png"),
new ResourceLocation("/capes/c10.jira_mod.png"),
new ResourceLocation("/capes/c11.mojang_very_old.png"),
new ResourceLocation("/capes/c12.scrolls.png"),
new ResourceLocation("/capes/c13.cobalt.png"),
new ResourceLocation("/capes/c14.translator.png"),
new ResourceLocation("/capes/c15.millionth_account.png"),
new ResourceLocation("/capes/c16.prismarine.png"),
new ResourceLocation("/capes/c17.snowman.png"),
new ResourceLocation("/capes/c18.spade.png"),
new ResourceLocation("/capes/c19.birthday.png"),
new ResourceLocation("/capes/c20.db.png")
};
public static void initialize() { public static void initialize() {
playerModelSteve = new ModelPlayer(0.0f, false); playerModelSteve = new ModelPlayer(0.0f, false);
playerModelSteve.isChild = false; playerModelSteve.isChild = false;
@ -61,7 +37,7 @@ public class SkinPreviewRenderer {
playerModelZombie.isChild = false; playerModelZombie.isChild = false;
} }
public static void renderBiped(int x, int y, int mx, int my, SkinModel skinModel, boolean showCape) { public static void renderBiped(int x, int y, int mx, int my, SkinModel skinModel) {
ModelBiped model; ModelBiped model;
switch(skinModel) { switch(skinModel) {
case STEVE: case STEVE:
@ -90,37 +66,12 @@ public class SkinPreviewRenderer {
RenderHelper.enableGUIStandardItemLighting(); RenderHelper.enableGUIStandardItemLighting();
GlStateManager.translate(0.0f, 1.0f, 0.0f); GlStateManager.translate(0.0f, 1.0f, 0.0f);
if(showCape) { GlStateManager.rotate(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f);
GlStateManager.rotate(140.0f, 0.0f, 1.0f, 0.0f);
mx = x - (x - mx) - 20;
GlStateManager.rotate(((y - my) * -0.02f), 1.0f, 0.0f, 0.0f);
} else {
GlStateManager.rotate(((y - my) * -0.06f), 1.0f, 0.0f, 0.0f);
}
GlStateManager.rotate(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f); GlStateManager.rotate(((x - mx) * 0.06f), 0.0f, 1.0f, 0.0f);
GlStateManager.translate(0.0f, -1.0f, 0.0f); GlStateManager.translate(0.0f, -1.0f, 0.0f);
model.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 2000000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625f); model.render(null, 0.0f, 0.0f, (float)(System.currentTimeMillis() % 2000000) / 50f, ((x - mx) * 0.06f), ((y - my) * -0.1f), 0.0625f);
if(showCape && !(EaglerProfile.presetCapeId >= 0 && defaultVanillaCapes[EaglerProfile.presetCapeId] == null)) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.150F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-6.0F, 1.0F, 0.0F, 0.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(defaultVanillaCapes[EaglerProfile.presetCapeId]);
new ModelBiped(0.0F, 0.0F, 64, 32).bipedCloak.render(0.0625F);
if(EaglerProfile.presetCapeId < 0) {
GlStateManager.matrixMode(RealOpenGLEnums.GL_TEXTURE);
GlStateManager.popMatrix();
GlStateManager.matrixMode(RealOpenGLEnums.GL_MODELVIEW);
}
GlStateManager.popMatrix();
}
GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.popMatrix(); GlStateManager.popMatrix();

View File

@ -20,6 +20,7 @@ import com.google.common.collect.Lists;
import net.FatalCodes.shadow.Shadow; import net.FatalCodes.shadow.Shadow;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.chunk.ChunkBorders;
import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu; import net.PeytonPlayz585.shadow.gui.GuiSecretMainMenu;
import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.EagRuntime; import net.lax1dude.eaglercraft.v1_8.EagRuntime;
@ -1235,22 +1236,11 @@ public class Minecraft implements IThreadListener {
public MusicTicker func_181535_r() { public MusicTicker func_181535_r() {
return this.mcMusicTicker; return this.mcMusicTicker;
} }
public int lastKeepAlive = 0;
public int keepAlive = 0;
GuiScreenEditProfile profile;
/**+ /**+
* Runs the current tick. * Runs the current tick.
*/ */
public void runTick() throws IOException { public void runTick() throws IOException {
lastKeepAlive++;
if(lastKeepAlive > (keepAlive + 300) && profile.isConnected) {
profile.socket.send("keepAlivePacket");
keepAlive = lastKeepAlive;
}
if (this.rightClickDelayTimer > 0) { if (this.rightClickDelayTimer > 0) {
--this.rightClickDelayTimer; --this.rightClickDelayTimer;
} }
@ -1485,6 +1475,10 @@ public class Minecraft implements IThreadListener {
this.gameSettings.saveOptions(); this.gameSettings.saveOptions();
} }
if(Keyboard.isKeyDown(34)) {
this.gameSettings.chunkBorders = !this.gameSettings.chunkBorders;
}
if (k == 59) { if (k == 59) {
this.gameSettings.hideGUI = !this.gameSettings.hideGUI; this.gameSettings.hideGUI = !this.gameSettings.hideGUI;
} }

View File

@ -141,7 +141,7 @@ public class FontRenderer implements IResourceManagerReloadListener {
Properties properties = FontUtils.readFontProperties(this.locationFontTexture); Properties properties = FontUtils.readFontProperties(this.locationFontTexture);
int i = bufferedimage.width; int i = bufferedimage.width;
int j = bufferedimage.height; int j = bufferedimage.height;
int[] aint = bufferedimage.pixels; int[] aint = bufferedimage.getPixels();
int k = j / 16; int k = j / 16;
int l = i / 16; int l = i / 16;
byte b0 = 1; byte b0 = 1;

View File

@ -145,6 +145,10 @@ public class GuiVideoSettings extends GuiScreen {
this.mc.displayGuiScreen(new GuiDetails(this)); this.mc.displayGuiScreen(new GuiDetails(this));
} }
if(parGuiButton.id == 222) {
this.mc.displayGuiScreen(new GuiOther(this));
}
if (this.guiGameSettings.guiScale != i) { if (this.guiGameSettings.guiScale != i) {
ScaledResolution scaledresolution = new ScaledResolution(this.mc); ScaledResolution scaledresolution = new ScaledResolution(this.mc);
int j = scaledresolution.getScaledWidth(); int j = scaledresolution.getScaledWidth();

View File

@ -88,7 +88,9 @@ import net.minecraft.world.WorldSettings;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.Lagometer;
import net.PeytonPlayz585.shadow.TextureUtils; import net.PeytonPlayz585.shadow.TextureUtils;
import net.PeytonPlayz585.shadow.debug.DebugChunkRenderer;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -178,6 +180,7 @@ public class EntityRenderer implements IResourceManagerReloadListener {
private float clipDistance = 128.0F; private float clipDistance = 128.0F;
private boolean initialized = false; private boolean initialized = false;
private DebugChunkRenderer chunkRenderer;
public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) { public EntityRenderer(Minecraft mcIn, IResourceManager resourceManagerIn) {
this.useShader = false; this.useShader = false;
@ -210,6 +213,8 @@ public class EntityRenderer implements IResourceManagerReloadListener {
} }
} }
chunkRenderer = new DebugChunkRenderer();
} }
public boolean isShaderActive() { public boolean isShaderActive() {
@ -1006,6 +1011,10 @@ public class EntityRenderer implements IResourceManagerReloadListener {
if (this.mc.gameSettings.hudPlayer) { // give the player model HUD good fps if (this.mc.gameSettings.hudPlayer) { // give the player model HUD good fps
this.mc.ingameGUI.drawEaglerPlayerOverlay(l - 3, 3, parFloat1); this.mc.ingameGUI.drawEaglerPlayerOverlay(l - 3, 3, parFloat1);
} }
if (this.mc.gameSettings.showDebugInfo) {
Lagometer.showLagometer(scaledresolution);
}
} }
this.mc.mcProfiler.endSection(); this.mc.mcProfiler.endSection();
@ -1054,6 +1063,12 @@ public class EntityRenderer implements IResourceManagerReloadListener {
} }
} }
Lagometer.updateLagometer();
if (this.mc.gameSettings.ofProfiler) {
this.mc.gameSettings.showDebugProfilerChart = true;
}
} }
public void renderStreamIndicator(float partialTicks) { public void renderStreamIndicator(float partialTicks) {
@ -1211,16 +1226,20 @@ public class EntityRenderer implements IResourceManagerReloadListener {
this.mc.thePlayer.isSpectator()); this.mc.thePlayer.isSpectator());
if (pass == 0 || pass == 2) { if (pass == 0 || pass == 2) {
this.mc.mcProfiler.endStartSection("updatechunks"); this.mc.mcProfiler.endStartSection("updatechunks");
Lagometer.timerChunkUpload.start();
this.mc.renderGlobal.updateChunks(finishTimeNano); this.mc.renderGlobal.updateChunks(finishTimeNano);
Lagometer.timerChunkUpload.end();
} }
this.mc.mcProfiler.endStartSection("terrain"); this.mc.mcProfiler.endStartSection("terrain");
Lagometer.timerTerrain.start();
if (this.mc.gameSettings.ofSmoothFps && pass > 0) { if (this.mc.gameSettings.ofSmoothFps && pass > 0) {
this.mc.mcProfiler.endStartSection("finish"); this.mc.mcProfiler.endStartSection("finish");
this.mc.mcProfiler.endStartSection("terrain"); this.mc.mcProfiler.endStartSection("terrain");
} }
Lagometer.timerTerrain.end();
GlStateManager.matrixMode(GL_MODELVIEW); GlStateManager.matrixMode(GL_MODELVIEW);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableAlpha(); GlStateManager.disableAlpha();
@ -1264,6 +1283,15 @@ public class EntityRenderer implements IResourceManagerReloadListener {
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
} }
if (this.chunkRenderer.shouldRender()) {
boolean fogEnabled = GlStateManager.isFogEnabled();
GlStateManager.disableFog();
this.chunkRenderer.render(partialTicks, finishTimeNano);
if(fogEnabled) {
GlStateManager.enableFog();
}
}
this.mc.mcProfiler.endStartSection("destroyProgress"); this.mc.mcProfiler.endStartSection("destroyProgress");
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, 1, 1, 0); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, 1, 1, 0);

View File

@ -49,7 +49,7 @@ public class ImageBufferDownload implements IImageBuffer {
bufferedimage1.drawLayer(bufferedimage, 48, 52, 44, 64, 52, 20, 56, 32); bufferedimage1.drawLayer(bufferedimage, 48, 52, 44, 64, 52, 20, 56, 32);
} }
this.imageData = bufferedimage1.pixels; this.imageData = bufferedimage1.getPixels();
this.setAreaOpaque(0, 0, 32, 16); this.setAreaOpaque(0, 0, 32, 16);
this.setAreaTransparent(32, 0, 64, 32); this.setAreaTransparent(32, 0, 64, 32);
this.setAreaOpaque(0, 16, 64, 32); this.setAreaOpaque(0, 16, 64, 32);

View File

@ -13,7 +13,7 @@ import java.util.Map;
import net.PeytonPlayz585.shadow.Config; import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.CustomSky; import net.PeytonPlayz585.shadow.CustomSky;
import net.PeytonPlayz585.shadow.DynamicLights; import net.PeytonPlayz585.shadow.DynamicLights;
import net.PeytonPlayz585.shadow.opengl.OpenGLManager; import net.PeytonPlayz585.shadow.Lagometer;
import net.PeytonPlayz585.shadow.other.CloudRenderer; import net.PeytonPlayz585.shadow.other.CloudRenderer;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.lax1dude.eaglercraft.v1_8.HString; import net.lax1dude.eaglercraft.v1_8.HString;
@ -895,6 +895,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
this.lastViewEntityPitch = (double) viewEntity.rotationPitch; this.lastViewEntityPitch = (double) viewEntity.rotationPitch;
this.lastViewEntityYaw = (double) viewEntity.rotationYaw; this.lastViewEntityYaw = (double) viewEntity.rotationYaw;
boolean flag = this.debugFixedClippingHelper != null; boolean flag = this.debugFixedClippingHelper != null;
Lagometer.timerVisibility.start();
if (!flag && this.displayListEntitiesDirty) { if (!flag && this.displayListEntitiesDirty) {
this.displayListEntitiesDirty = false; this.displayListEntitiesDirty = false;
this.renderInfos = Lists.newArrayList(); this.renderInfos = Lists.newArrayList();
@ -944,8 +945,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
} }
while (!linkedlist.isEmpty()) { while (!linkedlist.isEmpty()) {
RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = (RenderGlobal.ContainerLocalRenderInformation) linkedlist RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 = (RenderGlobal.ContainerLocalRenderInformation) linkedlist.poll();
.poll();
RenderChunk renderchunk3 = renderglobal$containerlocalrenderinformation1.renderChunk; RenderChunk renderchunk3 = renderglobal$containerlocalrenderinformation1.renderChunk;
EnumFacing enumfacing2 = renderglobal$containerlocalrenderinformation1.facing; EnumFacing enumfacing2 = renderglobal$containerlocalrenderinformation1.facing;
BlockPos blockpos2 = renderchunk3.getPosition(); BlockPos blockpos2 = renderchunk3.getPosition();
@ -975,8 +975,11 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
this.debugFixTerrainFrustum = false; this.debugFixTerrainFrustum = false;
} }
Lagometer.timerVisibility.end();
Set set = this.chunksToUpdate; Set set = this.chunksToUpdate;
this.chunksToUpdate = Sets.newLinkedHashSet(); this.chunksToUpdate = Sets.newLinkedHashSet();
Lagometer.timerChunkUpdate.start();
for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation2 : this.renderInfos) { for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation2 : this.renderInfos) {
RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation2.renderChunk; RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation2.renderChunk;
@ -997,6 +1000,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
} }
} }
Lagometer.timerChunkUpdate.end();
this.chunksToUpdate.addAll(set); this.chunksToUpdate.addAll(set);
this.mc.mcProfiler.endSection(); this.mc.mcProfiler.endSection();
} }
@ -1030,7 +1034,7 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene
} }
} }
return visgraph.getVisibleFacingsFrom(pos); return visgraph.func_178609_b(pos);
} }
private RenderChunk func_181562_a(BlockPos parBlockPos, RenderChunk parRenderChunk, EnumFacing parEnumFacing) { private RenderChunk func_181562_a(BlockPos parBlockPos, RenderChunk parRenderChunk, EnumFacing parEnumFacing) {

View File

@ -1,7 +1,6 @@
package net.minecraft.client.renderer.chunk; package net.minecraft.client.renderer.chunk;
import java.util.BitSet; import java.util.BitSet;
import java.util.Iterator;
import java.util.Set; import java.util.Set;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -25,108 +24,54 @@ import net.minecraft.util.EnumFacing;
* *
*/ */
public class SetVisibility { public class SetVisibility {
private static final int COUNT_FACES = EnumFacing.values().length; private static final int COUNT_FACES = EnumFacing.values().length;
private final BitSet bitSet; private final BitSet bitSet;
public SetVisibility() { public SetVisibility() {
this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES); this.bitSet = new BitSet(COUNT_FACES * COUNT_FACES);
} }
public void setManyVisible(Set<EnumFacing> faces) { public void setManyVisible(Set<EnumFacing> parSet) {
for (EnumFacing enumfacing : parSet) {
Iterator<EnumFacing> iterator = faces.iterator(); for (EnumFacing enumfacing1 : parSet) {
this.setVisible(enumfacing, enumfacing1, true);
while (iterator.hasNext()) {
EnumFacing enumfacing = iterator.next();
Iterator<EnumFacing> iterator1 = faces.iterator();
while (iterator1.hasNext()) {
EnumFacing enumfacing1 = iterator1.next();
setVisible(enumfacing, enumfacing1, true);
} }
} }
} }
public void setVisible(EnumFacing from, EnumFacing to, boolean visible) { public void setVisible(EnumFacing facing, EnumFacing facing2, boolean parFlag) {
this.bitSet.set(facing.ordinal() + facing2.ordinal() * COUNT_FACES, parFlag);
bitSet.set(from.ordinal() + to.ordinal() * COUNT_FACES, visible); this.bitSet.set(facing2.ordinal() + facing.ordinal() * COUNT_FACES, parFlag);
bitSet.set(to.ordinal() + from.ordinal() * COUNT_FACES, visible);
} }
public void setAllVisible(boolean visible) { public void setAllVisible(boolean visible) {
this.bitSet.set(0, this.bitSet.size(), visible);
bitSet.set(0, bitSet.size(), visible);
} }
public boolean isAllVisible(boolean visible) { public boolean isVisible(EnumFacing facing, EnumFacing facing2) {
return this.bitSet.get(facing.ordinal() + facing2.ordinal() * COUNT_FACES);
int i = visible ? bitSet.nextClearBit(0) : bitSet.nextSetBit(0);
return i < 0 || i >= (COUNT_FACES * COUNT_FACES);
} }
public boolean isVisible(EnumFacing from, EnumFacing to) {
return bitSet.get(from.ordinal() + to.ordinal() * COUNT_FACES);
}
@Override
public boolean equals(Object o) {
if (o instanceof SetVisibility) {
return ((SetVisibility) o).bitSet.equals(bitSet);
}
return false;
}
@Override
public int hashCode() {
return bitSet.hashCode();
}
@Override
public SetVisibility clone() {
SetVisibility r = new SetVisibility();
r.bitSet.or(bitSet);
return r;
}
@Override
public String toString() { public String toString() {
StringBuilder stringbuilder = new StringBuilder(); StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append(' '); stringbuilder.append(' ');
EnumFacing[] aenumfacing = EnumFacing.values();
int i = aenumfacing.length;
int j;
EnumFacing enumfacing;
for (j = 0; j < i; ++j) { for (EnumFacing enumfacing : EnumFacing.values()) {
enumfacing = aenumfacing[j];
stringbuilder.append(' ').append(enumfacing.toString().toUpperCase().charAt(0)); stringbuilder.append(' ').append(enumfacing.toString().toUpperCase().charAt(0));
} }
stringbuilder.append('\n'); stringbuilder.append('\n');
aenumfacing = EnumFacing.values();
i = aenumfacing.length;
for (j = 0; j < i; ++j) { for (EnumFacing enumfacing2 : EnumFacing.values()) {
enumfacing = aenumfacing[j]; stringbuilder.append(enumfacing2.toString().toUpperCase().charAt(0));
stringbuilder.append(enumfacing.toString().toUpperCase().charAt(0));
EnumFacing[] aenumfacing1 = EnumFacing.values();
int k = aenumfacing1.length;
for (int l = 0; l < k; ++l) { for (EnumFacing enumfacing1 : EnumFacing.values()) {
EnumFacing enumfacing1 = aenumfacing1[l]; if (enumfacing2 == enumfacing1) {
if (enumfacing == enumfacing1) {
stringbuilder.append(" "); stringbuilder.append(" ");
} else { } else {
boolean flag = this.isVisible(enumfacing, enumfacing1); boolean flag = this.isVisible(enumfacing2, enumfacing1);
stringbuilder.append(' ').append(flag ? 'Y' : 'n'); stringbuilder.append(' ').append((char) (flag ? 'Y' : 'n'));
} }
} }
@ -135,5 +80,4 @@ public class SetVisibility {
return stringbuilder.toString(); return stringbuilder.toString();
} }
} }

View File

@ -2,11 +2,14 @@ package net.minecraft.client.renderer.chunk;
import java.util.BitSet; import java.util.BitSet;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.LinkedList;
import java.util.Set; import java.util.Set;
import net.PeytonPlayz585.shadow.math.IntStack; import com.google.common.collect.Lists;
import net.minecraft.util.BlockPos; import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.IntegerCache;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -27,224 +30,150 @@ import net.minecraft.util.EnumFacing;
* *
*/ */
public class VisGraph { public class VisGraph {
private static final int field_178616_a = (int) Math.pow(16.0D, 0.0D);
private static final int field_178614_b = (int) Math.pow(16.0D, 1.0D);
private static final int field_178615_c = (int) Math.pow(16.0D, 2.0D);
private final BitSet field_178612_d = new BitSet(4096);
private static final int[] field_178613_e = new int[1352];
private int field_178611_f = 4096;
private static final int X_OFFSET = (int) Math.pow(16.0D, 0.0D); public void func_178606_a(BlockPos pos) {
private static final int Z_OFFSET = (int) Math.pow(16.0D, 1.0D); this.field_178612_d.set(getIndex(pos), true);
private static final int Y_OFFSET = (int) Math.pow(16.0D, 2.0D); --this.field_178611_f;
private static final int[] EDGES = new int[1352]; }
private static final SetVisibility ALL_VIS = new SetVisibility();
static { private static int getIndex(BlockPos pos) {
ALL_VIS.setAllVisible(true); return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15);
int var2 = 0; }
for (int var3 = 0; var3 < 16; ++var3) { private static int getIndex(int x, int y, int z) {
for (int var4 = 0; var4 < 16; ++var4) { return x << 0 | y << 8 | z << 4;
for (int var5 = 0; var5 < 16; ++var5) { }
if (var3 == 0 || var3 == 15 || var4 == 0 || var4 == 15 || var5 == 0 || var5 == 15) {
EDGES[var2++] = getIndex(var3, var4, var5);
}
}
}
}
}
/* public SetVisibility computeVisibility() {
* This is a pretty hefty structure: 1340 bytes per 16^3 (40+bytes per object, and the array of long[] in BitSet) SetVisibility setvisibility = new SetVisibility();
* weighing in around 190 bytes for BitSets, 40 bytes for SetVisibility, and 50 bytes for this. if (4096 - this.field_178611_f < 256) {
* ~4,824,000 bytes at view distance 7; This could be halved if it were not reusable, but reusability is part setvisibility.setAllVisible(true);
* of what makes it speedy when recalculating the viewable area. } else if (this.field_178611_f == 0) {
*/ setvisibility.setAllVisible(false);
private final BitSet opaqueBlocks = new BitSet(4096); } else {
private final BitSet visibleBlocks = new BitSet(4096); for (int i : field_178613_e) {
private short transparentBlocks = 4096; if (!this.field_178612_d.get(i)) {
private boolean dirty = true, computedVis = true; setvisibility.setManyVisible(this.func_178604_a(i));
private SetVisibility visibility; }
}
}
public void func_178606_a(BlockPos pos) { return setvisibility;
this.opaqueBlocks.set(getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15), true); }
--this.transparentBlocks;
}
private static int getIndex(int x, int y, int z) { public Set<EnumFacing> func_178609_b(BlockPos pos) {
return this.func_178604_a(getIndex(pos));
}
return x << 0 | y << 8 | z << 4; private Set<EnumFacing> func_178604_a(int parInt1) {
} EnumSet enumset = EnumSet.noneOf(EnumFacing.class);
LinkedList linkedlist = Lists.newLinkedList();
linkedlist.add(IntegerCache.func_181756_a(parInt1));
this.field_178612_d.set(parInt1, true);
public boolean isDirty() { while (!linkedlist.isEmpty()) {
int i = ((Integer) linkedlist.poll()).intValue();
this.func_178610_a(i, enumset);
return dirty; for (EnumFacing enumfacing : EnumFacing.values()) {
} int j = this.func_178603_a(i, enumfacing);
if (j >= 0 && !this.field_178612_d.get(j)) {
this.field_178612_d.set(j, true);
linkedlist.add(IntegerCache.func_181756_a(j));
}
}
}
public boolean isRenderDirty() { return enumset;
}
if (isDirty()) { private void func_178610_a(int parInt1, Set<EnumFacing> parSet) {
return true; int i = parInt1 >> 0 & 15;
} if (i == 0) {
boolean r = computedVis; parSet.add(EnumFacing.WEST);
computedVis = false; } else if (i == 15) {
return r; parSet.add(EnumFacing.EAST);
} }
public void setOpaque(int x, int y, int z, boolean opaque) { int j = parInt1 >> 8 & 15;
if (j == 0) {
parSet.add(EnumFacing.DOWN);
} else if (j == 15) {
parSet.add(EnumFacing.UP);
}
boolean prev = opaqueBlocks.get(getIndex(x, y, z)); int k = parInt1 >> 4 & 15;
if (prev != opaque) { if (k == 0) {
opaqueBlocks.set(getIndex(x, y, z), opaque); parSet.add(EnumFacing.NORTH);
transparentBlocks += opaque ? -1 : 1; } else if (k == 15) {
dirty = true; parSet.add(EnumFacing.SOUTH);
} }
}
public SetVisibility getVisibility() { }
SetVisibility setvisibility = visibility; private int func_178603_a(int parInt1, EnumFacing parEnumFacing) {
if (setvisibility != null) { switch (parEnumFacing) {
return setvisibility; case DOWN:
} if ((parInt1 >> 8 & 15) == 0) {
return ALL_VIS; return -1;
} }
public SetVisibility computeVisibility() { return parInt1 - field_178615_c;
case UP:
if ((parInt1 >> 8 & 15) == 15) {
return -1;
}
dirty = false; return parInt1 + field_178615_c;
SetVisibility setvisibility = new SetVisibility(); case NORTH:
if ((parInt1 >> 4 & 15) == 0) {
return -1;
}
if (4096 - transparentBlocks < 256) { return parInt1 - field_178614_b;
setvisibility.setAllVisible(true); case SOUTH:
} else if (transparentBlocks == 0) { if ((parInt1 >> 4 & 15) == 15) {
setvisibility.setAllVisible(false); return -1;
} else { }
int[] edges = EDGES;
int i = edges.length;
visibleBlocks.andNot(visibleBlocks); return parInt1 + field_178614_b;
visibleBlocks.or(opaqueBlocks); case WEST:
IntStack linkedlist = new IntStack(1024, 512); if ((parInt1 >> 0 & 15) == 0) {
for (int j = 0; j < i; ++j) { return -1;
int k = edges[j]; }
if (!opaqueBlocks.get(k)) { return parInt1 - field_178616_a;
setvisibility.setManyVisible(computeVisibleFacingsFrom(k, linkedlist)); case EAST:
} if ((parInt1 >> 0 & 15) == 15) {
linkedlist.setSize(0); return -1;
} }
}
visibility = setvisibility; return parInt1 + field_178616_a;
computedVis = true; default:
return -1;
}
}
return setvisibility; static {
} boolean flag = false;
boolean flag1 = true;
int i = 0;
public Set < EnumFacing > getVisibleFacingsFrom(int x, int y, int z) { for (int j = 0; j < 16; ++j) {
for (int k = 0; k < 16; ++k) {
for (int l = 0; l < 16; ++l) {
if (j == 0 || j == 15 || k == 0 || k == 15 || l == 0 || l == 15) {
field_178613_e[i++] = getIndex(j, k, l);
}
}
}
}
visibleBlocks.andNot(visibleBlocks); }
visibleBlocks.or(opaqueBlocks);
return computeVisibleFacingsFrom(getIndex(x & 15, y & 15, z & 15), new IntStack(256, 512));
}
public Set < EnumFacing > getVisibleFacingsFrom(BlockPos pos) {
visibleBlocks.andNot(visibleBlocks);
visibleBlocks.or(opaqueBlocks);
return computeVisibleFacingsFrom(getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15), new IntStack(256, 512));
}
private EnumSet < EnumFacing > computeVisibleFacingsFrom(int index, IntStack linkedlist) {
EnumSet < EnumFacing > enumset = EnumSet.noneOf(EnumFacing.class);
linkedlist.add(index);
BitSet blocks = this.visibleBlocks;
blocks.set(index, true);
EnumFacing[] facings = EnumFacing.values();
int k = facings.length;
while (!linkedlist.isEmpty()) {
int j = linkedlist.poll();
addSides(j, enumset);
for (int l = 0; l < k; ++l) {
EnumFacing face = facings[l];
int i1 = stepTo(j, face);
if (i1 >= 0 && !blocks.get(i1)) {
blocks.set(i1, true);
linkedlist.add(i1);
}
}
}
return enumset;
}
private void addSides(int index, Set < EnumFacing > set) {
int j = index >> 0 & 15;
if (j == 0) {
set.add(EnumFacing.WEST);
} else if (j == 15) {
set.add(EnumFacing.EAST);
}
int k = index >> 8 & 15;
if (k == 0) {
set.add(EnumFacing.DOWN);
} else if (k == 15) {
set.add(EnumFacing.UP);
}
int l = index >> 4 & 15;
if (l == 0) {
set.add(EnumFacing.NORTH);
} else if (l == 15) {
set.add(EnumFacing.SOUTH);
}
}
private int stepTo(int index, EnumFacing side) {
switch (side) {
case DOWN:
if ((index >> 8 & 15) == 0) {
return -1;
}
return index - Y_OFFSET;
case UP:
if ((index >> 8 & 15) == 15) {
return -1;
}
return index + Y_OFFSET;
case NORTH:
if ((index >> 4 & 15) == 0) {
return -1;
}
return index - Z_OFFSET;
case SOUTH:
if ((index >> 4 & 15) == 15) {
return -1;
}
return index + Z_OFFSET;
case WEST:
if ((index >> 0 & 15) == 0) {
return -1;
}
return index - X_OFFSET;
case EAST:
if ((index >> 0 & 15) == 15) {
return -1;
}
return index + X_OFFSET;
default:
return -1;
}
}
} }

View File

@ -127,9 +127,9 @@ public class RenderManager {
private Map<String, RenderPlayer> skinMap = Maps.newHashMap(); private Map<String, RenderPlayer> skinMap = Maps.newHashMap();
private RenderPlayer playerRenderer; private RenderPlayer playerRenderer;
private FontRenderer textRenderer; private FontRenderer textRenderer;
private double renderPosX; public static double renderPosX;
private double renderPosY; public static double renderPosY;
private double renderPosZ; public static double renderPosZ;
public TextureManager renderEngine; public TextureManager renderEngine;
public World worldObj; public World worldObj;
public Entity livingPlayer; public Entity livingPlayer;

View File

@ -30,30 +30,6 @@ import net.minecraft.util.ResourceLocation;
*/ */
public class LayerCape implements LayerRenderer<AbstractClientPlayer> { public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
private final RenderPlayer playerRenderer; private final RenderPlayer playerRenderer;
public static final ResourceLocation[] defaultVanillaCapes = new ResourceLocation[] {
null,
new ResourceLocation("/capes/c01.minecon_2011.png"),
new ResourceLocation("/capes/c02.minecon_2012.png"),
new ResourceLocation("/capes/c03.minecon_2013.png"),
new ResourceLocation("/capes/c04.minecon_2015.png"),
new ResourceLocation("/capes/c05.minecon_2016.png"),
new ResourceLocation("/capes/c06.microsoft_account.png"),
new ResourceLocation("/capes/c07.mapmaker.png"),
new ResourceLocation("/capes/c08.mojang_old.png"),
new ResourceLocation("/capes/c09.mojang_new.png"),
new ResourceLocation("/capes/c10.jira_mod.png"),
new ResourceLocation("/capes/c11.mojang_very_old.png"),
new ResourceLocation("/capes/c12.scrolls.png"),
new ResourceLocation("/capes/c13.cobalt.png"),
new ResourceLocation("/capes/c14.translator.png"),
new ResourceLocation("/capes/c15.millionth_account.png"),
new ResourceLocation("/capes/c16.prismarine.png"),
new ResourceLocation("/capes/c17.snowman.png"),
new ResourceLocation("/capes/c18.spade.png"),
new ResourceLocation("/capes/c19.birthday.png"),
new ResourceLocation("/capes/c20.db.png")
};
public LayerCape(RenderPlayer playerRendererIn) { public LayerCape(RenderPlayer playerRendererIn) {
this.playerRenderer = playerRendererIn; this.playerRenderer = playerRendererIn;
@ -61,57 +37,6 @@ public class LayerCape implements LayerRenderer<AbstractClientPlayer> {
public void doRenderLayer(AbstractClientPlayer abstractclientplayer, float var2, float var3, float f, float var5, public void doRenderLayer(AbstractClientPlayer abstractclientplayer, float var2, float var3, float f, float var5,
float var6, float var7, float var8) { float var6, float var7, float var8) {
if (abstractclientplayer.hasPlayerInfo() && !abstractclientplayer.isInvisible()
&& abstractclientplayer.isWearing(EnumPlayerModelParts.CAPE)
&& abstractclientplayer.getLocationCape() != null
&& this.playerRenderer.getMainModel() instanceof ModelPlayer) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if(GuiScreenEditProfile.capes.containsKey(abstractclientplayer.getName())) {
this.playerRenderer.bindTexture(defaultVanillaCapes[GuiScreenEditProfile.capes.get(abstractclientplayer.getName())]);
}
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 0.125F);
double d0 = abstractclientplayer.prevChasingPosX
+ (abstractclientplayer.chasingPosX - abstractclientplayer.prevChasingPosX) * (double) f
- (abstractclientplayer.prevPosX
+ (abstractclientplayer.posX - abstractclientplayer.prevPosX) * (double) f);
double d1 = abstractclientplayer.prevChasingPosY
+ (abstractclientplayer.chasingPosY - abstractclientplayer.prevChasingPosY) * (double) f
- (abstractclientplayer.prevPosY
+ (abstractclientplayer.posY - abstractclientplayer.prevPosY) * (double) f);
double d2 = abstractclientplayer.prevChasingPosZ
+ (abstractclientplayer.chasingPosZ - abstractclientplayer.prevChasingPosZ) * (double) f
- (abstractclientplayer.prevPosZ
+ (abstractclientplayer.posZ - abstractclientplayer.prevPosZ) * (double) f);
float f1 = abstractclientplayer.prevRenderYawOffset
+ (abstractclientplayer.renderYawOffset - abstractclientplayer.prevRenderYawOffset) * f;
double d3 = (double) MathHelper.sin(f1 * 3.1415927F / 180.0F);
double d4 = (double) (-MathHelper.cos(f1 * 3.1415927F / 180.0F));
float f2 = (float) d1 * 10.0F;
f2 = MathHelper.clamp_float(f2, -6.0F, 32.0F);
float f3 = (float) (d0 * d3 + d2 * d4) * 100.0F;
float f4 = (float) (d0 * d4 - d2 * d3) * 100.0F;
if (f3 < 0.0F) {
f3 = 0.0F;
}
float f5 = abstractclientplayer.prevCameraYaw
+ (abstractclientplayer.cameraYaw - abstractclientplayer.prevCameraYaw) * f;
f2 = f2 + MathHelper.sin((abstractclientplayer.prevDistanceWalkedModified
+ (abstractclientplayer.distanceWalkedModified - abstractclientplayer.prevDistanceWalkedModified)
* f)
* 6.0F) * 32.0F * f5;
if (abstractclientplayer.isSneaking()) {
f2 += 25.0F;
}
GlStateManager.rotate(6.0F + f3 / 2.0F + f2, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(f4 / 2.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(-f4 / 2.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
((ModelPlayer) this.playerRenderer.getMainModel()).renderCape(0.0625F);
GlStateManager.popMatrix();
}
} }
public boolean shouldCombineTextures() { public boolean shouldCombineTextures() {

View File

@ -30,7 +30,7 @@ public class DynamicTexture extends AbstractTexture {
public DynamicTexture(ImageData bufferedImage) { public DynamicTexture(ImageData bufferedImage) {
this(bufferedImage.width, bufferedImage.height); this(bufferedImage.width, bufferedImage.height);
System.arraycopy(bufferedImage.pixels, 0, dynamicTextureData, 0, bufferedImage.pixels.length); System.arraycopy(bufferedImage.getPixels(), 0, dynamicTextureData, 0, bufferedImage.getPixels().length);
this.updateDynamicTexture(); this.updateDynamicTexture();
} }

View File

@ -68,13 +68,13 @@ public class LayeredColorMaskTexture extends AbstractTexture {
if (bufferedimage2.width == bufferedimage.width && bufferedimage2.height == bufferedimage.height) { if (bufferedimage2.width == bufferedimage.width && bufferedimage2.height == bufferedimage.height) {
for (int k = 0; k < bufferedimage2.height; ++k) { for (int k = 0; k < bufferedimage2.height; ++k) {
for (int l = 0; l < bufferedimage2.width; ++l) { for (int l = 0; l < bufferedimage2.width; ++l) {
int i1 = bufferedimage2.pixels[k * bufferedimage2.width + l]; int i1 = bufferedimage2.getPixels()[k * bufferedimage2.width + l];
if ((i1 & -16777216) != 0) { if ((i1 & -16777216) != 0) {
int j1 = (i1 & 16711680) << 8 & -16777216; int j1 = (i1 & 16711680) << 8 & -16777216;
int k1 = bufferedimage1.pixels[k * bufferedimage1.width + l]; int k1 = bufferedimage1.getPixels()[k * bufferedimage1.width + l];
int l1 = MathHelper.func_180188_d(k1, ImageData.swapRB(mapcolor.colorValue)) int l1 = MathHelper.func_180188_d(k1, ImageData.swapRB(mapcolor.colorValue))
& 16777215; & 16777215;
bufferedimage2.pixels[k * bufferedimage2.width + l] = j1 | l1; bufferedimage2.getPixels()[k * bufferedimage2.width + l] = j1 | l1;
} }
} }
} }

View File

@ -277,7 +277,7 @@ public class TextureUtil {
public static int[] readImageData(IResourceManager resourceManager, ResourceLocation imageLocation) public static int[] readImageData(IResourceManager resourceManager, ResourceLocation imageLocation)
throws IOException { throws IOException {
return readBufferedImage(resourceManager.getResource(imageLocation).getInputStream()).pixels; return readBufferedImage(resourceManager.getResource(imageLocation).getInputStream()).getPixels();
} }
public static ImageData readBufferedImage(InputStream imageStream) throws IOException { public static ImageData readBufferedImage(InputStream imageStream) throws IOException {

View File

@ -206,34 +206,34 @@ public class GameSettings {
public float ofCloudsHeight = 0.0F; public float ofCloudsHeight = 0.0F;
public int ofTrees = 0; public int ofTrees = 0;
public int ofRain = 0; public int ofRain = 0;
public boolean ofSky = true; public boolean ofSky = false;
public boolean ofStars = true; public boolean ofStars = false;
public boolean ofSunMoon = true; public boolean ofSunMoon = false;
public boolean ofShowCapes = true; public boolean ofShowCapes = false;
public int ofTranslucentBlocks = 0; public int ofTranslucentBlocks = 0;
public boolean heldItemTooltips = true; public boolean heldItemTooltips = false;
public int ofDroppedItems = 0; public int ofDroppedItems = 0;
public int ofVignette = 0; public int ofVignette = 0;
public boolean ofDynamicFov = true; public boolean ofDynamicFov = false;
//Optifine Animations //Optifine Animations
public int ofAnimatedWater = 0; public int ofAnimatedWater = 2;
public int ofAnimatedLava = 0; public int ofAnimatedLava = 2;
public boolean ofAnimatedFire = true; public boolean ofAnimatedFire = false;
public boolean ofAnimatedPortal = true; public boolean ofAnimatedPortal = false;
public boolean ofAnimatedRedstone = true; public boolean ofAnimatedRedstone = false;
public boolean ofAnimatedExplosion = true; public boolean ofAnimatedExplosion = false;
public boolean ofAnimatedFlame = true; public boolean ofAnimatedFlame = false;
public boolean ofAnimatedSmoke = true; public boolean ofAnimatedSmoke = false;
public boolean ofVoidParticles = true; public boolean ofVoidParticles = false;
public boolean ofWaterParticles = true; public boolean ofWaterParticles = false;
public boolean ofPortalParticles = true; public boolean ofPortalParticles = false;
public boolean ofPotionParticles = true; public boolean ofPotionParticles = false;
public boolean ofFireworkParticles = true; public boolean ofFireworkParticles = false;
public boolean ofDrippingWaterLava = true; public boolean ofDrippingWaterLava = false;
public boolean ofAnimatedTerrain = true; public boolean ofAnimatedTerrain = false;
public boolean ofAnimatedTextures = true; public boolean ofAnimatedTextures = false;
public boolean ofRainSplash = true; public boolean ofRainSplash = false;
//Performance Settings //Performance Settings
public boolean ofSmoothFps = false; public boolean ofSmoothFps = false;
@ -255,6 +255,9 @@ public class GameSettings {
public static boolean toggleSprint = false; public static boolean toggleSprint = false;
public static boolean toggleSprintEnabled = false; public static boolean toggleSprintEnabled = false;
public boolean leftHand = false; public boolean leftHand = false;
public boolean chunkBorders = false;
public boolean ofLagometer = false;
public boolean ofProfiler = false;
public GameSettings(Minecraft mcIn) { public GameSettings(Minecraft mcIn) {
this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem, this.keyBindings = (KeyBinding[]) ArrayUtils.addAll(new KeyBinding[] { this.keyBindAttack, this.keyBindUseItem,
@ -775,9 +778,13 @@ public class GameSettings {
toggleSprint = !toggleSprint; toggleSprint = !toggleSprint;
} }
if(parOptions == GameSettings.Options.LEFT_HAND) { if (parOptions == GameSettings.Options.LAGOMETER) {
leftHand = !leftHand; this.ofLagometer = !this.ofLagometer;
} }
if (parOptions == GameSettings.Options.PROFILER) {
this.ofProfiler = !this.ofProfiler;
}
this.saveOptions(); this.saveOptions();
} }
@ -867,8 +874,10 @@ public class GameSettings {
return this.ofDynamicFov; return this.ofDynamicFov;
case TOGGLE_SPRINT: case TOGGLE_SPRINT:
return toggleSprint; return toggleSprint;
case LEFT_HAND: case LAGOMETER:
return leftHand; return ofLagometer;
case PROFILER:
return ofProfiler;
default: default:
return false; return false;
} }
@ -1133,9 +1142,11 @@ public class GameSettings {
return this.ofCustomFonts ? s + "ON" : s + "OFF"; return this.ofCustomFonts ? s + "ON" : s + "OFF";
} else if (parOptions == GameSettings.Options.TOGGLE_SPRINT) { } else if (parOptions == GameSettings.Options.TOGGLE_SPRINT) {
return toggleSprint ? s + "Toggle" : s + "Hold"; return toggleSprint ? s + "Toggle" : s + "Hold";
} else if(parOptions == GameSettings.Options.LEFT_HAND) { } else if (parOptions == GameSettings.Options.LAGOMETER) {
return leftHand ? s + "Left" : s + "Right"; return this.ofLagometer ? s + "ON" : s + "OFF";
} else { } else if (parOptions == GameSettings.Options.PROFILER) {
return this.ofProfiler ? s + "ON" : s + "OFF";
} else {
return s; return s;
} }
} }
@ -1620,9 +1631,13 @@ public class GameSettings {
toggleSprint = Boolean.valueOf(astring[1]).booleanValue(); toggleSprint = Boolean.valueOf(astring[1]).booleanValue();
} }
if (astring[0].equals("leftHand")) { if (astring[0].equals("ofLagometer") && astring.length >= 2) {
this.leftHand = Boolean.valueOf(astring[1]).booleanValue(); this.ofLagometer = Boolean.valueOf(astring[1]).booleanValue();
} }
if (astring[0].equals("ofProfiler") && astring.length >= 2) {
this.ofProfiler = Boolean.valueOf(astring[1]).booleanValue();
}
Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode());
@ -1776,7 +1791,8 @@ public class GameSettings {
printwriter.println("ofBetterSnow:" + this.ofBetterSnow); printwriter.println("ofBetterSnow:" + this.ofBetterSnow);
printwriter.println("ofCustomFonts:" + this.ofCustomFonts); printwriter.println("ofCustomFonts:" + this.ofCustomFonts);
printwriter.println("toggleSprint:" + toggleSprint); printwriter.println("toggleSprint:" + toggleSprint);
printwriter.println("leftHand:" + this.leftHand); printwriter.println("ofLagometer:" + this.ofLagometer);
printwriter.println("ofProfiler:" + this.ofProfiler);
for (KeyBinding keybinding : this.keyBindings) { for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -1967,7 +1983,9 @@ public class GameSettings {
BETTER_SNOW("Better Snow", false, false), BETTER_SNOW("Better Snow", false, false),
CUSTOM_FONTS("Custom Fonts", false, false), CUSTOM_FONTS("Custom Fonts", false, false),
TOGGLE_SPRINT("Sprint", false, false), TOGGLE_SPRINT("Sprint", false, false),
LEFT_HAND("Main Hand", false, false); LEFT_HAND("Main Hand", false, false),
LAGOMETER("Lagometer", false, false),
PROFILER("Profiler", false, false);
private final boolean enumFloat; private final boolean enumFloat;
private final boolean enumBoolean; private final boolean enumBoolean;
@ -2101,6 +2119,9 @@ public class GameSettings {
this.ofRainSplash = p_setAllAnimations_1_; this.ofRainSplash = p_setAllAnimations_1_;
} }
public void resetSettings() {
}
private void updateWaterOpacity() { private void updateWaterOpacity() {
ClearWater.updateWaterOpacity(this, this.mc.theWorld); ClearWater.updateWaterOpacity(this, this.mc.theWorld);
} }

View File

@ -8,6 +8,8 @@ import java.util.Map;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import net.PeytonPlayz585.shadow.Config;
import net.PeytonPlayz585.shadow.Lagometer;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger; import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
@ -46,6 +48,10 @@ public class Profiler {
private String profilingSection = ""; private String profilingSection = "";
private final Map<String, Long> profilingMap = Maps.newHashMap(); private final Map<String, Long> profilingMap = Maps.newHashMap();
private static final int HASH_SCHEDULED_EXECUTABLES = "scheduledExecutables".hashCode();
private static final int HASH_TICK = "tick".hashCode();
private static final int HASH_PRE_RENDER_ERRORS = "preRenderErrors".hashCode();
/**+ /**+
* Clear profiling. * Clear profiling.
*/ */
@ -59,6 +65,20 @@ public class Profiler {
* Start section * Start section
*/ */
public void startSection(String name) { public void startSection(String name) {
if (Lagometer.isActive()) {
int i = name.hashCode();
if (i == HASH_SCHEDULED_EXECUTABLES && name.equals("scheduledExecutables")) {
Lagometer.timerScheduledExecutables.start();
} else if (i == HASH_TICK && name.equals("tick")) {
Lagometer.timerScheduledExecutables.end();
Lagometer.timerTick.start();
} else if (i == HASH_PRE_RENDER_ERRORS && name.equals("preRenderErrors")) {
Lagometer.timerTick.end();
}
}
if (this.profilingEnabled) { if (this.profilingEnabled) {
if (this.profilingSection.length() > 0) { if (this.profilingSection.length() > 0) {
this.profilingSection = this.profilingSection + "."; this.profilingSection = this.profilingSection + ".";

View File

@ -44,6 +44,14 @@ public class AxisAlignedBB {
this.maxZ = (double) pos2.getZ(); this.maxZ = (double) pos2.getZ();
} }
/**
* Returns a bounding box with the specified bounds. Args: minX, minY, minZ,
* maxX, maxY, maxZ
*/
public static AxisAlignedBB getBoundingBox(double par0, double par2, double par4, double par6, double par8, double par10) {
return new AxisAlignedBB(par0, par2, par4, par6, par8, par10);
}
/**+ /**+
* Adds the coordinates to the bounding box extending it if the * Adds the coordinates to the bounding box extending it if the
* point lies outside the current ranges. Args: x, y, z * point lies outside the current ranges. Args: x, y, z

View File

@ -53,7 +53,7 @@ public class EarlyLoadScreen {
ImageData img = PlatformAssets.loadImageFile(Base64.decodeBase64(loadScreen)); ImageData img = PlatformAssets.loadImageFile(Base64.decodeBase64(loadScreen));
ByteBuffer upload = PlatformRuntime.allocateByteBuffer(192*192*4); ByteBuffer upload = PlatformRuntime.allocateByteBuffer(192*192*4);
IntBuffer pixelUpload = upload.asIntBuffer(); IntBuffer pixelUpload = upload.asIntBuffer();
pixelUpload.put(img.pixels); pixelUpload.put(img.getPixels());
pixelUpload.flip(); pixelUpload.flip();
_wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 192, 192, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelUpload); _wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 192, 192, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixelUpload);
@ -142,7 +142,7 @@ public class EarlyLoadScreen {
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
ImageData img = PlatformAssets.loadImageFile(Base64.decodeBase64(enableScreen)); ImageData img = PlatformAssets.loadImageFile(Base64.decodeBase64(enableScreen));
IntBuffer upload = PlatformRuntime.allocateIntBuffer(128*128); IntBuffer upload = PlatformRuntime.allocateIntBuffer(128*128);
upload.put(img.pixels); upload.put(img.getPixels());
upload.flip(); upload.flip();
_wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, upload); _wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, upload);
@ -199,7 +199,7 @@ public class EarlyLoadScreen {
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
ImageData img = PlatformAssets.loadImageFile(image); ImageData img = PlatformAssets.loadImageFile(image);
IntBuffer upload = PlatformRuntime.allocateIntBuffer(256*256); IntBuffer upload = PlatformRuntime.allocateIntBuffer(256*256);
upload.put(img.pixels); upload.put(img.getPixels());
upload.flip(); upload.flip();
_wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, upload); _wglTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, upload);