22
33import com .github .skriptdev .skript .api .hytale .utils .EntityUtils ;
44import com .github .skriptdev .skript .api .skript .registration .SkriptRegistration ;
5+ import com .hypixel .hytale .component .Ref ;
6+ import com .hypixel .hytale .component .Store ;
57import com .hypixel .hytale .server .core .entity .LivingEntity ;
68import com .hypixel .hytale .server .core .inventory .InventoryComponent .Hotbar ;
79import com .hypixel .hytale .server .core .inventory .InventoryComponent .Tool ;
810import com .hypixel .hytale .server .core .inventory .InventoryComponent .Utility ;
911import com .hypixel .hytale .server .core .inventory .ItemStack ;
1012import com .hypixel .hytale .server .core .inventory .container .ItemContainer ;
13+ import com .hypixel .hytale .server .core .universe .world .storage .EntityStore ;
1114import io .github .syst3ms .skriptparser .lang .Expression ;
1215import io .github .syst3ms .skriptparser .lang .TriggerContext ;
1316import io .github .syst3ms .skriptparser .parsing .ParseContext ;
@@ -86,6 +89,9 @@ public void change(@NotNull TriggerContext ctx, @NotNull ChangeMode changeMode,
8689 }
8790
8891 for (LivingEntity livingEntity : this .entities .getArray (ctx )) {
92+ Ref <EntityStore > reference = livingEntity .getReference ();
93+ if (reference == null ) continue ;
94+ Store <EntityStore > store = reference .getStore ();
8995
9096 if (this .pattern == 0 ) {
9197 Hotbar hotbar = EntityUtils .getComponent (livingEntity , Hotbar .getComponentType ());
@@ -102,7 +108,7 @@ public void change(@NotNull TriggerContext ctx, @NotNull ChangeMode changeMode,
102108 byte activeUtilitySlot = utility .getActiveSlot ();
103109 if (activeUtilitySlot < 0 ) {
104110 activeUtilitySlot = 0 ;
105- utility .setActiveSlot ((byte ) 0 );
111+ utility .setActiveSlot ((byte ) 0 , reference , store );
106112 }
107113 container .setItemStackForSlot (activeUtilitySlot , itemStack );
108114 } else if (this .pattern == 2 ) {
@@ -113,7 +119,7 @@ public void change(@NotNull TriggerContext ctx, @NotNull ChangeMode changeMode,
113119 byte activeToolSlot = tool .getActiveSlot ();
114120 if (activeToolSlot < 0 ) {
115121 tool .setUsingToolsItem (true );
116- tool .setActiveSlot ((byte ) 1 );
122+ tool .setActiveSlot ((byte ) 1 , reference , store );
117123 activeToolSlot = 1 ;
118124 }
119125 container .setItemStackForSlot (activeToolSlot , itemStack );
0 commit comments