Adding slot field to BlockPos, for future use with compound blocks#41
Open
dmchurch wants to merge 1 commit intoanegostudios:masterfrom
Open
Adding slot field to BlockPos, for future use with compound blocks#41dmchurch wants to merge 1 commit intoanegostudios:masterfrom
dmchurch wants to merge 1 commit intoanegostudios:masterfrom
Conversation
fa81e81 to
2b02271
Compare
Uses position-hashing to ensure that any direct public modification of BlockPos fields will result in the `Slot` property resetting itself to the default value of `SlotDontCare`, which will cause it to be omitted from the protobuf-serialized form due to the DefaultValue attribute.
2b02271 to
dfbf0d0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a new integer property
Slotto the BlockPos class, with the following behavior:BlockPos.SlotDontCarepos.Equals(other)now checks thatSlotproperties matchpos.GetHashCode()includes theSlotvalue in the hashSet,West, etc) will reset theSlotproperty toSlotDontCareBlockPosposition fields from external code (by any value from -15..15) will cause theSlotproperty to self-reset toSlotDontCareCopyandCopyAndCorrectDimensionwill copy theSlotvalueSlotpropertyBlockPos(int x, int y, int z, int dim, int slot)andBlockPos(Vec3i vec, int dim, int slot)public BlockPos SetSlot(int slot)Slotproperty as tag 4, but only if it is not currently set to the defaultSlotDontCareToBytes()andCreateFromBytes()) do not preserve theslotvalue (only x/y/z/dimension) as those methods are only used for particles, which don't need to know about slotsToString()includes the slot value in the output if the value is notSlotDontCareThis should have no impact on the game at present, as there isn't any code that reads or writes the
Slotproperty; allBlockPosinstances will grow by 4 bytes in size, but that seems incredibly unlikely to change anything.