Skip to content

Commit

Permalink
earth may rest in piece
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeRNG committed Mar 7, 2023
1 parent 0ecf220 commit db6ddc2
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.actiondump.ActionDump;
import dev.dfonline.codeclient.actiondump.CodeBlock;
import dev.dfonline.codeclient.actiondump.Item;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
Expand All @@ -27,7 +27,6 @@
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.screen.slot.Slot;
Expand Down Expand Up @@ -81,7 +80,9 @@ protected void onMouseClick(@Nullable Slot slot, int slotId, int button, SlotAct

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

slot.setStack(cursorItem);
this.handler.setCursorStack(slotStack);
this.handler.syncState();
this.listener.onSlotUpdate(this.handler,slot.id - 9,slot.getStack());
CodeClient.LOGGER.info(String.valueOf(slot.id));
// CodeClient.MC.getNetworkHandler().sendPacket(new CreativeInventoryActionC2SPacket(slot.id,slot.getStack()));
}
}
protected void init() {
Expand Down Expand Up @@ -213,6 +218,7 @@ else if(this.slots != null) {
this.handler.slots.addAll(this.slots);
this.slots = null;
}
this.scrollPosition = 0;
populate();
}
private void populate() {
Expand Down

0 comments on commit db6ddc2

Please sign in to comment.