useless pageflipper

This commit is contained in:
NK 2023-05-26 22:59:32 +01:00
parent 14640e3439
commit 96751bff06

View file

@ -3,20 +3,25 @@ package me.night0721.lilase.features.pageflipper;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import me.night0721.lilase.Lilase; import me.night0721.lilase.Lilase;
import me.night0721.lilase.features.sniper.Sniper;
import me.night0721.lilase.player.EffectState; import me.night0721.lilase.player.EffectState;
import me.night0721.lilase.utils.*; import me.night0721.lilase.utils.*;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import java.util.Objects; import java.util.Objects;
import static me.night0721.lilase.features.flipper.Flipper.*; import static me.night0721.lilase.features.flipper.Flipper.*;
public class PageFlipper { public class PageFlipper extends Sniper {
public PageFlipperState state = PageFlipperState.NONE; public PageFlipperState state = PageFlipperState.NONE;
public final Clock cooldown = new Clock(); public final Clock cooldown = new Clock();
public @Getter @Setter boolean open = false; public @Getter
@Setter boolean open = false;
private Thread loop; private Thread loop;
public void start() { public void start() {
@ -28,7 +33,7 @@ public class PageFlipper {
} }
} }
public void switchStates() { public void onTick() {
switch (state) { switch (state) {
case WALKING_TO_FIRST_POINT: case WALKING_TO_FIRST_POINT:
if (Lilase.mc.currentScreen != null) { if (Lilase.mc.currentScreen != null) {
@ -81,11 +86,13 @@ public class PageFlipper {
if (is != null && is.getItem() == Items.arrow) { if (is != null && is.getItem() == Items.arrow) {
if (loop == null) { if (loop == null) {
loop = new Thread(() -> { loop = new Thread(() -> {
for (int i = 11; i <= 43; i++) { long count = Lilase.mc.thePlayer.openContainer.inventorySlots.stream()
if (!Objects.equals(Lilase.mc.thePlayer.openContainer.getSlot(i).getStack().getDisplayName(), " ")) { .map(Slot::getStack)
byte[] b = Lilase.mc.thePlayer.openContainer.getSlot(i).getStack().getTagCompound().getCompoundTag("display").getByteArray("Lore"); .filter(Objects::nonNull)
// System.out.println(Arrays.toString(b).replaceAll("§[0-9a-z]", "")); .filter(slot -> Item.getItemFromBlock(Blocks.stained_glass_pane) != slot.getItem())
} .filter(slot -> ScoreboardUtils.cleanSB(Objects.requireNonNull(InventoryUtils.getLore(slot)).toString()).contains("Status: Sold")).count();
for (int i = 0; i< count; i++ ) {
System.out.println(InventoryUtils.getLore(Lilase.mc.thePlayer.openContainer.inventorySlots.get(i).getStack()));
} }
loop = null; loop = null;
}); });
@ -103,7 +110,7 @@ public class PageFlipper {
} }
} }
public void toggleAuction() { public void toggle() {
if (isOpen()) { if (isOpen()) {
Utils.sendMessage("Stopped Page Flipper"); Utils.sendMessage("Stopped Page Flipper");
Lilase.mc.thePlayer.closeScreen(); Lilase.mc.thePlayer.closeScreen();