Left hand

This commit is contained in:
PeytonPlayz595 2024-05-31 19:06:00 -04:00
parent 35ae850a9e
commit 1824fdd15b
4 changed files with 53 additions and 6 deletions

View File

@ -268,6 +268,7 @@ public class GameSettings {
public boolean ofCustomColors = true;
public boolean hidePassword = true;
public boolean fullBright = false;
public boolean leftHand = false;
public boolean enableFNAWSkins = true;
public int voiceListenRadius = 16;
@ -918,7 +919,11 @@ public class GameSettings {
if(parOptions == GameSettings.Options.FULLBRIGHT) {
this.fullBright = !this.fullBright;
}
if(parOptions == GameSettings.Options.LEFT_HAND) {
this.leftHand = !this.leftHand;
}
this.saveOptions();
}
@ -1047,6 +1052,8 @@ public class GameSettings {
return this.enableVsync;
case FULLBRIGHT:
return this.fullBright;
case LEFT_HAND:
return this.leftHand;
default:
return false;
}
@ -1103,6 +1110,8 @@ public class GameSettings {
: (parOptions == GameSettings.Options.AF_LEVEL ? (this.ofAfLevel == 1 ? s + Lang.getOff() : s + this.ofAfLevel)
: (parOptions == GameSettings.Options.AA_LEVEL ? s + this.getAntialiasingString()
: "yee")))))))))))))))));
} else if (parOptions == GameSettings.Options.LEFT_HAND) {
return this.leftHand ? s + "Left" : s + "Right";
} else if (parOptions.getEnumBoolean()) {
boolean flag = this.getOptionOrdinalValue(parOptions);
return flag ? s + I18n.format("options.on", new Object[0]) : s + I18n.format("options.off", new Object[0]);
@ -1918,6 +1927,10 @@ public class GameSettings {
if (astring[0].equals("fullbright") && astring.length >= 2) {
fullBright = Boolean.valueOf(astring[1]).booleanValue();
}
if (astring[0].equals("leftHand") && astring.length >= 2) {
leftHand = Boolean.valueOf(astring[1]).booleanValue();
}
for (SoundCategory soundcategory : SoundCategory._VALUES) {
if (astring[0].equals("soundCategory_" + soundcategory.getCategoryName())) {
@ -2113,6 +2126,7 @@ public class GameSettings {
printwriter.println("voicePTTKey:" + this.voicePTTKey);
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
printwriter.println("fullbright:" + this.fullBright);
printwriter.println("leftHand:" + this.leftHand);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -2325,7 +2339,8 @@ public class GameSettings {
HIDE_PASSWORD("Hide Password", false, false),
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true);
FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true);
private final boolean enumFloat;
private final boolean enumBoolean;

View File

@ -9,7 +9,7 @@ import net.minecraft.client.settings.GameSettings;
public class GuiShadow extends GuiScreen {
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.TOGGLE_SPRINT, GameSettings.Options.CHUNK_BORDERS, GameSettings.Options.HIDE_PASSWORD, GameSettings.Options.FULLBRIGHT};
private static GameSettings.Options[] enumOptions = new GameSettings.Options[] {GameSettings.Options.TOGGLE_SPRINT, GameSettings.Options.CHUNK_BORDERS, GameSettings.Options.HIDE_PASSWORD, GameSettings.Options.FULLBRIGHT, GameSettings.Options.LEFT_HAND};
private GuiScreen parentScreen;
protected String title;

View File

@ -173,6 +173,10 @@ public class ItemRenderer {
}
private void renderItemMap(AbstractClientPlayer clientPlayer, float parFloat1, float parFloat2, float parFloat3) {
if(this.mc.gameSettings.leftHand) {
GlStateManager.cullFace(GL_BACK);
GlStateManager.scale(-1, 1, 1);
}
float f = -0.4F * MathHelper.sin(MathHelper.sqrt_float(parFloat3) * 3.1415927F);
float f1 = 0.2F * MathHelper.sin(MathHelper.sqrt_float(parFloat3) * 3.1415927F * 2.0F);
float f2 = -0.2F * MathHelper.sin(parFloat3 * 3.1415927F);
@ -267,6 +271,12 @@ public class ItemRenderer {
* item in first person.
*/
private void transformFirstPersonItem(float equipProgress, float swingProgress) {
if(this.mc.gameSettings.leftHand && ((this.itemToRender.getItem() == Items.compass) || (this.itemToRender.getItem() == Items.clock))){
GlStateManager.cullFace(GL_BACK);
GlStateManager.translate(0.05, -0.63, -1.35);
GlStateManager.rotate(-50, 1, 0, 0);
GlStateManager.scale(1, 1, -1);
}
GlStateManager.translate(0.56F, -0.52F, -0.71999997F);
GlStateManager.translate(0.0F, equipProgress * -0.6F, 0.0F);
GlStateManager.rotate(45.0F, 0.0F, 1.0F, 0.0F);
@ -314,8 +324,15 @@ public class ItemRenderer {
* person mode. Args: partialTickTime
*/
public void renderItemInFirstPerson(float partialTicks) {
float f = 1.0F
- (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks);
if(this.mc.gameSettings.leftHand) {
GlStateManager.scale(-1, 1, 1);
if(itemToRender != null) {
GlStateManager.cullFace(GL_FRONT);
} else {
GlStateManager.cullFace(GL_BACK);
}
}
float f = 1.0F - (this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * partialTicks);
EntityPlayerSP entityplayersp = this.mc.thePlayer;
float f1 = entityplayersp.getSwingProgress(partialTicks);
float f2 = entityplayersp.prevRotationPitch

View File

@ -271,6 +271,7 @@ public class GameSettings extends ModData {
public boolean hidePassword = true;
public boolean enableFNAWSkins = true;
public boolean fullBright = false;
public boolean leftHand = false;
public int voiceListenRadius = 16;
public float voiceListenVolume = 0.5f;
@ -1082,6 +1083,10 @@ public class GameSettings extends ModData {
if(parOptions == GameSettings.Options.FULLBRIGHT) {
this.fullBright = !this.fullBright;
}
if(parOptions == GameSettings.Options.LEFT_HAND) {
this.leftHand = !this.leftHand;
}
this.saveOptions();
}
@ -1209,6 +1214,8 @@ public class GameSettings extends ModData {
return this.enableVsync;
case FULLBRIGHT:
return this.fullBright;
case LEFT_HAND:
return this.leftHand;
default:
return false;
}
@ -1265,6 +1272,8 @@ public class GameSettings extends ModData {
: (parOptions == GameSettings.Options.AF_LEVEL ? (this.ofAfLevel == 1 ? s + Lang.getOff() : s + this.ofAfLevel)
: (parOptions == GameSettings.Options.AA_LEVEL ? s + this.getAntialiasingString()
: "yee")))))))))))))))));
} else if (parOptions == GameSettings.Options.LEFT_HAND) {
return this.leftHand ? s + "Left" : s + "Right";
} else if (parOptions.getEnumBoolean()) {
boolean flag = this.getOptionOrdinalValue(parOptions);
return flag ? s + I18n.format("options.on", new Object[0]) : s + I18n.format("options.off", new Object[0]);
@ -2080,6 +2089,10 @@ public class GameSettings extends ModData {
if (astring[0].equals("fullbright") && astring.length >= 2) {
fullBright = Boolean.valueOf(astring[1]).booleanValue();
}
if (astring[0].equals("leftHand") && astring.length >= 2) {
leftHand = Boolean.valueOf(astring[1]).booleanValue();
}
for (SoundCategory soundcategory : SoundCategory._VALUES) {
if (astring[0].equals("soundCategory_" + soundcategory.getCategoryName())) {
@ -2275,6 +2288,7 @@ public class GameSettings extends ModData {
printwriter.println("voicePTTKey:" + this.voicePTTKey);
printwriter.println("enableFNAWSkins:" + this.enableFNAWSkins);
printwriter.println("fullbright:" + this.fullBright);
printwriter.println("leftHand:" + this.leftHand);
for (KeyBinding keybinding : this.keyBindings) {
printwriter.println("key_" + keybinding.getKeyDescription() + ":" + keybinding.getKeyCode());
@ -2487,7 +2501,8 @@ public class GameSettings extends ModData {
HIDE_PASSWORD("Hide Password", false, false),
FNAW_SKINS("options.skinCustomisation.enableFNAWSkins", false, true),
EAGLER_VSYNC("options.vsync", false, true),
FULLBRIGHT("Fullbright", false, true);
FULLBRIGHT("Fullbright", false, true),
LEFT_HAND("Main Hand", false, true);
private final boolean enumFloat;
private final boolean enumBoolean;