forked from Clones/Controlify
close #35
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
package dev.isxander.controlify.mixins.feature.screenop.vanilla;
|
||||
|
||||
import dev.isxander.controlify.screenop.ScreenProcessor;
|
||||
import dev.isxander.controlify.screenop.ScreenProcessorProvider;
|
||||
import dev.isxander.controlify.screenop.compat.vanilla.AbstractContainerScreenProcessor;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.world.inventory.ClickType;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
@Mixin(AbstractContainerScreen.class)
|
||||
public abstract class AbstractContainerScreenMixin implements ScreenProcessorProvider {
|
||||
@Shadow @Nullable protected Slot hoveredSlot;
|
||||
|
||||
@Shadow protected abstract void slotClicked(Slot slot, int slotId, int button, ClickType actionType);
|
||||
|
||||
@Unique private final ScreenProcessor<?> screenProcessor = new AbstractContainerScreenProcessor<>((AbstractContainerScreen<?>) (Object) this, () -> hoveredSlot, this::slotClicked);
|
||||
|
||||
@Override
|
||||
public ScreenProcessor<?> screenProcessor() {
|
||||
return screenProcessor;
|
||||
}
|
||||
}
|
@ -3,17 +3,24 @@ package dev.isxander.controlify.mixins.feature.screenop.vanilla;
|
||||
import dev.isxander.controlify.screenop.ScreenProcessor;
|
||||
import dev.isxander.controlify.screenop.ScreenProcessorProvider;
|
||||
import dev.isxander.controlify.screenop.compat.vanilla.CreativeModeInventoryScreenProcessor;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
@Mixin(CreativeModeInventoryScreen.class)
|
||||
public class CreativeModeInventoryScreenMixin implements ScreenProcessorProvider {
|
||||
@Unique private final CreativeModeInventoryScreenProcessor controlify$screenProcessor
|
||||
= new CreativeModeInventoryScreenProcessor((CreativeModeInventoryScreen) (Object) this);
|
||||
public abstract class CreativeModeInventoryScreenMixin extends AbstractContainerScreen<CreativeModeInventoryScreen.ItemPickerMenu> implements ScreenProcessorProvider {
|
||||
@Unique private final CreativeModeInventoryScreenProcessor creativeScreenProcessor
|
||||
= new CreativeModeInventoryScreenProcessor((CreativeModeInventoryScreen) (Object) this, () -> hoveredSlot, this::slotClicked);
|
||||
|
||||
public CreativeModeInventoryScreenMixin(CreativeModeInventoryScreen.ItemPickerMenu handler, Inventory inventory, Component title) {
|
||||
super(handler, inventory, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScreenProcessor<?> screenProcessor() {
|
||||
return controlify$screenProcessor;
|
||||
return creativeScreenProcessor;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user