Skip to content
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

Add Equipment support #663

Merged
merged 24 commits into from
Oct 23, 2024
Merged

Add Equipment support #663

merged 24 commits into from
Oct 23, 2024

Conversation

maxomatic458
Copy link
Contributor

Objective

  • make valence work with entity equipment (armor, main/off hand items)

Solution

adds the crate valence_equipment that exposes the Equipment Plugin.
every LivingEntity will have a Equipment Component.

The Equipment plugin will NOT be compatible with the inventory by default (thats intended, as that makes it possible to use the equipment feature without the inventory feature + I do think there are probably use cases where you want to make players appear as having armor, although they dont have it in their inventory)

This PR would add Events when entities are (un)loaded by a player (used for sending equipment once the player loads an entity). I do believe this might also be a useful feature outside of the equipment feature.

used #254 as reference + stole example idea

fixes #662

Opening as a draft for now (might refactor the updating/event emitting system).
Let me know what you think of the Entity Load/Unload events.

@maxomatic458
Copy link
Contributor Author

if the equipment feature is enabled (which it is by default), every LivingEntity will have the Equipment Component.

@maxomatic458
Copy link
Contributor Author

maxomatic458 commented Oct 15, 2024

Should be ready now (not sure why the CI is failing, the EquipmentPlugin is used in the DefaultPlugins) fixed that

As said above, this touches the client code and implements Custom events there, kind of a hack, but that seems to be the easiest way to do it without having to reimplement the "view" logic.

@maxomatic458 maxomatic458 marked this pull request as ready for review October 15, 2024 17:34
Copy link
Collaborator

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't reviewed this in depth yet, but I like how this is decoupled from inventories. Good tests too.

I think it would be nice to provide a utility system to keep equipment in sync with the entity's inventory. I foresee that being common enough that we should just provide that.

@maxomatic458
Copy link
Contributor Author

I think it would be nice to provide a utility system to keep equipment in sync with the entity's inventory. I foresee that being common enough that we should just provide that.

I agree with that for player inventories (as players can change the inventory themselves).

But im not sure that would be good for all LivingEntities, that would open up 2 ways of dealing with equipment (either through the Equipment, or through the Inventory component.
And i believe it would be better to just allow equipment handling through the Equipment component.

I can't think of any case where you would have to handle anything equipment related through the inventory

@maxomatic458
Copy link
Contributor Author

Ive added the EquipmentInventorySync component that will have to be attached to entities, once attached the inventory & equipment components will be synced (equipment changes will be prioritized if both change in the same tick).

Copy link
Collaborator

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just minor things and docs.

crates/valence_equipment/src/lib.rs Show resolved Hide resolved
crates/valence_equipment/README.md Outdated Show resolved Hide resolved
crates/valence_equipment/src/lib.rs Outdated Show resolved Hide resolved
crates/valence_equipment/src/lib.rs Outdated Show resolved Hide resolved
crates/valence_equipment/src/lib.rs Outdated Show resolved Hide resolved
crates/valence_equipment/src/lib.rs Outdated Show resolved Hide resolved
Copy link

It looks like this pull request changed the workspace structure. Please replace assets/depgraph.svg with the following text:

depgraph.svg (Don't forget the trailing newline)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.43.0 (0)
 -->
<!-- Title: %3 Pages: 1 -->
<svg width="1465pt" height="692pt"
 viewBox="0.00 0.00 1465.00 692.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 688)">
<title>%3</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-688 1461,-688 1461,4 -4,4"/>
<!-- 0 -->
<g id="node1" class="node">
<title>0</title>
<polygon fill="none" stroke="black" points="469,-684 374,-684 374,-648 469,-648 469,-684"/>
<text text-anchor="middle" x="421.5" y="-662.3" font-family="Times,serif" font-size="14.00">java_string</text>
</g>
<!-- 1 -->
<g id="node2" class="node">
<title>1</title>
<polygon fill="none" stroke="black" points="173,-468 0,-468 0,-432 173,-432 173,-468"/>
<text text-anchor="middle" x="86.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_advancement</text>
</g>
<!-- 2 -->
<g id="node3" class="node">
<title>2</title>
<polygon fill="none" stroke="black" points="828,-396 705,-396 705,-360 828,-360 828,-396"/>
<text text-anchor="middle" x="766.5" y="-374.3" font-family="Times,serif" font-size="14.00">valence_server</text>
</g>
<!-- 1&#45;&gt;2 -->
<g id="edge1" class="edge">
<title>1&#45;&gt;2</title>
<path fill="none" stroke="black" d="M173.05,-433.32C176.24,-432.86 179.4,-432.41 182.5,-432 366.46,-407.41 584.58,-390.96 694.92,-383.53"/>
<polygon fill="black" stroke="black" points="695.19,-387.02 704.93,-382.86 694.72,-380.04 695.19,-387.02"/>
</g>
<!-- 3 -->
<g id="node4" class="node">
<title>3</title>
<polygon fill="none" stroke="black" points="754,-324 635,-324 635,-288 754,-288 754,-324"/>
<text text-anchor="middle" x="694.5" y="-302.3" font-family="Times,serif" font-size="14.00">valence_entity</text>
</g>
<!-- 2&#45;&gt;3 -->
<g id="edge2" class="edge">
<title>2&#45;&gt;3</title>
<path fill="none" stroke="black" d="M748.7,-359.7C739.9,-351.14 729.12,-340.66 719.5,-331.3"/>
<polygon fill="black" stroke="black" points="721.7,-328.57 712.09,-324.1 716.82,-333.58 721.7,-328.57"/>
</g>
<!-- 12 -->
<g id="node5" class="node">
<title>12</title>
<polygon fill="none" stroke="black" points="906.5,-324 772.5,-324 772.5,-288 906.5,-288 906.5,-324"/>
<text text-anchor="middle" x="839.5" y="-302.3" font-family="Times,serif" font-size="14.00">valence_registry</text>
</g>
<!-- 2&#45;&gt;12 -->
<g id="edge3" class="edge">
<title>2&#45;&gt;12</title>
<path fill="none" stroke="black" d="M784.54,-359.7C793.56,-351.05 804.62,-340.45 814.44,-331.03"/>
<polygon fill="black" stroke="black" points="816.87,-333.55 821.66,-324.1 812.02,-328.5 816.87,-333.55"/>
</g>
<!-- 11 -->
<g id="node6" class="node">
<title>11</title>
<polygon fill="none" stroke="black" points="861.5,-252 671.5,-252 671.5,-216 861.5,-216 861.5,-252"/>
<text text-anchor="middle" x="766.5" y="-230.3" font-family="Times,serif" font-size="14.00">valence_server_common</text>
</g>
<!-- 3&#45;&gt;11 -->
<g id="edge4" class="edge">
<title>3&#45;&gt;11</title>
<path fill="none" stroke="black" d="M712.3,-287.7C721.1,-279.14 731.88,-268.66 741.5,-259.3"/>
<polygon fill="black" stroke="black" points="744.18,-261.58 748.91,-252.1 739.3,-256.57 744.18,-261.58"/>
</g>
<!-- 12&#45;&gt;11 -->
<g id="edge12" class="edge">
<title>12&#45;&gt;11</title>
<path fill="none" stroke="black" d="M821.46,-287.7C812.44,-279.05 801.38,-268.45 791.56,-259.03"/>
<polygon fill="black" stroke="black" points="793.98,-256.5 784.34,-252.1 789.13,-261.55 793.98,-256.5"/>
</g>
<!-- 9 -->
<g id="node12" class="node">
<title>9</title>
<polygon fill="none" stroke="black" points="683.5,-180 547.5,-180 547.5,-144 683.5,-144 683.5,-180"/>
<text text-anchor="middle" x="615.5" y="-158.3" font-family="Times,serif" font-size="14.00">valence_protocol</text>
</g>
<!-- 11&#45;&gt;9 -->
<g id="edge11" class="edge">
<title>11&#45;&gt;9</title>
<path fill="none" stroke="black" d="M729.56,-215.88C709.01,-206.35 683.25,-194.41 661.41,-184.28"/>
<polygon fill="black" stroke="black" points="662.86,-181.1 652.32,-180.07 659.92,-187.45 662.86,-181.1"/>
</g>
<!-- 4 -->
<g id="node7" class="node">
<title>4</title>
<polygon fill="none" stroke="black" points="617.5,-108 467.5,-108 467.5,-72 617.5,-72 617.5,-108"/>
<text text-anchor="middle" x="542.5" y="-86.3" font-family="Times,serif" font-size="14.00">valence_generated</text>
</g>
<!-- 5 -->
<g id="node8" class="node">
<title>5</title>
<polygon fill="none" stroke="black" points="675.5,-36 561.5,-36 561.5,0 675.5,0 675.5,-36"/>
<text text-anchor="middle" x="618.5" y="-14.3" font-family="Times,serif" font-size="14.00">valence_ident</text>
</g>
<!-- 4&#45;&gt;5 -->
<g id="edge5" class="edge">
<title>4&#45;&gt;5</title>
<path fill="none" stroke="black" d="M561.29,-71.7C570.67,-63.05 582.18,-52.45 592.41,-43.03"/>
<polygon fill="black" stroke="black" points="594.95,-45.45 599.93,-36.1 590.2,-40.3 594.95,-45.45"/>
</g>
<!-- 6 -->
<g id="node9" class="node">
<title>6</title>
<polygon fill="none" stroke="black" points="543.5,-36 429.5,-36 429.5,0 543.5,0 543.5,-36"/>
<text text-anchor="middle" x="486.5" y="-14.3" font-family="Times,serif" font-size="14.00">valence_math</text>
</g>
<!-- 4&#45;&gt;6 -->
<g id="edge6" class="edge">
<title>4&#45;&gt;6</title>
<path fill="none" stroke="black" d="M528.66,-71.7C522.01,-63.39 513.92,-53.28 506.61,-44.14"/>
<polygon fill="black" stroke="black" points="509.16,-41.73 500.18,-36.1 503.7,-46.1 509.16,-41.73"/>
</g>
<!-- 7 -->
<g id="node10" class="node">
<title>7</title>
<polygon fill="none" stroke="black" points="900.5,-684 748.5,-684 748.5,-648 900.5,-648 900.5,-684"/>
<text text-anchor="middle" x="824.5" y="-662.3" font-family="Times,serif" font-size="14.00">valence_build_utils</text>
</g>
<!-- 8 -->
<g id="node11" class="node">
<title>8</title>
<polygon fill="none" stroke="black" points="795,-36 694,-36 694,0 795,0 795,-36"/>
<text text-anchor="middle" x="744.5" y="-14.3" font-family="Times,serif" font-size="14.00">valence_nbt</text>
</g>
<!-- 9&#45;&gt;4 -->
<g id="edge7" class="edge">
<title>9&#45;&gt;4</title>
<path fill="none" stroke="black" d="M597.46,-143.7C588.44,-135.05 577.38,-124.45 567.56,-115.03"/>
<polygon fill="black" stroke="black" points="569.98,-112.5 560.34,-108.1 565.13,-117.55 569.98,-112.5"/>
</g>
<!-- 10 -->
<g id="node13" class="node">
<title>10</title>
<polygon fill="none" stroke="black" points="741.5,-108 635.5,-108 635.5,-72 741.5,-72 741.5,-108"/>
<text text-anchor="middle" x="688.5" y="-86.3" font-family="Times,serif" font-size="14.00">valence_text</text>
</g>
<!-- 9&#45;&gt;10 -->
<g id="edge8" class="edge">
<title>9&#45;&gt;10</title>
<path fill="none" stroke="black" d="M633.54,-143.7C642.56,-135.05 653.62,-124.45 663.44,-115.03"/>
<polygon fill="black" stroke="black" points="665.87,-117.55 670.66,-108.1 661.02,-112.5 665.87,-117.55"/>
</g>
<!-- 10&#45;&gt;5 -->
<g id="edge9" class="edge">
<title>10&#45;&gt;5</title>
<path fill="none" stroke="black" d="M671.2,-71.7C662.64,-63.14 652.16,-52.66 642.8,-43.3"/>
<polygon fill="black" stroke="black" points="645.15,-40.7 635.6,-36.1 640.2,-45.65 645.15,-40.7"/>
</g>
<!-- 10&#45;&gt;8 -->
<g id="edge10" class="edge">
<title>10&#45;&gt;8</title>
<path fill="none" stroke="black" d="M702.34,-71.7C708.99,-63.39 717.08,-53.28 724.39,-44.14"/>
<polygon fill="black" stroke="black" points="727.3,-46.1 730.82,-36.1 721.84,-41.73 727.3,-46.1"/>
</g>
<!-- 13 -->
<g id="node14" class="node">
<title>13</title>
<polygon fill="none" stroke="black" points="303.5,-468 191.5,-468 191.5,-432 303.5,-432 303.5,-468"/>
<text text-anchor="middle" x="247.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_anvil</text>
</g>
<!-- 13&#45;&gt;2 -->
<g id="edge13" class="edge">
<title>13&#45;&gt;2</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M303.76,-433.77C306.71,-433.14 309.63,-432.54 312.5,-432 446.35,-406.81 604.8,-391.57 694.69,-384.27"/>
<polygon fill="black" stroke="black" points="695.08,-387.75 704.77,-383.46 694.52,-380.77 695.08,-387.75"/>
</g>
<!-- 14 -->
<g id="node15" class="node">
<title>14</title>
<polygon fill="none" stroke="black" points="461.5,-468 321.5,-468 321.5,-432 461.5,-432 461.5,-468"/>
<text text-anchor="middle" x="391.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_boss_bar</text>
</g>
<!-- 14&#45;&gt;2 -->
<g id="edge14" class="edge">
<title>14&#45;&gt;2</title>
<path fill="none" stroke="black" d="M461.69,-433.76C464.66,-433.16 467.61,-432.57 470.5,-432 546.88,-416.95 634.72,-401.45 694.74,-391.13"/>
<polygon fill="black" stroke="black" points="695.61,-394.53 704.87,-389.39 694.43,-387.63 695.61,-394.53"/>
</g>
<!-- 15 -->
<g id="node16" class="node">
<title>15</title>
<polygon fill="none" stroke="black" points="625.5,-468 479.5,-468 479.5,-432 625.5,-432 625.5,-468"/>
<text text-anchor="middle" x="552.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_command</text>
</g>
<!-- 15&#45;&gt;2 -->
<g id="edge15" class="edge">
<title>15&#45;&gt;2</title>
<path fill="none" stroke="black" d="M604.58,-431.97C634.74,-422.1 672.89,-409.62 704.58,-399.25"/>
<polygon fill="black" stroke="black" points="705.77,-402.55 714.19,-396.11 703.6,-395.89 705.77,-402.55"/>
</g>
<!-- 16 -->
<g id="node17" class="node">
<title>16</title>
<polygon fill="none" stroke="black" points="611.5,-540 457.5,-540 457.5,-504 611.5,-504 611.5,-540"/>
<text text-anchor="middle" x="534.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_equipment</text>
</g>
<!-- 17 -->
<g id="node18" class="node">
<title>17</title>
<polygon fill="none" stroke="black" points="789.5,-468 643.5,-468 643.5,-432 789.5,-432 789.5,-468"/>
<text text-anchor="middle" x="716.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_inventory</text>
</g>
<!-- 16&#45;&gt;17 -->
<g id="edge16" class="edge">
<title>16&#45;&gt;17</title>
<path fill="none" stroke="black" d="M579.02,-503.88C604.23,-494.18 635.95,-481.98 662.57,-471.74"/>
<polygon fill="black" stroke="black" points="664.05,-474.92 672.12,-468.07 661.53,-468.39 664.05,-474.92"/>
</g>
<!-- 17&#45;&gt;2 -->
<g id="edge17" class="edge">
<title>17&#45;&gt;2</title>
<path fill="none" stroke="black" d="M728.86,-431.7C734.73,-423.47 741.87,-413.48 748.34,-404.42"/>
<polygon fill="black" stroke="black" points="751.32,-406.28 754.28,-396.1 745.62,-402.21 751.32,-406.28"/>
</g>
<!-- 18 -->
<g id="node19" class="node">
<title>18</title>
<polygon fill="none" stroke="black" points="953.5,-468 845.5,-468 845.5,-432 953.5,-432 953.5,-468"/>
<text text-anchor="middle" x="899.5" y="-446.3" font-family="Times,serif" font-size="14.00">valence_lang</text>
</g>
<!-- 19 -->
<g id="node20" class="node">
<title>19</title>
<polygon fill="none" stroke="black" points="765.5,-540 629.5,-540 629.5,-504 765.5,-504 765.5,-540"/>
<text text-anchor="middle" x="697.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_network</text>
</g>
<!-- 19&#45;&gt;2 -->
<g id="edge18" class="edge">
<title>19&#45;&gt;2</title>
<path fill="none" stroke="black" d="M754.75,-503.96C771.83,-495.91 788.61,-484.35 798.5,-468 810.53,-448.11 799.46,-423 787.17,-404.52"/>
<polygon fill="black" stroke="black" points="789.97,-402.42 781.33,-396.29 784.26,-406.47 789.97,-402.42"/>
</g>
<!-- 19&#45;&gt;18 -->
<g id="edge19" class="edge">
<title>19&#45;&gt;18</title>
<path fill="none" stroke="black" d="M746.66,-503.97C775,-494.14 810.82,-481.73 840.66,-471.39"/>
<polygon fill="black" stroke="black" points="841.82,-474.69 850.12,-468.11 839.53,-468.08 841.82,-474.69"/>
</g>
<!-- 20 -->
<g id="node21" class="node">
<title>20</title>
<polygon fill="none" stroke="black" points="935.5,-540 783.5,-540 783.5,-504 935.5,-504 935.5,-540"/>
<text text-anchor="middle" x="859.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_player_list</text>
</g>
<!-- 20&#45;&gt;2 -->
<g id="edge20" class="edge">
<title>20&#45;&gt;2</title>
<path fill="none" stroke="black" d="M918.4,-503.96C935.62,-495.93 952.5,-484.4 962.5,-468 970.83,-454.34 972.23,-444.7 962.5,-432 947.17,-411.97 887.7,-397.77 838.25,-389.14"/>
<polygon fill="black" stroke="black" points="838.64,-385.66 828.19,-387.44 837.47,-392.56 838.64,-385.66"/>
</g>
<!-- 21 -->
<g id="node22" class="node">
<title>21</title>
<polygon fill="none" stroke="black" points="1111,-540 954,-540 954,-504 1111,-504 1111,-540"/>
<text text-anchor="middle" x="1032.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_scoreboard</text>
</g>
<!-- 21&#45;&gt;2 -->
<g id="edge21" class="edge">
<title>21&#45;&gt;2</title>
<path fill="none" stroke="black" d="M1027.08,-503.79C1019.8,-483.49 1004.86,-450.23 980.5,-432 939.56,-401.37 883.07,-388.27 838.41,-382.75"/>
<polygon fill="black" stroke="black" points="838.53,-379.24 828.2,-381.6 837.74,-386.2 838.53,-379.24"/>
</g>
<!-- 22 -->
<g id="node23" class="node">
<title>22</title>
<polygon fill="none" stroke="black" points="1044,-684 919,-684 919,-648 1044,-648 1044,-684"/>
<text text-anchor="middle" x="981.5" y="-662.3" font-family="Times,serif" font-size="14.00">valence_spatial</text>
</g>
<!-- 23 -->
<g id="node24" class="node">
<title>23</title>
<polygon fill="none" stroke="black" points="1265.5,-540 1129.5,-540 1129.5,-504 1265.5,-504 1265.5,-540"/>
<text text-anchor="middle" x="1197.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_weather</text>
</g>
<!-- 23&#45;&gt;2 -->
<g id="edge22" class="edge">
<title>23&#45;&gt;2</title>
<path fill="none" stroke="black" d="M1167.13,-503.97C1130.69,-484.17 1067.27,-451.69 1009.5,-432 953.2,-412.81 887.12,-398.93 838.1,-390.2"/>
<polygon fill="black" stroke="black" points="838.67,-386.74 828.22,-388.46 837.46,-393.64 838.67,-386.74"/>
</g>
<!-- 24 -->
<g id="node25" class="node">
<title>24</title>
<polygon fill="none" stroke="black" points="1457,-540 1284,-540 1284,-504 1457,-504 1457,-540"/>
<text text-anchor="middle" x="1370.5" y="-518.3" font-family="Times,serif" font-size="14.00">valence_world_border</text>
</g>
<!-- 24&#45;&gt;2 -->
<g id="edge23" class="edge">
<title>24&#45;&gt;2</title>
<path fill="none" stroke="black" d="M1318.78,-503.97C1258.66,-484.61 1156.19,-452.98 1066.5,-432 989.06,-413.88 899.08,-398.76 838.02,-389.37"/>
<polygon fill="black" stroke="black" points="838.51,-385.9 828.09,-387.85 837.45,-392.82 838.51,-385.9"/>
</g>
<!-- 25 -->
<g id="node26" class="node">
<title>25</title>
<polygon fill="none" stroke="black" points="614,-684 487,-684 487,-648 614,-648 614,-684"/>
<text text-anchor="middle" x="550.5" y="-662.3" font-family="Times,serif" font-size="14.00">dump_schedule</text>
</g>
<!-- 26 -->
<g id="node27" class="node">
<title>26</title>
<polygon fill="none" stroke="black" points="651,-612 580,-612 580,-576 651,-576 651,-612"/>
<text text-anchor="middle" x="615.5" y="-590.3" font-family="Times,serif" font-size="14.00">valence</text>
</g>
<!-- 25&#45;&gt;26 -->
<g id="edge24" class="edge">
<title>25&#45;&gt;26</title>
<path fill="none" stroke="black" d="M566.57,-647.7C574.44,-639.22 584.06,-628.86 592.67,-619.58"/>
<polygon fill="black" stroke="black" points="595.38,-621.81 599.62,-612.1 590.25,-617.05 595.38,-621.81"/>
</g>
<!-- 26&#45;&gt;1 -->
<g id="edge25" class="edge">
<title>26&#45;&gt;1</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M579.79,-588.21C525.7,-580.53 420.03,-563.86 332.5,-540 263.28,-521.13 185.82,-491.66 136.64,-471.86"/>
<polygon fill="black" stroke="black" points="137.78,-468.54 127.19,-468.03 135.15,-475.03 137.78,-468.54"/>
</g>
<!-- 26&#45;&gt;13 -->
<g id="edge26" class="edge">
<title>26&#45;&gt;13</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M579.85,-586.74C537.9,-578.72 466.6,-563.06 408.5,-540 362.78,-521.85 313.8,-493.33 282.03,-473.48"/>
<polygon fill="black" stroke="black" points="283.86,-470.5 273.54,-468.13 280.13,-476.42 283.86,-470.5"/>
</g>
<!-- 26&#45;&gt;14 -->
<g id="edge27" class="edge">
<title>26&#45;&gt;14</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M579.8,-590.41C541.1,-585.91 479.39,-573.61 438.5,-540 419.07,-524.03 406.63,-497.89 399.47,-478.06"/>
<polygon fill="black" stroke="black" points="402.7,-476.71 396.19,-468.35 396.07,-478.95 402.7,-476.71"/>
</g>
<!-- 26&#45;&gt;15 -->
<g id="edge28" class="edge">
<title>26&#45;&gt;15</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M579.86,-593.1C540.43,-591.06 478.5,-580.99 448.5,-540 439.05,-527.09 440.14,-517.64 448.5,-504 456.75,-490.53 469.62,-480.36 483.52,-472.71"/>
<polygon fill="black" stroke="black" points="485.42,-475.67 492.77,-468.04 482.27,-469.42 485.42,-475.67"/>
</g>
<!-- 26&#45;&gt;16 -->
<g id="edge29" class="edge">
<title>26&#45;&gt;16</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M595.48,-575.7C585.37,-566.97 572.96,-556.24 561.98,-546.75"/>
<polygon fill="black" stroke="black" points="564.15,-543.99 554.29,-540.1 559.57,-549.29 564.15,-543.99"/>
</g>
<!-- 26&#45;&gt;19 -->
<g id="edge30" class="edge">
<title>26&#45;&gt;19</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M635.77,-575.7C646,-566.97 658.56,-556.24 669.68,-546.75"/>
<polygon fill="black" stroke="black" points="672.13,-549.26 677.46,-540.1 667.59,-543.94 672.13,-549.26"/>
</g>
<!-- 26&#45;&gt;20 -->
<g id="edge31" class="edge">
<title>26&#45;&gt;20</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M651.24,-582.75C687.62,-572.31 744.95,-555.86 790.26,-542.86"/>
<polygon fill="black" stroke="black" points="791.38,-546.18 800.02,-540.06 789.45,-539.46 791.38,-546.18"/>
</g>
<!-- 26&#45;&gt;21 -->
<g id="edge32" class="edge">
<title>26&#45;&gt;21</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M651.1,-587.64C709.81,-578.71 830.86,-559.97 943.97,-540.06"/>
<polygon fill="black" stroke="black" points="944.6,-543.51 953.84,-538.32 943.38,-536.61 944.6,-543.51"/>
</g>
<!-- 26&#45;&gt;23 -->
<g id="edge33" class="edge">
<title>26&#45;&gt;23</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M651.12,-590.61C732.28,-584.86 937.32,-568.72 1119.09,-539.95"/>
<polygon fill="black" stroke="black" points="1119.77,-543.39 1129.1,-538.35 1118.67,-536.48 1119.77,-543.39"/>
</g>
<!-- 26&#45;&gt;24 -->
<g id="edge34" class="edge">
<title>26&#45;&gt;24</title>
<path fill="none" stroke="black" stroke-dasharray="1,5" d="M651.34,-591.32C749.3,-586.46 1029.89,-570.85 1273.83,-540.01"/>
<polygon fill="black" stroke="black" points="1274.47,-543.45 1283.95,-538.72 1273.59,-536.51 1274.47,-543.45"/>
</g>
<!-- 27 -->
<g id="node28" class="node">
<title>27</title>
<polygon fill="none" stroke="black" points="560,-252 423,-252 423,-216 560,-216 560,-252"/>
<text text-anchor="middle" x="491.5" y="-230.3" font-family="Times,serif" font-size="14.00">packet_inspector</text>
</g>
<!-- 27&#45;&gt;9 -->
<g id="edge35" class="edge">
<title>27&#45;&gt;9</title>
<path fill="none" stroke="black" d="M521.83,-215.88C538.2,-206.64 558.58,-195.13 576.15,-185.21"/>
<polygon fill="black" stroke="black" points="578.06,-188.15 585.05,-180.19 574.62,-182.06 578.06,-188.15"/>
</g>
<!-- 28 -->
<g id="node29" class="node">
<title>28</title>
<polygon fill="none" stroke="black" points="730.5,-684 632.5,-684 632.5,-648 730.5,-648 730.5,-684"/>
<text text-anchor="middle" x="681.5" y="-662.3" font-family="Times,serif" font-size="14.00">playground</text>
</g>
<!-- 28&#45;&gt;26 -->
<g id="edge36" class="edge">
<title>28&#45;&gt;26</title>
<path fill="none" stroke="black" d="M665.19,-647.7C657.19,-639.22 647.43,-628.86 638.68,-619.58"/>
<polygon fill="black" stroke="black" points="641.03,-616.98 631.63,-612.1 635.94,-621.78 641.03,-616.98"/>
</g>
<!-- 29 -->
<g id="node30" class="node">
<title>29</title>
<polygon fill="none" stroke="black" points="653,-252 578,-252 578,-216 653,-216 653,-252"/>
<text text-anchor="middle" x="615.5" y="-230.3" font-family="Times,serif" font-size="14.00">stresser</text>
</g>
<!-- 29&#45;&gt;9 -->
<g id="edge37" class="edge">
<title>29&#45;&gt;9</title>
<path fill="none" stroke="black" d="M615.5,-215.7C615.5,-207.98 615.5,-198.71 615.5,-190.11"/>
<polygon fill="black" stroke="black" points="619,-190.1 615.5,-180.1 612,-190.1 619,-190.1"/>
</g>
</g>
</svg>

For reference, here is a diff against the old depgraph.svg:

diff --git a/assets/depgraph.svg b/assets/depgraph.svg
index e7d3d86..0a91745 100644
--- a/assets/depgraph.svg
+++ b/assets/depgraph.svg
@@ -210,7 +210,7 @@
 <!-- 16&#45;&gt;17 -->
 <g id="edge16" class="edge">
 <title>16&#45;&gt;17</title>
-<path fill="none" stroke="black" stroke-dasharray="1,5" d="M579.02,-503.88C604.23,-494.18 635.95,-481.98 662.57,-471.74"/>
+<path fill="none" stroke="black" d="M579.02,-503.88C604.23,-494.18 635.95,-481.98 662.57,-471.74"/>
 <polygon fill="black" stroke="black" points="664.05,-474.92 672.12,-468.07 661.53,-468.39 664.05,-474.92"/>
 </g>
 <!-- 17&#45;&gt;2 -->

@dyc3
Copy link
Collaborator

dyc3 commented Oct 17, 2024

Go ahead and hit resolve on the comments you've addressed in new commits so I know you got them.

@maxomatic458
Copy link
Contributor Author

should be ready now!

@maxomatic458
Copy link
Contributor Author

i just noticed that the HeldItem is not marked as changed. (which means the InventorySync will not work for Helditems)

let held = mut_held.bypass_change_detection();

is there any reason for not updating it?
@AviiNL (i saw you made that change)

@maxomatic458
Copy link
Contributor Author

yea looks like removing that causes some funky behavior.

Ill try to change that so we dont rely on the HeldItem, but listen for the UpdateSelectedSlotEvent instead

@AviiNL
Copy link
Contributor

AviiNL commented Oct 19, 2024

i just noticed that the HeldItem is not marked as changed. (which means the InventorySync will not work for Helditems)

let held = mut_held.bypass_change_detection();

is there any reason for not updating it? @AviiNL (i saw you made that change)

I don't even remember what I had for breakfast this morning, let alone something I've done over a year ago lol, there probably was a reason for it since it was discussed and the implementation changed in PR #525 there might be more info in discord but I really can't remember.
This is also from pre 1.21, so it's very possible that 1.21 changes made this requirement (whatever it was) obsolete.

@lukashermansson
Copy link
Contributor

This is also from pre 1.21, so it's very possible that 1.21 changes made this requirement (whatever it was) obsolete.

We are still on 1.20, the work to get us to 1.21 is still ongoing, so as far as I'm aware any requirement that was present then should still be a requirement as of right now (in main at least)

@maxomatic458
Copy link
Contributor Author

yea looks like removing that causes some funky behavior.
Ill try to change that so we dont rely on the HeldItem, but listen for the UpdateSelectedSlotEvent instead

I added a seperate system specifically for handling client HeldItem changes now

Copy link
Collaborator

@dyc3 dyc3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a minor doc thing.

@dyc3 dyc3 merged commit c57193a into valence-rs:main Oct 23, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Entity Equipment
4 participants