Some code styling

This commit is contained in:
FlorianMichael 2023-12-27 23:31:46 +01:00
parent c3dd66652d
commit 5c07c00b3b
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
5 changed files with 19 additions and 11 deletions

View File

@ -65,7 +65,7 @@ if (ItemRegistryDiff.contains(Items.STONE, VersionRange.andOlder(VersionEnum.r1_
```java
public class ExampleSettingGroup extends SettingGroup {
private static final ExampleSettingGroup instance = new ExampleSettingGroup();
private static final ExampleSettingGroup INSTANCE = new ExampleSettingGroup();
public final BooleanSetting test = new BooleanSetting(this, Text.of("Test"), false);
@ -74,7 +74,7 @@ public class ExampleSettingGroup extends SettingGroup {
}
public static ExampleSettingGroup global() {
return instance;
return INSTANCE;
}
}

View File

@ -51,7 +51,7 @@ import java.util.concurrent.CompletableFuture;
*/
public class ViaFabricPlus {
private static final ViaFabricPlus instance = new ViaFabricPlus();
private static final ViaFabricPlus INSTANCE = new ViaFabricPlus();
private final Logger logger = LogManager.getLogger("ViaFabricPlus");
private final File directory = FabricLoader.getInstance().getConfigDir().resolve("viafabricplus").toFile();
@ -77,7 +77,7 @@ public class ViaFabricPlus {
}
public static ViaFabricPlus global() {
return instance;
return INSTANCE;
}
public Logger getLogger() {

View File

@ -189,8 +189,8 @@ public class EntityDimensionReplacements {
VersionEnum closestVersion = null;
for (Map.Entry<VersionEnum, EntityDimensions> entry : dimensionMap.entrySet()) {
VersionEnum currentVersion = entry.getKey();
EntityDimensions currentDimensions = entry.getValue();
final var currentVersion = entry.getKey();
final var currentDimensions = entry.getValue();
if (currentVersion == version) { // If the version is exactly the same, return the dimensions
return currentDimensions;

View File

@ -59,14 +59,18 @@ public abstract class MixinChatInputSuggestor {
@Inject(method = "provideRenderText", at = @At(value = "HEAD"), cancellable = true)
private void disableTextFieldColors(String original, int firstCharacterIndex, CallbackInfoReturnable<OrderedText> cir) {
if (!this.viaFabricPlus$cancelTabComplete()) return;
if (!this.viaFabricPlus$cancelTabComplete()) {
return;
}
cir.setReturnValue(OrderedText.styledForwardsVisitedString(original, Style.EMPTY));
}
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
private void handle1_12_2KeyPressed(int keyCode, int scanCode, int modifiers, CallbackInfoReturnable<Boolean> cir) {
if (!this.viaFabricPlus$cancelTabComplete()) return;
if (!this.viaFabricPlus$cancelTabComplete()) {
return;
}
if (keyCode == GLFW.GLFW_KEY_TAB && this.window == null) {
this.refresh();
@ -82,7 +86,9 @@ public abstract class MixinChatInputSuggestor {
@Inject(method = "render", at = @At("HEAD"))
private void clearMessages(DrawContext drawContext, int mouseX, int mouseY, CallbackInfo ci) {
if (!this.viaFabricPlus$cancelTabComplete()) return;
if (!this.viaFabricPlus$cancelTabComplete()) {
return;
}
this.messages.clear();
}

View File

@ -97,16 +97,18 @@ public abstract class MixinFontStorage {
private FontStorage.GlyphPair viaFabricPlus$getBlankGlyphPair() {
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) {
return new FontStorage.GlyphPair(BuiltinEmptyGlyph1_12_2.INSTANCE, BuiltinEmptyGlyph1_12_2.INSTANCE);
} else {
return FontStorage.GlyphPair.MISSING;
}
return FontStorage.GlyphPair.MISSING;
}
@Unique
private GlyphRenderer viaFabricPlus$getBlankGlyphRenderer() {
if (VisualSettings.global().changeFontRendererBehaviour.isEnabled()) {
return this.viaFabricPlus$blankGlyphRenderer1_12_2;
} else {
return this.blankGlyphRenderer;
}
return this.blankGlyphRenderer;
}
}