Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
package simpleclient.feature;

import com.google.gson.JsonObject;
import net.minecraft.network.chat.Component;
import simpleclient.feature.config.EnableConfigEntry;

public class PerformanceBoost extends EnableableFeature {
public static PerformanceBoost INSTANCE = new PerformanceBoost();
public static boolean ENABLED = INSTANCE.isEnabled();
public static boolean ENABLED = false;
public static boolean FASTBOOT = false;
public static boolean DONT_RENDER_CLOUDS = false;
public static boolean DONT_RENDER_SKY_UNDER_WATER = false;
private final EnableConfigEntry fastBoot = new EnableConfigEntry("fastboot", Component.translatable("simpleclient.performance.fastboot"), true);
private final EnableConfigEntry dontRenderCouds = new EnableConfigEntry("dont_render_clouds", Component.translatable("simpleclient.performance.dont_render_clouds"), true);
private final EnableConfigEntry dontRenderSkyUnderWater = new EnableConfigEntry("dont_render_sky_under_water", Component.translatable("simpleclient.performance.dont_render_sky_under_water"), true);

public PerformanceBoost() {
super(FeatureType.PERFORMANCE_BOOST);
addConfigEntry(fastBoot);
addConfigEntry(dontRenderCouds);
addConfigEntry(dontRenderSkyUnderWater);
refresh();
}

public void refresh() {
ENABLED = isEnabled();
JsonObject data = getData();
FASTBOOT = ENABLED && fastBoot.load(data);
DONT_RENDER_CLOUDS = ENABLED && dontRenderCouds.load(data);
DONT_RENDER_SKY_UNDER_WATER = ENABLED && dontRenderSkyUnderWater.load(data);
}

@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
ENABLED = enabled;
public void setData(JsonObject data) {
super.setData(data);
refresh();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package simpleclient.mixin.performance;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.world.level.material.FogType;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import simpleclient.feature.PerformanceBoost;

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {
// +10% FPS under water
@Inject(at = @At("HEAD"), method = "renderSky", cancellable = true)
private void renderSky(PoseStack poseStack, Matrix4f matrix4f, float tickDelta, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) {
if (PerformanceBoost.DONT_RENDER_SKY_UNDER_WATER && camera.getFluidInCamera() != FogType.NONE) ci.cancel();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package simpleclient.mixin.performance;

import net.minecraft.client.CloudStatus;
import net.minecraft.client.Options;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import simpleclient.feature.PerformanceBoost;

@Mixin(Options.class)
public class OptionsMixin {
// +20% FPS
@Inject(at = @At("HEAD"), method = "getCloudsType", cancellable = true)
private void getCloudsType(CallbackInfoReturnable<CloudStatus> cir) {
if (PerformanceBoost.DONT_RENDER_CLOUDS) cir.setReturnValue(CloudStatus.OFF);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class SharedConstantsMixin {
// Faster starting
@Inject(at = @At("HEAD"), method = "enableDataFixerOptimizations", cancellable = true)
private static void enableDataFixerOptimizations(CallbackInfo ci) {
if (PerformanceBoost.INSTANCE.isEnabled()) ci.cancel();
if (PerformanceBoost.FASTBOOT) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
],
"client": [
"GuiMixin",
"performance.CubeMixin",
"performance.LevelRendererMixin",
"performance.OptionsMixin",
"performance.SharedConstantsMixin"
],
"injectors": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
package simpleclient.feature;

import com.google.gson.JsonObject;
import net.minecraft.network.chat.Component;
import simpleclient.feature.config.EnableConfigEntry;

public class PerformanceBoost extends EnableableFeature {
public static PerformanceBoost INSTANCE = new PerformanceBoost();
public static boolean ENABLED = INSTANCE.isEnabled();
public static boolean ENABLED = false;
public static boolean FASTBOOT = false;
public static boolean DONT_RENDER_CLOUDS = false;
public static boolean DONT_RENDER_SKY_UNDER_WATER = false;
private final EnableConfigEntry fastBoot = new EnableConfigEntry("fastboot", Component.translatable("simpleclient.performance.fastboot"), true);
private final EnableConfigEntry dontRenderCouds = new EnableConfigEntry("dont_render_clouds", Component.translatable("simpleclient.performance.dont_render_clouds"), true);
private final EnableConfigEntry dontRenderSkyUnderWater = new EnableConfigEntry("dont_render_sky_under_water", Component.translatable("simpleclient.performance.dont_render_sky_under_water"), true);

public PerformanceBoost() {
super(FeatureType.PERFORMANCE_BOOST);
addConfigEntry(fastBoot);
addConfigEntry(dontRenderCouds);
addConfigEntry(dontRenderSkyUnderWater);
refresh();
}

public void refresh() {
ENABLED = isEnabled();
JsonObject data = getData();
FASTBOOT = ENABLED && fastBoot.load(data);
DONT_RENDER_CLOUDS = ENABLED && dontRenderCouds.load(data);
DONT_RENDER_SKY_UNDER_WATER = ENABLED && dontRenderSkyUnderWater.load(data);
}

@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
ENABLED = enabled;
public void setData(JsonObject data) {
super.setData(data);
refresh();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package simpleclient.mixin.performance;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Camera;
import net.minecraft.client.renderer.LevelRenderer;
import net.minecraft.world.level.material.FogType;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import simpleclient.feature.PerformanceBoost;

@Mixin(LevelRenderer.class)
public class LevelRendererMixin {
// +10% FPS under water
@Inject(at = @At("HEAD"), method = "renderSky", cancellable = true)
private void renderSky(PoseStack poseStack, Matrix4f matrix4f, float tickDelta, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) {
if (PerformanceBoost.DONT_RENDER_SKY_UNDER_WATER && camera.getFluidInCamera() != FogType.NONE) ci.cancel();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package simpleclient.mixin.performance;

import net.minecraft.client.CloudStatus;
import net.minecraft.client.Options;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import simpleclient.feature.PerformanceBoost;

@Mixin(Options.class)
public class OptionsMixin {
// +20% FPS
@Inject(at = @At("HEAD"), method = "getCloudsType", cancellable = true)
private void getCloudsType(CallbackInfoReturnable<CloudStatus> cir) {
if (PerformanceBoost.DONT_RENDER_CLOUDS) cir.setReturnValue(CloudStatus.OFF);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public class SharedConstantsMixin {
// Faster starting
@Inject(at = @At("HEAD"), method = "enableDataFixerOptimizations", cancellable = true)
private static void enableDataFixerOptimizations(CallbackInfo ci) {
if (PerformanceBoost.INSTANCE.isEnabled()) ci.cancel();
if (PerformanceBoost.FASTBOOT) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
],
"client": [
"GuiMixin",
"performance.CubeMixin",
"performance.LevelRendererMixin",
"performance.OptionsMixin",
"performance.SharedConstantsMixin"
],
"injectors": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"simpleclient.edit_features": "Features bearbeiten",
"simpleclient.edit_feature_config": "Featurekonfiguration bearbeiten",
"simpleclient.edit_config_of": "Konfiguration von %s bearbeiten",
"simpleclient.motionblur.strength": "Motionblur Stärke"
"simpleclient.motionblur.strength": "Motionblur Stärke",
"simpleclient.performance.fastboot": "Schnelles Starten",
"simpleclient.performance.dont_render_clouds": "Wolken nicht rendern (+20% FPS)",
"simpleclient.performance.dont_render_sky_under_water": "Himmel unter Wasser nicht rendern (+10% FPS unter Wasser)"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"simpleclient.edit_features": "Edit Features",
"simpleclient.edit_feature_config": "Edit Feature Config",
"simpleclient.edit_config_of": "Edit Config of %s",
"simpleclient.motionblur.strength": "Motionblur Strength"
"simpleclient.motionblur.strength": "Motionblur Strength",
"simpleclient.performance.fastboot": "Fast starting",
"simpleclient.performance.dont_render_clouds": "Don't render clouds (+20% FPS)",
"simpleclient.performance.dont_render_sky_under_water": "Don't render sky under water (+10% FPS under water)"
}