Skip to content

Commit

Permalink
Fix packets topping for 21w19a+ (Java 15+)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pokechu22 committed Feb 17, 2022
1 parent f0f77a0 commit f83e4ec
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion burger/toppings/packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,13 +434,21 @@ def on_invoke(self, ins, const, obj, args):
obj.append(cls)
return obj

if const.name_and_type.descriptor == "()[L" + connectionstate + ";":
# Calling $values() to construct the values array -- this is
# is the endpoint for us in versions starting with 21w19a.
# 21w19a updated to require Java 16.
# This function was added by a Javac change from Java 15:
# https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8241798
raise StopIteration()

def on_get_field(self, ins, const, obj):
if const.class_.name == direction_class:
return directions_by_field[const.name_and_type.name.value]["name"]

if const.class_.name == connectionstate:
# Getting the enum fields to create the values array -- this
# is the endpoint for us
# is the endpoint for us in versions before 21w19a
raise StopIteration()

raise Exception("Unexpected getfield: %s" % str(ins))
Expand Down

0 comments on commit f83e4ec

Please sign in to comment.