本文整理了Java中net.minecraft.inventory.Slot.canTakeStack()
方法的一些代码示例,展示了Slot.canTakeStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.canTakeStack()
方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:canTakeStack
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( !s.canTakeStack( ( (AEBaseContainer) this.inventorySlots ).getPlayerInv().player ) )
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
for( final Slot inventorySlot : slots )
if( inventorySlot != null && inventorySlot.canTakeStack(
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
inventorySlot, this.dbl_whichItem, true ) )
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public boolean canTakeStack(@Nonnull EntityPlayer playerIn) {
ItemStack stackInSlot = inventory.getStackInSlot(getSlotIndex());
if (stackInSlot.getItem() == Item.getItemFromBlock(Blocks.BARRIER)) {
return false;
}
return super.canTakeStack(playerIn);
}
});
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( !isA.isEmpty() && !a.canTakeStack( this.getInventoryPlayer().player ) )
if( !isB.isEmpty() && !b.canTakeStack( this.getInventoryPlayer().player ) )
代码示例来源:origin: Ellpeck/ActuallyAdditions
@Override
public boolean canTakeStack(EntityPlayer player) {
ItemStack itemstack = this.getStack();
return !itemstack.isEmpty() && !player.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(player);
}
代码示例来源:origin: Azanor/Baubles
@Override
public boolean canTakeStack(EntityPlayer playerIn)
{
ItemStack itemstack = this.getStack();
return !itemstack.isEmpty() && !playerIn.isCreative() && EnchantmentHelper.hasBindingCurse(itemstack) ? false : super.canTakeStack(playerIn);
}
@Override
代码示例来源:origin: Nividica/ThaumicEnergistics
public boolean canTakeStack(EntityPlayer playerIn) {
return (this.getStack().isEmpty() || playerIn.isCreative() || !EnchantmentHelper.hasBindingCurse(this.getStack())) && super.canTakeStack(playerIn);
}
代码示例来源:origin: Nividica/ThaumicEnergistics
public boolean canTakeStack(EntityPlayer playerIn) {
return (this.getStack().isEmpty() || playerIn.isCreative() || !EnchantmentHelper.hasBindingCurse(this.getStack())) && super.canTakeStack(playerIn);
}
代码示例来源:origin: Nividica/ThaumicEnergistics
public boolean canTakeStack(EntityPlayer playerIn) {
return (this.getStack().isEmpty() || playerIn.isCreative() || !EnchantmentHelper.hasBindingCurse(this.getStack())) && super.canTakeStack(playerIn);
}
代码示例来源:origin: Nividica/ThaumicEnergistics
public boolean canTakeStack(EntityPlayer playerIn) {
return (this.getStack().isEmpty() || playerIn.isCreative() || !EnchantmentHelper.hasBindingCurse(this.getStack())) && super.canTakeStack(playerIn);
}
代码示例来源:origin: mezz/JustEnoughItems
final ItemStack stack = slot.getStack();
if (!stack.isEmpty()) {
if (!slot.canTakeStack(player)) {
Log.get().error("Recipe Transfer helper {} does not work for container {}. Player can't move item out of Crafting Slot number {}", transferHelper.getClass(), container.getClass(), slot.slotNumber);
return handlerHelper.createInternalError();
代码示例来源:origin: mezz/JustEnoughItems
final ItemStack stack = slot.getStack();
if (!stack.isEmpty()) {
if (!slot.canTakeStack(player)) {
Log.get().error("Recipe Transfer helper {} does not work for container {}. Player can't move item out of Crafting Slot number {}", transferHelper.getClass(), container.getClass(), slot.slotNumber);
return handlerHelper.createInternalError();
代码示例来源:origin: Vazkii/Psi
@Override
public boolean canTakeStack(EntityPlayer playerIn) {
CADTakeEvent event = new CADTakeEvent(getStack(), assembler, playerIn);
float sound = event.getSound();
if (MinecraftForge.EVENT_BUS.post(event)) {
BlockPos assemblerPos = this.assembler.getPos();
String cancelMessage = event.getCancellationMessage();
if (!playerIn.world.isRemote) {
if (cancelMessage != null && !cancelMessage.isEmpty())
playerIn.sendMessage(new TextComponentTranslation(cancelMessage).setStyle(new Style().setColor(TextFormatting.RED)));
playerIn.world.playSound(null, assemblerPos.getX(), assemblerPos.getY(), assemblerPos.getZ(), PsiSoundHandler.compileError, SoundCategory.BLOCKS, sound, 1F);
}
return false;
}
return super.canTakeStack(playerIn);
}
代码示例来源:origin: gr8pefish/IronBackpacks
@Nonnull
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotIndex) {
Slot slot = this.getSlot(slotIndex);
if (!slot.canTakeStack(player))
return slot.getStack();
if (slotIndex == blocked)
return ItemStack.EMPTY;
if (!slot.getHasStack())
return ItemStack.EMPTY;
ItemStack stack = slot.getStack();
if (!stack.isEmpty() && ItemStack.areItemStacksEqual(stack, blockedStack))
return ItemStack.EMPTY;
ItemStack newStack = stack.copy();
if (InventoryBlacklist.INSTANCE.isBlacklisted(slot.getStack()))
return ItemStack.EMPTY;
else if (slotIndex < backpackSize.getTotalSize()) {
if (!this.mergeItemStack(stack, backpackSize.getTotalSize(), this.inventorySlots.size(), true))
return ItemStack.EMPTY;
slot.onSlotChanged();
} else if (!this.mergeItemStack(stack, 0, backpackSize.getTotalSize(), false))
return ItemStack.EMPTY;
if (stack.isEmpty())
slot.putStack(ItemStack.EMPTY);
else
slot.onSlotChanged();
return slot.onTake(player, newStack);
}
代码示例来源:origin: PenguinSquad/Harvest-Festival
if (slot6 != null && slot6.canTakeStack(player)) {
ItemStack itemstack8 = slot6.getStack();
} else if (slot7.canTakeStack(player)) {
if (held == null) {
if (inSlot.stackSize > 0) {
if (itemstack7 != null || itemstack10 != null) {
if (itemstack7 == null) {
if (slot5.canTakeStack(player)) {
inventoryplayer.setInventorySlotContents(dragType, itemstack10);
slot5.putStack(null);
} else if (slot5.canTakeStack(player) && slot5.isItemValid(itemstack7)) {
int l1 = slot5.getItemStackLimit(itemstack7);
if (slot3 != null && slot3.getHasStack() && slot3.canTakeStack(player)) {
ItemStack itemstack5 = slot3.decrStackSize(dragType == 0 ? 1 : slot3.getStack().stackSize);
slot3.onPickupFromSlot(player, itemstack5);
if (itemstack4 != null && (slot2 == null || !slot2.getHasStack() || !slot2.canTakeStack(player))) {
int i1 = dragType == 0 ? 0 : inventorySlots.size() - 1;
int j1 = dragType == 0 ? 1 : -1;
if (slot8.getHasStack() && canAddItemToSlot(slot8, itemstack4, true) && slot8.canTakeStack(player) && canMergeSlot(itemstack4, slot8) && (i3 != 0 || slot8.getStack().stackSize != slot8.getStack().getMaxStackSize())) {
int l = Math.min(itemstack4.getMaxStackSize() - itemstack4.stackSize, slot8.getStack().stackSize);
ItemStack itemstack2 = slot8.decrStackSize(l);
代码示例来源:origin: RS485/LogisticsPipes
if (slot5 == null || !slot5.canTakeStack(player)) {
return ItemStack.EMPTY;
} else if (slot6.canTakeStack(player)) {
if (itemstack11.isEmpty()) {
if (itemstack8.isEmpty()) {
if (slot4.canTakeStack(player)) {
inventoryplayer.setInventorySlotContents(dragType, itemstack10);
ReflectionHelper.invokePrivateMethod(Slot.class, slot4, "onSwapCraft", "func_190900_b", new Class[]{int.class}, new Object[] {itemstack10.getCount()});
} else if (slot4.canTakeStack(player) && slot4.isItemValid(itemstack6)) {
int i2 = slot4.getItemStackLimit(itemstack6);
Slot slot2 = this.inventorySlots.get(slotId);
if (slot2 != null && slot2.getHasStack() && slot2.canTakeStack(player)) {
ItemStack itemstack4 = slot2.decrStackSize(dragType == 0 ? 1 : slot2.getStack().getCount());
slot2.onTake(player, itemstack4);
if (!itemstack1.isEmpty() && (slot == null || !slot.getHasStack() || !slot.canTakeStack(player))) {
int i = dragType == 0 ? 0 : this.inventorySlots.size() - 1;
int j = dragType == 0 ? 1 : -1;
if (slot1.getHasStack() && canAddItemToSlot(slot1, itemstack1, true) && slot1.canTakeStack(player) && this
.canMergeSlot(itemstack1, slot1)) {
ItemStack itemstack2 = slot1.getStack();
代码示例来源:origin: p455w0rd/WirelessCraftingTerminal
if (inventorySlot != null && inventorySlot.canTakeStack(Minecraft.getMinecraft().player) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(inventorySlot, dbl_whichItem, true)) {
handleMouseClick(inventorySlot, inventorySlot.slotNumber, 1, clickType);
代码示例来源:origin: CoFH/CoFHCore
if (slot2 != null && slot2.canTakeStack(player)) {
itemstack3 = this.transferStackInSlot(player, slotIndex);
} else if (slot2.canTakeStack(player)) {
if (itemstack4.isEmpty()) {
l1 = mouseButton == 0 ? itemstack3.getCount() : (itemstack3.getCount() + 1) / 2;
slot2 = this.inventorySlots.get(slotIndex);
if (slot2.canTakeStack(player)) {
itemstack3 = inventoryPlayer.getStackInSlot(mouseButton);
boolean flag = itemstack3.isEmpty() || slot2.inventory == inventoryPlayer && slot2.isItemValid(itemstack3);
slot2 = this.inventorySlots.get(slotIndex);
if (slot2 != null && slot2.getHasStack() && slot2.canTakeStack(player)) {
itemstack3 = slot2.decrStackSize(mouseButton == 0 ? 1 : slot2.getStack().getCount());
slot2.onTake(player, itemstack3);
itemstack3 = inventoryPlayer.getItemStack();
if (!itemstack3.isEmpty() && (slot2 == null || !slot2.getHasStack() || !slot2.canTakeStack(player))) {
i1 = mouseButton == 0 ? 0 : this.inventorySlots.size() - 1;
l1 = mouseButton == 0 ? 1 : -1;
if (slot3.getHasStack() && canAddItemToSlot(slot3, itemstack3, true) && slot3.canTakeStack(player) && this.canMergeSlot(itemstack3, slot3) && (i2 != 0 || slot3.getStack().getCount() != slot3.getStack().getMaxStackSize())) {
int k1 = Math.min(itemstack3.getMaxStackSize() - itemstack3.getCount(), slot3.getStack().getCount());
ItemStack itemstack2 = slot3.decrStackSize(k1);
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(ANVIL_TEXTURE);
int k = (width - xSize) / 2;
int l = (height - ySize) / 2;
drawTexturedModalRect(k, l, 0, 0, xSize, ySize);
drawTexturedModalRect(k + 59, l + 20, 0, ySize + (container.getSlot(0).getHasStack() ? 0 : 16), 110, 16);
if ((container.getSlot(0).getHasStack() || container.getSlot(1).getHasStack()) && !container.getSlot(2).getHasStack()) {
drawTexturedModalRect(k + 99, l + 45, xSize, 0, 28, 21);
}
if (hammer.cost > 0 && hammer.getStackInSlot(2) != null) {
mc.getTextureManager().bindTexture(ARROW);
drawTexturedModalRect(k + 102, l + 48, 177, 14, MathHelper.floor(22.0F *
(((float) hammer.progress + (float) hammer.hammerTicks / 360.0F) / (float) hammer.cost)), 16);
}
if (!this.container.getSlot(2).canTakeStack(this.playerInv.player) && this.container.getSlot(2).getHasStack()) {
GL11.glPushMatrix();
GL11.glColorMask(true, true, true, false);
this.drawGradientRect(k + 134, l + 47, k + 134 + 16, l + 47 + 16, 0x59000000, 0x59000000);
GL11.glColorMask(true, true, true, true);
GL11.glPopMatrix();
}
}
内容来源于网络,如有侵权,请联系作者删除!