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

[1.19.3; Fix] Equip sounds now work with Curios slots and the Curios menu #281

Merged
merged 2 commits into from
Feb 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public String getSlotName() {
return I18n.get("curios.identifier." + this.identifier);
}

@Override
public void set(@Nonnull ItemStack stack) {
super.set(stack);
CuriosApi.getCuriosHelper().getCurio(stack).ifPresent(curio -> curio.onEquipFromUse(slotContext));
}

@Override
public boolean mayPlace(@Nonnull ItemStack stack) {
CurioEquipEvent equipEvent = new CurioEquipEvent(stack, slotContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ public CuriosContainer(int windowId, Inventory playerInventory) {
for (int k = 0; k < 4; ++k) {
final EquipmentSlot equipmentslottype = VALID_EQUIPMENT_SLOTS[k];
this.addSlot(new Slot(playerInventory, 36 + (3 - k), 8, 8 + k * 18) {
@Override
public void set(@Nonnull ItemStack stack) {
ItemStack itemstack = this.getItem();
super.set(stack);
CuriosContainer.this.player.onEquipItem(equipmentslottype, itemstack, stack);
}

@Override
public int getMaxStackSize() {
Expand Down