Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 17:10:13 +01:00
Remove some old todos, don't send empty 1.14->1.15 meta packet
Dieser Commit ist enthalten in:
Ursprung
22379eda6f
Commit
12e2be40e8
@ -28,7 +28,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
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 class Entity1_11Types {
|
||||||
|
|
||||||
public static EntityType getTypeFromId(int typeID, boolean isObject) {
|
public static EntityType getTypeFromId(int typeID, boolean isObject) {
|
||||||
|
@ -39,8 +39,6 @@ import java.io.IOException;
|
|||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Provide more specific position information
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return super.getMessage() + "(at position " + this.position + ")";
|
return super.getMessage() + "(at position " + this.position + ")";
|
||||||
|
@ -86,7 +86,6 @@ import java.util.stream.IntStream;
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Tag next = this.tag();
|
final Tag next = this.tag();
|
||||||
// TODO: validate type
|
|
||||||
listTag.add(next);
|
listTag.add(next);
|
||||||
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
||||||
return listTag;
|
return listTag;
|
||||||
@ -128,7 +127,7 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
||||||
final byte[] result = new byte[bytes.size()];
|
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);
|
result[i] = bytes.get(i);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -164,7 +163,7 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
if (this.separatorOrCompleteWith(Tokens.ARRAY_END)) {
|
||||||
final long[] result = new long[longs.size()];
|
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);
|
result[i] = longs.get(i);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -46,7 +46,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
/* package */ final class TagStringWriter implements AutoCloseable {
|
/* package */ final class TagStringWriter implements AutoCloseable {
|
||||||
private final Appendable out;
|
private final Appendable out;
|
||||||
private final String indent = " "; // TODO: pretty-printing
|
private final String indent = " ";
|
||||||
private int level;
|
private int level;
|
||||||
/**
|
/**
|
||||||
* Whether a {@link Tokens#VALUE_SEPARATOR} needs to be printed before the beginning of the next object.
|
* 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 {
|
public TagStringWriter key(final String key) throws IOException {
|
||||||
this.printAndResetSeparator();
|
this.printAndResetSeparator();
|
||||||
this.writeMaybeQuoted(key, false);
|
this.writeMaybeQuoted(key, false);
|
||||||
this.out.append(Tokens.COMPOUND_KEY_TERMINATOR); // TODO: spacing/pretty-printing
|
this.out.append(Tokens.COMPOUND_KEY_TERMINATOR);
|
||||||
return this;
|
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(Tokens.DOUBLE_QUOTE);
|
||||||
this.out.append(escape(content, Tokens.DOUBLE_QUOTE));
|
this.out.append(escape(content, Tokens.DOUBLE_QUOTE));
|
||||||
this.out.append(Tokens.DOUBLE_QUOTE);
|
this.out.append(Tokens.DOUBLE_QUOTE);
|
||||||
|
@ -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()));
|
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));
|
platformSpecific.add("plugins", GsonUtil.getGson().toJsonTree(plugins));
|
||||||
// TODO more? ProtocolLib things etc?
|
|
||||||
|
|
||||||
return platformSpecific;
|
return platformSpecific;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,6 @@ public class BungeeServerHandler implements Listener {
|
|||||||
|
|
||||||
if (protocolId <= ProtocolVersion.v1_8.getVersion()) { // 1.8 doesn't have BossBar packet
|
if (protocolId <= ProtocolVersion.v1_8.getVersion()) { // 1.8 doesn't have BossBar packet
|
||||||
if (storage.getBossbar() != null) {
|
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.
|
// 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)) {
|
if (user.getProtocolInfo().getPipeline().contains(Protocol1_9To1_8.class)) {
|
||||||
for (UUID uuid : storage.getBossbar()) {
|
for (UUID uuid : storage.getBossbar()) {
|
||||||
|
@ -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;
|
int newId = id;
|
||||||
if (id >= 24) //Blame the enchantment table sound
|
if (id >= 24) //Blame the enchantment table sound
|
||||||
newId += 1;
|
newId += 1;
|
||||||
|
@ -229,7 +229,7 @@ public class Protocol1_12To1_11_1 extends AbstractProtocol<ClientboundPackets1_9
|
|||||||
cancelServerbound(ServerboundPackets1_12.ADVANCEMENT_TAB);
|
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;
|
int newId = id;
|
||||||
if (id >= 26) // End Portal Sounds
|
if (id >= 26) // End Portal Sounds
|
||||||
newId += 2;
|
newId += 2;
|
||||||
|
@ -62,7 +62,7 @@ public class ParticleRewriter {
|
|||||||
add(15); // (25->15) enchantmenttable -> minecraft:enchant
|
add(15); // (25->15) enchantmenttable -> minecraft:enchant
|
||||||
add(23); // (26->23) flame -> minecraft:flame
|
add(23); // (26->23) flame -> minecraft:flame
|
||||||
add(31); // (27->31) lava -> minecraft:lava
|
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(5); // (29->5) cloud -> minecraft:cloud
|
||||||
add(11, reddustHandler()); // (30->11) reddust -> minecraft:dust
|
add(11, reddustHandler()); // (30->11) reddust -> minecraft:dust
|
||||||
// Red Float Red value, 0-1
|
// Red Float Red value, 0-1
|
||||||
@ -81,7 +81,7 @@ public class ParticleRewriter {
|
|||||||
add(3, blockHandler()); // (38->3) blockdust_(id) -> minecraft:block
|
add(3, blockHandler()); // (38->3) blockdust_(id) -> minecraft:block
|
||||||
// BlockState VarInt The ID of the block state.
|
// BlockState VarInt The ID of the block state.
|
||||||
add(36); // (39->36) droplet -> minecraft:rain
|
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(13); // (41->13) mobappearance -> minecraft:elder_guardian
|
||||||
add(8); // (42->8) dragonbreath -> minecraft:dragon_breath
|
add(8); // (42->8) dragonbreath -> minecraft:dragon_breath
|
||||||
add(16); // (43->16) endrod -> minecraft:end_rod
|
add(16); // (43->16) endrod -> minecraft:end_rod
|
||||||
|
@ -106,7 +106,7 @@ public class InventoryPackets extends ItemRewriter<Protocol1_13To1_12_2> {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
String channel = wrapper.get(Type.STRING, 0);
|
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")) {
|
if (channel.equalsIgnoreCase("MC|StopSound")) {
|
||||||
String originalSource = wrapper.read(Type.STRING);
|
String originalSource = wrapper.read(Type.STRING);
|
||||||
String originalSound = 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);
|
wrapper.set(Type.STRING, 0, channel);
|
||||||
}
|
}
|
||||||
// TODO Fix trading GUI
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -42,7 +42,7 @@ public class MetadataRewriter1_14To1_13_2 extends EntityRewriter<Protocol1_14To1
|
|||||||
public MetadataRewriter1_14To1_13_2(Protocol1_14To1_13_2 protocol) {
|
public MetadataRewriter1_14To1_13_2(Protocol1_14To1_13_2 protocol) {
|
||||||
super(protocol);
|
super(protocol);
|
||||||
mapTypes(Entity1_13Types.EntityType.values(), Entity1_14Types.class);
|
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
|
@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 (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);
|
metadata.setId(metadata.id() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class MetadataRewriter1_15To1_14_4 extends EntityRewriter<Protocol1_15To1
|
|||||||
|
|
||||||
// Metadata 12 added to abstract_living
|
// Metadata 12 added to abstract_living
|
||||||
if (metadata.id() > 11 && type.isOrHasParent(Entity1_15Types.LIVINGENTITY)) {
|
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:
|
//NOTES:
|
||||||
|
@ -86,6 +86,9 @@ public class EntityPackets {
|
|||||||
private static void sendMetadataPacket(PacketWrapper wrapper, int entityId, EntityRewriter rewriter) throws Exception {
|
private static void sendMetadataPacket(PacketWrapper wrapper, int entityId, EntityRewriter rewriter) throws Exception {
|
||||||
// Meta is no longer included in the spawn packets, but sent separately
|
// Meta is no longer included in the spawn packets, but sent separately
|
||||||
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
List<Metadata> metadata = wrapper.read(Types1_14.METADATA_LIST);
|
||||||
|
if (metadata.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Send the spawn packet manually
|
// Send the spawn packet manually
|
||||||
wrapper.send(Protocol1_15To1_14_4.class);
|
wrapper.send(Protocol1_15To1_14_4.class);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren