本文整理汇总了Java中com.enderio.core.client.gui.widget.GhostSlot类的典型用法代码示例。如果您正苦于以下问题:Java GhostSlot类的具体用法?Java GhostSlot怎么用?Java GhostSlot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GhostSlot类属于com.enderio.core.client.gui.widget包,在下文中一共展示了GhostSlot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ghostSlotClickedPrimaryMouseButton
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void ghostSlotClickedPrimaryMouseButton(GhostSlot slot, ItemStack handStack, ItemStack existingStack) {
if (handStack == null || handStack.getItem() == null || handStack.stackSize == 0) { // empty hand
slot.putStack(null);
} else { // item in hand
if (existingStack == null || existingStack.getItem() == null || existingStack.stackSize == 0) { // empty slot
replaceSlot(slot, handStack);
} else { // filled slot
if (ItemUtil.areStackMergable(existingStack, handStack)) { // same item
if (existingStack.stackSize < existingStack.getMaxStackSize() && existingStack.stackSize < slot.getStackSizeLimit()) {
increaseSlot(slot, existingStack);
} else {
// NOP
}
} else { // different item
replaceSlot(slot, handStack);
}
}
}
}
示例2: drawGhostSlotGrayout
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
/**
* Gray out the item that was just painted into a GhostSlot by overpainting it
* with 50% transparent background. This gives the illusion that the item was
* painted with 50% transparency. (100%*a ° 100%*b ° 50%*a == 100%*a ° 50%*b)
*/
protected void drawGhostSlotGrayout(GuiContainerBase gui, GhostSlot slot) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, slot.getGrayOutLevel());
String guiTexture = gui.getGuiTexture();
if (guiTexture == null) {
NEUTRAL_SLOT_BACKGROUND.getMap().render(NEUTRAL_SLOT_BACKGROUND, gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, gui.getZlevel(), true);
} else {
RenderUtil.bindTexture(guiTexture);
gui.drawTexturedModalRect(gui.getGuiLeft() + slot.x, gui.getGuiTop() + slot.y, slot.x, slot.y, 16, 16);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
}
示例3: addGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void addGhostSlots(List<GhostSlot> ghostSlots) {
final SlotDefinitionAfarm slotDef = (SlotDefinitionAfarm) getInv().getSlotDefinition();
int x = COL + D;
int y = ROW1;
boolean even = true;
for (int slot = slotDef.getMinSlot(SLOT.SEED_GHOST); slot <= slotDef.getMaxSlot(SLOT.SEED_GHOST); slot++) {
final AfarmGhostSlot theSlot = new AfarmGhostSlot(slot, x, y);
x += D + D / 2;
if (even) {
tab1ghostSlots.add(theSlot);
} else {
tab1ghostSlotsOdd.add(theSlot);
}
even = !even;
}
if (ghostItemsEnabled.getBoolean()) {
ghostSlots.addAll(tab0ghostSlots);
ghostSlots.addAll(tab1ghostSlots);
ghostSlots.addAll(tab1ghostSlotsOdd);
ghostSlots.addAll(tab2ghostSlots);
ghostSlots.addAll(tab3ghostSlots);
}
}
示例4: addGhostslots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void addGhostslots(NNList<GhostSlot> ghostSlots) {
NNList<ItemStack> fuels = new NNList<>();
ItemHelper.getValidItems().apply(new Callback<ItemStack>() {
@Override
public void apply(@Nonnull ItemStack e) {
if (getTe().isMachineItemValidForSlot(0, e)) {
fuels.add(e);
if (e.getItem() == Items.LAVA_BUCKET || e.getItem() == Items.COAL) {
// put an emphasis on the common fuels, especially the lava bucket---many players don't know about that one
for (int i = 0; i < 30; i++) {
fuels.add(e);
}
}
}
}
});
ghostSlots.add(new GhostBackgroundItemSlot(fuels, getSlotFromInventory(0)));
}
示例5: addGhostslots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void addGhostslots(NNList<GhostSlot> ghostSlots) {
NNList<ItemStack> empties = new NNList<>();
NNList<ItemStack> fulls = new NNList<>();
getValidPair(ItemHelper.getValidItems()).apply(new Callback<Triple<ItemStack, ItemStack, Integer>>() {
@Override
public void apply(@Nonnull Triple<ItemStack, ItemStack, Integer> e) {
empties.add(e.getLeft());
fulls.add(e.getMiddle());
}
});
ghostSlots.removeAllByClass(GhostBackgroundItemSlot.class); // JEI will cause initGui to be re-run after closing the recipe view, causing duplicate ghost
// slots
final GhostBackgroundItemSlot ghost0 = new GhostBackgroundItemSlot(empties, getSlotFromInventory(0));
ghost0.setDisplayStdOverlay(true);
ghostSlots.add(ghost0);
final GhostBackgroundItemSlot ghost1 = new GhostBackgroundItemSlot(fulls, getSlotFromInventory(1));
ghost1.setDisplayStdOverlay(true);
ghostSlots.add(ghost1);
}
示例6: mouseWheel
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void mouseWheel(int x, int y, int delta) {
if (!scrollbars.isEmpty()) {
for (VScrollbar vs : scrollbars) {
vs.mouseWheel(x, y, delta);
}
}
if (!ghostSlotHandler.getGhostSlots().isEmpty()) {
GhostSlot slot = getGhostSlot(x, y);
if (slot != null) {
ghostSlotClicked(slot, x, y, delta < 0 ? -1 : -2);
}
}
}
示例7: getGhostSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected GhostSlot getGhostSlot(GuiContainerBase guiContainerBase, int mouseX, int mouseY) {
mouseX -= guiContainerBase.getGuiLeft();
mouseY -= guiContainerBase.getGuiTop();
for (GhostSlot slot : ghostSlots) {
if (slot.isVisible() && slot.isMouseOver(mouseX, mouseY)) {
return slot;
}
}
return null;
}
示例8: ghostSlotClickedSecondaryMouseButton
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void ghostSlotClickedSecondaryMouseButton(GhostSlot slot, ItemStack handStack, ItemStack existingStack) {
if (handStack == null || handStack.getItem() == null || handStack.stackSize == 0) { // empty hand
slot.putStack(null);
} else { // item in hand
if (existingStack == null || existingStack.getItem() == null || existingStack.stackSize == 0) { // empty slot
replaceSlot1Item(slot, handStack);
} else { // filled slot
if (ItemUtil.areStackMergable(existingStack, handStack)) { // same item
descreaseSlot(slot, existingStack);
} else { // different item
replaceSlot1Item(slot, handStack);
}
}
}
}
示例9: descreaseSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void descreaseSlot(GhostSlot slot, ItemStack existingStack) {
if (existingStack.stackSize > 1) {
existingStack.stackSize--;
slot.putStack(existingStack);
} else {
slot.putStack(null);
}
}
示例10: replaceSlot
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void replaceSlot(GhostSlot slot, ItemStack handStack) {
if (handStack.stackSize <= slot.getStackSizeLimit()) {
slot.putStack(handStack);
} else {
ItemStack tmp = handStack.copy();
tmp.stackSize = slot.getStackSizeLimit();
slot.putStack(tmp);
}
}
示例11: drawGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
protected void drawGhostSlots(GuiContainerBase gui, int mouseX, int mouseY) {
int sx = gui.getGuiLeft();
int sy = gui.getGuiTop();
gui.drawFakeItemsStart();
try {
gui.hoverGhostSlot = hoverGhostSlot = null;
for (GhostSlot slot : ghostSlots) {
ItemStack stack = slot.getStack();
if (slot.isVisible()) {
if (stack != null) {
gui.drawFakeItemStack(slot.x + sx, slot.y + sy, stack);
if (slot.shouldDisplayStdOverlay()) {
gui.drawFakeItemStackStdOverlay(slot.x + sx, slot.y + sy, stack);
}
if (slot.shouldGrayOut()) {
gui.ghostSlotHandler.drawGhostSlotGrayout(gui, slot);
}
}
if (slot.isMouseOver(mouseX - sx, mouseY - sy)) {
gui.hoverGhostSlot = hoverGhostSlot = slot;
}
}
}
if (hoverGhostSlot != null) {
// draw hover last to prevent it from affecting rendering of other slots ...
gui.drawFakeItemHover(hoverGhostSlot.x + sx, hoverGhostSlot.y + sy);
}
} finally {
gui.drawFakeItemsEnd();
}
}
示例12: createGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
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));
}
}
}
}
示例13: addGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void addGhostSlots(List<GhostSlot> ghostSlots) {
int x = 44;
int y = 28;
for (int i = 0; i < 5; i++) {
ghostSlots.add(new AuthGhostSlot(getInv(), i, x, y));
x += 18;
}
}
示例14: addGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void addGhostSlots(List<GhostSlot> ghostSlots) {
int x = 44;
int y = 73;
for (int i = 0; i < 5; i++) {
ghostSlots.add(new CtaGhostSlot(ta, i, x, y, true));
x += 18;
}
x = 125;
y = 10;
ghostSlots.add(new CtaGhostSlot(ta, 0, x, y, false));
}
示例15: createGhostSlots
import com.enderio.core.client.gui.widget.GhostSlot; //导入依赖的package包/类
public void createGhostSlots(List<GhostSlot> slots) {
slots.add(new GhostBackgroundItemSlot(slotItemsFull.getItemStacks(), getSlotFromInventory(inFull)));
if (getTe().tank.isEmpty() || !getTe().tank.hasFluid(Fluids.XP_JUICE.getFluid())) {
slots.add(new GhostBackgroundItemSlot(slotItemsEmpty.getItemStacks(), getSlotFromInventory(inEmpty)));
} else {
slots.add(new GhostBackgroundItemSlot(mendables.getItemStacks(), getSlotFromInventory(inEmpty)));
}
slots.add(new GhostBackgroundItemSlot(slotItemsEmpty.getItemStacks(), getSlotFromInventory(outEmpty)));
slots.add(new GhostBackgroundItemSlot(slotItemsFull.getItemStacks(), getSlotFromInventory(outFull)));
}