Client sky option
This commit is contained in:
parent
fc71ea4eba
commit
2549ab810f
4 changed files with 26 additions and 3 deletions
|
@ -23,6 +23,7 @@ public class BetterEndClient implements ClientModInitializer {
|
|||
EndParticles.register();
|
||||
EndEntitiesRenders.register();
|
||||
EndModelProviders.register();
|
||||
ClientOptions.init();
|
||||
|
||||
if (BetterEnd.isDevEnvironment()) {
|
||||
TranslationHelper.printMissingNames();
|
||||
|
|
20
src/main/java/ru/betterend/client/ClientOptions.java
Normal file
20
src/main/java/ru/betterend/client/ClientOptions.java
Normal 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;
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ public class Configs {
|
|||
public static final PathConfig ITEM_CONFIG = new PathConfig("items");
|
||||
public static final IdConfig BIOME_CONFIG = new EntryConfig("biomes");
|
||||
public static final PathConfig GENERATOR_CONFIG = new PathConfig("generator");
|
||||
public static final PathConfig CLENT_CONFIG = new PathConfig("client");
|
||||
|
||||
public static void saveConfigs() {
|
||||
ENTITY_CONFIG.saveChanges();
|
||||
|
@ -13,5 +14,6 @@ public class Configs {
|
|||
BIOME_CONFIG.saveChanges();
|
||||
ITEM_CONFIG.saveChanges();
|
||||
GENERATOR_CONFIG.saveChanges();
|
||||
CLENT_CONFIG.saveChanges();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.client.world.ClientWorld;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import ru.betterend.BetterEnd;
|
||||
import ru.betterend.client.ClientOptions;
|
||||
import ru.betterend.util.BackgroundInfo;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
|
@ -83,7 +84,7 @@ public class WorldRendererMixin {
|
|||
|
||||
@Inject(method = "renderSky", at = @At("HEAD"), cancellable = true)
|
||||
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;
|
||||
|
||||
BackgroundRenderer.setFogBlack();
|
||||
|
@ -324,8 +325,7 @@ public class WorldRendererMixin {
|
|||
|
||||
private void makeCylinder(BufferBuilder buffer, int segments, double height, double radius) {
|
||||
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 a2 = (double) (i + 1) * Math.PI * 2.0 / (double) segments;
|
||||
double px1 = Math.sin(a1) * radius;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue