mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-09 19:40:14 +02:00
Fixed compatibility with OptiFine
This commit is contained in:
parent
6d5c1628a9
commit
c083abae28
@ -63,7 +63,7 @@ public final class LimboServer {
|
|||||||
Logger.setLevel(config.getDebugLevel());
|
Logger.setLevel(config.getDebugLevel());
|
||||||
|
|
||||||
dimensionRegistry = new DimensionRegistry();
|
dimensionRegistry = new DimensionRegistry();
|
||||||
dimensionRegistry.load(config.getDimensionType());
|
dimensionRegistry.load(this, config.getDimensionType());
|
||||||
connections = new Connections();
|
connections = new Connections();
|
||||||
|
|
||||||
ClientConnection.preInitPackets(this);
|
ClientConnection.preInitPackets(this);
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
package ru.nanit.limbo.world;
|
package ru.nanit.limbo.world;
|
||||||
|
|
||||||
|
import net.kyori.adventure.nbt.BinaryTagIO;
|
||||||
import net.kyori.adventure.nbt.CompoundBinaryTag;
|
import net.kyori.adventure.nbt.CompoundBinaryTag;
|
||||||
import net.kyori.adventure.nbt.ListBinaryTag;
|
import net.kyori.adventure.nbt.ListBinaryTag;
|
||||||
|
import ru.nanit.limbo.server.LimboServer;
|
||||||
import ru.nanit.limbo.util.Logger;
|
import ru.nanit.limbo.util.Logger;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
public final class DimensionRegistry {
|
public final class DimensionRegistry {
|
||||||
|
|
||||||
private CompoundBinaryTag defaultDimension;
|
private CompoundBinaryTag defaultDimension;
|
||||||
@ -33,8 +38,14 @@ public final class DimensionRegistry {
|
|||||||
return nether;
|
return nether;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(String def){
|
public void load(LimboServer server, String def) throws IOException {
|
||||||
initDimensions();
|
InputStream in = server.getClass().getResourceAsStream("/dimension_registry.nbt");
|
||||||
|
codec = BinaryTagIO.readCompressedInputStream(in);
|
||||||
|
ListBinaryTag dimensions = codec.getCompound("minecraft:dimension_type").getList("value");
|
||||||
|
|
||||||
|
overWorld = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(0)).get("element");
|
||||||
|
nether = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(2)).get("element");
|
||||||
|
theEnd = (CompoundBinaryTag) ((CompoundBinaryTag) dimensions.get(3)).get("element");
|
||||||
|
|
||||||
switch (def.toLowerCase()){
|
switch (def.toLowerCase()){
|
||||||
case "overworld":
|
case "overworld":
|
||||||
@ -52,120 +63,4 @@ public final class DimensionRegistry {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDimensions(){
|
|
||||||
overWorld = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:overworld")
|
|
||||||
.putByte("piglin_safe", (byte) 0)
|
|
||||||
.putByte("natural", (byte) 1)
|
|
||||||
.putFloat("ambient_light", 0.0F)
|
|
||||||
.putString("infiniburn", "minecraft:infiniburn_overworld")
|
|
||||||
.putByte("respawn_anchor_works", (byte) 0)
|
|
||||||
.putByte("has_skylight", (byte) 1)
|
|
||||||
.putByte("bed_works", (byte) 1)
|
|
||||||
.putString("effects", "minecraft:overworld")
|
|
||||||
.putLong("fixed_time", 6000L)
|
|
||||||
.putByte("has_raids", (byte) 1)
|
|
||||||
.putInt("logical_height", 256)
|
|
||||||
.putDouble("coordinate_scale", 1.0)
|
|
||||||
.putByte("ultrawarm", (byte) 0)
|
|
||||||
.putByte("has_ceiling", (byte) 0)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
nether = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:the_nether")
|
|
||||||
.putByte("piglin_safe", (byte) 1)
|
|
||||||
.putByte("natural", (byte) 0)
|
|
||||||
.putFloat("ambient_light", 0.1F)
|
|
||||||
.putString("infiniburn", "minecraft:infiniburn_nether")
|
|
||||||
.putByte("respawn_anchor_works", (byte) 1)
|
|
||||||
.putByte("has_skylight", (byte) 0)
|
|
||||||
.putByte("bed_works", (byte) 0)
|
|
||||||
.putString("effects", "minecraft:the_nether")
|
|
||||||
.putLong("fixed_time", 18000L)
|
|
||||||
.putByte("has_raids", (byte) 0)
|
|
||||||
.putInt("logical_height", 128)
|
|
||||||
.putDouble("coordinate_scale", 1.0)
|
|
||||||
.putByte("ultrawarm", (byte) 1)
|
|
||||||
.putByte("has_ceiling", (byte) 1)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
theEnd = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:the_end")
|
|
||||||
.putByte("piglin_safe", (byte) 0)
|
|
||||||
.putByte("natural", (byte) 0)
|
|
||||||
.putFloat("ambient_light", 0.0F)
|
|
||||||
.putString("infiniburn", "minecraft:infiniburn_end")
|
|
||||||
.putByte("respawn_anchor_works", (byte) 0)
|
|
||||||
.putByte("has_skylight", (byte) 0)
|
|
||||||
.putByte("bed_works", (byte) 0)
|
|
||||||
.putString("effects", "minecraft:the_end")
|
|
||||||
.putLong("fixed_time", 6000L)
|
|
||||||
.putByte("has_raids", (byte) 1)
|
|
||||||
.putInt("logical_height", 256)
|
|
||||||
.putDouble("coordinate_scale", 1.0)
|
|
||||||
.putByte("ultrawarm", (byte) 0)
|
|
||||||
.putByte("has_ceiling", (byte) 0)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompoundBinaryTag overWorldData = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:overworld")
|
|
||||||
.putInt("id", 0)
|
|
||||||
.put("element", overWorld)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompoundBinaryTag netherData = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:the_nether")
|
|
||||||
.putInt("id", 1)
|
|
||||||
.put("element", nether)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompoundBinaryTag endData = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:the_end")
|
|
||||||
.putInt("id", 2)
|
|
||||||
.put("element", theEnd)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
CompoundBinaryTag plains = CompoundBinaryTag.builder()
|
|
||||||
.putString("name", "minecraft:plains")
|
|
||||||
.putInt("id", 1)
|
|
||||||
.put("element", CompoundBinaryTag.builder()
|
|
||||||
.putString("precipitation", "rain")
|
|
||||||
.putFloat("depth", 0.125F)
|
|
||||||
.putFloat("temperature", 0.8F)
|
|
||||||
.putFloat("scale", 0.05F)
|
|
||||||
.putFloat("downfall", 0.4F)
|
|
||||||
.putString("category", "plains")
|
|
||||||
.put("effects", CompoundBinaryTag.builder()
|
|
||||||
.putInt("sky_color", 7907327)
|
|
||||||
.putInt("water_fog_color", 329011)
|
|
||||||
.putInt("fog_color", 12638463)
|
|
||||||
.putInt("water_color", 4159204)
|
|
||||||
.put("mood_sound", CompoundBinaryTag.builder()
|
|
||||||
.putInt("tick_delay", 6000)
|
|
||||||
.putFloat("offset", 2.0F)
|
|
||||||
.putString("sound", "minecraft:ambient.cave")
|
|
||||||
.putInt("block_search_extent", 8)
|
|
||||||
.build())
|
|
||||||
.build())
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
codec = CompoundBinaryTag.builder()
|
|
||||||
.put("minecraft:dimension_type", CompoundBinaryTag.builder()
|
|
||||||
.putString("type", "minecraft:dimension_type")
|
|
||||||
.put("value", ListBinaryTag.builder()
|
|
||||||
.add(overWorldData)
|
|
||||||
.add(netherData)
|
|
||||||
.add(endData)
|
|
||||||
.build())
|
|
||||||
.build())
|
|
||||||
.put("minecraft:worldgen/biome", CompoundBinaryTag.builder()
|
|
||||||
.putString("type", "minecraft:worldgen/biome")
|
|
||||||
.put("value", ListBinaryTag.builder()
|
|
||||||
.add(plains)
|
|
||||||
.build())
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
BIN
src/main/resources/dimension_registry.nbt
Normal file
BIN
src/main/resources/dimension_registry.nbt
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user