本文整理了Java中net.minecraft.inventory.Slot.getHasStack()
方法的一些代码示例,展示了Slot.getHasStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.getHasStack()
方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:getHasStack
暂无
代码示例来源:origin: Vazkii/Botania
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
for(int i1 = 0; i1 < 7; ++i1) {
Slot slot = inventorySlots.inventorySlots.get(i1);
if(slot.getHasStack() && slot.getSlotStackLimit() == 1)
drawTexturedModalRect(guiLeft+slot.xPos, guiTop+slot.yPos, 200, 0, 16, 16);
}
}
代码示例来源:origin: Vazkii/Botania
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if(slotIndex < 16) {
if(!mergeItemStack(itemstack1, 16, 52, true))
return ItemStack.EMPTY;
} else {
int i = itemstack.getItemDamage();
if(i < 16) {
Slot slot1 = inventorySlots.get(i);
if(slot1.isItemValid(itemstack) && !mergeItemStack(itemstack1, i, i + 1, true))
return ItemStack.EMPTY;
}
}
if(itemstack1.isEmpty())
slot.putStack(ItemStack.EMPTY);
else slot.onSlotChanged();
if(itemstack1.getCount() == itemstack.getCount())
return ItemStack.EMPTY;
slot.onTake(player, itemstack1);
}
return itemstack;
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean hasFilter(boolean input) {
Slot slot = input ? slotInputFilter : slotOutputFilter;
return slot != null && slot.getHasStack();
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean hasFunctionUpgrade() {
return slotFunctionUpgrade != null && slotFunctionUpgrade.getHasStack();
}
代码示例来源:origin: Vazkii/Botania
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(slotIndex);
if(slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
int boxStart = 7;
int boxEnd = boxStart + 24;
int invEnd = boxEnd + 36;
if(slotIndex < boxEnd) {
if(!mergeItemStack(itemstack1, boxEnd, invEnd, true))
return ItemStack.EMPTY;
} else {
if(!itemstack1.isEmpty() && (itemstack1.getItem() instanceof IBauble || itemstack1.getItem() instanceof IManaItem) && !mergeItemStack(itemstack1, boxStart, boxEnd, false))
return ItemStack.EMPTY;
}
if(itemstack1.isEmpty())
slot.putStack(ItemStack.EMPTY);
else slot.onSlotChanged();
if(itemstack1.getCount() == itemstack.getCount())
return ItemStack.EMPTY;
slot.onTake(player, itemstack1);
}
return itemstack;
}
代码示例来源:origin: SonarSonic/Calculator
public int getCurrentUsage() {
if (this.inventorySlots.get(0).getHasStack() || this.inventorySlots.get(1).getHasStack()) {
return 1;
} else if (this.inventorySlots.get(3).getHasStack() || this.inventorySlots.get(4).getHasStack()) {
return 2;
} else if (this.inventorySlots.get(6).getHasStack() || this.inventorySlots.get(7).getHasStack() || this.inventorySlots.get(8).getHasStack()) {
return 3;
}
return 0;
}
}
代码示例来源:origin: SleepyTrousers/EnderIO
public boolean clearCraftingGrid() {
boolean cleared = true;
for (Slot slot : getCraftingGridSlots()) {
if (slot.getHasStack()) {
moveItemsToReturnArea(slot.slotNumber);
if (slot.getHasStack()) {
cleared = false;
}
}
}
return cleared;
}
代码示例来源:origin: RS485/LogisticsPipes
private void handleShiftClickLists(Slot from, List<Slot> toList, boolean ignoreEmpty, EntityPlayer player) {
if (!from.getHasStack()) {
return;
}
for (Slot to : toList) {
if (handleShiftClickForSlots(from, to, ignoreEmpty, player)) {
return;
}
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( slot != null )
this.dbl_whichItem = slot.getHasStack() ? slot.getStack().copy() : ItemStack.EMPTY;
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
inventorySlot, this.dbl_whichItem, true ) )
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean shouldDraw() {
return !c.getUpgradeSlot().getHasStack() && super.shouldDraw();
}
});
代码示例来源:origin: p455w0rd/WirelessCraftingTerminal
public boolean isMagnetInstalled() {
for (Slot slot : inventorySlots) {
if (slot instanceof SlotMagnet && slot.getHasStack() && slot.getStack().getItem() == ModItems.MAGNET_CARD) {
return true;
}
}
return false;
}
代码示例来源:origin: Vazkii/Quark
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = inventorySlots.get(index);
if(index >= 9 && index < 36 && slot != null && slot.getHasStack()) {
ItemStack stack = slot.getStack();
if(!mergeItemStack(stack, 46, 72, false))
return ItemStack.EMPTY;
}
return super.transferStackInSlot(playerIn, index);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean shouldDraw() {
return !getContainer().getSlotFilter().getHasStack() && super.shouldDraw();
}
});
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean shouldDraw() {
return super.shouldDraw() && getTileEntity().canVoidItems() && !inventorySlots.getSlot(ContainerTank.trashcan).getHasStack();
}
});
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( d.getHasStack() )
if( d.getHasStack() )
代码示例来源:origin: p455w0rd/WirelessCraftingTerminal
public static boolean stackFitsInSlot(Slot slot, @Nonnull ItemStack itemStack, boolean sizeMatters) {
boolean flag1 = slot == null || !slot.getHasStack();
if (slot != null && slot.getHasStack() && !itemStack.isEmpty() && itemStack.isItemEqual(slot.getStack()) && ItemStack.areItemStackTagsEqual(slot.getStack(), itemStack)) {
int i = sizeMatters ? 0 : itemStack.getCount();
flag1 |= slot.getStack().getCount() + i <= itemStack.getMaxStackSize();
}
return flag1;
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
private void renameItem() {
String s = textField.getText();
Slot slot = container.getSlot(0);
if ((slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() &&
s.equals(slot.getStack().getDisplayName())) || slot != null && slot.getStack() == null) {
s = "";
}
if (!s.isEmpty() && canEdit && !s.equals(container.hammer.itemName)) {
ItemNamePacket packet = new ItemNamePacket(hammer.getPos(), s);
EsteemedInnovation.channel.sendToServer(packet);
}
}
代码示例来源:origin: WayofTime/BloodMagic
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
InventoryPlayer inventoryPlayer = player.inventory;
if (slotId < 6 && slotId >= 0) {
Slot slot = this.getSlot(slotId);
if (!slot.getHasStack() && inventoryPlayer.getItemStack().isEmpty()) {
((TileAlchemyTable) tileTable).toggleInputSlotAccessible(slotId);
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
代码示例来源:origin: Nividica/ThaumicEnergistics
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
if (ForgeUtil.isClient() || index < 0 || index > this.inventorySlots.size())
return super.transferStackInSlot(playerIn, index);
Slot slot = this.inventorySlots.get(index);
if (slot.getHasStack() && !slot.getStack().isEmpty()) {
IAEItemStack remaining = AEUtil.inventoryInsert(this.channel.createStack(slot.getStack()), this.monitor, this.part.source, Actionable.MODULATE);
slot.putStack(remaining == null ? ItemStack.EMPTY : remaining.createItemStack());
this.detectAndSendChanges();
}
return super.transferStackInSlot(playerIn, index);
}
代码示例来源:origin: Nividica/ThaumicEnergistics
@Override
protected void handleMouseClick(Slot slot, int slotId, int mouseButton, ClickType type) {
if (slot instanceof SlotME) {
// Send to server for processing
if (slot.getHasStack())
PacketHandler.sendToServer(new PacketUIAction(ActionType.FILL_ESSENTIA_ITEM, ((SlotME) slot).getAEStack()));
else
PacketHandler.sendToServer(new PacketUIAction(ActionType.EMPTY_ESSENTIA_ITEM));
return;
}
super.handleMouseClick(slot, slotId, mouseButton, type);
}
内容来源于网络,如有侵权,请联系作者删除!