small fixes

This commit is contained in:
HoosierTransfer 2024-04-14 14:02:52 -04:00
parent f99a6228d6
commit 7e49cad89c
20 changed files with 1290671 additions and 44166 deletions

View File

@ -112,5 +112,4 @@ void main() {
#endif #endif
gl_Position = u_projectionMat4f * pos; gl_Position = u_projectionMat4f * pos;
} }

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ package net.hoosiertransfer;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.Arrays; import java.util.Arrays;
import net.minecraft.client.Minecraft;
public class Config { public class Config {
public static int biomeBlendRadius = 2; public static int biomeBlendRadius = 2;
@ -15,4 +16,16 @@ public class Config {
public static Set<String> blockEntityWhitelist = new HashSet<>(Arrays.asList("minecraft:beacon")); public static Set<String> blockEntityWhitelist = new HashSet<>(Arrays.asList("minecraft:beacon"));
public static int SleepDuration = 10; public static int SleepDuration = 10;
public static int hitboxLimit = 50; public static int hitboxLimit = 50;
public static boolean disableAlpha() {
return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders;
}
public static boolean skipRenderUpdate() {
return Minecraft.getMinecraft().gameSettings.skipHandRender && !Minecraft.getMinecraft().gameSettings.shaders;
}
public static boolean audioEnabled() {
return Minecraft.getMinecraft().gameSettings.enableSound;
}
} }

View File

@ -38,85 +38,85 @@ public class CullTask implements Runnable {
@Override @Override
public void run() { public void run() {
while (client != null) { // while (client != null) {
try { // try {
Thread.sleep(Config.SleepDuration); // Thread.sleep(Config.SleepDuration);
if (Config.enableCulling && client.theWorld != null && client.thePlayer != null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() != null) { // if (Config.enableCulling && client.theWorld != null && client.thePlayer != null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() != null) {
Vec3 cameraMC = getCameraPos(); // Vec3 cameraMC = getCameraPos();
if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord == lastPos.y && cameraMC.zCoord == lastPos.z)) { // if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord == lastPos.y && cameraMC.zCoord == lastPos.z)) {
long start = System.currentTimeMillis(); // long start = System.currentTimeMillis();
requestCull = false; // requestCull = false;
lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord); // lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord);
Vec3d camera = lastPos; // Vec3d camera = lastPos;
culling.resetCache(); // culling.resetCache();
boolean noCulling = client.thePlayer.isSpectator() || client.gameSettings.thirdPersonView != 0; // boolean noCulling = client.thePlayer.isSpectator() || client.gameSettings.thirdPersonView != 0;
Iterator<TileEntity> iterator = client.theWorld.loadedTileEntityList.iterator(); // Iterator<TileEntity> iterator = client.theWorld.loadedTileEntityList.iterator();
TileEntity entry; // TileEntity entry;
while(iterator.hasNext()) { // while(iterator.hasNext()) {
try { // try {
entry = iterator.next(); // entry = iterator.next();
} catch(NullPointerException | ConcurrentModificationException ex) { // } catch(NullPointerException | ConcurrentModificationException ex) {
break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less // break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less
// overhead probably than trying to sync stuff up for no really good reason // // overhead probably than trying to sync stuff up for no really good reason
} // }
if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) { // if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) {
continue; // continue;
} // }
if (!entry.isForcedVisible()) { // if (!entry.isForcedVisible()) {
if (noCulling) { // if (noCulling) {
entry.setCulled(true); // entry.setCulled(true);
continue; // continue;
} // }
BlockPos pos = entry.getPos(); // BlockPos pos = entry.getPos();
if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64) { // 64 is the fixed max tile view distance // if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64) { // 64 is the fixed max tile view distance
aabbMin.set(pos.getX(), pos.getY(), pos.getZ()); // aabbMin.set(pos.getX(), pos.getY(), pos.getZ());
aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d); // aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d);
boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera); // boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
entry.setCulled(!visible); // entry.setCulled(!visible);
} // }
} // }
} // }
Entity entity = null; // Entity entity = null;
Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator(); // Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator();
while(iterable.hasNext()) { // while(iterable.hasNext()) {
try { // try {
entity = iterable.next(); // entity = iterable.next();
} catch(NullPointerException | ConcurrentModificationException ex) { // } catch(NullPointerException | ConcurrentModificationException ex) {
break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less // break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less
// overhead probably than trying to sync stuff up for no really good reason // // overhead probably than trying to sync stuff up for no really good reason
} // }
if (entity == null) { // if (entity == null) {
continue; // continue;
} // }
if (!entity.isForcedVisible()) { // if (!entity.isForcedVisible()) {
if (noCulling || isSkippableArmorstand(entity)) { // if (noCulling || isSkippableArmorstand(entity)) {
entity.setCulled(false); // entity.setCulled(false);
continue; // continue;
} // }
if(entity.getPositionVector().squareDistanceTo(cameraMC) > Config.tracingDistance * Config.tracingDistance) { // if(entity.getPositionVector().squareDistanceTo(cameraMC) > Config.tracingDistance * Config.tracingDistance) {
entity.setCulled(false); // If your entity view distance is larger than tracingDistance just render it // entity.setCulled(false); // If your entity view distance is larger than tracingDistance just render it
continue; // continue;
} // }
AxisAlignedBB boundingBox = entity.getEntityBoundingBox(); // AxisAlignedBB boundingBox = entity.getEntityBoundingBox();
if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY - boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ > hitboxLimit) { // if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY - boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ > hitboxLimit) {
entity.setCulled(false); // To big to bother to cull // entity.setCulled(false); // To big to bother to cull
continue; // continue;
} // }
aabbMin.set(boundingBox.minX, boundingBox.minY, boundingBox.minZ); // aabbMin.set(boundingBox.minX, boundingBox.minY, boundingBox.minZ);
aabbMax.set(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); // aabbMax.set(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ);
boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera); // boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
entity.setCulled(!visible); // entity.setCulled(!visible);
} // }
} // }
lastTime = (System.currentTimeMillis()-start); // lastTime = (System.currentTimeMillis()-start);
} // }
} // }
} catch (Exception e) { // } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
System.out.println("Culling thread stopped"); // System.out.println("Culling thread stopped");
} }
private Vec3 getCameraPos() { private Vec3 getCameraPos() {

View File

@ -29,11 +29,11 @@ public class Mouse {
} }
public static int getX() { public static int getX() {
return (int)(PlatformInput.mouseGetX() * RenderResolution.renderScale); return (int)(PlatformInput.mouseGetX());
} }
public static int getY() { public static int getY() {
return (int)(PlatformInput.mouseGetY() * RenderResolution.renderScale); return (int)(PlatformInput.mouseGetY());
} }
public static boolean getEventButtonState() { public static boolean getEventButtonState() {
@ -49,11 +49,11 @@ public class Mouse {
} }
public static int getEventX() { public static int getEventX() {
return (int)(PlatformInput.mouseGetEventX() * RenderResolution.renderScale); return (int)(PlatformInput.mouseGetEventX());
} }
public static int getEventY() { public static int getEventY() {
return (int)(PlatformInput.mouseGetEventY() * RenderResolution.renderScale); return (int)(PlatformInput.mouseGetEventY());
} }
public static int getEventButton() { public static int getEventButton() {

View File

@ -912,7 +912,7 @@ public class FixedFunctionPipeline {
float x = GlStateManager.stateNormalX; float x = GlStateManager.stateNormalX;
float y = GlStateManager.stateNormalY; float y = GlStateManager.stateNormalY;
float z = GlStateManager.stateNormalZ; float z = GlStateManager.stateNormalZ;
float c = 1.0f / MathHelper.sqrt_float(x * x + y * y + z * z); float c = MathHelper.Q_rsqrt(x * x + y * y + z * z);
x *= c; y *= c; z *= c; x *= c; y *= c; z *= c;
if(stateNormalX != x || stateNormalY != y || stateNormalZ != z) { if(stateNormalX != x || stateNormalY != y || stateNormalZ != z) {
stateNormalX = x; stateNormalX = x;

View File

@ -1,5 +1,6 @@
package net.minecraft.client.audio; package net.minecraft.client.audio;
import net.hoosiertransfer.Config;
import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -39,6 +40,10 @@ public class MovingSoundMinecart extends MovingSound {
* Like the old updateEntity(), except more generic. * Like the old updateEntity(), except more generic.
*/ */
public void update() { public void update() {
if (Config.audioEnabled() == false) {
this.donePlaying = true;
return;
}
if (this.minecart.isDead) { if (this.minecart.isDead) {
this.donePlaying = true; this.donePlaying = true;
} else { } else {

View File

@ -1,5 +1,6 @@
package net.minecraft.client.audio; package net.minecraft.client.audio;
import net.hoosiertransfer.Config;
import net.minecraft.entity.item.EntityMinecart; import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
@ -42,6 +43,10 @@ public class MovingSoundMinecartRiding extends MovingSound {
* Like the old updateEntity(), except more generic. * Like the old updateEntity(), except more generic.
*/ */
public void update() { public void update() {
if (Config.audioEnabled() == false) {
this.donePlaying = true;
return;
}
if (!this.minecart.isDead && this.player.isRiding() && this.player.ridingEntity == this.minecart) { if (!this.minecart.isDead && this.player.isRiding() && this.player.ridingEntity == this.minecart) {
float f = MathHelper.sqrt_double( float f = MathHelper.sqrt_double(
this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ); this.minecart.motionX * this.minecart.motionX + this.minecart.motionZ * this.minecart.motionZ);

View File

@ -1,5 +1,6 @@
package net.minecraft.client.audio; package net.minecraft.client.audio;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
@ -41,6 +42,9 @@ public class MusicTicker implements ITickable {
* Like the old updateEntity(), except more generic. * Like the old updateEntity(), except more generic.
*/ */
public void update() { public void update() {
if (Config.audioEnabled() == false) {
return;
}
MusicTicker.MusicType musicticker$musictype = this.mc.getAmbientMusicType(); MusicTicker.MusicType musicticker$musictype = this.mc.getAmbientMusicType();
if (this.currentMusic != null) { if (this.currentMusic != null) {
if (!musicticker$musictype.getMusicLocation().equals(this.currentMusic.getSoundLocation())) { if (!musicticker$musictype.getMusicLocation().equals(this.currentMusic.getSoundLocation())) {
@ -64,12 +68,18 @@ public class MusicTicker implements ITickable {
} }
public void func_181558_a(MusicTicker.MusicType parMusicType) { public void func_181558_a(MusicTicker.MusicType parMusicType) {
if (Config.audioEnabled() == false) {
return;
}
this.currentMusic = PositionedSoundRecord.create(parMusicType.getMusicLocation()); this.currentMusic = PositionedSoundRecord.create(parMusicType.getMusicLocation());
this.mc.getSoundHandler().playSound(this.currentMusic); this.mc.getSoundHandler().playSound(this.currentMusic);
this.timeUntilNextMusic = Integer.MAX_VALUE; this.timeUntilNextMusic = Integer.MAX_VALUE;
} }
public void func_181557_a() { public void func_181557_a() {
if (Config.audioEnabled() == false) {
return;
}
if (this.currentMusic != null) { if (this.currentMusic != null) {
this.mc.getSoundHandler().stopSound(this.currentMusic); this.mc.getSoundHandler().stopSound(this.currentMusic);
this.currentMusic = null; this.currentMusic = null;

View File

@ -13,6 +13,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformAudio;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager; import net.lax1dude.eaglercraft.v1_8.EaglercraftSoundManager;
import net.lax1dude.eaglercraft.v1_8.IOUtils; import net.lax1dude.eaglercraft.v1_8.IOUtils;
import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom; import net.lax1dude.eaglercraft.v1_8.ThreadLocalRandom;
@ -191,6 +192,9 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
* Play a sound * Play a sound
*/ */
public void playSound(ISound sound) { public void playSound(ISound sound) {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.playSound(sound); this.sndManager.playSound(sound);
} }
@ -198,18 +202,30 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
* Plays the sound in n ticks * Plays the sound in n ticks
*/ */
public void playDelayedSound(ISound sound, int delay) { public void playDelayedSound(ISound sound, int delay) {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.playDelayedSound(sound, delay); this.sndManager.playDelayedSound(sound, delay);
} }
public void setListener(EntityPlayer player, float parFloat1) { public void setListener(EntityPlayer player, float parFloat1) {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.setListener(player, parFloat1); this.sndManager.setListener(player, parFloat1);
} }
public void pauseSounds() { public void pauseSounds() {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.pauseAllSounds(); this.sndManager.pauseAllSounds();
} }
public void stopSounds() { public void stopSounds() {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.stopAllSounds(); this.sndManager.stopAllSounds();
} }
@ -221,14 +237,23 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
* Like the old updateEntity(), except more generic. * Like the old updateEntity(), except more generic.
*/ */
public void update() { public void update() {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.updateAllSounds(); this.sndManager.updateAllSounds();
} }
public void resumeSounds() { public void resumeSounds() {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.resumeAllSounds(); this.sndManager.resumeAllSounds();
} }
public void setSoundLevel(SoundCategory category, float volume) { public void setSoundLevel(SoundCategory category, float volume) {
if (Config.audioEnabled() == false) {
return;
}
if (category == SoundCategory.MASTER && volume <= 0.0F) { if (category == SoundCategory.MASTER && volume <= 0.0F) {
this.stopSounds(); this.stopSounds();
} }
@ -241,6 +266,9 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
} }
public void stopSound(ISound parISound) { public void stopSound(ISound parISound) {
if (Config.audioEnabled() == false) {
return;
}
this.sndManager.stopSound(parISound); this.sndManager.stopSound(parISound);
} }

View File

@ -26,6 +26,17 @@ public class GuiClientSettings extends GuiScreen {
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20, this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.HIDE_PASSWORD))); this.options.getKeyBinding(GameSettings.Options.HIDE_PASSWORD)));
++i; ++i;
this.buttonList.add(new GuiButton(GameSettings.Options.ENABLE_SOUND.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.ENABLE_SOUND)));
++i;
this.buttonList.add(new GuiButton(GameSettings.Options.SKIP_SOME_RENDERING.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.SKIP_SOME_RENDERING)));
++i;
this.buttonList.add(new GuiButton(GameSettings.Options.DISABLE_ALPHA.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1), 150, 20,
this.options.getKeyBinding(GameSettings.Options.DISABLE_ALPHA)));
++i; ++i;
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1), this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1),
I18n.format("gui.done", new Object[0]))); I18n.format("gui.done", new Object[0])));
@ -41,6 +52,21 @@ public class GuiClientSettings extends GuiScreen {
this.options.setOptionValue(GameSettings.Options.HIDE_PASSWORD, 1); this.options.setOptionValue(GameSettings.Options.HIDE_PASSWORD, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.HIDE_PASSWORD); parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.HIDE_PASSWORD);
} }
if (parGuiButton.id == GameSettings.Options.ENABLE_SOUND.returnEnumOrdinal()) {
this.options.setOptionValue(GameSettings.Options.ENABLE_SOUND, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.ENABLE_SOUND);
}
if (parGuiButton.id == GameSettings.Options.SKIP_SOME_RENDERING.returnEnumOrdinal()) {
this.options.setOptionValue(GameSettings.Options.SKIP_SOME_RENDERING, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.SKIP_SOME_RENDERING);
}
if (parGuiButton.id == GameSettings.Options.DISABLE_ALPHA.returnEnumOrdinal()) {
this.options.setOptionValue(GameSettings.Options.DISABLE_ALPHA, 1);
parGuiButton.displayString = this.options.getKeyBinding(GameSettings.Options.DISABLE_ALPHA);
}
} }
} }

View File

@ -80,9 +80,9 @@ public class GuiOptions extends GuiScreen implements GuiYesNoCallback {
++i; ++i;
} }
this.buttonList.add(new GuiOptionSlider(GameSettings.Options.RENDER_SCALE.returnEnumOrdinal(), // this.buttonList.add(new GuiOptionSlider(GameSettings.Options.RENDER_SCALE.returnEnumOrdinal(),
this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), // this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1),
GameSettings.Options.RENDER_SCALE)); // GameSettings.Options.RENDER_SCALE));
i++; i++;
this.buttonList.add(new GuiButton(420, this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), 150, 20, this.buttonList.add(new GuiButton(420, this.width / 2 - 155 + i % 2 * 160, this.height / 6 - 12 + 24 * (i >> 1), 150, 20,

View File

@ -136,12 +136,6 @@ public class ModelPlayer extends ModelBiped {
copyModelAngles(this.bipedLeftArm, this.bipedLeftArmwear); copyModelAngles(this.bipedLeftArm, this.bipedLeftArmwear);
copyModelAngles(this.bipedRightArm, this.bipedRightArmwear); copyModelAngles(this.bipedRightArm, this.bipedRightArmwear);
copyModelAngles(this.bipedBody, this.bipedBodyWear); copyModelAngles(this.bipedBody, this.bipedBodyWear);
if (entity != null && entity.isSneaking()) {
this.bipedCape.rotationPointY = 2.0F;
} else {
this.bipedCape.rotationPointY = 0.0F;
}
} }
public void renderRightArm() { public void renderRightArm() {

View File

@ -13,6 +13,7 @@ import java.util.concurrent.Callable;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.base.Predicates; import com.google.common.base.Predicates;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.Display; import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.Mouse; import net.lax1dude.eaglercraft.v1_8.Mouse;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
@ -259,28 +260,30 @@ public class EntityRenderer implements IResourceManagerReloadListener {
if (this.mc.getRenderViewEntity() == null) { if (this.mc.getRenderViewEntity() == null) {
this.mc.setRenderViewEntity(this.mc.thePlayer); this.mc.setRenderViewEntity(this.mc.thePlayer);
} }
if (!Config.skipRenderUpdate()) {
float f3 = this.mc.theWorld.getLightBrightness( float f3 = this.mc.theWorld.getLightBrightness(
DeferredStateManager.isDeferredRenderer() ? new BlockPos(this.mc.getRenderViewEntity()).up() DeferredStateManager.isDeferredRenderer() ? new BlockPos(this.mc.getRenderViewEntity()).up()
: new BlockPos(this.mc.getRenderViewEntity())); : new BlockPos(this.mc.getRenderViewEntity()));
float f4 = (float) this.mc.gameSettings.renderDistanceChunks / 32.0F; float f4 = (float) this.mc.gameSettings.renderDistanceChunks / 32.0F;
float f2 = f3 * (1.0F - f4) + f4; float f2 = f3 * (1.0F - f4) + f4;
this.fogColor1 += (f2 - this.fogColor1) * 0.1F; this.fogColor1 += (f2 - this.fogColor1) * 0.1F;
++this.rendererUpdateCount;
this.itemRenderer.updateEquippedItem();
this.addRainParticles();
this.bossColorModifierPrev = this.bossColorModifier;
if (BossStatus.hasColorModifier) {
this.bossColorModifier += 0.05F;
if (this.bossColorModifier > 1.0F) {
this.bossColorModifier = 1.0F;
}
BossStatus.hasColorModifier = false;
} else if (this.bossColorModifier > 0.0F) {
this.bossColorModifier -= 0.0125F;
} }
++this.rendererUpdateCount;
this.addRainParticles();
if (!Config.skipRenderUpdate()) {
this.itemRenderer.updateEquippedItem();
this.bossColorModifierPrev = this.bossColorModifier;
if (BossStatus.hasColorModifier) {
this.bossColorModifier += 0.05F;
if (this.bossColorModifier > 1.0F) {
this.bossColorModifier = 1.0F;
}
BossStatus.hasColorModifier = false;
} else if (this.bossColorModifier > 0.0F) {
this.bossColorModifier -= 0.0125F;
}
}
} }
public void updateShaderGroupSize(int width, int height) { public void updateShaderGroupSize(int width, int height) {
@ -1073,6 +1076,7 @@ public class EntityRenderer implements IResourceManagerReloadListener {
} }
public void renderWorld(float partialTicks, long finishTimeNano) { public void renderWorld(float partialTicks, long finishTimeNano) {
this.updateLightmap(partialTicks); this.updateLightmap(partialTicks);
if (this.mc.getRenderViewEntity() == null) { if (this.mc.getRenderViewEntity() == null) {
this.mc.setRenderViewEntity(this.mc.thePlayer); this.mc.setRenderViewEntity(this.mc.thePlayer);
@ -1086,10 +1090,14 @@ public class EntityRenderer implements IResourceManagerReloadListener {
if (fxaa) { if (fxaa) {
EffectPipelineFXAA.begin(this.mc.displayWidth, this.mc.displayHeight); EffectPipelineFXAA.begin(this.mc.displayWidth, this.mc.displayHeight);
} }
if (Config.disableAlpha()) {
GlStateManager.enableDepth(); GlStateManager.disableAlpha();
GlStateManager.enableAlpha(); GlStateManager.disableBlend();
GlStateManager.alphaFunc(GL_GREATER, 0.5F); } else {
GlStateManager.enableDepth();
GlStateManager.enableAlpha();
GlStateManager.alphaFunc(GL_GREATER, 0.5F);
}
this.mc.mcProfiler.startSection("center"); this.mc.mcProfiler.startSection("center");
if (this.mc.gameSettings.anaglyph && !this.mc.gameSettings.shaders) { if (this.mc.gameSettings.anaglyph && !this.mc.gameSettings.shaders) {
anaglyphField = 0; anaglyphField = 0;

View File

@ -2,6 +2,7 @@ package net.minecraft.client.renderer.entity;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer; import net.lax1dude.eaglercraft.v1_8.internal.buffer.FloatBuffer;
import java.util.List; import java.util.List;
@ -37,6 +38,7 @@ import net.minecraft.scoreboard.Team;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
/**+ /**+
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code. * This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -116,23 +118,22 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
* public void func_76986_a(T entity, double d, double d1, * public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doe * double d2, float f, float f1). But JAD is pre 1.5 so doe
*/ */
public void doRender(T entitylivingbase, double d0, double d1, double d2, float f, float f1) { public void doRender(T entitylivingbase, double d0, double d1, double d2, float f, float partialTicks) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableCull(); GlStateManager.disableCull();
this.mainModel.swingProgress = this.getSwingProgress(entitylivingbase, f1); this.mainModel.swingProgress = this.getSwingProgress(entitylivingbase, partialTicks);
this.mainModel.isRiding = entitylivingbase.isRiding(); this.mainModel.isRiding = entitylivingbase.isRiding();
this.mainModel.isChild = entitylivingbase.isChild(); this.mainModel.isChild = entitylivingbase.isChild();
try { try {
float f2 = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset, float f2 = this.interpolateRotation(entitylivingbase.prevRenderYawOffset, entitylivingbase.renderYawOffset,
f1); partialTicks);
float f3 = this.interpolateRotation(entitylivingbase.prevRotationYawHead, entitylivingbase.rotationYawHead, float f3 = this.interpolateRotation(entitylivingbase.prevRotationYawHead, entitylivingbase.rotationYawHead,
f1); partialTicks);
float f4 = f3 - f2; float f4 = f3 - f2;
if (entitylivingbase.isRiding() && entitylivingbase.ridingEntity instanceof EntityLivingBase) { if (entitylivingbase.isRiding() && entitylivingbase.ridingEntity instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase1 = (EntityLivingBase) entitylivingbase.ridingEntity; EntityLivingBase entitylivingbase1 = (EntityLivingBase) entitylivingbase.ridingEntity;
f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset, f2 = this.interpolateRotation(entitylivingbase1.prevRenderYawOffset, entitylivingbase1.renderYawOffset,
f1); partialTicks);
f4 = f3 - f2; f4 = f3 - f2;
float f5 = MathHelper.wrapAngleTo180_float(f4); float f5 = MathHelper.wrapAngleTo180_float(f4);
if (f5 < -85.0F) { if (f5 < -85.0F) {
@ -150,18 +151,18 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
} }
float f9 = entitylivingbase.prevRotationPitch float f9 = entitylivingbase.prevRotationPitch
+ (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * f1; + (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * partialTicks;
this.renderLivingAt(entitylivingbase, d0, d1, d2); this.renderLivingAt(entitylivingbase, d0, d1, d2);
float f10 = this.handleRotationFloat(entitylivingbase, f1); float f10 = this.handleRotationFloat(entitylivingbase, partialTicks);
this.rotateCorpse(entitylivingbase, f10, f2, f1); this.rotateCorpse(entitylivingbase, f10, f2, partialTicks);
GlStateManager.enableRescaleNormal(); GlStateManager.enableRescaleNormal();
GlStateManager.scale(-1.0F, -1.0F, 1.0F); GlStateManager.scale(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(entitylivingbase, f1); this.preRenderCallback(entitylivingbase, partialTicks);
float f6 = 0.0625F; float f6 = 0.0625F;
GlStateManager.translate(0.0F, -1.5078125F, 0.0F); GlStateManager.translate(0.0F, -1.5078125F, 0.0F);
float f7 = entitylivingbase.prevLimbSwingAmount float f7 = entitylivingbase.prevLimbSwingAmount
+ (entitylivingbase.limbSwingAmount - entitylivingbase.prevLimbSwingAmount) * f1; + (entitylivingbase.limbSwingAmount - entitylivingbase.prevLimbSwingAmount) * partialTicks;
float f8 = entitylivingbase.limbSwing - entitylivingbase.limbSwingAmount * (1.0F - f1); float f8 = entitylivingbase.limbSwing - entitylivingbase.limbSwingAmount * (1.0F - partialTicks);
if (entitylivingbase.isChild()) { if (entitylivingbase.isChild()) {
f8 *= 3.0F; f8 *= 3.0F;
} }
@ -171,7 +172,7 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
} }
GlStateManager.enableAlpha(); GlStateManager.enableAlpha();
this.mainModel.setLivingAnimations(entitylivingbase, f8, f7, f1); this.mainModel.setLivingAnimations(entitylivingbase, f8, f7, partialTicks);
this.mainModel.setRotationAngles(f8, f7, f10, f4, f9, 0.0625F, entitylivingbase); this.mainModel.setRotationAngles(f8, f7, f10, f4, f9, 0.0625F, entitylivingbase);
if (this.renderOutlines) { if (this.renderOutlines) {
boolean flag1 = this.setScoreTeamColor(entitylivingbase); boolean flag1 = this.setScoreTeamColor(entitylivingbase);
@ -180,7 +181,7 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
this.unsetScoreTeamColor(); this.unsetScoreTeamColor();
} }
} else { } else {
boolean flag = this.setDoRenderBrightness(entitylivingbase, f1); boolean flag = this.setDoRenderBrightness(entitylivingbase, partialTicks);
this.renderModel(entitylivingbase, f8, f7, f10, f4, f9, 0.0625F); this.renderModel(entitylivingbase, f8, f7, f10, f4, f9, 0.0625F);
if (flag) { if (flag) {
this.unsetBrightness(); this.unsetBrightness();
@ -188,7 +189,7 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
GlStateManager.depthMask(true); GlStateManager.depthMask(true);
if (!(entitylivingbase instanceof EntityPlayer) || !((EntityPlayer) entitylivingbase).isSpectator()) { if (!(entitylivingbase instanceof EntityPlayer) || !((EntityPlayer) entitylivingbase).isSpectator()) {
this.renderLayers(entitylivingbase, f8, f7, f1, f10, f4, f9, 0.0625F); this.renderLayers(entitylivingbase, f8, f7, partialTicks, f10, f4, f9, 0.0625F);
} }
} }
@ -203,7 +204,7 @@ public abstract class RendererLivingEntity<T extends EntityLivingBase> extends R
GlStateManager.enableCull(); GlStateManager.enableCull();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
if (!this.renderOutlines) { if (!this.renderOutlines) {
super.doRender(entitylivingbase, d0, d1, d2, f, f1); super.doRender(entitylivingbase, d0, d1, d2, f, partialTicks);
} }
} }

View File

@ -205,6 +205,12 @@ public class GameSettings {
private boolean shouldReloadPage = false; private boolean shouldReloadPage = false;
public boolean enableSound = true;
public boolean disableAlpha = true;
public boolean skipHandRender = 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,
this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump, this.keyBindForward, this.keyBindLeft, this.keyBindBack, this.keyBindRight, this.keyBindJump,
@ -335,6 +341,18 @@ public class GameSettings {
* through the list i.e. render distances. * through the list i.e. render distances.
*/ */
public void setOptionValue(GameSettings.Options parOptions, int parInt1) { public void setOptionValue(GameSettings.Options parOptions, int parInt1) {
if (parOptions == GameSettings.Options.SKIP_SOME_RENDERING) {
this.skipHandRender = !this.skipHandRender;
}
if (parOptions == GameSettings.Options.DISABLE_ALPHA) {
this.disableAlpha = !this.disableAlpha;
}
if (parOptions == GameSettings.Options.ENABLE_SOUND) {
this.enableSound = !this.enableSound;
}
if (parOptions == GameSettings.Options.HIDE_PASSWORD) { if (parOptions == GameSettings.Options.HIDE_PASSWORD) {
this.hidePassword = !this.hidePassword; this.hidePassword = !this.hidePassword;
} }
@ -493,6 +511,12 @@ public class GameSettings {
public boolean getOptionOrdinalValue(GameSettings.Options parOptions) { public boolean getOptionOrdinalValue(GameSettings.Options parOptions) {
switch (parOptions) { switch (parOptions) {
case SKIP_SOME_RENDERING:
return this.skipHandRender;
case DISABLE_ALPHA:
return this.disableAlpha;
case ENABLE_SOUND:
return this.enableSound;
case HIDE_PASSWORD: case HIDE_PASSWORD:
return this.hidePassword; return this.hidePassword;
case INVERT_MOUSE: case INVERT_MOUSE:
@ -626,9 +650,18 @@ public class GameSettings {
: "yee")))))))))))); : "yee"))))))))))));
} else if (parOptions.getEnumBoolean()) { } else if (parOptions.getEnumBoolean()) {
boolean flag = this.getOptionOrdinalValue(parOptions); boolean flag = this.getOptionOrdinalValue(parOptions);
if (parOptions == GameSettings.Options.ENABLE_SOUND) {
return flag ? "Sound: " + I18n.format("options.on", new Object[0]) : "Sound: " + I18n.format("options.off", new Object[0]);
}
if (parOptions == GameSettings.Options.HIDE_PASSWORD) { if (parOptions == GameSettings.Options.HIDE_PASSWORD) {
return flag ? "Hide Password: " + I18n.format("options.on", new Object[0]) : "Hide Password: " + I18n.format("options.off", new Object[0]); return flag ? "Hide Password: " + I18n.format("options.on", new Object[0]) : "Hide Password: " + I18n.format("options.off", new Object[0]);
} }
if (parOptions == GameSettings.Options.SKIP_SOME_RENDERING) {
return flag ? "Skip Some Rendering: " + I18n.format("options.on", new Object[0]) : "Skip Some Rendering: " + I18n.format("options.off", new Object[0]);
}
if (parOptions == GameSettings.Options.DISABLE_ALPHA) {
return !flag ? "Render Alpha: " + I18n.format("options.on", new Object[0]) : "Render Alpha: " + I18n.format("options.off", new Object[0]);
}
return flag ? s + I18n.format("options.on", new Object[0]) : s + I18n.format("options.off", new Object[0]); return flag ? s + I18n.format("options.on", new Object[0]) : s + I18n.format("options.off", new Object[0]);
} else if (parOptions == GameSettings.Options.GUI_SCALE) { } else if (parOptions == GameSettings.Options.GUI_SCALE) {
return s + getTranslation(GUISCALES, this.guiScale); return s + getTranslation(GUISCALES, this.guiScale);
@ -690,6 +723,18 @@ public class GameSettings {
this.mouseSensitivity = this.parseFloat(astring[1]); this.mouseSensitivity = this.parseFloat(astring[1]);
} }
if (astring[0].equals("skipHandRender")) {
this.skipHandRender = astring[1].equals("true");
}
if (astring[0].equals("disableAlpha")) {
this.disableAlpha = astring[1].equals("true");
}
if (astring[0].equals("enableSound")) {
this.enableSound = astring[1].equals("true");
}
if (astring[0].equals("hidePassword")) { if (astring[0].equals("hidePassword")) {
this.hidePassword = astring[1].equals("true"); this.hidePassword = astring[1].equals("true");
} }
@ -1046,6 +1091,9 @@ public class GameSettings {
printwriter.println("renderClouds:true"); printwriter.println("renderClouds:true");
} }
printwriter.println("hidePassword:" + this.hidePassword); printwriter.println("hidePassword:" + this.hidePassword);
printwriter.println("enableSound:" + this.getOptionOrdinalValue(GameSettings.Options.ENABLE_SOUND));
printwriter.println("skipHandRender:" + this.skipHandRender);
printwriter.println("disableAlpha:" + this.disableAlpha);
printwriter.println("resourcePacks:" + toJSONArray(this.resourcePacks)); printwriter.println("resourcePacks:" + toJSONArray(this.resourcePacks));
printwriter.println("incompatibleResourcePacks:" + toJSONArray(this.field_183018_l)); printwriter.println("incompatibleResourcePacks:" + toJSONArray(this.field_183018_l));
@ -1189,11 +1237,13 @@ public class GameSettings {
} }
public static enum Options { public static enum Options {
DISABLE_ALPHA("options.alpha", false, true), SKIP_SOME_RENDERING("options.skipHandRender", false, true),
INVERT_MOUSE("options.invertMouse", false, true), SENSITIVITY("options.sensitivity", true, false), INVERT_MOUSE("options.invertMouse", false, true), SENSITIVITY("options.sensitivity", true, false),
FOV("options.fov", true, false, 30.0F, 110.0F, 1.0F), GAMMA("options.gamma", true, false), FOV("options.fov", true, false, 30.0F, 110.0F, 1.0F), GAMMA("options.gamma", true, false),
SATURATION("options.saturation", true, false), SATURATION("options.saturation", true, false),
RENDER_SCALE("options.renderScale", true, false, 40.0F, 100.0F, 1.0F), RENDER_SCALE("options.renderScale", true, false, 40.0F, 100.0F, 1.0F),
HIDE_PASSWORD("options.hidePassword", false, true), HIDE_PASSWORD("options.hidePassword", false, true),
ENABLE_SOUND("options.sound", false, true),
RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F), RENDER_DISTANCE("options.renderDistance", true, false, 1.0F, 16.0F, 1.0F),
VIEW_BOBBING("options.viewBobbing", false, true), ANAGLYPH("options.anaglyph", false, true), VIEW_BOBBING("options.viewBobbing", false, true), ANAGLYPH("options.anaglyph", false, true),
FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F), FRAMERATE_LIMIT("options.framerateLimit", true, false, 10.0F, 260.0F, 10.0F),

View File

@ -60,6 +60,17 @@ public class MathHelper {
return (float) Math.sqrt(value); return (float) Math.sqrt(value);
} }
// silly thing from quake3
public static float Q_rsqrt(float value) {
int i = Float.floatToRawIntBits(value);
float x2 = value * 0.5F;
i = 0x5f3759df - (i >> 1); // what the fuck?
float y = Float.intBitsToFloat(i);
y = y * (1.5F - (x2 * y * y));
// y = y * (1.5F - (x2 * y * y)); // 2nd iteration
return y;
}
/**+ /**+
* Returns the greatest integer less than or equal to the float * Returns the greatest integer less than or equal to the float
* argument * argument

View File

@ -21,6 +21,7 @@ import org.teavm.jso.webgl.WebGLRenderbuffer;
import net.lax1dude.eaglercraft.v1_8.EagUtils; import net.lax1dude.eaglercraft.v1_8.EagUtils;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen; import net.lax1dude.eaglercraft.v1_8.internal.teavm.EarlyLoadScreen;
import net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext; import net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext;
import net.minecraft.client.Minecraft;
import static net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext.*; import static net.lax1dude.eaglercraft.v1_8.internal.teavm.WebGL2RenderingContext.*;
import static org.teavm.jso.webgl.WebGLRenderingContext.COLOR_ATTACHMENT0; import static org.teavm.jso.webgl.WebGLRenderingContext.COLOR_ATTACHMENT0;
@ -304,8 +305,8 @@ public class PlatformInput {
public static void update() { public static void update() {
double r = win.getDevicePixelRatio(); double r = win.getDevicePixelRatio();
int w = (int)(PlatformRuntime.parent.getClientWidth() * RenderResolution.renderScale); int w = (int)(PlatformRuntime.parent.getClientWidth());
int h = (int)(PlatformRuntime.parent.getClientHeight() * RenderResolution.renderScale); int h = (int)(PlatformRuntime.parent.getClientHeight());
int w2 = windowWidth = (int)(w * r); int w2 = windowWidth = (int)(w * r);
int h2 = windowHeight = (int)(h * r); int h2 = windowHeight = (int)(h * r);
if(canvas.getWidth() != w2) { if(canvas.getWidth() != w2) {
@ -315,7 +316,7 @@ public class PlatformInput {
canvas.setHeight(h2); canvas.setHeight(h2);
} }
flipBuffer(); flipBuffer();
// why was this here // why is this here
EagUtils.sleep(1l); EagUtils.sleep(1l);
} }
@ -323,8 +324,8 @@ public class PlatformInput {
context = ctx; context = ctx;
mainFramebuffer = fbo; mainFramebuffer = fbo;
framebufferWidth = windowWidth = (int)(sw * RenderResolution.renderScale); framebufferWidth = windowWidth = (int)(sw);
framebufferHeight = windowHeight = (int)(sh / 2 * RenderResolution.renderScale); framebufferHeight = windowHeight = (int)(sh / 2);
ctx.bindFramebuffer(FRAMEBUFFER, fbo); ctx.bindFramebuffer(FRAMEBUFFER, fbo);

View File

@ -109,10 +109,9 @@ public class PlatformRuntime {
style.setProperty("height", "100%"); style.setProperty("height", "100%");
style.setProperty("image-rendering", "pixelated"); style.setProperty("image-rendering", "pixelated");
RenderResolution.loadRenderScale();
double r = win.getDevicePixelRatio(); double r = win.getDevicePixelRatio();
int iw = (int)(parent.getClientWidth() * RenderResolution.renderScale); int iw = (int)(parent.getClientWidth());
int ih = (int)(parent.getClientHeight() * RenderResolution.renderScale); int ih = (int)(parent.getClientHeight());
int sw = (int)(r * iw); int sw = (int)(r * iw);
int sh = (int)(r * ih); int sh = (int)(r * ih);
@ -208,7 +207,7 @@ public class PlatformRuntime {
FixWebMDurationJS.checkOldScriptStillLoaded(); FixWebMDurationJS.checkOldScriptStillLoaded();
} }
@JSBody(params = { }, script = "return {antialias: false, depth: false, powerPreference: \"high-performance\", desynchronized: true, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false};") @JSBody(params = { }, script = "return {antialias: false, depth: false, powerPreference: \"high-performance\", desynchronized: true, preserveDrawingBuffer: false, premultipliedAlpha: false, alpha: false, stencil: false, failIfMajorPerformanceCaveat: false, xrCompatible: false, xrWebGLLayer: false};")
public static native JSObject youEagler(); public static native JSObject youEagler();
public static class RuntimeInitializationFailureException extends IllegalStateException { public static class RuntimeInitializationFailureException extends IllegalStateException {