Skip to content

Commit

Permalink
Fix 20w21a
Browse files Browse the repository at this point in the history
For some reason, dimension data is handled through DataFixerUpper, using a Codec to generate the right NBT.

It specifically uses Encoder.encodeStart with NBTDynamicOps, and then errors if it returns a non-present DataResult, but that's a bit more noise than we care about.  We can just pretend that there's a regular encode function that knows to use NBT.
  • Loading branch information
Pokechu22 committed Nov 12, 2020
1 parent 1492067 commit f66607c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion burger/toppings/packetinstructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,19 @@ def operations(classloader, classname, classes, verbose, args=None,
)
elif num_arguments == 2:
if arg_type == "java/lang/String" and descriptor.args[1].name == "int":
max_length = arguments[1] # not using this at the time
max_length = arguments[1] # not using this at this time
operations.append(Operation(instruction.pos, "write",
type="string",
field=field))
elif arg_type == "com/mojang/serialization/Codec":
codec = arguments[0]
value = arguments[1]
# This isn't the exact syntax used by DataFixerUpper,
# but it's close enough for our purposes
field = "%s.encode(%s)" % (codec, value)
operations.append(Operation(instruction.pos, "write",
type="nbtcompound",
field=field))
else:
raise Exception("Unexpected descriptor " + desc)
else:
Expand Down

0 comments on commit f66607c

Please sign in to comment.