Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-20 06:50:08 +01:00
Merge branch 'master' into dev
Dieser Commit ist enthalten in:
Commit
6b7bf843a1
@ -2,6 +2,7 @@ package us.myles.ViaVersion.bungee.platform;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.NonNull;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
@ -23,14 +24,17 @@ public class BungeeViaAPI implements ViaAPI<ProxiedPlayer> {
|
||||
@Override
|
||||
public int getPlayerVersion(@NonNull ProxiedPlayer player) {
|
||||
if (!isPorted(player.getUniqueId()))
|
||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
||||
return player.getPendingConnection().getVersion();
|
||||
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerVersion(@NonNull UUID uuid) {
|
||||
if (!isPorted(uuid))
|
||||
if (!isPorted(uuid)) {
|
||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(uuid);
|
||||
if (player != null) return player.getPendingConnection().getVersion();
|
||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
||||
}
|
||||
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,9 @@ import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.ConnectionData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.BlockConnectionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections.providers.PacketBlockConnectionProvider;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.RecipeData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.EntityPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.InventoryPackets;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets.WorldPackets;
|
||||
@ -125,6 +127,8 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.WHITE, '?');
|
||||
MappingData.init();
|
||||
ConnectionData.init();
|
||||
RecipeData.init();
|
||||
BlockIdData.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -428,11 +432,11 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
registerOutgoing(State.PLAY, 0x2B, 0x2D, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE);
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
// TODO This packet changed
|
||||
wrapper.cancel();
|
||||
wrapper.write(Type.STRING, "viaversion:legacy/" + wrapper.read(Type.VAR_INT));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -459,15 +463,97 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
// New 0x31 - Face Player
|
||||
registerOutgoing(State.PLAY, 0x2F, 0x32);
|
||||
registerOutgoing(State.PLAY, 0x30, 0x33);
|
||||
// Recipe
|
||||
// Unlock recipes
|
||||
registerOutgoing(State.PLAY, 0x31, 0x34, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // action
|
||||
map(Type.BOOLEAN); // crafting book open
|
||||
map(Type.BOOLEAN); // crafting filter active
|
||||
create(new ValueCreator() {
|
||||
@Override
|
||||
public void write(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.write(Type.BOOLEAN, false); // smelting book open
|
||||
wrapper.write(Type.BOOLEAN, false); // smelting filter active
|
||||
}
|
||||
});
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
// TODO: This has changed >.>
|
||||
wrapper.cancel();
|
||||
int action = wrapper.get(Type.VAR_INT, 0);
|
||||
for (int i = 0; i < (action == 0 ? 2 : 1); i++) {
|
||||
Integer[] ids = wrapper.read(Type.VAR_INT_ARRAY);
|
||||
String[] stringIds = new String[ids.length];
|
||||
for (int j = 0; j < ids.length; j++) {
|
||||
stringIds[j] = "viaversion:legacy/" + ids[j];
|
||||
}
|
||||
wrapper.write(Type.STRING_ARRAY, stringIds);
|
||||
}
|
||||
if (action == 0) {
|
||||
wrapper.create(0x54, new ValueCreator() { // Declare recipes
|
||||
@Override
|
||||
public void write(PacketWrapper wrapper) throws Exception {
|
||||
wrapper.write(Type.VAR_INT, RecipeData.recipes.size());
|
||||
for (Map.Entry<String, RecipeData.Recipe> entry : RecipeData.recipes.entrySet()) {
|
||||
wrapper.write(Type.STRING, entry.getKey()); // Id
|
||||
wrapper.write(Type.STRING, entry.getValue().getType());
|
||||
switch (entry.getValue().getType()) {
|
||||
case "crafting_shapeless": {
|
||||
wrapper.write(Type.STRING, entry.getValue().getGroup());
|
||||
wrapper.write(Type.VAR_INT, entry.getValue().getIngredients().length);
|
||||
for (Item[] ingredient : entry.getValue().getIngredients()) {
|
||||
Item[] clone = ingredient.clone(); // Clone because array and item is mutable
|
||||
for (int i = 0; i < clone.length; i++) {
|
||||
if (clone[i] == null) continue;
|
||||
clone[i] = new Item(clone[i].getId(), clone[i].getAmount(),
|
||||
(short) 0, null);
|
||||
}
|
||||
wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
|
||||
}
|
||||
wrapper.write(Type.FLAT_ITEM, new Item(
|
||||
entry.getValue().getResult().getId(),
|
||||
entry.getValue().getResult().getAmount(), (short) 0, null));
|
||||
break;
|
||||
}
|
||||
case "crafting_shaped": {
|
||||
wrapper.write(Type.VAR_INT, entry.getValue().getWidth());
|
||||
wrapper.write(Type.VAR_INT, entry.getValue().getHeight());
|
||||
wrapper.write(Type.STRING, entry.getValue().getGroup());
|
||||
for (Item[] ingredient : entry.getValue().getIngredients()) {
|
||||
Item[] clone = ingredient.clone(); // Clone because array and item is mutable
|
||||
for (int i = 0; i < clone.length; i++) {
|
||||
if (clone[i] == null) continue;
|
||||
clone[i] = new Item(clone[i].getId(), clone[i].getAmount(),
|
||||
(short) 0, null);
|
||||
}
|
||||
wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
|
||||
}
|
||||
wrapper.write(Type.FLAT_ITEM, new Item(
|
||||
entry.getValue().getResult().getId(),
|
||||
entry.getValue().getResult().getAmount(), (short) 0, null));
|
||||
break;
|
||||
}
|
||||
case "smelting": {
|
||||
wrapper.write(Type.STRING, entry.getValue().getGroup());
|
||||
Item[] clone = entry.getValue().getIngredient().clone(); // Clone because array and item is mutable
|
||||
for (int i = 0; i < clone.length; i++) {
|
||||
if (clone[i] == null) continue;
|
||||
clone[i] = new Item(clone[i].getId(), clone[i].getAmount(),
|
||||
(short) 0, null);
|
||||
}
|
||||
wrapper.write(Type.FLAT_ITEM_ARRAY_VAR_INT, clone);
|
||||
wrapper.write(Type.FLAT_ITEM, new Item(
|
||||
entry.getValue().getResult().getId(),
|
||||
entry.getValue().getResult().getAmount(), (short) 0, null));
|
||||
wrapper.write(Type.FLOAT, entry.getValue().getExperience());
|
||||
wrapper.write(Type.VAR_INT, entry.getValue().getCookingTime());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}).send(Protocol1_13To1_12_2.class, true, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -834,11 +920,11 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
registerIncoming(State.PLAY, 0x12, 0x16, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.BYTE); // Window id
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
// TODO: This has changed >.>
|
||||
wrapper.cancel();
|
||||
wrapper.write(Type.VAR_INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18)));
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -859,6 +945,9 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int type = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
if (type == 0) {
|
||||
wrapper.write(Type.INT, Integer.parseInt(wrapper.read(Type.STRING).substring(18)));
|
||||
}
|
||||
if (type == 1) {
|
||||
wrapper.passthrough(Type.BOOLEAN); // Crafting Recipe Book Open
|
||||
wrapper.passthrough(Type.BOOLEAN); // Crafting Recipe Filter Active
|
||||
|
@ -2,7 +2,7 @@ package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.blockconnections;
|
||||
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
import us.myles.ViaVersion.api.minecraft.Position;
|
||||
import us.myles.ViaVersion.api.protocol.ProtocolRegistry;
|
||||
import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
|
||||
public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
||||
|
||||
@ -34,6 +34,8 @@ public class GlassConnectionHandler extends AbstractFenceConnectionHandler {
|
||||
@Override
|
||||
protected byte getStates(UserConnection user, Position position, int blockState) {
|
||||
byte states = super.getStates(user, position, blockState);
|
||||
return states == 0 && (ProtocolRegistry.SERVER_PROTOCOL <= 47 && ProtocolRegistry.SERVER_PROTOCOL != -1) ? 0xF : states;
|
||||
return states == 0
|
||||
&& user.get(ProtocolInfo.class).getServerProtocolVersion() <= 47
|
||||
&& user.get(ProtocolInfo.class).getServerProtocolVersion() != -1 ? 0xF : states;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BlockIdData {
|
||||
public static Map<String, String[]> blockIdMapping;
|
||||
public static Map<String, String[]> fallbackReverseMapping;
|
||||
|
||||
public static void init() {
|
||||
InputStream stream = MappingData.class.getClassLoader()
|
||||
.getResourceAsStream("assets/viaversion/data/blockIds1.12to1.13.json");
|
||||
InputStreamReader reader = new InputStreamReader(stream);
|
||||
try {
|
||||
blockIdMapping = new HashMap<>((Map<String, String[]>) GsonUtil.getGson().fromJson(
|
||||
reader,
|
||||
new TypeToken<Map<String, String[]>>() {
|
||||
}.getType()
|
||||
));
|
||||
fallbackReverseMapping = new HashMap<>();
|
||||
for (Map.Entry<String, String[]> entry : blockIdMapping.entrySet()) {
|
||||
for (String val : entry.getValue()) {
|
||||
String[] previous = fallbackReverseMapping.get(val);
|
||||
if (previous == null) previous = new String[0];
|
||||
fallbackReverseMapping.put(val, ObjectArrays.concat(previous, entry.getKey()));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException ignored) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
import us.myles.ViaVersion.api.minecraft.item.Item;
|
||||
import us.myles.ViaVersion.util.GsonUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Map;
|
||||
|
||||
public class RecipeData {
|
||||
public static Map<String, Recipe> recipes;
|
||||
|
||||
public static void init() {
|
||||
InputStream stream = MappingData.class.getClassLoader()
|
||||
.getResourceAsStream("assets/viaversion/data/itemrecipes1_12_2to1_13.json");
|
||||
InputStreamReader reader = new InputStreamReader(stream);
|
||||
try {
|
||||
recipes = GsonUtil.getGson().fromJson(
|
||||
reader,
|
||||
new TypeToken<Map<String, Recipe>>() {
|
||||
}.getType()
|
||||
);
|
||||
} finally {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (IOException ignored) {
|
||||
// Ignored
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Recipe {
|
||||
@NonNull
|
||||
private String type;
|
||||
private String group;
|
||||
private int width;
|
||||
private int height;
|
||||
private float experience;
|
||||
private int cookingTime;
|
||||
private Item[] ingredient;
|
||||
private Item[][] ingredients;
|
||||
private Item result;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package us.myles.ViaVersion.protocols.protocol1_13to1_12_2.packets;
|
||||
|
||||
import com.github.steveice10.opennbt.conversion.ConverterRegistry;
|
||||
import com.github.steveice10.opennbt.tag.builtin.*;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Optional;
|
||||
@ -13,6 +14,7 @@ import us.myles.ViaVersion.api.remapper.PacketRemapper;
|
||||
import us.myles.ViaVersion.api.type.Type;
|
||||
import us.myles.ViaVersion.packets.State;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.ChatRewriter;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.BlockIdData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.MappingData;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SoundSource;
|
||||
import us.myles.ViaVersion.protocols.protocol1_13to1_12_2.data.SpawnEggRewriter;
|
||||
@ -373,6 +375,44 @@ public class InventoryPackets {
|
||||
tag.remove("StoredEnchantments");
|
||||
tag.put(newStoredEnch);
|
||||
}
|
||||
if (tag.get("CanPlaceOn") instanceof ListTag) {
|
||||
ListTag old = tag.get("CanPlaceOn");
|
||||
ListTag newCanPlaceOn = new ListTag("CanPlaceOn", StringTag.class);
|
||||
tag.put(ConverterRegistry.convertToTag(NBT_TAG_NAME + "|CanPlaceOn", ConverterRegistry.convertToValue(old))); // There will be data losing
|
||||
for (Tag oldTag : old) {
|
||||
Object value = oldTag.getValue();
|
||||
String[] newValues = BlockIdData.blockIdMapping.get(value instanceof String
|
||||
? ((String) value).replace("minecraft:", "")
|
||||
: null);
|
||||
if (newValues != null) {
|
||||
for (String newValue : newValues) {
|
||||
newCanPlaceOn.add(new StringTag("", newValue));
|
||||
}
|
||||
} else {
|
||||
newCanPlaceOn.add(oldTag);
|
||||
}
|
||||
}
|
||||
tag.put(newCanPlaceOn);
|
||||
}
|
||||
if (tag.get("CanDestroy") instanceof ListTag) {
|
||||
ListTag old = tag.get("CanDestroy");
|
||||
ListTag newCanDestroy = new ListTag("CanDestroy", StringTag.class);
|
||||
tag.put(ConverterRegistry.convertToTag(NBT_TAG_NAME + "|CanDestroy", ConverterRegistry.convertToValue(old))); // There will be data losing
|
||||
for (Tag oldTag : old) {
|
||||
Object value = oldTag.getValue();
|
||||
String[] newValues = BlockIdData.blockIdMapping.get(value instanceof String
|
||||
? ((String) value).replace("minecraft:", "")
|
||||
: null);
|
||||
if (newValues != null) {
|
||||
for (String newValue : newValues) {
|
||||
newCanDestroy.add(new StringTag("", newValue));
|
||||
}
|
||||
} else {
|
||||
newCanDestroy.add(oldTag);
|
||||
}
|
||||
}
|
||||
tag.put(newCanDestroy);
|
||||
}
|
||||
// Handle SpawnEggs
|
||||
if (item.getIdentifier() == 383) {
|
||||
if (tag.get("EntityTag") instanceof CompoundTag) {
|
||||
@ -538,7 +578,6 @@ public class InventoryPackets {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display Name now uses JSON
|
||||
if (tag.get("display") instanceof CompoundTag) {
|
||||
CompoundTag display = tag.get("display");
|
||||
@ -603,6 +642,54 @@ public class InventoryPackets {
|
||||
tag.remove("StoredEnchantments");
|
||||
tag.put(newStoredEnch);
|
||||
}
|
||||
if (tag.get(NBT_TAG_NAME + "|CanPlaceOn") instanceof ListTag) {
|
||||
tag.put(ConverterRegistry.convertToTag(
|
||||
"CanPlaceOn",
|
||||
ConverterRegistry.convertToValue(tag.get(NBT_TAG_NAME + "|CanPlaceOn"))
|
||||
));
|
||||
tag.remove(NBT_TAG_NAME + "|CanPlaceOn");
|
||||
} else if (tag.get("CanPlaceOn") instanceof ListTag) {
|
||||
ListTag old = tag.get("CanPlaceOn");
|
||||
ListTag newCanPlaceOn = new ListTag("CanPlaceOn", StringTag.class);
|
||||
for (Tag oldTag : old) {
|
||||
Object value = oldTag.getValue();
|
||||
String[] newValues = BlockIdData.fallbackReverseMapping.get(value instanceof String
|
||||
? ((String) value).replace("minecraft:", "")
|
||||
: null);
|
||||
if (newValues != null) {
|
||||
for (String newValue : newValues) {
|
||||
newCanPlaceOn.add(new StringTag("", newValue));
|
||||
}
|
||||
} else {
|
||||
newCanPlaceOn.add(oldTag);
|
||||
}
|
||||
}
|
||||
tag.put(newCanPlaceOn);
|
||||
}
|
||||
if (tag.get(NBT_TAG_NAME + "|CanDestroy") instanceof ListTag) {
|
||||
tag.put(ConverterRegistry.convertToTag(
|
||||
"CanDestroy",
|
||||
ConverterRegistry.convertToValue(tag.get(NBT_TAG_NAME + "|CanDestroy"))
|
||||
));
|
||||
tag.remove(NBT_TAG_NAME + "|CanDestroy");
|
||||
} else if (tag.get("CanDestroy") instanceof ListTag) {
|
||||
ListTag old = tag.get("CanDestroy");
|
||||
ListTag newCanDestroy = new ListTag("CanDestroy", StringTag.class);
|
||||
for (Tag oldTag : old) {
|
||||
Object value = oldTag.getValue();
|
||||
String[] newValues = BlockIdData.fallbackReverseMapping.get(value instanceof String
|
||||
? ((String) value).replace("minecraft:", "")
|
||||
: null);
|
||||
if (newValues != null) {
|
||||
for (String newValue : newValues) {
|
||||
newCanDestroy.add(new StringTag("", newValue));
|
||||
}
|
||||
} else {
|
||||
newCanDestroy.add(oldTag);
|
||||
}
|
||||
}
|
||||
tag.put(newCanDestroy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,20 +132,33 @@ public class PlayerPackets {
|
||||
String[] players = wrapper.read(Type.STRING_ARRAY); // Players
|
||||
final EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
String myName = wrapper.user().get(ProtocolInfo.class).getUsername();
|
||||
String teamName = wrapper.get(Type.STRING, 0);
|
||||
for (String player : players) {
|
||||
if (entityTracker.isAutoTeam() && player.equalsIgnoreCase(myName)) {
|
||||
if (mode == 4) {
|
||||
// since removing add to auto team
|
||||
entityTracker.sendTeamPacket(true, false);
|
||||
|
||||
entityTracker.setCurrentTeam("viaversion");
|
||||
} else {
|
||||
// since adding remove from auto team
|
||||
entityTracker.sendTeamPacket(false, true);
|
||||
entityTracker.setCurrentTeam(teamName);
|
||||
}
|
||||
}
|
||||
}
|
||||
wrapper.write(Type.STRING_ARRAY, players);
|
||||
}
|
||||
|
||||
if (mode == 1) { // Remove team
|
||||
final EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
String teamName = wrapper.get(Type.STRING, 0);
|
||||
if (entityTracker.isAutoTeam()
|
||||
&& teamName.equals(entityTracker.getCurrentTeam())) {
|
||||
// team was removed
|
||||
entityTracker.sendTeamPacket(true, false);
|
||||
entityTracker.setCurrentTeam("viaversion");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -190,6 +203,21 @@ public class PlayerPackets {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Scoreboard will be cleared when join game is received
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
if (Via.getConfig().isAutoTeam()) {
|
||||
entityTracker.setAutoTeam(true);
|
||||
entityTracker.sendTeamPacket(true, false);
|
||||
entityTracker.setCurrentTeam("viaversion");
|
||||
} else {
|
||||
entityTracker.setAutoTeam(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -212,23 +212,6 @@ public class WorldPackets {
|
||||
}
|
||||
});
|
||||
|
||||
// Server Difficulty Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x41, 0x0D, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
if (Via.getConfig().isAutoTeam()) {
|
||||
EntityTracker entityTracker = wrapper.user().get(EntityTracker.class);
|
||||
entityTracker.setAutoTeam(true);
|
||||
entityTracker.sendTeamPacket(true, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Block Change Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x23, 0x0B, new PacketRemapper() {
|
||||
@Override
|
||||
@ -241,6 +224,7 @@ public class WorldPackets {
|
||||
|
||||
protocol.registerOutgoing(State.PLAY, 0x25, 0x08); // Block Break Animation Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x24, 0x0A); // Block Action Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x41, 0x0D); // Server Difficulty Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x22, 0x10); // Multi Block Change Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x27, 0x1C); // Explosion Packet
|
||||
protocol.registerOutgoing(State.PLAY, 0x2A, 0x22); // Particle Packet
|
||||
|
@ -53,6 +53,8 @@ public class EntityTracker extends StoredObject {
|
||||
private GameMode gameMode;
|
||||
@Setter
|
||||
private int mainHand;
|
||||
@Setter
|
||||
private String currentTeam;
|
||||
|
||||
public EntityTracker(UserConnection user) {
|
||||
super(user);
|
||||
|
@ -17,7 +17,7 @@ import java.util.UUID;
|
||||
public class UpdateUtil {
|
||||
|
||||
public final static String PREFIX = ChatColor.GREEN + "" + ChatColor.BOLD + "[ViaVersion] " + ChatColor.GREEN;
|
||||
private final static String URL = "http://api.spiget.org/v2/resources/";
|
||||
private final static String URL = "https://api.spiget.org/v2/resources/";
|
||||
private final static int PLUGIN = 19254;
|
||||
private final static String LATEST_VERSION = "/versions/latest";
|
||||
|
||||
|
753
common/src/main/resources/assets/viaversion/data/blockIds1.12to1.13.json
Normale Datei
753
common/src/main/resources/assets/viaversion/data/blockIds1.12to1.13.json
Normale Datei
@ -0,0 +1,753 @@
|
||||
// Data from https://minecraft.gamepedia.com/1.13/Flattening
|
||||
{
|
||||
"wooden_slab": [
|
||||
"oak_slab",
|
||||
"spruce_slab",
|
||||
"birch_slab",
|
||||
"jungle_slab",
|
||||
"acacia_slab",
|
||||
"dark_oak_slab"
|
||||
],
|
||||
"red_sandstone": [
|
||||
"red_sandstone",
|
||||
"chiseled_red_sandstone",
|
||||
"cut_red_sandstone"
|
||||
],
|
||||
"lit_pumpkin": [
|
||||
"jack_o_lantern"
|
||||
],
|
||||
"magma": [
|
||||
"magma_block"
|
||||
],
|
||||
"silver_glazed_terracotta": [
|
||||
"light_gray_glazed_terracotta"
|
||||
],
|
||||
"double_stone_slab2": [
|
||||
"red_sandstone_slab",
|
||||
"smooth_red_sandstone"
|
||||
],
|
||||
"standing_sign": [
|
||||
"sign"
|
||||
],
|
||||
"stained_glass_pane": [
|
||||
"white_stained_glass_pane",
|
||||
"orange_stained_glass_pane",
|
||||
"magenta_stained_glass_pane",
|
||||
"light_blue_stained_glass_pane",
|
||||
"yellow_stained_glass_pane",
|
||||
"lime_stained_glass_pane",
|
||||
"pink_stained_glass_pane",
|
||||
"gray_stained_glass_pane",
|
||||
"light_gray_stained_glass_pane",
|
||||
"cyan_stained_glass_pane",
|
||||
"purple_stained_glass_pane",
|
||||
"blue_stained_glass_pane",
|
||||
"brown_stained_glass_pane",
|
||||
"green_stained_glass_pane",
|
||||
"red_stained_glass_pane",
|
||||
"black_stained_glass_pane"
|
||||
],
|
||||
"hardened_clay": [
|
||||
"terracotta"
|
||||
],
|
||||
"portal": [
|
||||
"nether_portal"
|
||||
],
|
||||
"leaves2": [
|
||||
"acacia_leaves",
|
||||
"dark_oak_leaves"
|
||||
],
|
||||
"piston_extension": [
|
||||
"moving_piston"
|
||||
],
|
||||
"concrete_powder": [
|
||||
"white_concrete_powder",
|
||||
"orange_concrete_powder",
|
||||
"magenta_concrete_powder",
|
||||
"light_blue_concrete_powder",
|
||||
"yellow_concrete_powder",
|
||||
"lime_concrete_powder",
|
||||
"pink_concrete_powder",
|
||||
"gray_concrete_powder",
|
||||
"light_gray_concrete_powder",
|
||||
"cyan_concrete_powder",
|
||||
"purple_concrete_powder",
|
||||
"blue_concrete_powder",
|
||||
"brown_concrete_powder",
|
||||
"green_concrete_powder",
|
||||
"red_concrete_powder",
|
||||
"black_concrete_powder"
|
||||
],
|
||||
"powered_repeater": [
|
||||
"repeater"
|
||||
],
|
||||
"record_wait": [
|
||||
"music_disc_wait"
|
||||
],
|
||||
"waterlily": [
|
||||
"lily_pad"
|
||||
],
|
||||
"record_chirp": [
|
||||
"music_disc_chirp"
|
||||
],
|
||||
"nether_brick": [
|
||||
"nether_bricks"
|
||||
],
|
||||
"record_ward": [
|
||||
"music_disc_ward"
|
||||
],
|
||||
"flowing_lava": [
|
||||
"lava"
|
||||
],
|
||||
"trapdoor": [
|
||||
"oak_trapdoor"
|
||||
],
|
||||
"stone_slab2": [
|
||||
"red_sandstone_slab",
|
||||
"smooth_red_sandstone"
|
||||
],
|
||||
"record_cat": [
|
||||
"music_disc_cat"
|
||||
],
|
||||
"mob_spawner": [
|
||||
"spawner"
|
||||
],
|
||||
"sponge": [
|
||||
"sponge",
|
||||
"wet_sponge"
|
||||
],
|
||||
"log": [
|
||||
"oak_log",
|
||||
"spruce_log",
|
||||
"birch_log",
|
||||
"jungle_log",
|
||||
"oak_wood",
|
||||
"spruce_wood",
|
||||
"birch_wood",
|
||||
"jungle_wood"
|
||||
],
|
||||
"anvil": [
|
||||
"anvil",
|
||||
"chipped_anvil",
|
||||
"damaged_anvil"
|
||||
],
|
||||
"daylight_detector": [
|
||||
"daylight_detector"
|
||||
],
|
||||
"cooked_fish": [
|
||||
"cooked_cod",
|
||||
"cooked_salmon"
|
||||
],
|
||||
"lit_redstone_lamp": [
|
||||
"redstone_lamp"
|
||||
],
|
||||
"daylight_detector_inverted": [
|
||||
"daylight_detector"
|
||||
],
|
||||
"deadbush": [
|
||||
"dead_bush"
|
||||
],
|
||||
"fireworks": [
|
||||
"firework_rocket"
|
||||
],
|
||||
"sandstone": [
|
||||
"sandstone",
|
||||
"chiseled_sandstone",
|
||||
"cut_sandstone"
|
||||
],
|
||||
"end_bricks": [
|
||||
"end_stone_bricks"
|
||||
],
|
||||
"slime": [
|
||||
"slime_block"
|
||||
],
|
||||
"web": [
|
||||
"cobweb"
|
||||
],
|
||||
"grass": [
|
||||
"grass_block"
|
||||
],
|
||||
"unpowered_repeater": [
|
||||
"repeater"
|
||||
],
|
||||
"quartz_block": [
|
||||
"quartz_block",
|
||||
"chiseled_quartz_block",
|
||||
"quartz_pillar"
|
||||
],
|
||||
"brick_block": [
|
||||
"bricks"
|
||||
],
|
||||
"netherbrick": [
|
||||
"nether_brick"
|
||||
],
|
||||
"log2": [
|
||||
"acacia_log",
|
||||
"dark_oak_log",
|
||||
"acacia_wood",
|
||||
"dark_oak_wood"
|
||||
],
|
||||
"double_stone_slab": [
|
||||
"stone_slab",
|
||||
"sandstone_slab",
|
||||
"petrified_oak_slab",
|
||||
"cobblestone_slab",
|
||||
"brick_slab",
|
||||
"stone_brick_slab",
|
||||
"nether_brick_slab",
|
||||
"quartz_slab",
|
||||
"smooth_stone",
|
||||
"smooth_sandstone",
|
||||
"smooth_quartz"
|
||||
],
|
||||
"quartz_ore": [
|
||||
"nether_quartz_ore"
|
||||
],
|
||||
"golden_apple": [
|
||||
"golden_apple",
|
||||
"enchanted_golden_apple"
|
||||
],
|
||||
"pumpkin_stem": [
|
||||
"pumpkin_stem",
|
||||
"attached_pumpkin_stem"
|
||||
],
|
||||
"stained_glass": [
|
||||
"white_stained_glass",
|
||||
"orange_stained_glass",
|
||||
"magenta_stained_glass",
|
||||
"light_blue_stained_glass",
|
||||
"yellow_stained_glass",
|
||||
"lime_stained_glass",
|
||||
"pink_stained_glass",
|
||||
"gray_stained_glass",
|
||||
"light_gray_stained_glass",
|
||||
"cyan_stained_glass",
|
||||
"purple_stained_glass",
|
||||
"blue_stained_glass",
|
||||
"brown_stained_glass",
|
||||
"green_stained_glass",
|
||||
"red_stained_glass",
|
||||
"black_stained_glass"
|
||||
],
|
||||
"double_wooden_slab": [
|
||||
"oak_slab",
|
||||
"spruce_slab",
|
||||
"birch_slab",
|
||||
"jungle_slab",
|
||||
"acacia_slab",
|
||||
"dark_oak_slab"
|
||||
],
|
||||
"torch": [
|
||||
"wall_torch",
|
||||
"torch"
|
||||
],
|
||||
"cobblestone_wall": [
|
||||
"cobblestone_wall",
|
||||
"mossy_cobblestone_wall"
|
||||
],
|
||||
"boat": [
|
||||
"oak_boat"
|
||||
],
|
||||
"planks": [
|
||||
"oak_planks",
|
||||
"spruce_planks",
|
||||
"birch_planks",
|
||||
"jungle_planks",
|
||||
"acacia_planks",
|
||||
"dark_oak_planks"
|
||||
],
|
||||
"comparator": [
|
||||
"comparator"
|
||||
],
|
||||
"dye": [
|
||||
"bone_meal",
|
||||
"orange_dye",
|
||||
"magenta_dye",
|
||||
"light_blue_dye",
|
||||
"dandelion_yellow",
|
||||
"lime_dye",
|
||||
"pink_dye",
|
||||
"gray_dye",
|
||||
"light_gray_dye",
|
||||
"cyan_dye",
|
||||
"purple_dye",
|
||||
"lapis_lazuli",
|
||||
"cocoa_beans",
|
||||
"cactus_green",
|
||||
"rose_red",
|
||||
"ink_sac"
|
||||
],
|
||||
"speckled_melon": [
|
||||
"glistering_melon_slice"
|
||||
],
|
||||
"red_mushroom_block": [
|
||||
"brown_mushroom_block",
|
||||
"mushroom_stem",
|
||||
"red_mushroom_block"
|
||||
],
|
||||
"firework_charge": [
|
||||
"firework_star"
|
||||
],
|
||||
"fish": [
|
||||
"cod",
|
||||
"salmon",
|
||||
"tropical_fish",
|
||||
"pufferfish"
|
||||
],
|
||||
"wall_banner": [
|
||||
"white_wall_banner",
|
||||
"orange_wall_banner",
|
||||
"magenta_wall_banner",
|
||||
"light_blue_wall_banner",
|
||||
"yellow_wall_banner",
|
||||
"lime_wall_banner",
|
||||
"pink_wall_banner",
|
||||
"gray_wall_banner",
|
||||
"light_gray_wall_banner",
|
||||
"cyan_wall_banner",
|
||||
"purple_wall_banner",
|
||||
"blue_wall_banner",
|
||||
"brown_wall_banner",
|
||||
"green_wall_banner",
|
||||
"red_wall_banner",
|
||||
"black_wall_banner"
|
||||
],
|
||||
"record_mellohi": [
|
||||
"music_disc_mellohi"
|
||||
],
|
||||
"melon_block": [
|
||||
"melon"
|
||||
],
|
||||
"stonebrick": [
|
||||
"stone_bricks",
|
||||
"mossy_stone_bricks",
|
||||
"cracked_stone_bricks",
|
||||
"chiseled_stone_bricks"
|
||||
],
|
||||
"repeater": [
|
||||
"repeater"
|
||||
],
|
||||
"silver_shulker_box": [
|
||||
"light_gray_shulker_box"
|
||||
],
|
||||
"bed": [
|
||||
"white_bed",
|
||||
"orange_bed",
|
||||
"magenta_bed",
|
||||
"light_blue_bed",
|
||||
"yellow_bed",
|
||||
"lime_bed",
|
||||
"pink_bed",
|
||||
"gray_bed",
|
||||
"light_gray_bed",
|
||||
"cyan_bed",
|
||||
"purple_bed",
|
||||
"blue_bed",
|
||||
"brown_bed",
|
||||
"green_bed",
|
||||
"red_bed",
|
||||
"black_bed"
|
||||
],
|
||||
"prismarine": [
|
||||
"prismarine",
|
||||
"prismarine_bricks",
|
||||
"dark_prismarine"
|
||||
],
|
||||
"wool": [
|
||||
"white_wool",
|
||||
"orange_wool",
|
||||
"magenta_wool",
|
||||
"light_blue_wool",
|
||||
"yellow_wool",
|
||||
"lime_wool",
|
||||
"pink_wool",
|
||||
"gray_wool",
|
||||
"light_gray_wool",
|
||||
"cyan_wool",
|
||||
"purple_wool",
|
||||
"blue_wool",
|
||||
"brown_wool",
|
||||
"green_wool",
|
||||
"red_wool",
|
||||
"black_wool"
|
||||
],
|
||||
"double_purpur_slab": [
|
||||
"purpur_slab"
|
||||
],
|
||||
"furnace": [
|
||||
"furnace"
|
||||
],
|
||||
"redstone_ore": [
|
||||
"redstone_ore"
|
||||
],
|
||||
"red_flower": [
|
||||
"poppy",
|
||||
"blue_orchid",
|
||||
"allium",
|
||||
"azure_bluet",
|
||||
"red_tulip",
|
||||
"orange_tulip",
|
||||
"white_tulip",
|
||||
"pink_tulip",
|
||||
"oxeye_daisy"
|
||||
],
|
||||
"lit_redstone_ore": [
|
||||
"redstone_ore"
|
||||
],
|
||||
"tallgrass": [
|
||||
"dead_bush",
|
||||
"grass",
|
||||
"fern"
|
||||
],
|
||||
"sign": [
|
||||
"sign"
|
||||
],
|
||||
"spawn_egg": [
|
||||
"bat_spawn_egg",
|
||||
"blaze_spawn_egg",
|
||||
"cave_spider_spawn_egg",
|
||||
"chicken_spawn_egg",
|
||||
"cow_spawn_egg",
|
||||
"creeper_spawn_egg",
|
||||
"donkey_spawn_egg",
|
||||
"elder_guardian_spawn_egg",
|
||||
"enderman_spawn_egg",
|
||||
"endermite_spawn_egg",
|
||||
"evoker_spawn_egg",
|
||||
"ghast_spawn_egg",
|
||||
"guardian_spawn_egg",
|
||||
"horse_spawn_egg",
|
||||
"husk_spawn_egg",
|
||||
"llama_spawn_egg",
|
||||
"magma_cube_spawn_egg",
|
||||
"mooshroom_spawn_egg",
|
||||
"mule_spawn_egg",
|
||||
"ocelot_spawn_egg",
|
||||
"parrot_spawn_egg",
|
||||
"pig_spawn_egg",
|
||||
"polar_bear_spawn_egg",
|
||||
"rabbit_spawn_egg",
|
||||
"sheep_spawn_egg",
|
||||
"shulker_spawn_egg",
|
||||
"silverfish_spawn_egg",
|
||||
"skeleton_spawn_egg",
|
||||
"skeleton_horse_spawn_egg",
|
||||
"slime_spawn_egg",
|
||||
"spider_spawn_egg",
|
||||
"squid_spawn_egg",
|
||||
"stray_spawn_egg",
|
||||
"vex_spawn_egg",
|
||||
"villager_spawn_egg",
|
||||
"vindicator_spawn_egg",
|
||||
"witch_spawn_egg",
|
||||
"wither_skeleton_spawn_egg",
|
||||
"wolf_spawn_egg",
|
||||
"zombie_spawn_egg",
|
||||
"zombie_horse_spawn_egg",
|
||||
"zombie_pigman_spawn_egg",
|
||||
"zombie_villager_spawn_egg"
|
||||
],
|
||||
"wooden_door": [
|
||||
"oak_door"
|
||||
],
|
||||
"stone_slab": [
|
||||
"stone_slab",
|
||||
"sandstone_slab",
|
||||
"petrified_oak_slab",
|
||||
"cobblestone_slab",
|
||||
"brick_slab",
|
||||
"stone_brick_slab",
|
||||
"nether_brick_slab",
|
||||
"quartz_slab",
|
||||
"smooth_stone",
|
||||
"smooth_sandstone",
|
||||
"smooth_quartz"
|
||||
],
|
||||
"unpowered_comparator": [
|
||||
"comparator"
|
||||
],
|
||||
"leaves": [
|
||||
"oak_leaves",
|
||||
"spruce_leaves",
|
||||
"birch_leaves",
|
||||
"jungle_leaves"
|
||||
],
|
||||
"noteblock": [
|
||||
"note_block"
|
||||
],
|
||||
"sapling": [
|
||||
"oak_sapling",
|
||||
"spruce_sapling",
|
||||
"birch_sapling",
|
||||
"jungle_sapling",
|
||||
"acacia_sapling",
|
||||
"dark_oak_sapling"
|
||||
],
|
||||
"melon": [
|
||||
"melon_slice"
|
||||
],
|
||||
"wooden_button": [
|
||||
"oak_button"
|
||||
],
|
||||
"golden_rail": [
|
||||
"powered_rail"
|
||||
],
|
||||
"redstone_torch": [
|
||||
"redstone_wall_torch",
|
||||
"redstone_torch"
|
||||
],
|
||||
"stone_stairs": [
|
||||
"cobblestone_stairs"
|
||||
],
|
||||
"dirt": [
|
||||
"dirt",
|
||||
"coarse_dirt",
|
||||
"podzol"
|
||||
],
|
||||
"wooden_pressure_plate": [
|
||||
"oak_pressure_plate"
|
||||
],
|
||||
"powered_comparator": [
|
||||
"comparator"
|
||||
],
|
||||
"water": [
|
||||
"water"
|
||||
],
|
||||
"sand": [
|
||||
"sand",
|
||||
"red_sand"
|
||||
],
|
||||
"flowing_water": [
|
||||
"water"
|
||||
],
|
||||
"snow": [
|
||||
"snow_block"
|
||||
],
|
||||
"carpet": [
|
||||
"white_carpet",
|
||||
"orange_carpet",
|
||||
"magenta_carpet",
|
||||
"light_blue_carpet",
|
||||
"yellow_carpet",
|
||||
"lime_carpet",
|
||||
"pink_carpet",
|
||||
"gray_carpet",
|
||||
"light_gray_carpet",
|
||||
"cyan_carpet",
|
||||
"purple_carpet",
|
||||
"blue_carpet",
|
||||
"brown_carpet",
|
||||
"green_carpet",
|
||||
"red_carpet",
|
||||
"black_carpet"
|
||||
],
|
||||
"lit_furnace": [
|
||||
"furnace"
|
||||
],
|
||||
"coal": [
|
||||
"coal",
|
||||
"charcoal"
|
||||
],
|
||||
"concrete": [
|
||||
"white_concrete",
|
||||
"orange_concrete",
|
||||
"magenta_concrete",
|
||||
"light_blue_concrete",
|
||||
"yellow_concrete",
|
||||
"lime_concrete",
|
||||
"pink_concrete",
|
||||
"gray_concrete",
|
||||
"light_gray_concrete",
|
||||
"cyan_concrete",
|
||||
"purple_concrete",
|
||||
"blue_concrete",
|
||||
"brown_concrete",
|
||||
"green_concrete",
|
||||
"red_concrete",
|
||||
"black_concrete"
|
||||
],
|
||||
"record_mall": [
|
||||
"music_disc_mall"
|
||||
],
|
||||
"monster_egg": [
|
||||
"infested_stone",
|
||||
"infested_cobblestone",
|
||||
"infested_stone_bricks",
|
||||
"infested_mossy_stone_bricks",
|
||||
"infested_cracked_stone_bricks",
|
||||
"infested_chiseled_stone_bricks"
|
||||
],
|
||||
"fence_gate": [
|
||||
"oak_fence_gate"
|
||||
],
|
||||
"standing_banner": [
|
||||
"white_banner",
|
||||
"orange_banner",
|
||||
"magenta_banner",
|
||||
"light_blue_banner",
|
||||
"yellow_banner",
|
||||
"lime_banner",
|
||||
"pink_banner",
|
||||
"gray_banner",
|
||||
"light_gray_banner",
|
||||
"cyan_banner",
|
||||
"purple_banner",
|
||||
"blue_banner",
|
||||
"brown_banner",
|
||||
"green_banner",
|
||||
"red_banner",
|
||||
"black_banner"
|
||||
],
|
||||
"record_blocks": [
|
||||
"music_disc_blocks"
|
||||
],
|
||||
"unlit_redstone_torch": [
|
||||
"redstone_wall_torch",
|
||||
"redstone_torch"
|
||||
],
|
||||
"lava": [
|
||||
"lava"
|
||||
],
|
||||
"reeds": [
|
||||
"sugar_cane"
|
||||
],
|
||||
"chorus_fruit_popped": [
|
||||
"popped_chorus_fruit"
|
||||
],
|
||||
"redstone_lamp": [
|
||||
"redstone_lamp"
|
||||
],
|
||||
"skull": [
|
||||
"skeleton_skull",
|
||||
"skeleton_wall_skull",
|
||||
"wither_skeleton_skull",
|
||||
"wither_skeleton_wall_skull",
|
||||
"zombie_head",
|
||||
"zombie_wall_head",
|
||||
"player_head",
|
||||
"player_wall_head",
|
||||
"creeper_head",
|
||||
"creeper_wall_head",
|
||||
"dragon_head",
|
||||
"dragon_wall_head"
|
||||
],
|
||||
"snow_layer": [
|
||||
"snow"
|
||||
],
|
||||
"stained_hardened_clay": [
|
||||
"white_terracotta",
|
||||
"orange_terracotta",
|
||||
"magenta_terracotta",
|
||||
"light_blue_terracotta",
|
||||
"yellow_terracotta",
|
||||
"lime_terracotta",
|
||||
"pink_terracotta",
|
||||
"gray_terracotta",
|
||||
"light_gray_terracotta",
|
||||
"cyan_terracotta",
|
||||
"purple_terracotta",
|
||||
"blue_terracotta",
|
||||
"brown_terracotta",
|
||||
"green_terracotta",
|
||||
"red_terracotta",
|
||||
"black_terracotta"
|
||||
],
|
||||
"double_plant": [
|
||||
"sunflower",
|
||||
"lilac",
|
||||
"tall_grass",
|
||||
"large_fern",
|
||||
"rose_bush",
|
||||
"peony"
|
||||
],
|
||||
"record_strad": [
|
||||
"music_disc_strad"
|
||||
],
|
||||
"brown_mushroom_block": [
|
||||
"brown_mushroom_block",
|
||||
"mushroom_stem",
|
||||
"red_mushroom_block"
|
||||
],
|
||||
"flower_pot": [
|
||||
"flower_pot",
|
||||
"potted_poppy",
|
||||
"potted_dandelion",
|
||||
"potted_oak_sapling",
|
||||
"potted_spruce_sapling",
|
||||
"potted_birch_sapling",
|
||||
"potted_jungle_sapling",
|
||||
"potted_red_mushroom",
|
||||
"potted_brown_mushroom",
|
||||
"potted_cactus",
|
||||
"potted_dead_bush",
|
||||
"potted_fern",
|
||||
"potted_acacia_sapling",
|
||||
"potted_dark_oak_sapling",
|
||||
"potted_blue_orchid",
|
||||
"potted_allium",
|
||||
"potted_azure_bluet",
|
||||
"potted_red_tulip",
|
||||
"potted_orange_tulip",
|
||||
"potted_white_tulip",
|
||||
"potted_pink_tulip",
|
||||
"potted_oxeye_daisy"
|
||||
],
|
||||
"melon_stem": [
|
||||
"melon_stem",
|
||||
"attached_melon_stem"
|
||||
],
|
||||
"record_13": [
|
||||
"music_disc_13"
|
||||
],
|
||||
"banner": [
|
||||
"white_banner",
|
||||
"orange_banner",
|
||||
"magenta_banner",
|
||||
"light_blue_banner",
|
||||
"yellow_banner",
|
||||
"lime_banner",
|
||||
"pink_banner",
|
||||
"gray_banner",
|
||||
"light_gray_banner",
|
||||
"cyan_banner",
|
||||
"purple_banner",
|
||||
"blue_banner",
|
||||
"brown_banner",
|
||||
"green_banner",
|
||||
"red_banner",
|
||||
"black_banner"
|
||||
],
|
||||
"stone": [
|
||||
"stone",
|
||||
"granite",
|
||||
"polished_granite",
|
||||
"diorite",
|
||||
"polished_diorite",
|
||||
"andesite",
|
||||
"polished_andesite"
|
||||
],
|
||||
"yellow_flower": [
|
||||
"dandelion"
|
||||
],
|
||||
"record_11": [
|
||||
"music_disc_11"
|
||||
],
|
||||
"purpur_slab": [
|
||||
"purpur_slab"
|
||||
],
|
||||
"red_nether_brick": [
|
||||
"red_nether_bricks"
|
||||
],
|
||||
"record_far": [
|
||||
"music_disc_far"
|
||||
],
|
||||
"record_stal": [
|
||||
"music_disc_stal"
|
||||
],
|
||||
"fence": [
|
||||
"oak_fence"
|
||||
],
|
||||
"pumpkin": [
|
||||
"carved_pumpkin"
|
||||
]
|
||||
}
|
22265
common/src/main/resources/assets/viaversion/data/itemrecipes1_12_2to1_13.json
Normale Datei
22265
common/src/main/resources/assets/viaversion/data/itemrecipes1_12_2to1_13.json
Normale Datei
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -54,7 +54,7 @@
|
||||
<shadedPattern>us.myles.viaversion.libs.gson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.javassist</pattern>
|
||||
<pattern>javassist</pattern>
|
||||
<shadedPattern>us.myles.viaversion.libs.javassist</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
|
@ -1,8 +1,11 @@
|
||||
package us.myles.ViaVersion.velocity.platform;
|
||||
|
||||
import com.velocitypowered.api.network.ProtocolVersion;
|
||||
import com.velocitypowered.api.proxy.InboundConnection;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.NonNull;
|
||||
import us.myles.ViaVersion.VelocityPlugin;
|
||||
import us.myles.ViaVersion.api.Via;
|
||||
import us.myles.ViaVersion.api.ViaAPI;
|
||||
import us.myles.ViaVersion.api.boss.BossBar;
|
||||
@ -21,14 +24,18 @@ public class VelocityViaAPI implements ViaAPI<Player> {
|
||||
@Override
|
||||
public int getPlayerVersion(@NonNull Player player) {
|
||||
if (!isPorted(player.getUniqueId()))
|
||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
||||
return player.getProtocolVersion().getProtocol();
|
||||
return getPortedPlayers().get(player.getUniqueId()).get(ProtocolInfo.class).getProtocolVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPlayerVersion(@NonNull UUID uuid) {
|
||||
if (!isPorted(uuid))
|
||||
return ProtocolRegistry.SERVER_PROTOCOL;
|
||||
if (!isPorted(uuid)) {
|
||||
return VelocityPlugin.PROXY.getPlayer(uuid)
|
||||
.map(InboundConnection::getProtocolVersion)
|
||||
.map(ProtocolVersion::getProtocol)
|
||||
.orElse(ProtocolRegistry.SERVER_PROTOCOL);
|
||||
}
|
||||
return getPortedPlayers().get(uuid).get(ProtocolInfo.class).getProtocolVersion();
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
public class VelocityViaConfig extends Config implements ViaVersionConfig {
|
||||
private static List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers");
|
||||
private static List<String> UNSUPPORTED = Arrays.asList("nms-player-ticking", "item-cache", "anti-xray-patch", "quick-move-action-fix", "bungee-ping-interval", "bungee-ping-save", "bungee-servers", "blockconnection-method");
|
||||
|
||||
public VelocityViaConfig(File configFile) {
|
||||
super(new File(configFile, "config.yml"));
|
||||
|
@ -8,27 +8,24 @@ import us.myles.ViaVersion.protocols.base.ProtocolInfo;
|
||||
import us.myles.ViaVersion.protocols.base.VersionProvider;
|
||||
import us.myles.ViaVersion.velocity.platform.VelocityViaInjector;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class VelocityVersionProvider extends VersionProvider {
|
||||
private static final List<Integer> VELOCITY_PROTOCOLS = com.velocitypowered.api.network.ProtocolVersion.SUPPORTED_VERSIONS.stream()
|
||||
.map(com.velocitypowered.api.network.ProtocolVersion::getProtocol)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@Override
|
||||
public int getServerProtocol(UserConnection user) throws Exception {
|
||||
// TODO Have one constant list forever until restart? (Might limit plugins if they change this)
|
||||
List<Integer> sorted = new ArrayList<>(com.velocitypowered.api.network.ProtocolVersion.ID_TO_PROTOCOL_CONSTANT.keySet());
|
||||
sorted.remove(Integer.valueOf(-1)); // Unknown/legacy
|
||||
Collections.sort(sorted);
|
||||
|
||||
int playerVersion = user.get(ProtocolInfo.class).getProtocolVersion();
|
||||
|
||||
// Bungee supports it
|
||||
if (sorted.contains(playerVersion))
|
||||
if (Collections.binarySearch(VELOCITY_PROTOCOLS, playerVersion) >= 0)
|
||||
return playerVersion;
|
||||
|
||||
// Older than bungee supports, get the lowest version
|
||||
if (playerVersion < sorted.get(0)) {
|
||||
if (playerVersion < VELOCITY_PROTOCOLS.get(0)) {
|
||||
return VelocityViaInjector.getLowestSupportedProtocolVersion();
|
||||
}
|
||||
|
||||
@ -36,7 +33,7 @@ public class VelocityVersionProvider extends VersionProvider {
|
||||
|
||||
// TODO: This needs a better fix, i.e checking ProtocolRegistry to see if it would work.
|
||||
// This is more of a workaround for snapshot support by bungee.
|
||||
for (Integer protocol : Lists.reverse(sorted)) {
|
||||
for (Integer protocol : Lists.reverse(VELOCITY_PROTOCOLS)) {
|
||||
if (playerVersion > protocol && ProtocolVersion.isRegistered(protocol))
|
||||
return protocol;
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren