Skip to content

Commit

Permalink
Refactor PacketInstructionsTopping
Browse files Browse the repository at this point in the history
No change in behavior from this.
  • Loading branch information
Pokechu22 committed Feb 17, 2022
1 parent 6781fbe commit 05c25e4
Show file tree
Hide file tree
Showing 2 changed files with 357 additions and 334 deletions.
8 changes: 5 additions & 3 deletions burger/toppings/entitymetadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ def identify_serializers(classloader, dataserializer_class, dataserializers_clas
def identify_serializer(classloader, cls, classes, verbose):
# In here because otherwise the import messes with finding the topping in this file
from .packetinstructions import PacketInstructionsTopping as _PIT
from .packetinstructions import PACKETBUF_NAME

cf = classloader[cls]
sig = cf.attributes.find_one(name="Signature").signature.value
Expand Down Expand Up @@ -459,9 +460,10 @@ def identify_serializer(classloader, cls, classes, verbose):
# Note that we are using the bridge method that takes an object, and not the more find
try:
write_args = "L" + classes["packet.packetbuffer"] + ";Ljava/lang/Object;"
operations = _PIT.operations(classloader, cls + ".class", # XXX This .class only exists because PIT needs it, for no real reason
classes, verbose,
args=write_args, arg_names=("this", "packetbuffer", "value"))
methods = list(cf.methods.find(returns="V", args=write_args))
assert len(methods) == 1
operations = _PIT.operations(classloader, cf, classes, verbose,
methods[0], arg_names=("this", PACKETBUF_NAME, "value"))
serializer.update(_PIT.format(operations))
except:
if verbose:
Expand Down
Loading

0 comments on commit 05c25e4

Please sign in to comment.