-
Notifications
You must be signed in to change notification settings - Fork 33
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
Ready Java Lighting #302
Ready Java Lighting #302
Conversation
679c616
to
b758782
Compare
the game will recalculate the light levels for (19w08b) 1934 <= 1.14 => 1.21
b758782
to
df09599
Compare
4993750
to
c152129
Compare
This reverts commit 16b0635.
c152129
to
d94ce71
Compare
the game will recalculate the light levels for (19w08b) 1934 <= 1.14 => 1.21 Fixed a typo, bug [Bug report] Amulet-Team#286 Updated Fixed this issue where it always evaluates to true and adds the tag. I think its better to set the value to 0 than to remove the tag, Revert "Fixed a typo, bug [Bug report] Amulet-Team#286" This reverts commit 16b0635.
10b481b
to
f37b231
Compare
self, chunk: Chunk, data: ChunkDataType, floor_cy: int, height_cy: int | ||
): | ||
if chunk.misc.get("isLightOn", None): | ||
self.set_layer_obj(data, self.isLightOn, ByteTag(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ByteTag(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would tell the game that it does not need to be recalculated, it needs to be set to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. "only call this once. Store the value."
def _decode_islighton( | ||
self, chunk: Chunk, data: ChunkDataType, floor_cy: int, height_cy: int | ||
): | ||
if self.get_layer_obj(data, self.isLightOn) == ByteTag(1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only call this once. Store the value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This checks if the tag and value exists in the chunk and if the set value is 1, if it is it stores it, then format.py,
changed_ |= chunk.misc.get("isLightOn", None) is not None #true
if in format.py the above code, use's pop the below code is None and does not do anything,
I could put the if statement line 36 below, still would work the same.
if chunk.misc.get("isLightOn", None): # is true
self.set_layer_obj(data, self.isLightOn, ByteTag(0) ) # sets it to 0
this is according to my tests
maybe
if chunk.misc.get("isLightOn", None) == ByteTag(1):
self.set_layer_obj(data, self.isLightOn, ByteTag(0))
but then chunk change would always return true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like nothing gets committed to the originally loaded object data, even after a save it still returns true, until you reload the world in amulet. Does make it a little tedious when testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of the decoder and encoder is to read the data and write it back exactly as it was found.
The lighting changes in the save operation are a separate step.
this will update only the chunks that have the isLightOn tag set to 1 ,
c427b01
to
35daff3
Compare
1fc1272
to
d6c1d30
Compare
@@ -387,3 +389,14 @@ def misc(self) -> dict: | |||
def misc(self, misc: dict): | |||
assert isinstance(misc, dict), "misc must be a dictionary." | |||
self._misc = misc | |||
|
|||
@property | |||
def set_light_off(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feature only exists in Java. I would prefer if this was left in the misc data.
The rewrite gives each format the ability to define its own chunk class so in the future we could have something like this but for now it should be left in misc.
d6c1d30
to
c229470
Compare
c229470
to
51a1804
Compare
the game will recalculate the light levels for versions tested (19w08b) 1934 to 3949 (1.21.Pre2)