Added OptifineSupport for fast fix

This commit is contained in:
themode 2020-11-14 04:09:38 +01:00
parent 0d3ef8e7a3
commit facc43e550
4 changed files with 33 additions and 2 deletions

View File

@ -7,7 +7,7 @@ package net.minestom.server.extras.bungee;
*/
public final class BungeeCordProxy {
private static boolean enabled;
private static volatile boolean enabled;
/**
* Enables bungee IP forwarding.

View File

@ -0,0 +1,28 @@
package net.minestom.server.extras.optifine;
import net.minestom.server.MinecraftServer;
import net.minestom.server.utils.NamespaceID;
import net.minestom.server.utils.validate.Check;
import net.minestom.server.world.biomes.Biome;
import net.minestom.server.world.biomes.BiomeManager;
/**
* Hacky class for Optifine because of an issue making the client crash if biomes 'swamp' or 'swamp_hills'
* are not registered.
* <p>
* Can be removed anytime, hope that it will be fixed.
*/
public final class OptifineSupport {
private static volatile boolean enabled;
public static void enable() {
Check.stateCondition(enabled, "Optifine support is already enabled!");
OptifineSupport.enabled = true;
BiomeManager biomeManager = MinecraftServer.getBiomeManager();
biomeManager.addBiome(Biome.builder().name(NamespaceID.from("minecraft:swamp")).build());
biomeManager.addBiome(Biome.builder().name(NamespaceID.from("minecraft:swamp_hills")).build());
}
}

View File

@ -22,7 +22,7 @@ public final class VelocityProxy {
public static final String PLAYER_INFO_CHANNEL = "velocity:player_info";
private static final int SUPPORTED_FORWARDING_VERSION = 1;
private static boolean enabled;
private static volatile boolean enabled;
private static byte[] secret;
/**

View File

@ -6,6 +6,7 @@ import demo.blocks.UpdatableBlockDemo;
import demo.commands.*;
import net.minestom.server.MinecraftServer;
import net.minestom.server.command.CommandManager;
import net.minestom.server.extras.optifine.OptifineSupport;
import net.minestom.server.instance.block.BlockManager;
import net.minestom.server.instance.block.rule.vanilla.RedstonePlacementRule;
import net.minestom.server.storage.StorageManager;
@ -48,6 +49,8 @@ public class Main {
PlayerInit.init();
OptifineSupport.enable();
//VelocityProxy.enable("rBeJJ79W4MVU");
//BungeeCordProxy.enable();