Remove some old todos, don't send empty 1.14->1.15 meta packet

This commit is contained in:
Nassim Jahnke 2021-09-22 11:15:36 +02:00
parent 22379eda6f
commit 12e2be40e8
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
13 changed files with 17 additions and 21 deletions

View File

@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
// 1.11 Entity / Object ids TODO maybe in the future instead of copying it, some api.
// 1.11 Entity / Object ids
public class Entity1_11Types {
public static EntityType getTypeFromId(int typeID, boolean isObject) {

View File

@ -39,8 +39,6 @@ import java.io.IOException;
this.position = position;
}
// TODO: Provide more specific position information
@Override
public String getMessage() {
return super.getMessage() + "(at position " + this.position + ")";

View File

@ -86,7 +86,6 @@ import java.util.stream.IntStream;
}
final Tag next = this.tag();
// TODO: validate type
listTag.add(next);
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
return listTag;
@ -128,7 +127,7 @@ import java.util.stream.IntStream;
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
final byte[] result = new byte[bytes.size()];
for (int i = 0; i < bytes.size(); ++i) { // todo yikes, let's do less boxing
for (int i = 0; i < bytes.size(); ++i) {
result[i] = bytes.get(i);
}
return result;
@ -164,7 +163,7 @@ import java.util.stream.IntStream;
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
final long[] result = new long[longs.size()];
for (int i = 0; i < longs.size(); ++i) { // todo yikes
for (int i = 0; i < longs.size(); ++i) {
result[i] = longs.get(i);
}
return result;

View File

@ -46,7 +46,7 @@ import java.util.Map;
*/
/* package */ final class TagStringWriter implements AutoCloseable {
private final Appendable out;
private final String indent = " "; // TODO: pretty-printing
private final String indent = " ";
private int level;
/**
* Whether a {@link Tokens#VALUE_SEPARATOR} needs to be printed before the beginning of the next object.
@ -165,7 +165,7 @@ import java.util.Map;
public TagStringWriter key(final String key) throws IOException {
this.printAndResetSeparator();
this.writeMaybeQuoted(key, false);
this.out.append(Tokens.COMPOUND_KEY_TERMINATOR); // TODO: spacing/pretty-printing
this.out.append(Tokens.COMPOUND_KEY_TERMINATOR);
return this;
}
@ -216,7 +216,7 @@ import java.util.Map;
}
}
}
if (requireQuotes) { // TODO: single quotes
if (requireQuotes) {
this.out.append(Tokens.DOUBLE_QUOTE);
this.out.append(escape(content, Tokens.DOUBLE_QUOTE));
this.out.append(Tokens.DOUBLE_QUOTE);

View File

@ -272,7 +272,6 @@ public class ViaVersionPlugin extends JavaPlugin implements ViaPlatform<Player>
plugins.add(new PluginInfo(p.isEnabled(), p.getDescription().getName(), p.getDescription().getVersion(), p.getDescription().getMain(), p.getDescription().getAuthors()));
platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
// TODO more? ProtocolLib things etc?
return platformSpecific;
}

View File

@ -166,7 +166,6 @@ public class BungeeServerHandler implements Listener {
if (protocolId <= ProtocolVersion.v1_8.getVersion()) { // 1.8 doesn't have BossBar packet
if (storage.getBossbar() != null) {
// TODO: Verify whether this packet needs to be sent when 1.8 -> 1.9 protocol isn't present in the pipeline
// This ensures we can encode it properly as only the 1.9 protocol is currently implemented.
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
for (UUID uuid : storage.getBossbar()) {

View File

@ -242,7 +242,7 @@ public class Protocol1_10To1_9_3_4 extends AbstractProtocol<ClientboundPackets1_
});
}
public int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.
public int getNewSoundId(int id) {
int newId = id;
if (id >= 24) //Blame the enchantment table sound
newId += 1;

View File

@ -229,7 +229,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
cancelServerbound(ServerboundPackets1_12.ADVANCEMENT_TAB);
}
private int getNewSoundId(int id) { //TODO Make it better, suggestions are welcome. It's ugly and hardcoded now.
private int getNewSoundId(int id) {
int newId = id;
if (id >= 26) // End Portal Sounds
newId += 2;

View File

@ -62,7 +62,7 @@ public class ParticleRewriter {
add(15); // (25->15) enchantmenttable -> minecraft:enchant
add(23); // (26->23) flame -> minecraft:flame
add(31); // (27->31) lava -> minecraft:lava
add(-1); // (28->-1) footstap -> REMOVED (TODO REPLACEMENT/CLIENT_SIDED?)
add(-1); // (28->-1) footstap -> REMOVED
add(5); // (29->5) cloud -> minecraft:cloud
add(11, reddustHandler()); // (30->11) reddust -> minecraft:dust
// Red Float Red value, 0-1
@ -81,7 +81,7 @@ public class ParticleRewriter {
add(3, blockHandler()); // (38->3) blockdust_(id) -> minecraft:block
// BlockState VarInt The ID of the block state.
add(36); // (39->36) droplet -> minecraft:rain
add(-1); // (40->-1) take -> REMOVED (TODO REPLACENT/CLIENT_SIDED?)
add(-1); // (40->-1) take -> REMOVED
add(13); // (41->13) mobappearance -> minecraft:elder_guardian
add(8); // (42->8) dragonbreath -> minecraft:dragon_breath
add(16); // (43->16) endrod -> minecraft:end_rod

View File

@ -106,7 +106,7 @@ public class InventoryPackets extends ItemRewriter<Protocol1_13To1_12_2> {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
String channel = wrapper.get(Type.STRING, 0);
// Handle stopsound change TODO change location of this remap to other class?
// Handle stopsound change
if (channel.equalsIgnoreCase("MC|StopSound")) {
String originalSource = wrapper.read(Type.STRING);
String originalSound = wrapper.read(Type.STRING);
@ -194,7 +194,6 @@ public class InventoryPackets extends ItemRewriter<Protocol1_13To1_12_2> {
}
wrapper.set(Type.STRING, 0, channel);
}
// TODO Fix trading GUI
});
}
});

View File

@ -42,7 +42,7 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<Protocol1_14To1
public MetadataRewriter1_14To1_13_2(Protocol1_14To1_13_2 protocol) {
super(protocol);
mapTypes(Entity1_13Types.EntityType.values(), Entity1_14Types.class);
mapEntityType(Entity1_13Types.EntityType.OCELOT, Entity1_14Types.CAT); //TODO remap untamed ocelots to ocelots?
mapEntityType(Entity1_13Types.EntityType.OCELOT, Entity1_14Types.CAT);
}
@Override
@ -176,9 +176,8 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<Protocol1_14To1
}
}
// TODO Are witch and ravager also abstract illagers? They all inherit the new metadata 14 added in 19w13a
if (type.is(Entity1_14Types.WITCH) || type.is(Entity1_14Types.RAVAGER) || type.isOrHasParent(Entity1_14Types.ABSTRACT_ILLAGER_BASE)) {
if (metadata.id() >= 14) { // TODO 19w13 added a new boolean (raid participant - is celebrating) with id 14
if (metadata.id() >= 14) { // 19w13 added a new boolean (raid participant - is celebrating) with id 14
metadata.setId(metadata.id() + 1);
}
}

View File

@ -60,7 +60,7 @@ public class MetadataRewriter1_15To1_14_4 extends EntityRewriter<Protocol1_15To1
// Metadata 12 added to abstract_living
if (metadata.id() > 11 && type.isOrHasParent(Entity1_15Types.LIVINGENTITY)) {
metadata.setId(metadata.id() + 1); //TODO is it 11 or 12? what is it for?
metadata.setId(metadata.id() + 1);
}
//NOTES:

View File

@ -86,6 +86,9 @@ public class EntityPackets {
private static void sendMetadataPacket(PacketWrapper wrapper, int entityId, EntityRewriter rewriter) throws Exception {
// Meta is no longer included in the spawn packets, but sent separately
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
if (metadata.isEmpty()) {
return;
}
// Send the spawn packet manually
wrapper.send(Protocol1_15To1_14_4.class);