mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96ccd4e109 | ||
|
|
b30ca57e68 |
No files matched your search
@@ -32,6 +32,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -272,8 +273,18 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
given += qty;
|
||||
if (given >= stack.stackSize) break;
|
||||
}
|
||||
if (given > 0) NEICPH.sendGiveItem(copyStack(typestack, given), false, false);
|
||||
} else NEICPH.sendGiveItem(stack, infinite, true);
|
||||
if (given > 0) {
|
||||
if (mc().currentScreen instanceof GuiContainerCreative gcc) {
|
||||
mc().thePlayer.inventory.addItemStackToInventory(stack);
|
||||
gcc.inventorySlots.detectAndSendChanges();
|
||||
} else NEICPH.sendGiveItem(copyStack(typestack, given), false, false);
|
||||
}
|
||||
} else {
|
||||
if (mc().currentScreen instanceof GuiContainerCreative gcc) {
|
||||
mc().thePlayer.inventory.addItemStackToInventory(stack);
|
||||
gcc.inventorySlots.detectAndSendChanges();
|
||||
} else NEICPH.sendGiveItem(stack, infinite, true);
|
||||
}
|
||||
} else {
|
||||
for (int given = 0; given < stack.stackSize;) {
|
||||
int qty = Math.min(stack.stackSize - given, stack.getMaxStackSize());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package codechicken.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.getMousePosition;
|
||||
import static codechicken.nei.NEIClientConfig.canCheatItem;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.util.LinkedList;
|
||||
@@ -151,6 +152,8 @@ public class NEIController implements IContainerSlotClickHandler, IContainerInpu
|
||||
&& slot != null
|
||||
&& slot.getStack() != null
|
||||
&& slot.isItemValid(slot.getStack())) {
|
||||
if (!canCheatItem(slot.getStack())) return false;
|
||||
|
||||
NEIClientUtils.cheatItem(slot.getStack(), button, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package codechicken.nei.recipe;
|
||||
|
||||
import static com.gtnewhorizon.gtnhlib.ClientProxy.mc;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainerCreative;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -30,9 +33,16 @@ public class CheatItemHandler extends INEIGuiAdapter {
|
||||
.min(contents + add, Math.min(overSlot.getSlotStackLimit(), draggedStack.getMaxStackSize()));
|
||||
|
||||
if (total > contents) {
|
||||
NEIClientUtils
|
||||
.setSlotContents(overSlot.slotNumber, NEIServerUtils.copyStack(draggedStack, total), true);
|
||||
NEICPH.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false);
|
||||
if (mc.currentScreen instanceof GuiContainerCreative gcc) {
|
||||
mc.thePlayer.inventory.addItemStackToInventory(draggedStack);
|
||||
gcc.inventorySlots.detectAndSendChanges();
|
||||
} else {
|
||||
NEIClientUtils.setSlotContents(
|
||||
overSlot.slotNumber,
|
||||
NEIServerUtils.copyStack(draggedStack, total),
|
||||
true);
|
||||
NEICPH.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false);
|
||||
}
|
||||
draggedStack.stackSize -= total - contents;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user