Skip to content

Commit db6ddc2

Browse files
committed
earth may rest in piece
1 parent 0ecf220 commit db6ddc2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/main/java/dev/dfonline/codeclient/dev/DevInventory/DevInventoryScreen.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import dev.dfonline.codeclient.CodeClient;
1212
import dev.dfonline.codeclient.actiondump.ActionDump;
13-
import dev.dfonline.codeclient.actiondump.CodeBlock;
13+
import dev.dfonline.codeclient.actiondump.Item;
1414
import net.fabricmc.api.EnvType;
1515
import net.fabricmc.api.Environment;
1616
import net.minecraft.client.MinecraftClient;
@@ -27,7 +27,6 @@
2727
import net.minecraft.inventory.SimpleInventory;
2828
import net.minecraft.item.ItemStack;
2929
import net.minecraft.item.Items;
30-
import net.minecraft.nbt.NbtHelper;
3130
import net.minecraft.screen.ScreenHandler;
3231
import net.minecraft.screen.ScreenTexts;
3332
import net.minecraft.screen.slot.Slot;
@@ -81,7 +80,9 @@ protected void onMouseClick(@Nullable Slot slot, int slotId, int button, SlotAct
8180

8281
if(slot.inventory instanceof SimpleInventory) {
8382
if(actionType == SlotActionType.PICKUP) {
84-
this.handler.setCursorStack(slot.getStack());
83+
CodeClient.LOGGER.info(String.valueOf(this.handler.getCursorStack()));
84+
if(this.handler.getCursorStack().getItem().equals(Items.AIR)) this.handler.setCursorStack(slot.getStack());
85+
else this.handler.setCursorStack(Items.AIR.getDefaultStack());
8586
}
8687
}
8788
if(slot.inventory instanceof PlayerInventory) {
@@ -90,6 +91,10 @@ protected void onMouseClick(@Nullable Slot slot, int slotId, int button, SlotAct
9091

9192
slot.setStack(cursorItem);
9293
this.handler.setCursorStack(slotStack);
94+
this.handler.syncState();
95+
this.listener.onSlotUpdate(this.handler,slot.id - 9,slot.getStack());
96+
CodeClient.LOGGER.info(String.valueOf(slot.id));
97+
// CodeClient.MC.getNetworkHandler().sendPacket(new CreativeInventoryActionC2SPacket(slot.id,slot.getStack()));
9398
}
9499
}
95100
protected void init() {
@@ -213,6 +218,7 @@ else if(this.slots != null) {
213218
this.handler.slots.addAll(this.slots);
214219
this.slots = null;
215220
}
221+
this.scrollPosition = 0;
216222
populate();
217223
}
218224
private void populate() {

0 commit comments

Comments
 (0)