Client sky option

This commit is contained in:
paulevsGitch 2020-12-31 07:24:50 +03:00
parent fc71ea4eba
commit 2549ab810f
4 changed files with 26 additions and 3 deletions

View file

@ -23,6 +23,7 @@ public class BetterEndClient implements ClientModInitializer {
EndParticles.register(); EndParticles.register();
EndEntitiesRenders.register(); EndEntitiesRenders.register();
EndModelProviders.register(); EndModelProviders.register();
ClientOptions.init();
if (BetterEnd.isDevEnvironment()) { if (BetterEnd.isDevEnvironment()) {
TranslationHelper.printMissingNames(); TranslationHelper.printMissingNames();

View file

@ -0,0 +1,20 @@
package ru.betterend.client;
import ru.betterend.config.Configs;
public class ClientOptions {
private static boolean customSky;
public static void init() {
setCustomSky(Configs.CLENT_CONFIG.getBooleanRoot("customSky", true));
Configs.CLENT_CONFIG.saveChanges();
}
public static boolean isCustomSky() {
return customSky;
}
public static void setCustomSky(boolean customSky) {
ClientOptions.customSky = customSky;
}
}

View file

@ -6,6 +6,7 @@ public class Configs {
public static final PathConfig ITEM_CONFIG = new PathConfig("items"); public static final PathConfig ITEM_CONFIG = new PathConfig("items");
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes"); public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator"); public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
public static void saveConfigs() { public static void saveConfigs() {
ENTITY_CONFIG.saveChanges(); ENTITY_CONFIG.saveChanges();
@ -13,5 +14,6 @@ public class Configs {
BIOME_CONFIG.saveChanges(); BIOME_CONFIG.saveChanges();
ITEM_CONFIG.saveChanges(); ITEM_CONFIG.saveChanges();
GENERATOR_CONFIG.saveChanges(); GENERATOR_CONFIG.saveChanges();
CLENT_CONFIG.saveChanges();
} }
} }

View file

@ -30,6 +30,7 @@ import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.math.Quaternion; import net.minecraft.util.math.Quaternion;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
import ru.betterend.client.ClientOptions;
import ru.betterend.util.BackgroundInfo; import ru.betterend.util.BackgroundInfo;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
@ -83,7 +84,7 @@ public class WorldRendererMixin {
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true) @Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
private void renderBetterEndSky(MatrixStack matrices, float tickDelta, CallbackInfo info) { private void renderBetterEndSky(MatrixStack matrices, float tickDelta, CallbackInfo info) {
if (client.world.getSkyProperties().getSkyType() == SkyProperties.SkyType.END) { if (ClientOptions.isCustomSky() && client.world.getSkyProperties().getSkyType() == SkyProperties.SkyType.END) {
time = (ticks % 360000) * 0.001F; time = (ticks % 360000) * 0.001F;
BackgroundRenderer.setFogBlack(); BackgroundRenderer.setFogBlack();
@ -324,8 +325,7 @@ public class WorldRendererMixin {
private void makeCylinder(BufferBuilder buffer, int segments, double height, double radius) { private void makeCylinder(BufferBuilder buffer, int segments, double height, double radius) {
buffer.begin(7, VertexFormats.POSITION_TEXTURE); buffer.begin(7, VertexFormats.POSITION_TEXTURE);
for (int i = 0; i < segments; i ++) for (int i = 0; i < segments; i ++) {
{
double a1 = (double) i * Math.PI * 2.0 / (double) segments; double a1 = (double) i * Math.PI * 2.0 / (double) segments;
double a2 = (double) (i + 1) * Math.PI * 2.0 / (double) segments; double a2 = (double) (i + 1) * Math.PI * 2.0 / (double) segments;
double px1 = Math.sin(a1) * radius; double px1 = Math.sin(a1) * radius;