Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce memory allocations #24

Merged
merged 6 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
dependencies {
api('com.github.GTNewHorizons:LunatriusCore:1.2.0-GTNH:dev')

compileOnly('com.github.GTNewHorizons:BloodMagic:1.6.2:dev')
compileOnly('com.github.GTNewHorizons:BloodMagic:1.6.6:dev')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:simply-jetpacks-79325:2267185')
compileOnly('curse.maven:tfcraft-302973:2627990')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.49.56:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.42:dev')
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ developmentEnvironmentUserName = Developer

# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = false
enableModernJavaSyntax = true

# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
enableGenericInjection = true

# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pluginManagement {
}

plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}


34 changes: 12 additions & 22 deletions src/main/java/com/github/lunatrius/ingameinfo/Alignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,33 +66,23 @@ public static Alignment parse(String str) {
}

public int getX(int screenwidth, int textwidth) {
switch (this.alignment & MASK_X) {
case LEFT:
return this.x;
return switch (this.alignment & MASK_X) {
case LEFT -> this.x;
case CENTER -> this.x + (screenwidth - textwidth) / 2;
case RIGHT -> this.x + screenwidth - textwidth;
default -> 0;
};

case CENTER:
return this.x + (screenwidth - textwidth) / 2;

case RIGHT:
return this.x + screenwidth - textwidth;
}

return 0;
}

public int getY(int screenheight, int textheight) {
switch (this.alignment & MASK_Y) {
case TOP:
return this.y;

case MIDDLE:
return this.y + (screenheight - textheight) / 2;

case BOTTOM:
return this.y + screenheight - textheight;
}
return switch (this.alignment & MASK_Y) {
case TOP -> this.y;
case MIDDLE -> this.y + (screenheight - textheight) / 2;
case BOTTOM -> this.y + screenheight - textheight;
default -> 0;
};

return 0;
}

public String getDefaultXY() {
Expand Down
Loading