Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-07 16:50:14 +01:00
Merge pull request #1503 from creeper123123321/abstraction-update
Abstraction update
Dieser Commit ist enthalten in:
Commit
a7d78f7f69
@ -11,3 +11,5 @@ cache:
|
||||
script:
|
||||
- mvn dependency:purge-local-repository -DactTransitively=false -DreResolve=false
|
||||
- mvn clean install -B -U
|
||||
|
||||
install: true
|
||||
|
@ -77,7 +77,7 @@ public class ProtocolVersion {
|
||||
register(v1_14_2 = new ProtocolVersion(485, "1.14.2"));
|
||||
register(v1_14_3 = new ProtocolVersion(490, "1.14.3"));
|
||||
register(v1_14_4 = new ProtocolVersion(498, "1.14.4"));
|
||||
register(v1_15 = new ProtocolVersion(556, "1.15"));
|
||||
register(v1_15 = new ProtocolVersion(560, "1.15"));
|
||||
register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import us.myles.ViaVersion.api.data.UserConnection;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
@ -20,23 +21,30 @@ public class ChatItemRewriter {
|
||||
if (hoverEvent.has("action") && hoverEvent.has("value")) {
|
||||
String type = hoverEvent.get("action").getAsString();
|
||||
if (type.equals("show_item") || type.equals("show_entity")) {
|
||||
if (hoverEvent.get("value").isJsonPrimitive()) {
|
||||
if (hoverEvent.get("value").getAsJsonPrimitive().isString()) {
|
||||
String value = hoverEvent.get("value").getAsString();
|
||||
value = indexRemoval.matcher(value).replaceAll("");
|
||||
hoverEvent.addProperty("value", value);
|
||||
JsonElement value = hoverEvent.get("value");
|
||||
|
||||
if (value.isJsonPrimitive() && value.getAsJsonPrimitive().isString()) {
|
||||
String newValue = indexRemoval.matcher(value.getAsString()).replaceAll("");
|
||||
hoverEvent.addProperty("value", newValue);
|
||||
} else if (value.isJsonArray()) {
|
||||
JsonArray newArray = new JsonArray();
|
||||
|
||||
for (JsonElement valueElement : value.getAsJsonArray()) {
|
||||
if (valueElement.isJsonPrimitive() && valueElement.getAsJsonPrimitive().isString()) {
|
||||
String newValue = indexRemoval.matcher(valueElement.getAsString()).replaceAll("");
|
||||
newArray.add(new JsonPrimitive(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
hoverEvent.add("value", newArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (obj.has("extra")) {
|
||||
toClient(obj.get("extra"), user);
|
||||
}
|
||||
} else if (obj.has("extra")) {
|
||||
toClient(obj.get("extra"), user);
|
||||
}
|
||||
}
|
||||
if (element instanceof JsonArray) {
|
||||
} else if (element instanceof JsonArray) {
|
||||
JsonArray array = (JsonArray) element;
|
||||
for (JsonElement value : array) {
|
||||
toClient(value, user);
|
||||
|
@ -108,7 +108,7 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
};
|
||||
|
||||
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
||||
protected final static EnumMap<ChatColor, Character> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<>(ChatColor.class);
|
||||
protected static final EnumMap<ChatColor, Character> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<>(ChatColor.class);
|
||||
|
||||
static {
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.BLACK, 'g');
|
||||
@ -127,6 +127,13 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.LIGHT_PURPLE, 'z');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.YELLOW, '!');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.WHITE, '?');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.MAGIC, '#');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.BOLD, '(');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.STRIKETHROUGH, ')');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.UNDERLINE, ':');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.ITALIC, ';');
|
||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.RESET, '/');
|
||||
|
||||
MappingData.init();
|
||||
ConnectionData.init();
|
||||
RecipeData.init();
|
||||
|
@ -61,27 +61,28 @@ public class EntityPackets {
|
||||
protocol.registerOutgoing(State.PLAY, 0x03, 0x03, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Type.UUID); // 1 - Entity UUID
|
||||
map(Type.VAR_INT); // 2 - Entity Type
|
||||
map(Type.DOUBLE); // 3 - X
|
||||
map(Type.DOUBLE); // 4 - Y
|
||||
map(Type.DOUBLE); // 5 - Z
|
||||
map(Type.BYTE); // 6 - Yaw
|
||||
map(Type.BYTE); // 7 - Pitch
|
||||
map(Type.BYTE); // 8 - Head Pitch
|
||||
map(Type.SHORT); // 9 - Velocity X
|
||||
map(Type.SHORT); // 10 - Velocity Y
|
||||
map(Type.SHORT); // 11 - Velocity Z
|
||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.passthrough(Type.UUID);
|
||||
|
||||
int typeId = wrapper.read(Type.VAR_INT);
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
int typeId = wrapper.get(Type.VAR_INT, 1);
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
|
||||
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
||||
wrapper.write(Type.VAR_INT, entityType.getId());
|
||||
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
wrapper.passthrough(Type.SHORT);
|
||||
wrapper.passthrough(Type.SHORT);
|
||||
wrapper.passthrough(Type.SHORT);
|
||||
wrapper.read(Types1_14.METADATA_LIST); // removed - probably sent in an update packet?
|
||||
wrapper.set(Type.VAR_INT, 1, entityType.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -91,23 +92,22 @@ public class EntityPackets {
|
||||
protocol.registerOutgoing(State.PLAY, 0x05, 0x05, new PacketRemapper() {
|
||||
@Override
|
||||
public void registerMap() {
|
||||
map(Type.VAR_INT); // 0 - Entity ID
|
||||
map(Type.UUID); // 1 - Player UUID
|
||||
map(Type.DOUBLE); // 2 - X
|
||||
map(Type.DOUBLE); // 3 - Y
|
||||
map(Type.DOUBLE); // 4 - Z
|
||||
map(Type.BYTE); // 5 - Yaw
|
||||
map(Type.BYTE); // 6 - Pitch
|
||||
map(Types1_14.METADATA_LIST, Type.NOTHING); // removed - probably sent in an update packet?
|
||||
|
||||
handler(new PacketHandler() {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
int entityId = wrapper.passthrough(Type.VAR_INT);
|
||||
wrapper.passthrough(Type.UUID);
|
||||
int entityId = wrapper.get(Type.VAR_INT, 0);
|
||||
|
||||
int typeId = wrapper.read(Type.VAR_INT);
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.getTypeFromId(getNewEntityId(typeId));
|
||||
Entity1_15Types.EntityType entityType = Entity1_15Types.EntityType.PLAYER;
|
||||
wrapper.user().get(EntityTracker1_15.class).addEntity(entityId, entityType);
|
||||
wrapper.write(Type.VAR_INT, entityType.getId());
|
||||
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.DOUBLE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
wrapper.passthrough(Type.BYTE);
|
||||
wrapper.read(Types1_14.METADATA); // removed - probably sent in an update packet?
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -11311,30 +11311,32 @@
|
||||
"11308": "minecraft:bee_nest[facing=east,honey_level=3]",
|
||||
"11309": "minecraft:bee_nest[facing=east,honey_level=4]",
|
||||
"11310": "minecraft:bee_nest[facing=east,honey_level=5]",
|
||||
"11311": "minecraft:bee_hive[facing=north,honey_level=0]",
|
||||
"11312": "minecraft:bee_hive[facing=north,honey_level=1]",
|
||||
"11313": "minecraft:bee_hive[facing=north,honey_level=2]",
|
||||
"11314": "minecraft:bee_hive[facing=north,honey_level=3]",
|
||||
"11315": "minecraft:bee_hive[facing=north,honey_level=4]",
|
||||
"11316": "minecraft:bee_hive[facing=north,honey_level=5]",
|
||||
"11317": "minecraft:bee_hive[facing=south,honey_level=0]",
|
||||
"11318": "minecraft:bee_hive[facing=south,honey_level=1]",
|
||||
"11319": "minecraft:bee_hive[facing=south,honey_level=2]",
|
||||
"11320": "minecraft:bee_hive[facing=south,honey_level=3]",
|
||||
"11321": "minecraft:bee_hive[facing=south,honey_level=4]",
|
||||
"11322": "minecraft:bee_hive[facing=south,honey_level=5]",
|
||||
"11323": "minecraft:bee_hive[facing=west,honey_level=0]",
|
||||
"11324": "minecraft:bee_hive[facing=west,honey_level=1]",
|
||||
"11325": "minecraft:bee_hive[facing=west,honey_level=2]",
|
||||
"11326": "minecraft:bee_hive[facing=west,honey_level=3]",
|
||||
"11327": "minecraft:bee_hive[facing=west,honey_level=4]",
|
||||
"11328": "minecraft:bee_hive[facing=west,honey_level=5]",
|
||||
"11329": "minecraft:bee_hive[facing=east,honey_level=0]",
|
||||
"11330": "minecraft:bee_hive[facing=east,honey_level=1]",
|
||||
"11331": "minecraft:bee_hive[facing=east,honey_level=2]",
|
||||
"11332": "minecraft:bee_hive[facing=east,honey_level=3]",
|
||||
"11333": "minecraft:bee_hive[facing=east,honey_level=4]",
|
||||
"11334": "minecraft:bee_hive[facing=east,honey_level=5]"
|
||||
"11311": "minecraft:beehive[facing=north,honey_level=0]",
|
||||
"11312": "minecraft:beehive[facing=north,honey_level=1]",
|
||||
"11313": "minecraft:beehive[facing=north,honey_level=2]",
|
||||
"11314": "minecraft:beehive[facing=north,honey_level=3]",
|
||||
"11315": "minecraft:beehive[facing=north,honey_level=4]",
|
||||
"11316": "minecraft:beehive[facing=north,honey_level=5]",
|
||||
"11317": "minecraft:beehive[facing=south,honey_level=0]",
|
||||
"11318": "minecraft:beehive[facing=south,honey_level=1]",
|
||||
"11319": "minecraft:beehive[facing=south,honey_level=2]",
|
||||
"11320": "minecraft:beehive[facing=south,honey_level=3]",
|
||||
"11321": "minecraft:beehive[facing=south,honey_level=4]",
|
||||
"11322": "minecraft:beehive[facing=south,honey_level=5]",
|
||||
"11323": "minecraft:beehive[facing=west,honey_level=0]",
|
||||
"11324": "minecraft:beehive[facing=west,honey_level=1]",
|
||||
"11325": "minecraft:beehive[facing=west,honey_level=2]",
|
||||
"11326": "minecraft:beehive[facing=west,honey_level=3]",
|
||||
"11327": "minecraft:beehive[facing=west,honey_level=4]",
|
||||
"11328": "minecraft:beehive[facing=west,honey_level=5]",
|
||||
"11329": "minecraft:beehive[facing=east,honey_level=0]",
|
||||
"11330": "minecraft:beehive[facing=east,honey_level=1]",
|
||||
"11331": "minecraft:beehive[facing=east,honey_level=2]",
|
||||
"11332": "minecraft:beehive[facing=east,honey_level=3]",
|
||||
"11333": "minecraft:beehive[facing=east,honey_level=4]",
|
||||
"11334": "minecraft:beehive[facing=east,honey_level=5]",
|
||||
"11335": "minecraft:honey_block",
|
||||
"11336": "minecraft:honeycomb_block"
|
||||
},
|
||||
"blocks": {
|
||||
"0": "air",
|
||||
@ -12014,7 +12016,9 @@
|
||||
"674": "jigsaw",
|
||||
"675": "composter",
|
||||
"676": "bee_nest",
|
||||
"677": "bee_hive"
|
||||
"677": "beehive",
|
||||
"678": "honey_block",
|
||||
"679": "honeycomb_block"
|
||||
},
|
||||
"items": {
|
||||
"0": "minecraft:air",
|
||||
@ -12897,8 +12901,10 @@
|
||||
"877": "minecraft:campfire",
|
||||
"878": "minecraft:honeycomb",
|
||||
"879": "minecraft:bee_nest",
|
||||
"880": "minecraft:bee_hive",
|
||||
"881": "minecraft:honey_bottle"
|
||||
"880": "minecraft:beehive",
|
||||
"881": "minecraft:honey_bottle",
|
||||
"882": "minecraft:honey_block",
|
||||
"883": "minecraft:honeycomb_block"
|
||||
},
|
||||
"sounds": [
|
||||
"ambient.cave",
|
||||
@ -13202,6 +13208,12 @@
|
||||
"entity.guardian.hurt",
|
||||
"entity.guardian.hurt_land",
|
||||
"item.hoe.till",
|
||||
"block.honey_block.break",
|
||||
"block.honey_block.fall",
|
||||
"block.honey_block.hit",
|
||||
"block.honey_block.place",
|
||||
"block.honey_block.slide",
|
||||
"block.honey_block.step",
|
||||
"item.honey_bottle.drink",
|
||||
"entity.horse.ambient",
|
||||
"entity.horse.angry",
|
||||
@ -13245,8 +13257,10 @@
|
||||
"block.iron_door.close",
|
||||
"block.iron_door.open",
|
||||
"entity.iron_golem.attack",
|
||||
"entity.iron_golem.damage",
|
||||
"entity.iron_golem.death",
|
||||
"entity.iron_golem.hurt",
|
||||
"entity.iron_golem.repair",
|
||||
"entity.iron_golem.step",
|
||||
"block.iron_trapdoor.close",
|
||||
"block.iron_trapdoor.open",
|
||||
@ -13367,10 +13381,8 @@
|
||||
"entity.parrot.imitate.husk",
|
||||
"entity.parrot.imitate.illusioner",
|
||||
"entity.parrot.imitate.magma_cube",
|
||||
"entity.parrot.imitate.panda",
|
||||
"entity.parrot.imitate.phantom",
|
||||
"entity.parrot.imitate.pillager",
|
||||
"entity.parrot.imitate.polar_bear",
|
||||
"entity.parrot.imitate.ravager",
|
||||
"entity.parrot.imitate.shulker",
|
||||
"entity.parrot.imitate.silverfish",
|
||||
@ -13383,9 +13395,7 @@
|
||||
"entity.parrot.imitate.witch",
|
||||
"entity.parrot.imitate.wither",
|
||||
"entity.parrot.imitate.wither_skeleton",
|
||||
"entity.parrot.imitate.wolf",
|
||||
"entity.parrot.imitate.zombie",
|
||||
"entity.parrot.imitate.zombie_pigman",
|
||||
"entity.parrot.imitate.zombie_villager",
|
||||
"entity.parrot.step",
|
||||
"entity.phantom.ambient",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren