Skip to content

Commit

Permalink
Fix mixin conflict with morejs (#1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
IzzelAliz committed Dec 10, 2023
1 parent 7c67acb commit 0149472
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
import java.util.List;
import java.util.Map;

@Mixin(EnchantmentMenu.class)
// morejs https://github.com/AlmostReliable/morejs/blob/fd738a28a054d780031c7666fc8a01533c86f63b/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMenuMixin.java
@Mixin(value = EnchantmentMenu.class, priority = 39)
public abstract class EnchantmentContainerMixin extends AbstractContainerMenuMixin implements PosContainerBridge {

// @formatter:off
Expand Down Expand Up @@ -86,6 +87,8 @@ public void slotsChanged(Container inventoryIn) {
if (inventoryIn == this.enchantSlots) {
ItemStack itemstack = inventoryIn.getItem(0);
if (!itemstack.isEmpty()) {
// morejs https://github.com/AlmostReliable/morejs/blob/fd738a28a054d780031c7666fc8a01533c86f63b/Common/src/main/java/com/almostreliable/morejs/mixin/enchanting/EnchantmentMenuMixin.java
boolean enchantable = itemstack.isEnchantable();
this.access.execute((p_217002_2_, p_217002_3_) -> {
float power = 0;

Expand Down Expand Up @@ -127,7 +130,7 @@ public void slotsChanged(Container inventoryIn) {
}

PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(((ServerPlayerEntityBridge) this.playerInventory.player).bridge$getBukkitEntity(), this.getBukkitView(), ((IWorldPosCallableBridge) this.access).bridge$getLocation().getBlock(), item, offers, (int) power);
event.setCancelled(!itemstack.isEnchantable());
event.setCancelled(!enchantable);
Bukkit.getPluginManager().callEvent(event);

if (event.isCancelled()) {
Expand Down

0 comments on commit 0149472

Please sign in to comment.