Remove equals and hashCode ignore from chunks and fix example.

This commit is contained in:
Steveice10 2020-07-10 17:31:26 -07:00
parent 35557e853f
commit 46b46001f6
3 changed files with 53 additions and 8 deletions

View file

@ -7,9 +7,6 @@ import com.github.steveice10.mc.protocol.MinecraftProtocol;
import com.github.steveice10.mc.protocol.ServerLoginHandler;
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.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.TextMessage;
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.server.ServerChatPacket;
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.ProxyInfo;
import com.github.steveice10.packetlib.Server;
@ -70,7 +73,24 @@ public class MinecraftProtocolTest {
server.setGlobalFlag(MinecraftConstants.SERVER_LOGIN_HANDLER_KEY, new ServerLoginHandler() {
@Override
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();
}
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;
}
}

View file

@ -2,7 +2,6 @@ package com.github.steveice10.mc.protocol.data.game.chunk;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import java.util.Arrays;
@ -12,7 +11,6 @@ public class Column {
private final int x;
private final int z;
private final boolean ignoreOldData;
@EqualsAndHashCode.Exclude
private final @NonNull Chunk[] chunks;
private final @NonNull CompoundTag[] tileEntities;
private final @NonNull CompoundTag heightMaps;

View file

@ -29,10 +29,10 @@ public class ServerJoinGamePacket implements Packet {
private @NonNull GameMode gameMode;
private GameMode previousGamemode;
private int worldCount;
private String[] worldNames;
private @NonNull String[] worldNames;
private @NonNull CompoundTag dimensionCodec;
private @NonNull String dimension;
private String worldName;
private @NonNull String worldName;
private long hashedSeed;
private int maxPlayers;
private int viewDistance;