mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2025-01-05 20:21:59 -05:00
Remove equals and hashCode ignore from chunks and fix example.
This commit is contained in:
parent
35557e853f
commit
46b46001f6
3 changed files with 53 additions and 8 deletions
|
@ -7,9 +7,6 @@ import com.github.steveice10.mc.protocol.MinecraftProtocol;
|
||||||
import com.github.steveice10.mc.protocol.ServerLoginHandler;
|
import com.github.steveice10.mc.protocol.ServerLoginHandler;
|
||||||
import com.github.steveice10.mc.protocol.data.SubProtocol;
|
import com.github.steveice10.mc.protocol.data.SubProtocol;
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
|
||||||
import com.github.steveice10.mc.protocol.data.game.world.WorldType;
|
|
||||||
import com.github.steveice10.mc.protocol.data.message.ChatColor;
|
|
||||||
import com.github.steveice10.mc.protocol.data.message.ChatFormat;
|
|
||||||
import com.github.steveice10.mc.protocol.data.message.Message;
|
import com.github.steveice10.mc.protocol.data.message.Message;
|
||||||
import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
||||||
import com.github.steveice10.mc.protocol.data.message.style.ChatColor;
|
import com.github.steveice10.mc.protocol.data.message.style.ChatColor;
|
||||||
|
@ -24,6 +21,12 @@ import com.github.steveice10.mc.protocol.data.status.handler.ServerPingTimeHandl
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.ClientChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerChatPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerJoinGamePacket;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ByteTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.FloatTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.IntTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.ListTag;
|
||||||
|
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||||
import com.github.steveice10.packetlib.Client;
|
import com.github.steveice10.packetlib.Client;
|
||||||
import com.github.steveice10.packetlib.ProxyInfo;
|
import com.github.steveice10.packetlib.ProxyInfo;
|
||||||
import com.github.steveice10.packetlib.Server;
|
import com.github.steveice10.packetlib.Server;
|
||||||
|
@ -70,7 +73,24 @@ public class MinecraftProtocolTest {
|
||||||
server.setGlobalFlag(MinecraftConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
server.setGlobalFlag(MinecraftConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void loggedIn(Session session) {
|
public void loggedIn(Session session) {
|
||||||
session.send(new ServerJoinGamePacket(0, false, GameMode.SURVIVAL, 0, 0, 100, WorldType.DEFAULT, 16, false, true));
|
session.send(new ServerJoinGamePacket(
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
GameMode.SURVIVAL,
|
||||||
|
GameMode.SURVIVAL,
|
||||||
|
1,
|
||||||
|
new String[] {"minecraft:world"},
|
||||||
|
getDimensionTag(),
|
||||||
|
"minecraft:overworld",
|
||||||
|
"minecraft:world",
|
||||||
|
100,
|
||||||
|
0,
|
||||||
|
16,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
false
|
||||||
|
));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -206,4 +226,31 @@ public class MinecraftProtocolTest {
|
||||||
|
|
||||||
client.getSession().connect();
|
client.getSession().connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static CompoundTag getDimensionTag() {
|
||||||
|
CompoundTag tag = new CompoundTag("");
|
||||||
|
ListTag dimensionTag = new ListTag("dimension");
|
||||||
|
CompoundTag overworldTag = new CompoundTag("");
|
||||||
|
overworldTag.put(new StringTag("name", "minecraft:overworld"));
|
||||||
|
overworldTag.put(new ByteTag("natural", (byte) 1));
|
||||||
|
overworldTag.put(new FloatTag("ambient_light", 0f));
|
||||||
|
overworldTag.put(new ByteTag("shrunk", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("ultrawarm", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("has_ceiling", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("has_skylight", (byte) 1));
|
||||||
|
overworldTag.put(new ByteTag("piglin_safe", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("natural", (byte) 1));
|
||||||
|
overworldTag.put(new FloatTag("ambient_light", 0));
|
||||||
|
overworldTag.put(new StringTag("infiniburn", "minecraft:infiniburn_overworld"));
|
||||||
|
overworldTag.put(new ByteTag("respawn_anchor_works", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("has_skylight", (byte) 1));
|
||||||
|
overworldTag.put(new ByteTag("bed_works", (byte) 1));
|
||||||
|
overworldTag.put(new ByteTag("has_raids", (byte) 1));
|
||||||
|
overworldTag.put(new IntTag("logical_height", 256));
|
||||||
|
overworldTag.put(new ByteTag("shrunk", (byte) 0));
|
||||||
|
overworldTag.put(new ByteTag("ultrawarm", (byte) 0));
|
||||||
|
dimensionTag.add(overworldTag);
|
||||||
|
overworldTag.put(tag);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.github.steveice10.mc.protocol.data.game.chunk;
|
||||||
|
|
||||||
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -12,7 +11,6 @@ public class Column {
|
||||||
private final int x;
|
private final int x;
|
||||||
private final int z;
|
private final int z;
|
||||||
private final boolean ignoreOldData;
|
private final boolean ignoreOldData;
|
||||||
@EqualsAndHashCode.Exclude
|
|
||||||
private final @NonNull Chunk[] chunks;
|
private final @NonNull Chunk[] chunks;
|
||||||
private final @NonNull CompoundTag[] tileEntities;
|
private final @NonNull CompoundTag[] tileEntities;
|
||||||
private final @NonNull CompoundTag heightMaps;
|
private final @NonNull CompoundTag heightMaps;
|
||||||
|
|
|
@ -29,10 +29,10 @@ public class ServerJoinGamePacket implements Packet {
|
||||||
private @NonNull GameMode gameMode;
|
private @NonNull GameMode gameMode;
|
||||||
private GameMode previousGamemode;
|
private GameMode previousGamemode;
|
||||||
private int worldCount;
|
private int worldCount;
|
||||||
private String[] worldNames;
|
private @NonNull String[] worldNames;
|
||||||
private @NonNull CompoundTag dimensionCodec;
|
private @NonNull CompoundTag dimensionCodec;
|
||||||
private @NonNull String dimension;
|
private @NonNull String dimension;
|
||||||
private String worldName;
|
private @NonNull String worldName;
|
||||||
private long hashedSeed;
|
private long hashedSeed;
|
||||||
private int maxPlayers;
|
private int maxPlayers;
|
||||||
private int viewDistance;
|
private int viewDistance;
|
||||||
|
|
Loading…
Reference in a new issue