-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RecipeManager mixin & add ShulkerBoxScreenHandler Mixin
- Loading branch information
Showing
5 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
40 changes: 40 additions & 0 deletions
40
src/main/java/com/javazilla/bukkitfabric/mixin/screen/MixinShulkerBoxScreenHandler.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.javazilla.bukkitfabric.mixin.screen; | ||
|
||
import org.bukkit.craftbukkit.inventory.CraftInventory; | ||
import org.bukkit.craftbukkit.inventory.CraftInventoryView; | ||
import org.bukkit.entity.Player; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import com.javazilla.bukkitfabric.interfaces.IMixinServerEntityPlayer; | ||
|
||
import net.minecraft.entity.player.PlayerInventory; | ||
import net.minecraft.inventory.Inventory; | ||
import net.minecraft.screen.ShulkerBoxScreenHandler; | ||
|
||
@Mixin(ShulkerBoxScreenHandler.class) | ||
public class MixinShulkerBoxScreenHandler extends MixinScreenHandler { | ||
|
||
@Shadow | ||
public Inventory inventory; | ||
|
||
private CraftInventoryView bukkitEntity; | ||
private PlayerInventory player; | ||
|
||
@Inject(method = "<init>*", at = @At("TAIL")) | ||
public void setPlayerInv(int i, PlayerInventory playerinventory, Inventory iinventory, CallbackInfo ci) { | ||
this.player = (PlayerInventory) playerinventory; | ||
} | ||
|
||
@Override | ||
public CraftInventoryView getBukkitView() { | ||
if (bukkitEntity != null) | ||
return bukkitEntity; | ||
|
||
bukkitEntity = new CraftInventoryView((Player)((IMixinServerEntityPlayer)this.player.player).getBukkitEntity(), new CraftInventory(this.inventory), (ShulkerBoxScreenHandler)(Object)this); | ||
return bukkitEntity; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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