3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +02:00

Merge remote-tracking branch 'origin/master' into dev

Dieser Commit ist enthalten in:
Nassim Jahnke 2021-09-22 11:16:35 +02:00
Commit 763a88fe97
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
14 geänderte Dateien mit 20 neuen und 27 gelöschten Zeilen

Datei anzeigen

@ -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) {

Datei anzeigen

@ -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 + ")";

Datei anzeigen

@ -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;

Datei anzeigen

@ -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);

Datei anzeigen

@ -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;
}

Datei anzeigen

@ -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()) {

Datei anzeigen

@ -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;

Datei anzeigen

@ -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;

Datei anzeigen

@ -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

Datei anzeigen

@ -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
});
}
});

Datei anzeigen

@ -25,6 +25,7 @@ import it.unimi.dsi.fastutil.ints.IntSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
// TODO Fix memory leak lolz (only a smol one tho)
public class BlockStorage implements StorableObject {
private static final IntSet WHITELIST = new IntOpenHashSet(46, 1F);
private final Map<Position, ReplacementData> blocks = new ConcurrentHashMap<>();
@ -81,8 +82,8 @@ public class BlockStorage implements StorableObject {
return blocks.remove(position);
}
public static class ReplacementData {
private int original;
public static final class ReplacementData {
private final int original;
private int replacement;
public ReplacementData(int original, int replacement) {
@ -94,10 +95,6 @@ public class BlockStorage implements StorableObject {
return original;
}
public void setOriginal(int original) {
this.original = original;
}
public int getReplacement() {
return replacement;
}

Datei anzeigen

@ -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);
}
}

Datei anzeigen

@ -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:

Datei anzeigen

@ -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);