Fix mixin issue (#209)
This commit is contained in:
@@ -20,6 +20,11 @@ public abstract class InventoryTweaksMixin implements IInventoryTweaks {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stealCallback(Runnable callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Inject(method = "lambda$new$1", at = @At("HEAD"))
|
||||
private void onStealChanged(Boolean b, CallbackInfo info) {
|
||||
callback = null;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package anticope.rejects.mixininterface;
|
||||
|
||||
public interface IInventoryTweaks {
|
||||
void afterSteal(Runnable callback);
|
||||
void stealCallback(Runnable callback);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import meteordevelopment.meteorclient.systems.modules.Modules;
|
||||
import meteordevelopment.meteorclient.systems.modules.misc.InventoryTweaks;
|
||||
import meteordevelopment.meteorclient.utils.Utils;
|
||||
import meteordevelopment.meteorclient.utils.player.Rotations;
|
||||
import meteordevelopment.meteorclient.utils.player.SlotUtils;
|
||||
import meteordevelopment.orbit.EventHandler;
|
||||
import meteordevelopment.orbit.EventPriority;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -20,7 +21,9 @@ import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.ScreenHandler;
|
||||
import net.minecraft.screen.slot.Slot;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.collection.DefaultedList;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -29,6 +32,7 @@ import net.minecraft.util.math.Vec3d;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class ChestAura extends Module {
|
||||
private final SettingGroup sgGeneral = settings.getDefaultGroup();
|
||||
@@ -142,12 +146,13 @@ public class ChestAura extends Module {
|
||||
if (event.packet.getSyncId() == handler.syncId) {
|
||||
switch (closeCondition.get()) {
|
||||
case IfEmpty -> {
|
||||
if (handler.getStacks().stream().allMatch(ItemStack::isEmpty))
|
||||
mc.player.closeHandledScreen();
|
||||
DefaultedList<ItemStack> stacks = DefaultedList.of();
|
||||
IntStream.range(0, SlotUtils.indexToId(SlotUtils.MAIN_START)).mapToObj(handler.slots::get).map(Slot::getStack).forEach(stacks::add);
|
||||
if (stacks.stream().allMatch(ItemStack::isEmpty)) mc.player.closeHandledScreen();
|
||||
}
|
||||
case Always -> mc.player.closeHandledScreen();
|
||||
case AfterSteal ->
|
||||
((IInventoryTweaks) Modules.get().get(InventoryTweaks.class)).afterSteal(() -> RenderSystem.recordRenderCall(() -> mc.player.closeHandledScreen()));
|
||||
((IInventoryTweaks) Modules.get().get(InventoryTweaks.class)).stealCallback(() -> RenderSystem.recordRenderCall(() -> mc.player.closeHandledScreen()));
|
||||
}
|
||||
}
|
||||
MeteorClient.EVENT_BUS.unsubscribe(this);
|
||||
|
||||
Reference in New Issue
Block a user