diff --git a/src/main/java/net/PeytonPlayz585/shadow/Config.java b/src/main/java/net/PeytonPlayz585/shadow/Config.java index e04bf81..c58610f 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/Config.java +++ b/src/main/java/net/PeytonPlayz585/shadow/Config.java @@ -133,6 +133,10 @@ public class Config { public static float getFogStart() { return Minecraft.getMinecraft().gameSettings.ofFogStart; } + + public static int getUpdatesPerFrame() { + return Minecraft.getMinecraft().gameSettings.ofChunkUpdates; + } public static int limit(int p_limit_0_, int p_limit_1_, int p_limit_2_) { return p_limit_0_ < p_limit_1_ ? p_limit_1_ : (p_limit_0_ > p_limit_2_ ? p_limit_2_ : p_limit_0_); diff --git a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java new file mode 100644 index 0000000..80ebec7 --- /dev/null +++ b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiPerformance.java @@ -0,0 +1,70 @@ +package net.PeytonPlayz585.shadow.gui; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiOptionButton; +import net.minecraft.client.gui.GuiOptionSlider; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.resources.I18n; +import net.minecraft.client.settings.GameSettings; + +public class GuiPerformance extends GuiScreen { + private GuiScreen prevScreen; + protected String title; + private GameSettings settings; + private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.SMOOTH_FPS, GameSettings.Options.FAST_MATH, GameSettings.Options.CHUNK_UPDATES}; + + public GuiPerformance(GuiScreen p_i52_1_) { + this.prevScreen = p_i52_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("of.options.performanceTitle", 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))); + } else { + this.buttonList.add(new GuiOptionSlider(gamesettings$options.returnEnumOrdinal(), j, k, gamesettings$options)); + } + } + + 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); + } + } + } + + /** + * 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); + } +} \ No newline at end of file diff --git a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiShaders.java b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiShaders.java index 44673d3..006f46d 100644 --- a/src/main/java/net/PeytonPlayz585/shadow/gui/GuiShaders.java +++ b/src/main/java/net/PeytonPlayz585/shadow/gui/GuiShaders.java @@ -29,7 +29,7 @@ public class GuiShaders extends GuiScreen { this.buttonList.add(new GuiButton(6, j1 / 4 * 3 - k1 / 2, height - 25, k1, j, I18n.format("gui.done", new Object[0]))); this.buttonList.add(button = new GuiButton(201, j1 / 4 - k1 / 2, height - 25, k1, j, "Shaders Folder")); button.enabled = false; - this.buttonList.add(shaderProfile = new GuiOptionButton(201, k, height - 25, shaderProfile2, Minecraft.getMinecraft().gameSettings.getKeyBinding(shaderProfile2))); + this.buttonList.add(shaderProfile = new GuiOptionButton(201, k, height - 25, i, j, shaderProfile2, Minecraft.getMinecraft().gameSettings.getKeyBinding(shaderProfile2))); shaderProfile.enabled = Minecraft.getMinecraft().gameSettings.shaders; this.list = new GuiShaders.List(this.mc); this.list.registerScrollButtons(7, 8); diff --git a/src/main/java/net/PeytonPlayz585/shadow/other/PlayerControllerOF.java b/src/main/java/net/PeytonPlayz585/shadow/other/PlayerControllerOF.java new file mode 100644 index 0000000..109a3bf --- /dev/null +++ b/src/main/java/net/PeytonPlayz585/shadow/other/PlayerControllerOF.java @@ -0,0 +1,59 @@ +package net.PeytonPlayz585.shadow.other; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public class PlayerControllerOF extends PlayerControllerMP { + private boolean acting = false; + + public PlayerControllerOF(Minecraft p_i73_1_, NetHandlerPlayClient p_i73_2_) { + super(p_i73_1_, p_i73_2_); + } + + /** + * Called when the player is hitting a block with an item. + */ + public boolean clickBlock(BlockPos loc, EnumFacing face) { + this.acting = true; + boolean flag = super.clickBlock(loc, face); + this.acting = false; + return flag; + } + + public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing) { + this.acting = true; + boolean flag = super.onPlayerDamageBlock(posBlock, directionFacing); + this.acting = false; + return flag; + } + + /** + * Notifies the server of things like consuming food, etc... + */ + public boolean sendUseItem(EntityPlayer playerIn, World worldIn, ItemStack itemStackIn) { + this.acting = true; + boolean flag = super.sendUseItem(playerIn, worldIn, itemStackIn); + this.acting = false; + return flag; + } + + public boolean onPlayerRightClick(EntityPlayerSP player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, EnumFacing side, Vec3 hitVec) { + this.acting = true; + boolean flag = super.onPlayerRightClick(player, worldIn, heldStack, hitPos, side, hitVec); + this.acting = false; + return flag; + } + + public boolean isActing() { + return this.acting; + } +} \ No newline at end of file diff --git a/src/main/java/net/minecraft/client/gui/GuiOptionButton.java b/src/main/java/net/minecraft/client/gui/GuiOptionButton.java index 5f2ed02..8cbf5e1 100644 --- a/src/main/java/net/minecraft/client/gui/GuiOptionButton.java +++ b/src/main/java/net/minecraft/client/gui/GuiOptionButton.java @@ -36,6 +36,11 @@ public class GuiOptionButton extends GuiButton { super(parInt1, parInt2, parInt3, 150, 20, parString1); this.enumOptions = parOptions; } + + public GuiOptionButton(int parInt1, int parInt2, int parInt3, int parInt4, int parInt5, GameSettings.Options parOptions, String parString1) { + super(parInt1, parInt2, parInt3, parInt4, parInt5, parString1); + this.enumOptions = parOptions; + } public GameSettings.Options returnEnumOptions() { return this.enumOptions; diff --git a/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java b/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java index d7788a8..f09a8a5 100644 --- a/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java +++ b/src/main/java/net/minecraft/client/gui/GuiVideoSettings.java @@ -136,6 +136,10 @@ public class GuiVideoSettings extends GuiScreen { if(parGuiButton.id == 202) { this.mc.displayGuiScreen(new GuiQuality(this)); } + + if(parGuiButton.id == 212) { + this.mc.displayGuiScreen(new GuiPerformance(this)); + } if (this.guiGameSettings.guiScale != i) { ScaledResolution scaledresolution = new ScaledResolution(this.mc); diff --git a/src/main/java/net/minecraft/client/multiplayer/WorldClient.java b/src/main/java/net/minecraft/client/multiplayer/WorldClient.java index a3bd1b2..33b5e79 100644 --- a/src/main/java/net/minecraft/client/multiplayer/WorldClient.java +++ b/src/main/java/net/minecraft/client/multiplayer/WorldClient.java @@ -1,5 +1,6 @@ package net.minecraft.client.multiplayer; +import net.PeytonPlayz585.shadow.other.PlayerControllerOF; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import java.util.Set; import java.util.concurrent.Callable; @@ -72,6 +73,7 @@ public class WorldClient extends World { private final Set entitySpawnQueue = Sets.newHashSet(); private final Minecraft mc = Minecraft.getMinecraft(); private final Set previousActiveChunkSet = Sets.newHashSet(); + private boolean playerUpdate = false; public WorldClient(NetHandlerPlayClient parNetHandlerPlayClient, WorldSettings parWorldSettings, int parInt1, EnumDifficulty parEnumDifficulty, Profiler parProfiler) { @@ -85,6 +87,10 @@ public class WorldClient extends World { this.mapStorage = new SaveDataMemoryStorage(); this.calculateInitialSkylight(); this.calculateInitialWeather(); + + if (this.mc.playerController != null && this.mc.playerController.getClass() == PlayerControllerMP.class) { + this.mc.playerController = new PlayerControllerOF(this.mc, parNetHandlerPlayClient); + } } /**+ @@ -428,4 +434,30 @@ public class WorldClient extends World { super.setWorldTime(i); } + + /** + * Sets the block state at a given location. Flag 1 will cause a block update. Flag 2 will send the change to + * clients (you almost always want this). Flag 4 prevents the block from being re-rendered, if this is a client + * world. Flags can be added together. + */ + @Override + public boolean setBlockState(BlockPos pos, IBlockState newState, int flags) { + this.playerUpdate = this.isPlayerActing(); + boolean flag = super.setBlockState(pos, newState, flags); + this.playerUpdate = false; + return flag; + } + + private boolean isPlayerActing() { + if (this.mc.playerController instanceof PlayerControllerOF) { + PlayerControllerOF playercontrollerof = (PlayerControllerOF)this.mc.playerController; + return playercontrollerof.isActing(); + } else { + return false; + } + } + + public boolean isPlayerUpdate() { + return this.playerUpdate; + } } \ No newline at end of file diff --git a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java b/src/main/java/net/minecraft/client/renderer/EntityRenderer.java index fac16c3..baf01f7 100644 --- a/src/main/java/net/minecraft/client/renderer/EntityRenderer.java +++ b/src/main/java/net/minecraft/client/renderer/EntityRenderer.java @@ -1190,6 +1190,12 @@ public class EntityRenderer implements IResourceManagerReloadListener { } this.mc.mcProfiler.endStartSection("terrain"); + + if (this.mc.gameSettings.ofSmoothFps && pass > 0) { + this.mc.mcProfiler.endStartSection("finish"); + this.mc.mcProfiler.endStartSection("terrain"); + } + GlStateManager.matrixMode(GL_MODELVIEW); GlStateManager.pushMatrix(); GlStateManager.disableAlpha(); diff --git a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java index efd9697..37ea88d 100644 --- a/src/main/java/net/minecraft/client/renderer/RenderGlobal.java +++ b/src/main/java/net/minecraft/client/renderer/RenderGlobal.java @@ -5,6 +5,7 @@ import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import java.util.Collection; import java.util.EnumSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -186,6 +187,9 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene private boolean displayListEntitiesDirty = true; private int renderDistance = 0; private int renderDistanceSq = 0; + + public Set chunksToResortTransparency = new LinkedHashSet(); + public Set chunksToUpdateForced = new LinkedHashSet(); public RenderGlobal(Minecraft mcIn) { this.mc = mcIn; @@ -957,12 +961,15 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene RenderChunk renderchunk4 = renderglobal$containerlocalrenderinformation2.renderChunk; if (renderchunk4.isNeedsUpdate() || set.contains(renderchunk4)) { this.displayListEntitiesDirty = true; - if (this.mc.gameSettings.chunkFix ? this.isPositionInRenderChunkHack(blockpos1, renderchunk4) - : this.isPositionInRenderChunk(blockpos, renderchunk4)) { - this.mc.mcProfiler.startSection("build near"); - this.renderDispatcher.updateChunkNow(renderchunk4); - renderchunk4.setNeedsUpdate(false); - this.mc.mcProfiler.endSection(); + if (this.mc.gameSettings.chunkFix ? this.isPositionInRenderChunkHack(blockpos1, renderchunk4) : this.isPositionInRenderChunk(blockpos, renderchunk4)) { + if (!renderchunk4.isPlayerUpdate()) { + this.chunksToUpdateForced.add(renderchunk4); + } else { + this.mc.mcProfiler.startSection("build near"); + this.renderDispatcher.updateChunkNow(renderchunk4); + renderchunk4.setNeedsUpdate(false); + this.mc.mcProfiler.endSection(); + } } else { this.chunksToUpdate.add(renderchunk4); } @@ -1081,53 +1088,62 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene public int renderBlockLayer(EnumWorldBlockLayer blockLayerIn, double partialTicks, int pass, Entity entityIn) { RenderHelper.disableStandardItemLighting(); - if (blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT) { - this.mc.mcProfiler.startSection("translucent_sort"); - double d0 = entityIn.posX - this.prevRenderSortX; - double d1 = entityIn.posY - this.prevRenderSortY; - double d2 = entityIn.posZ - this.prevRenderSortZ; - if (d0 * d0 + d1 * d1 + d2 * d2 > 1.0D) { - this.prevRenderSortX = entityIn.posX; - this.prevRenderSortY = entityIn.posY; - this.prevRenderSortZ = entityIn.posZ; - int k = 0; - for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation : this.renderInfos) { - if (renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk - .isLayerStarted(blockLayerIn) && k++ < 15) { - this.renderDispatcher - .updateTransparencyLater(renderglobal$containerlocalrenderinformation.renderChunk); - } - } - } + if (blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT) { + this.mc.mcProfiler.startSection("translucent_sort"); + double d0 = entityIn.posX - this.prevRenderSortX; + double d1 = entityIn.posY - this.prevRenderSortY; + double d2 = entityIn.posZ - this.prevRenderSortZ; - this.mc.mcProfiler.endSection(); - } + if (d0 * d0 + d1 * d1 + d2 * d2 > 1.0D) { + this.prevRenderSortX = entityIn.posX; + this.prevRenderSortY = entityIn.posY; + this.prevRenderSortZ = entityIn.posZ; + int k = 0; + Iterator iterator = this.renderInfos.iterator(); + this.chunksToResortTransparency.clear(); - this.mc.mcProfiler.startSection("filterempty"); - int l = 0; - boolean flag = blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT; - int i1 = flag ? this.renderInfos.size() - 1 : 0; - int i = flag ? -1 : this.renderInfos.size(); - int j1 = flag ? -1 : 1; + while (iterator.hasNext()) { + RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator.next(); - for (int j = i1; j != i; j += j1) { - RenderChunk renderchunk = ((RenderGlobal.ContainerLocalRenderInformation) this.renderInfos - .get(j)).renderChunk; - if (!renderchunk.getCompiledChunk().isLayerEmpty(blockLayerIn)) { - ++l; - this.renderContainer.addRenderChunk(renderchunk, blockLayerIn); - } - } - - if (Config.isFogOff() && this.mc.entityRenderer.fogStandard) { - GlStateManager.disableFog(); + if (renderglobal$containerlocalrenderinformation.renderChunk.compiledChunk.isLayerStarted(blockLayerIn) && k++ < 15) { + this.chunksToResortTransparency.add(renderglobal$containerlocalrenderinformation.renderChunk); + } + } + } + + this.mc.mcProfiler.endSection(); } - this.mc.mcProfiler.endStartSection("render_" + blockLayerIn); - this.renderBlockLayer(blockLayerIn); - this.mc.mcProfiler.endSection(); - return l; + this.mc.mcProfiler.startSection("filterempty"); + int l = 0; + boolean flag = blockLayerIn == EnumWorldBlockLayer.TRANSLUCENT; + int i1 = flag ? this.renderInfos.size() - 1 : 0; + int i = flag ? -1 : this.renderInfos.size(); + int j1 = flag ? -1 : 1; + + for (int j = i1; j != i; j += j1) { + RenderChunk renderchunk = ((RenderGlobal.ContainerLocalRenderInformation)this.renderInfos.get(j)).renderChunk; + + if (!renderchunk.getCompiledChunk().isLayerEmpty(blockLayerIn)) { + ++l; + this.renderContainer.addRenderChunk(renderchunk, blockLayerIn); + } + } + + if (l == 0) { + this.mc.mcProfiler.endSection(); + return l; + } else { + if (Config.isFogOff() && this.mc.entityRenderer.fogStandard) { + GlStateManager.disableFog(); + } + + this.mc.mcProfiler.endStartSection("render_" + blockLayerIn); + this.renderBlockLayer(blockLayerIn); + this.mc.mcProfiler.endSection(); + return l; + } } public static interface ChunkCullAdapter { @@ -1802,25 +1818,64 @@ public class RenderGlobal implements IWorldAccess, IResourceManagerReloadListene } public void updateChunks(long finishTimeNano) { - this.displayListEntitiesDirty |= this.renderDispatcher.updateChunks(finishTimeNano); - if (!this.chunksToUpdate.isEmpty()) { - Iterator iterator = this.chunksToUpdate.iterator(); + finishTimeNano = (long)((double)finishTimeNano + 1.0E8D); + this.displayListEntitiesDirty |= this.renderDispatcher.updateChunks(finishTimeNano); - while (iterator.hasNext()) { - RenderChunk renderchunk = (RenderChunk) iterator.next(); - if (!this.renderDispatcher.updateChunkLater(renderchunk)) { - break; - } + if (this.chunksToUpdateForced.size() > 0) { + Iterator iterator = this.chunksToUpdateForced.iterator(); - renderchunk.setNeedsUpdate(false); - iterator.remove(); - long i = finishTimeNano - System.nanoTime(); - if (i < 0L) { - break; - } - } - } - } + while (iterator.hasNext()) { + RenderChunk renderchunk = (RenderChunk)iterator.next(); + + if (!this.renderDispatcher.updateChunkLater(renderchunk)) { + break; + } + + renderchunk.setNeedsUpdate(false); + iterator.remove(); + this.chunksToUpdate.remove(renderchunk); + this.chunksToResortTransparency.remove(renderchunk); + } + } + + if (this.chunksToResortTransparency.size() > 0) { + Iterator iterator2 = this.chunksToResortTransparency.iterator(); + + if (iterator2.hasNext()) { + RenderChunk renderchunk2 = (RenderChunk)iterator2.next(); + + if (this.renderDispatcher.updateTransparencyLater(renderchunk2)) { + iterator2.remove(); + } + } + } + + int j = 0; + int k = Config.getUpdatesPerFrame(); + int i = k * 2; + Iterator iterator1 = this.chunksToUpdate.iterator(); + + while (iterator1.hasNext()) { + RenderChunk renderchunk1 = (RenderChunk)iterator1.next(); + + if (!this.renderDispatcher.updateChunkLater(renderchunk1)) { + break; + } + + renderchunk1.setNeedsUpdate(false); + iterator1.remove(); + + if (renderchunk1.getCompiledChunk().isEmpty() && k < i) { + ++k; + } + + ++j; + + if (j >= k) { + break; + } + } + } public void renderWorldBorder(Entity partialTicks, float parFloat1) { Tessellator tessellator = Tessellator.getInstance(); diff --git a/src/main/java/net/minecraft/client/renderer/chunk/RenderChunk.java b/src/main/java/net/minecraft/client/renderer/chunk/RenderChunk.java index 3ed3fd6..762c8ef 100644 --- a/src/main/java/net/minecraft/client/renderer/chunk/RenderChunk.java +++ b/src/main/java/net/minecraft/client/renderer/chunk/RenderChunk.java @@ -17,6 +17,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.RegionRenderCache; import net.minecraft.client.renderer.RenderGlobal; @@ -71,8 +72,8 @@ public class RenderChunk { public ShadowFrustumState shadowLOD0InFrustum = ShadowFrustumState.OUTSIDE; public ShadowFrustumState shadowLOD1InFrustum = ShadowFrustumState.OUTSIDE; public ShadowFrustumState shadowLOD2InFrustum = ShadowFrustumState.OUTSIDE; - //private EnumMap field_181702_p = Maps.newEnumMap(EnumFacing.class); private BlockPos[] positionOffsets16 = new BlockPos[EnumFacing.VALUES.length]; + private boolean playerUpdate = false; public RenderChunk(World worldIn, RenderGlobal renderGlobalIn, BlockPos blockPosIn, int indexIn) { this.world = worldIn; @@ -300,11 +301,32 @@ public class RenderChunk { public void setNeedsUpdate(boolean needsUpdateIn) { this.needsUpdate = needsUpdateIn; + + if (this.needsUpdate) { + if (this.isWorldPlayerUpdate()) { + this.playerUpdate = true; + } + } else { + this.playerUpdate = false; + } } public boolean isNeedsUpdate() { return this.needsUpdate; } + + private boolean isWorldPlayerUpdate() { + if (this.world instanceof WorldClient) { + WorldClient worldclient = (WorldClient)this.world; + return worldclient.isPlayerUpdate(); + } else { + return false; + } + } + + public boolean isPlayerUpdate() { + return this.playerUpdate; + } public BlockPos func_181701_a(EnumFacing p_181701_1_) { return this.getPositionOffset16(p_181701_1_); diff --git a/src/main/java/net/minecraft/client/settings/GameSettings.java b/src/main/java/net/minecraft/client/settings/GameSettings.java index ce4d2d5..9974821 100644 --- a/src/main/java/net/minecraft/client/settings/GameSettings.java +++ b/src/main/java/net/minecraft/client/settings/GameSettings.java @@ -73,14 +73,6 @@ public class GameSettings { "options.particles.minimal" }; private static final String[] AMBIENT_OCCLUSIONS = new String[] { "options.ao.off", "options.ao.min", "options.ao.max" }; - private static final String[] STREAM_COMPRESSIONS = new String[] { "options.stream.compression.low", - "options.stream.compression.medium", "options.stream.compression.high" }; - private static final String[] STREAM_CHAT_MODES = new String[] { "options.stream.chat.enabled.streaming", - "options.stream.chat.enabled.always", "options.stream.chat.enabled.never" }; - private static final String[] STREAM_CHAT_FILTER_MODES = new String[] { "options.stream.chat.userFilter.all", - "options.stream.chat.userFilter.subs", "options.stream.chat.userFilter.mods" }; - private static final String[] STREAM_MIC_MODES = new String[] { "options.stream.mic_toggle.mute", - "options.stream.mic_toggle.talk" }; private static final String[] field_181149_aW = new String[] { "options.off", "options.graphics.fast", "options.graphics.fancy" }; public float mouseSensitivity = 0.5F; @@ -226,6 +218,10 @@ public class GameSettings { public boolean ofAnimatedTerrain = true; public boolean ofAnimatedTextures = true; + //Performance Settings + public boolean ofSmoothFps = false; + public int ofChunkUpdates = 1; + //Super Secret Setting :> public boolean secret = false; @@ -627,6 +623,18 @@ public class GameSettings { Shaders shader = new Shaders(); shader.updateShaderProfile(profile); } + + if (parOptions == GameSettings.Options.SMOOTH_FPS) { + this.ofSmoothFps = !this.ofSmoothFps; + } + + if (parOptions == GameSettings.Options.CHUNK_UPDATES) { + ++this.ofChunkUpdates; + + if (this.ofChunkUpdates > 5) { + this.ofChunkUpdates = 1; + } + } this.saveOptions(); } @@ -698,6 +706,8 @@ public class GameSettings { return this.ofCustomSky; case CLEAR_WATER: return this.ofClearWater; + case SMOOTH_FPS: + return this.ofSmoothFps; default: return false; } @@ -757,7 +767,6 @@ public class GameSettings { if (this.fancyGraphics) { return s + I18n.format("options.graphics.fancy", new Object[0]); } else { - String s1 = "options.graphics.fast"; return s + I18n.format("options.graphics.fast", new Object[0]); } } else if (parOptions == GameSettings.Options.FXAA) { @@ -870,6 +879,10 @@ public class GameSettings { default: return s + "Low"; } + } else if (parOptions == GameSettings.Options.SMOOTH_FPS) { + return this.ofSmoothFps ? s + "ON" : s + "OFF"; + } else if (parOptions == GameSettings.Options.CHUNK_UPDATES) { + return s + this.ofChunkUpdates; } else { return s; } @@ -1272,6 +1285,15 @@ public class GameSettings { } System.out.println("Loaded Shader Profile: " + this.profile); } + + if (astring[0].equals("ofSmoothFps") && astring.length >= 2) { + this.ofSmoothFps = Boolean.valueOf(astring[1]).booleanValue(); + } + + if (astring[0].equals("ofChunkUpdates") && astring.length >= 2) { + this.ofChunkUpdates = Integer.valueOf(astring[1]).intValue(); + this.ofChunkUpdates = Config.limit(this.ofChunkUpdates, 1, 5); + } Keyboard.setFunctionKeyModifier(keyBindFunction.getKeyCode()); @@ -1402,24 +1424,22 @@ public class GameSettings { printwriter.println("ofBetterGrass:" + this.ofBetterGrass); printwriter.println("ofFogType:" + this.ofFogType); printwriter.println("ofFogStart:" + this.ofFogStart); - //printwriter.print("secret:" + this.secret); switch(this.profile) { case 1: printwriter.println("profile:low"); break; - case 2: printwriter.println("profile:mid"); break; - case 3: printwriter.println("profile:high"); break; - case 4: printwriter.println("profile:ultra"); break; } + printwriter.println("ofSmoothFps:" + this.ofSmoothFps); + printwriter.println("ofChunkUpdates:" + this.ofChunkUpdates); for (KeyBinding keybinding : this.keyBindings) { printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode()); @@ -1587,7 +1607,9 @@ public class GameSettings { BETTER_GRASS("Better Grass", false, false), FOG_FANCY("Fog", false, false), FOG_START("Fog Start", false, false), - SHADER_PROFILE("Profile", false, false); + SHADER_PROFILE("Profile", false, false), + SMOOTH_FPS("Smooth FPS", false, false), + CHUNK_UPDATES("Chunk Updates", false, false); private final boolean enumFloat; private final boolean enumBoolean;