Skip to content

Commit

Permalink
1.16.2 port
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 committed Aug 21, 2020
1 parent 03cdb95 commit 8762ce2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 27 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
version += "." + System.getenv('BUILD_NUMBER')
}
group = "com.blamejared.tipthescales"
archivesBaseName = "TipTheScales-1.16.1"
archivesBaseName = "TipTheScales-1.16.2"

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
repositories {
Expand Down Expand Up @@ -102,7 +102,7 @@ task genGitChangelog() {
}

dependencies {
minecraft 'net.minecraftforge:forge:1.16.1-32.0.63'
minecraft 'net.minecraftforge:forge:1.16.2-33.0.7'

}

Expand Down Expand Up @@ -216,7 +216,7 @@ task updateVersionTracker {
def body = [
'author' : "${project.findProperty('versionTrackerAuthor')}",
'projectName' : "TipTheScales",
'gameVersion' : "1.16.1",
'gameVersion' : "1.16.2",
'projectVersion': "${version}",
'homepage' : "${project.findProperty('versionTrackerHomepage')}",
'uid' : "${project.findProperty('versionTrackerKey')}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@
import net.minecraft.client.*;
import net.minecraft.client.gui.IGuiEventListener;
import net.minecraft.client.gui.screen.*;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.*;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.client.settings.SliderPercentageOption;
import net.minecraft.util.text.*;

public class FancyVideoSettingsScreen extends VideoSettingsScreen {
import java.util.ArrayList;

public class FancyVideoSettingsScreen extends VideoSettingsScreen {

public FancyVideoSettingsScreen(Screen p_i1062_1_, GameSettings p_i1062_2_) {
super(p_i1062_1_, p_i1062_2_);
}

public static int guiScale;

@Override
protected void init() {
super.init();
this.optionsRowList.children().clear();
this.optionsRowList.addOption(new FullscreenResolutionOption(this.minecraft.getMainWindow()));
this.optionsRowList.addOption(AbstractOption.BIOME_BLEND_RADIUS);
for (int i = 0; i < OPTIONS.length; i++) {
for(int i = 0; i < OPTIONS.length; i++) {
AbstractOption option = OPTIONS[i];
if (option.func_238238_a_().equals(AbstractOption.GUI_SCALE.func_238238_a_()) && !(option instanceof SliderPercentageOption)) {
if(option.field_243217_ac.getString().equals(AbstractOption.GUI_SCALE.field_243217_ac.getString()) && !(option instanceof SliderPercentageOption)) {
OPTIONS[i] = new SliderPercentageOption("options.guiScale", 0, Minecraft.getInstance().getMainWindow().calcGuiScale(0, Minecraft.getInstance().getForceUnicodeFont()), 1, gameSettings1 -> (double) gameSettings1.guiScale, (gameSettings1, aDouble) -> {
gameSettings1.guiScale = (int) Math.round(aDouble);
}, (gameSettings1, sliderPercentageOption) -> sliderPercentageOption.func_238238_a_().append(gameSettings1.guiScale == 0 ? new TranslationTextComponent("options.guiScale.auto") : new StringTextComponent(gameSettings1.guiScale + "")));
}, (gameSettings1, sliderPercentageOption) -> sliderPercentageOption.func_243222_a(gameSettings1.guiScale == 0 ? new TranslationTextComponent("options.guiScale.auto") : new StringTextComponent(gameSettings1.guiScale + "")));
}
}
this.optionsRowList.addOptions(OPTIONS);
this.children.add(this.optionsRowList);
}

public boolean mouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
guiScale = this.gameSettings.guiScale;
return superMouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_);
}

@Override
public boolean mouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
if (this.gameSettings.guiScale != guiScale) {
if(this.gameSettings.guiScale != guiScale) {
this.minecraft.updateWindowSize();
}
guiScale = this.gameSettings.guiScale;
if (superMouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_)) {
if(superMouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_)) {
return true;
} else {
return this.optionsRowList.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_);
}
}

public boolean superMouseClicked(double p_mouseClicked_1_, double p_mouseClicked_3_, int p_mouseClicked_5_) {
for (IGuiEventListener iguieventlistener : this.children()) {
if (iguieventlistener.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) {
for(IGuiEventListener iguieventlistener : this.children()) {
if(iguieventlistener.mouseClicked(p_mouseClicked_1_, p_mouseClicked_3_, p_mouseClicked_5_)) {
this.setFocused(iguieventlistener);
if (p_mouseClicked_5_ == 0) {
if(p_mouseClicked_5_ == 0) {
this.setDragging(true);
}

return true;
}
}

return false;
}

public boolean superMouseReleased(double p_mouseReleased_1_, double p_mouseReleased_3_, int p_mouseReleased_5_) {
this.setDragging(false);
return this.getEventListenerForPos(p_mouseReleased_1_, p_mouseReleased_3_).filter((p_212931_5_) -> p_212931_5_.mouseReleased(p_mouseReleased_1_, p_mouseReleased_3_, p_mouseReleased_5_)).isPresent();
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ public net.minecraft.client.gui.screen.SettingsScreen field_228182_a_ # parentSc
public net.minecraft.client.gui.screen.SettingsScreen field_228183_b_ # gameSettings
public net.minecraft.client.gui.screen.VideoSettingsScreen field_146501_h # optionsRowList
public net.minecraft.client.GameSettings field_151442_I # mipmapLevels
public net.minecraft.client.gui.screen.VideoSettingsScreen field_213107_d # OPTIONS
public net.minecraft.client.gui.screen.VideoSettingsScreen field_213107_d # OPTIONS

public net.minecraft.client.AbstractOption field_243217_ac #translationKeyIn
public net.minecraft.client.AbstractOption func_243222_a(Lnet/minecraft/util/text/ITextComponent;)Lnet/minecraft/util/text/ITextComponent;

5 changes: 3 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
modLoader="javafml" #mandatory
loaderVersion="[32,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[33,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
license="MIT"
[[mods]] #mandatory
modId="tipthescales" #mandatory
version="${file.jarVersion}" #mandatory
displayName="TipTheScales" #mandatory
authors="Jaredlll08"
updateJSONURL="https://updates.blamejared.com/get?n=TipTheScales&gv=1.16.1"
updateJSONURL="https://updates.blamejared.com/get?n=TipTheScales&gv=1.16.2"
description='''
Allows for more control when adjusting the GUI size.
'''

0 comments on commit 8762ce2

Please sign in to comment.