-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Legacy Packet Adapter #59
Conversation
I think we remove the 1.8 adapter and rename this one to just |
Update:
Out of those three:
Removing those and trying to build unfortunately doesn't seem to make it work either. Would guess this works fine for all versions from 1.8 to 1.12.2. Unfortunately not 1.7, may make another PR for those versions. Still begs the question as to if this should be called "legacy" or "1.8-1.12", since if 1.7 requires another adapter that one would need to be named legacy-legacier or smth (depends on if you even want a 1.7- adapter at all in this project) Also completely forgot on the initial comment, but another urgent thing is to get the "v1_8_R3" , "v1_12_R1" from the server version as of rn it's just hardcoded in RandomUtils |
FastBoard supports 1.7.10, we can use it as a reference as to what needs changing. https://github.com/MrMicky-FR/FastBoard/blob/master/src/main/java/fr/mrmicky/fastboard/FastBoardBase.java |
From a quick glance, most likely place that's failing in 1.7 with nothing changed is in sendScore: @Override
public void sendScore(
...
) {
Object packet = packetPlayOutScoreboardScoreConstructor.invoke(entry);
PacketAccessors.SCORE_OBJECTIVE_NAME_FIELD.set(packet, objectiveName);
PacketAccessors.SCORE_VALUE_FIELD.set(packet, value);
// Removed - not in 1.7
// PacketAccessors.SCORE_ACTION_FIELD.set(packet, enumScoreboardActionChange);
sender.sendPacket(players, packet);
} In FastBoard, they still do something for the action field even in 1.7: if (VersionType.V1_8.isHigherOrEqual()) {
Object enumAction = action == ScoreboardAction.REMOVE
? ENUM_SB_ACTION_REMOVE : ENUM_SB_ACTION_CHANGE;
setField(packet, ENUM_SB_ACTION, enumAction);
} else {
setField(packet, int.class, action.ordinal(), 1); // Action
} |
Added this in PacketAccessors: public static final FieldAccessor<Object, Integer> SCORE_ACTION_FIELD_1_7 =
ReflectUtil.findField(packetPlayOutScoreboardScoreClass, 1, int.class); Then in ObjectivePacketAdapterImpl replaced: PacketAccessors.SCORE_ACTION_FIELD.set(packet, enumScoreboardActionChange); with PacketAccessors.SCORE_ACTION_FIELD_1_7.set(packet, 0); // 0 = CHANGE, int value yoinked from FastBoard Pretty sure the other lib's functionalities that i had to remove for 1.7 support were added in 1.8 tho so can't support them |
Unfortunately, as excepted, 1.6 doesn't work either with that last change. |
Not sure why the test is failing btw, iirc it worked correctly when I tried it |
Very rough edges but had free time so why not
Confirmed to work on 1.7.10 -> 1.12.2 instead of just 1.8.8
TODOs:
& probably some other things I forgot
Maybe TODO: