本文整理了Java中net.minecraft.inventory.Slot.getSlotIndex()
方法的一些代码示例,展示了Slot.getSlotIndex()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Slot.getSlotIndex()
方法的具体详情如下:
包路径:net.minecraft.inventory.Slot
类名称:Slot
方法名:getSlotIndex
暂无
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public boolean shouldDrawSlot(Slot slot) {
if(slot.getSlotIndex() >= slotCount) {
return false;
}
// all visible
if(!slider.isEnabled()) {
return true;
}
return firstSlotId <= slot.getSlotIndex() && lastSlotId > slot.getSlotIndex();
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public boolean shouldDrawSlot(Slot slot) {
// all visible
if(!slider.isEnabled()) {
return true;
}
int index = slot.getSlotIndex();
return (firstSlotId <= index && lastSlotId > index); // inside visible area
//|| indexStart > index || indexEnd <= index; // or not our concern
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
@Override
public boolean shouldDrawSlot(Slot slot) {
if(slot.getSlotIndex() >= inventory.getSizeInventory()) {
return false;
}
return super.shouldDrawSlot(slot);
}
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
public void updateSlots() {
// calculate displayed slots
firstSlotId = slider.getValue() * columns;
lastSlotId = Math.min(slotCount, firstSlotId + rows * columns);
for(Slot slot : container.inventorySlots) {
if(shouldDrawSlot(slot)) {
// calc position of the slot
int offset = slot.getSlotIndex() - firstSlotId;
int x = (offset % columns) * GuiDynInventory.slot.w;
int y = (offset / columns) * GuiDynInventory.slot.h;
slot.xPos = xOffset + x + 1;
slot.yPos = yOffset + y + 1;
}
else {
slot.xPos = 0;
slot.yPos = 0;
}
}
}
代码示例来源:origin: SlimeKnights/TinkersConstruct
protected void updateSlots() {
firstSlotId = slider.getValue() * columns;
lastSlotId = Math.min(slotCount, firstSlotId + getDisplayedRows() * columns);
int xd = border.w + xOffset;
int yd = border.h + yOffset;
if(shouldDrawName()) {
yd += textBackground.h;
}
for(Object o : inventorySlots.inventorySlots) {
Slot slot = (Slot) o;
if(shouldDrawSlot(slot)) {
// calc position of the slot
int offset = slot.getSlotIndex() - firstSlotId;
int x = (offset % columns) * this.slot.w;
int y = (offset / columns) * this.slot.h;
slot.xPos = xd + x + 1;
slot.yPos = yd + y + 1;
if(this.right) {
slot.xPos += parent.realWidth;
}
else {
slot.xPos -= this.xSize;
}
}
else {
slot.xPos = 0;
slot.yPos = 0;
}
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( slot.getSlotIndex() == slotIndex )
recipe.setTag( "#" + slot.getSlotIndex(), tags );
break;
代码示例来源:origin: SlimeKnights/TinkersConstruct
float progress = smeltery.getHeatingProgress(slot.getSlotIndex());
String tooltip = null;
GuiElement bar = progressBar;
代码示例来源:origin: SlimeKnights/TinkersConstruct
float progress = furnace.getHeatingProgress(slot.getSlotIndex());
String tooltip = null;
GuiElement bar = progressBar;
代码示例来源:origin: SlimeKnights/Mantle
public SlotWrapper(Slot slot) {
super(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos);
this.parent = slot;
}
代码示例来源:origin: RS485/LogisticsPipes
public UnmodifiableSlot(Slot slot) {
super(slot.inventory, slot.getSlotIndex(), slot.xPos, slot.yPos);
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
for( final Slot s : slots )
if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.inventorySlots ).getPlayerInv() )
if( s.getSlotIndex() == j && s.inventory == ( (AEBaseContainer) this.inventorySlots ).getPlayerInv() )
代码示例来源:origin: ForestryMC/ForestryMC
private String getDirectionString() {
if (slot.getSlotIndex() >= InventoryPlanter.SLOT_PRODUCTION_1 || slot.getSlotIndex() < InventoryPlanter.SLOT_RESOURCES_1 + InventoryPlanter.SLOT_RESOURCES_COUNT) {
return "";
}
int index = slot.getSlotIndex() % 4;
FarmDirection direction = FarmDirection.values()[index];
String directionString = direction.toString().toLowerCase(Locale.ENGLISH);
return Translator.translateToLocal("for.gui.planter." + directionString);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
protected void renderSlotHighlight(@Nonnull Slot slot, @Nonnull Vector4f col) {
// Check if this is a simple sag mill, if so don't draw the grinding slot highlight
if (isSimple && slot.getSlotIndex() == ContainerSagMill.GRINDING_BALL_SLOT) {
return;
}
super.renderSlotHighlight(slot, col);
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) {
ItemStack result = super.slotClick(slotId, dragType_or_button, clickTypeIn, player);
if (slotId > 0) {
inventory.onSlotClick(inventorySlots.get(slotId).getSlotIndex(), player);
}
return result;
}
代码示例来源:origin: SleepyTrousers/EnderIO
public void createGhostSlots(List<GhostSlot> slots) {
for (Slot slot : inventorySlots) {
if (slot instanceof InventorySlot) {
if (slot.getSlotIndex() == TileSliceAndSplice.axeIndex) {
slots.add(new GhostBackgroundItemSlot(slotItems1.getItemStacks(), slot));
} else if (slot.getSlotIndex() == TileSliceAndSplice.shearsIndex) {
slots.add(new GhostBackgroundItemSlot(slotItems2.getItemStacks(), slot));
}
}
}
}
代码示例来源:origin: raoulvdberge/refinedstorage
@Override
protected void handle(MessageSlotFilterSetFluid message, EntityPlayerMP player) {
Container container = player.openContainer;
if (container != null) {
if (message.containerSlot >= 0 && message.containerSlot < container.inventorySlots.size()) {
Slot slot = container.getSlot(message.containerSlot);
if (slot instanceof SlotFilterFluid) {
((SlotFilterFluid) slot).getFluidInventory().setFluid(slot.getSlotIndex(), message.stack);
}
}
}
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() );
NetworkHandler.instance().sendToServer( p );
代码示例来源:origin: SleepyTrousers/EnderIO
public void renderSlotHighlights(@Nonnull IoMode mode) {
SlotDefinition slotDef = tileEntity.getSlotDefinition();
for (Slot invSlot : inventorySlots.inventorySlots) { // this is a bit hacky, we need a better way for cap-based machines
if (invSlot.inventory == tileEntity || (inventorySlots instanceof ContainerEnder && invSlot.inventory == ((ContainerEnder<?>) inventorySlots).getInv())) {
if ((mode == IoMode.PULL || mode == IoMode.PUSH_PULL) && slotDef.isInputSlot(invSlot.getSlotIndex())) {
renderSlotHighlight(invSlot, PULL_COLOR);
} else if ((mode == IoMode.PUSH || mode == IoMode.PUSH_PULL) && slotDef.isOutputSlot(invSlot.getSlotIndex())) {
renderSlotHighlight(invSlot, PUSH_COLOR);
}
}
}
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
Slot slot = getSlotAtPosition(mouseX, mouseY);
if (slot != null && slot.getSlotIndex() == -1) {
return;
}
super.mouseClicked(mouseX, mouseY, mouseButton);
if (searchField != null) {
searchField.mouseClicked(mouseX, mouseY, mouseButton);
}
}
代码示例来源:origin: RS485/LogisticsPipes
@Override
protected Slot addSlotToContainer(Slot par1Slot) {
if (par1Slot != null && par1Slot.getSlotIndex() == slot && par1Slot.inventory == _playerInventory) {
return super.addSlotToContainer(new UnmodifiableSlot(par1Slot));
}
return super.addSlotToContainer(par1Slot);
}
内容来源于网络,如有侵权,请联系作者删除!