本文整理了Java中net.minecraft.inventory.Slot.putStack()
方法的一些代码示例,展示了Slot.putStack()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.putStack()
方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:putStack
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
public void clear()
{
for( final Slot s : this.craftingSlots )
{
s.putStack( ItemStack.EMPTY );
}
for( final Slot s : this.outputSlots )
{
s.putStack( ItemStack.EMPTY );
}
this.detectAndSendChanges();
this.getAndUpdateOutput();
}
代码示例来源: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: 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: ForestryMC/Binnie
public void setItemStacks(final ItemStack[] array) {
int i = 0;
for (final ItemStack item : array) {
if (i >= this.slots.size()) {
return;
}
ControlSlot controlSlot = this.slots.get(i);
Slot slot = controlSlot.slot;
slot.putStack(item);
++i;
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
cca.getCraftingItem().putStack( baseContainer.getTargetStack().asItemStackRepresentation() );
代码示例来源:origin: AlgorithmX2/Chisels-and-Bits
@Override
public void client()
{
final Container cc = ClientSide.instance.getPlayer().openContainer;
if ( cc instanceof BagContainer )
{
( (BagContainer) cc ).customSlots.get( index ).putStack( is );
}
}
代码示例来源:origin: p455w0rd/WirelessCraftingTerminal
@Override
public void putStack(@Nonnull ItemStack itemStack) {
if (!isPhantom() || canAdjustPhantom()) {
super.putStack(itemStack);
}
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public void putStack(ItemStack itemStack) {
if (!isPhantom() || canAdjustPhantom()) {
super.putStack(itemStack);
}
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Override
public void accept(I ingredient) {
slot.putStack((ItemStack) ingredient);
RS.INSTANCE.network.sendToServer(new MessageSlotFilterSet(slot.slotNumber, (ItemStack) ingredient));
}
});
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public void putStack(@Nonnull ItemStack stack) {
if (stack.getCount() <= getItemStackLimit(stack)) {
super.putStack(stack);
} else {
throw new RuntimeException("Invalid stacksize. " + stack.getCount() + " is more than the allowed limit of " + getItemStackLimit(stack)
+ ". THIS IS NOT AN ERROR IN ENDER IO BUT THE CALLING MOD!");
}
}
代码示例来源:origin: Darkhax-Minecraft/Bookshelf
@Override
public void putStack (@Nullable ItemStack stack) {
ItemStack copy = stack;
if (!copy.isEmpty()) {
copy = copy.copy();
copy.setCount(1);
}
super.putStack(copy);
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
a.putStack( testA );
b.putStack( testB );
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
tis.setCount( tis.getCount() - placeAble );
d.putStack( t );
tis.setCount( tis.getCount() - placeAble );
d.putStack( t );
d.putStack( tmp );
代码示例来源:origin: CoFH/CoFHCore
@Override
public ItemStack slotClick(int slotId, int mouseButton, ClickType modifier, EntityPlayer player) {
Slot slot = slotId < 0 ? null : this.inventorySlots.get(slotId);
if (slot instanceof SlotFalseCopy) {
if (mouseButton == 2) {
slot.putStack(ItemStack.EMPTY);
} else {
slot.putStack(player.inventory.getItemStack().isEmpty() ? ItemStack.EMPTY : player.inventory.getItemStack().copy());
}
return player.inventory.getItemStack();
}
return super.slotClick(slotId, mouseButton, modifier, player);
}
代码示例来源:origin: GregTechCE/GregTech
private static void fillPhantomSlot(Slot slot, ItemStack stackHeld, int mouseButton) {
if (stackHeld.isEmpty()) {
slot.putStack(ItemStack.EMPTY);
return;
}
int stackSize = mouseButton == 0 ? stackHeld.getCount() : 1;
if (stackSize > slot.getSlotStackLimit()) {
stackSize = slot.getSlotStackLimit();
}
ItemStack phantomStack = stackHeld.copy();
phantomStack.setCount(stackSize);
slot.putStack(phantomStack);
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
s.putStack( ItemStack.EMPTY );
s.putStack( hand.copy() );
s.putStack( is );
s.putStack( is );
s.putStack( is );
代码示例来源:origin: sinkillerj/ProjectE
@Nonnull
@Override
public ItemStack slotClick(int slot, int button, ClickType flag, EntityPlayer player)
{
if (slot >= 0 && getSlot(slot) instanceof SlotGhost && !getSlot(slot).getStack().isEmpty())
{
getSlot(slot).putStack(ItemStack.EMPTY);
return ItemStack.EMPTY;
} else
{
return super.slotClick(slot, button, flag, player);
}
}
代码示例来源:origin: ForestryMC/Binnie
private ItemStack shiftClick(final EntityPlayer player, final int slotnumber) {
final TransferRequest request = this.getShiftClickRequest(player, slotnumber);
TransferResult transferResult = request.transfer(player, true);
if (transferResult.isSuccess()) {
NonNullList<ItemStack> results = transferResult.getRemaining();
if (results.size() == 1) {
final ItemStack itemstack = results.get(0);
final Slot shiftClickedSlot = this.inventorySlots.get(slotnumber);
shiftClickedSlot.putStack(itemstack);
shiftClickedSlot.onSlotChanged();
}
}
return ItemStack.EMPTY;
}
代码示例来源: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: ldtteam/minecolonies
@Override
public void putStack(final ItemStack stack)
{
if (buildingId != null && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER && !ItemStackUtils.isEmpty(stack))
{
final Colony colony = ColonyManager.getColonyByWorld(colonyId, world);
final AbstractBuilding building = colony.getBuildingManager().getBuilding(buildingId);
final CitizenData citizenData = colony.getCitizenManager().getCitizen(citizenId);
building.overruleNextOpenRequestOfCitizenWithStack(citizenData, stack);
}
super.putStack(stack);
}
});
内容来源于网络,如有侵权,请联系作者删除!