forked from BLOCKFANTASY/LOOHP-Limbo
Use actaul dimension code from vanilla minecraft, use the right biome for each dimension, allow limbo.yml instead of plugin.yml for plugins
This commit is contained in:
parent
28372a9bcc
commit
c711f8cea6
2
pom.xml
2
pom.xml
|
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>Limbo</groupId>
|
<groupId>Limbo</groupId>
|
||||||
<artifactId>Limbo</artifactId>
|
<artifactId>Limbo</artifactId>
|
||||||
<version>0.2.3-ALPHA</version>
|
<version>0.2.4-ALPHA</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class PluginManager {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String name = entry.getName();
|
String name = entry.getName();
|
||||||
if (name.endsWith("plugin.yml")) {
|
if (name.endsWith("plugin.yml") || name.endsWith("limbo.yml")) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
FileConfiguration pluginYaml = new FileConfiguration(zip);
|
FileConfiguration pluginYaml = new FileConfiguration(zip);
|
||||||
|
|
|
||||||
|
|
@ -280,7 +280,7 @@ public class ClientConnection extends Thread {
|
||||||
TimeUnit.MILLISECONDS.sleep(500);
|
TimeUnit.MILLISECONDS.sleep(500);
|
||||||
|
|
||||||
ServerProperties p = Limbo.getInstance().getServerProperties();
|
ServerProperties p = Limbo.getInstance().getServerProperties();
|
||||||
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, p.getDefaultGamemode(), Limbo.getInstance().getWorlds().stream().map(each -> new NamespacedKey(each.getName()).toString()).collect(Collectors.toList()).toArray(new String[Limbo.getInstance().getWorlds().size()]), DimensionRegistry.getCodec(), p.getWorldSpawn().getWorld(), 0, (byte) p.getMaxPlayers(), 8, p.isReducedDebugInfo(), true, false, false);
|
PacketPlayOutLogin join = new PacketPlayOutLogin(player.getEntityId(), false, p.getDefaultGamemode(), Limbo.getInstance().getWorlds().stream().map(each -> new NamespacedKey(each.getName()).toString()).collect(Collectors.toList()).toArray(new String[Limbo.getInstance().getWorlds().size()]), DimensionRegistry.getCodec(), p.getWorldSpawn().getWorld(), 0, (byte) p.getMaxPlayers(), 8, p.isReducedDebugInfo(), true, false, true);
|
||||||
sendPacket(join);
|
sendPacket(join);
|
||||||
player.setGamemodeSilent(p.getDefaultGamemode());
|
player.setGamemodeSilent(p.getDefaultGamemode());
|
||||||
|
|
||||||
|
|
@ -294,7 +294,7 @@ public class ClientConnection extends Thread {
|
||||||
for (int z = 0; z < world.getChunks()[x].length; z++) {
|
for (int z = 0; z < world.getChunks()[x].length; z++) {
|
||||||
Chunk chunk = world.getChunks()[x][z];
|
Chunk chunk = world.getChunks()[x][z];
|
||||||
if (chunk != null) {
|
if (chunk != null) {
|
||||||
PacketPlayOutMapChunk chunkdata = new PacketPlayOutMapChunk(x, z, chunk);
|
PacketPlayOutMapChunk chunkdata = new PacketPlayOutMapChunk(x, z, chunk, world.getEnvironment());
|
||||||
sendPacket(chunkdata);
|
sendPacket(chunkdata);
|
||||||
//System.out.println(x + ", " + z);
|
//System.out.println(x + ", " + z);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import java.util.Iterator;
|
||||||
import com.loohp.limbo.Utils.ChunkDataUtils;
|
import com.loohp.limbo.Utils.ChunkDataUtils;
|
||||||
import com.loohp.limbo.Utils.DataTypeIO;
|
import com.loohp.limbo.Utils.DataTypeIO;
|
||||||
import com.loohp.limbo.Utils.GeneratedDataUtils;
|
import com.loohp.limbo.Utils.GeneratedDataUtils;
|
||||||
|
import com.loohp.limbo.World.World.Environment;
|
||||||
|
|
||||||
import net.querz.mca.Chunk;
|
import net.querz.mca.Chunk;
|
||||||
import net.querz.mca.Section;
|
import net.querz.mca.Section;
|
||||||
|
|
@ -19,11 +20,18 @@ public class PacketPlayOutMapChunk extends PacketOut {
|
||||||
private int chunkX;
|
private int chunkX;
|
||||||
private int chunkZ;
|
private int chunkZ;
|
||||||
private Chunk chunk;
|
private Chunk chunk;
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
public PacketPlayOutMapChunk(int chunkX, int chunkZ, Chunk chunk) {
|
public PacketPlayOutMapChunk(int chunkX, int chunkZ, Chunk chunk, Environment environment) {
|
||||||
this.chunkX = chunkX;
|
this.chunkX = chunkX;
|
||||||
this.chunkZ = chunkZ;
|
this.chunkZ = chunkZ;
|
||||||
this.chunk = chunk;
|
this.chunk = chunk;
|
||||||
|
this.environment = environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public PacketPlayOutMapChunk(int chunkX, int chunkZ, Chunk chunk) {
|
||||||
|
this(chunkZ, chunkZ, chunk, Environment.NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk getChunk() {
|
public Chunk getChunk() {
|
||||||
|
|
@ -38,6 +46,10 @@ public class PacketPlayOutMapChunk extends PacketOut {
|
||||||
return chunkZ;
|
return chunkZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Environment getEnvironment() {
|
||||||
|
return environment;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] serializePacket() throws IOException {
|
public byte[] serializePacket() throws IOException {
|
||||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
|
||||||
|
|
@ -61,8 +73,21 @@ public class PacketPlayOutMapChunk extends PacketOut {
|
||||||
//for (int i : chunk.getBiomes()) {
|
//for (int i : chunk.getBiomes()) {
|
||||||
// output.writeInt(i);
|
// output.writeInt(i);
|
||||||
//}
|
//}
|
||||||
|
int biome;
|
||||||
|
switch (environment) {
|
||||||
|
case END:
|
||||||
|
biome = 9; //the_end
|
||||||
|
break;
|
||||||
|
case NETHER:
|
||||||
|
biome = 8; //nether_waste
|
||||||
|
break;
|
||||||
|
case NORMAL:
|
||||||
|
default:
|
||||||
|
biome = 1; //plains
|
||||||
|
break;
|
||||||
|
}
|
||||||
for (int i = 0; i < 1024; i++) {
|
for (int i = 0; i < 1024; i++) {
|
||||||
output.writeInt(127);
|
output.writeInt(biome);
|
||||||
}
|
}
|
||||||
|
|
||||||
ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream();
|
ByteArrayOutputStream dataBuffer = new ByteArrayOutputStream();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ public class DimensionRegistry {
|
||||||
CompoundTag overworld = new CompoundTag();
|
CompoundTag overworld = new CompoundTag();
|
||||||
overworld.putString("name", "minecraft:overworld");
|
overworld.putString("name", "minecraft:overworld");
|
||||||
overworld.putByte("natural", (byte) 1);
|
overworld.putByte("natural", (byte) 1);
|
||||||
overworld.putFloat("ambient_light", 0.4F);
|
overworld.putFloat("ambient_light", 0.0F);
|
||||||
overworld.putByte("has_ceiling", (byte) 0);
|
overworld.putByte("has_ceiling", (byte) 0);
|
||||||
overworld.putByte("has_skylight", (byte) 1);
|
overworld.putByte("has_skylight", (byte) 1);
|
||||||
overworld.putLong("fixed_time", 0);
|
overworld.putLong("fixed_time", 0);
|
||||||
|
|
@ -26,15 +26,31 @@ public class DimensionRegistry {
|
||||||
overworld.putByte("bed_works", (byte) 1);
|
overworld.putByte("bed_works", (byte) 1);
|
||||||
overworld.putByte("piglin_safe", (byte) 0);
|
overworld.putByte("piglin_safe", (byte) 0);
|
||||||
overworld.putInt("logical_height", 256);
|
overworld.putInt("logical_height", 256);
|
||||||
overworld.putString("infiniburn", "");
|
overworld.putString("infiniburn", "minecraft:infiniburn_overworld");
|
||||||
|
|
||||||
|
CompoundTag overworld_caves = new CompoundTag();
|
||||||
|
overworld_caves.putString("name", "minecraft:overworld_caves");
|
||||||
|
overworld_caves.putByte("natural", (byte) 1);
|
||||||
|
overworld_caves.putFloat("ambient_light", 0.0F);
|
||||||
|
overworld_caves.putByte("has_ceiling", (byte) 1);
|
||||||
|
overworld_caves.putByte("has_skylight", (byte) 1);
|
||||||
|
overworld_caves.putLong("fixed_time", 0);
|
||||||
|
overworld_caves.putByte("shrunk", (byte) 0);
|
||||||
|
overworld_caves.putByte("ultrawarm", (byte) 0);
|
||||||
|
overworld_caves.putByte("has_raids", (byte) 1);
|
||||||
|
overworld_caves.putByte("respawn_anchor_works", (byte) 0);
|
||||||
|
overworld_caves.putByte("bed_works", (byte) 1);
|
||||||
|
overworld_caves.putByte("piglin_safe", (byte) 0);
|
||||||
|
overworld_caves.putInt("logical_height", 256);
|
||||||
|
overworld_caves.putString("infiniburn", "minecraft:infiniburn_overworld");
|
||||||
|
|
||||||
CompoundTag nether = new CompoundTag();
|
CompoundTag nether = new CompoundTag();
|
||||||
nether.putString("name", "minecraft:the_nether");
|
nether.putString("name", "minecraft:the_nether");
|
||||||
nether.putByte("natural", (byte) 0);
|
nether.putByte("natural", (byte) 0);
|
||||||
nether.putFloat("ambient_light", 0.3F);
|
nether.putFloat("ambient_light", 0.1F);
|
||||||
nether.putByte("has_ceiling", (byte) 1);
|
nether.putByte("has_ceiling", (byte) 1);
|
||||||
nether.putByte("has_skylight", (byte) 0);
|
nether.putByte("has_skylight", (byte) 0);
|
||||||
nether.putLong("fixed_time", 0);
|
nether.putLong("fixed_time", 18000);
|
||||||
nether.putByte("shrunk", (byte) 1);
|
nether.putByte("shrunk", (byte) 1);
|
||||||
nether.putByte("ultrawarm", (byte) 1);
|
nether.putByte("ultrawarm", (byte) 1);
|
||||||
nether.putByte("has_raids", (byte) 0);
|
nether.putByte("has_raids", (byte) 0);
|
||||||
|
|
@ -42,26 +58,27 @@ public class DimensionRegistry {
|
||||||
nether.putByte("bed_works", (byte) 0);
|
nether.putByte("bed_works", (byte) 0);
|
||||||
nether.putByte("piglin_safe", (byte) 1);
|
nether.putByte("piglin_safe", (byte) 1);
|
||||||
nether.putInt("logical_height", 128);
|
nether.putInt("logical_height", 128);
|
||||||
nether.putString("infiniburn", "");
|
nether.putString("infiniburn", "minecraft:infiniburn_nether");
|
||||||
|
|
||||||
CompoundTag the_end = new CompoundTag();
|
CompoundTag the_end = new CompoundTag();
|
||||||
the_end.putString("name", "minecraft:the_end");
|
the_end.putString("name", "minecraft:the_end");
|
||||||
the_end.putByte("natural", (byte) 0);
|
the_end.putByte("natural", (byte) 0);
|
||||||
the_end.putFloat("ambient_light", 0.3F);
|
the_end.putFloat("ambient_light", 0.0F);
|
||||||
the_end.putByte("has_ceiling", (byte) 0);
|
the_end.putByte("has_ceiling", (byte) 0);
|
||||||
the_end.putByte("has_skylight", (byte) 0);
|
the_end.putByte("has_skylight", (byte) 0);
|
||||||
the_end.putLong("fixed_time", 0);
|
the_end.putLong("fixed_time", 6000);
|
||||||
the_end.putByte("shrunk", (byte) 0);
|
the_end.putByte("shrunk", (byte) 0);
|
||||||
the_end.putByte("ultrawarm", (byte) 0);
|
the_end.putByte("ultrawarm", (byte) 0);
|
||||||
the_end.putByte("has_raids", (byte) 0);
|
the_end.putByte("has_raids", (byte) 1);
|
||||||
the_end.putByte("respawn_anchor_works", (byte) 0);
|
the_end.putByte("respawn_anchor_works", (byte) 0);
|
||||||
the_end.putByte("bed_works", (byte) 0);
|
the_end.putByte("bed_works", (byte) 0);
|
||||||
the_end.putByte("piglin_safe", (byte) 1);
|
the_end.putByte("piglin_safe", (byte) 0);
|
||||||
the_end.putInt("logical_height", 256);
|
the_end.putInt("logical_height", 256);
|
||||||
the_end.putString("infiniburn", "");
|
the_end.putString("infiniburn", "minecraft:infiniburn_end");
|
||||||
|
|
||||||
ListTag<CompoundTag> listtag = new ListTag<CompoundTag>(CompoundTag.class);
|
ListTag<CompoundTag> listtag = new ListTag<CompoundTag>(CompoundTag.class);
|
||||||
listtag.add(overworld);
|
listtag.add(overworld);
|
||||||
|
listtag.add(overworld_caves);
|
||||||
listtag.add(nether);
|
listtag.add(nether);
|
||||||
listtag.add(the_end);
|
listtag.add(the_end);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,16 @@ max-players=-1
|
||||||
server-port=30000
|
server-port=30000
|
||||||
|
|
||||||
#Server ip, localhost for local access only
|
#Server ip, localhost for local access only
|
||||||
server-ip=localhost
|
server-ip=0.0.0.0
|
||||||
|
|
||||||
#Whether this is server is behind a bungeecord proxy
|
#Whether this is server is behind a bungeecord proxy
|
||||||
bungeecord=true
|
bungeecord=false
|
||||||
|
|
||||||
#World Name and the Schematic file containing map
|
#World Name and the Schematic file containing map
|
||||||
level-name=world;spawn.schem
|
level-name=world;spawn.schem
|
||||||
|
|
||||||
#Dimension, "minecraft:overworld", "minecraft:the_nether" or "minecraft:the_end"
|
#Dimension, "minecraft:overworld", "minecraft:the_nether" or "minecraft:the_end"
|
||||||
level-dimension=minecraft:the_end
|
level-dimension=minecraft:overworld
|
||||||
|
|
||||||
#Whether Flying is allowed
|
#Whether Flying is allowed
|
||||||
allow-flight=false
|
allow-flight=false
|
||||||
|
|
@ -29,7 +29,7 @@ world-spawn=world;20.5;17;22.5;-90;0
|
||||||
reduced-debug-info=false
|
reduced-debug-info=false
|
||||||
|
|
||||||
#Server list message in Json
|
#Server list message in Json
|
||||||
motd={"text":"","extra":[{"text":"H ","color":"#E8162E"},{"text":"M ","color":"#F9D52B"},{"text":"G ","color":"#28B31F"},{"text":"! ","color":"blue"},{"text":"!","color":"dark_purple"},{"text":"\n"},{"text":"Limbo Demo Server!","color":"yellow"}]}
|
motd={"text":"","extra":[{"text":"Limbo Server!","color":"yellow"}]}
|
||||||
|
|
||||||
#Server list version as string
|
#Server list version as string
|
||||||
version=Limbo!
|
version=Limbo!
|
||||||
Loading…
Reference in New Issue