本文整理汇总了Java中net.minecraft.client.gui.inventory.GuiContainerCreative.getSelectedTabIndex方法的典型用法代码示例。如果您正苦于以下问题:Java GuiContainerCreative.getSelectedTabIndex方法的具体用法?Java GuiContainerCreative.getSelectedTabIndex怎么用?Java GuiContainerCreative.getSelectedTabIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.gui.inventory.GuiContainerCreative
的用法示例。
在下文中一共展示了GuiContainerCreative.getSelectedTabIndex方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMouseClicked
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
@SubscribeEvent
public void onMouseClicked(MouseInputEvent.Post event)
{
if (event.getGui() instanceof GuiContainerCreative)
{
GuiContainerCreative guiScreen = (GuiContainerCreative) event.getGui();
List<GuiButton> buttonList = ObfuscationReflectionHelper.getPrivateValue(GuiScreen.class, (GuiScreen) guiScreen, 7);
if (previousSelectedTabIndex != guiScreen.getSelectedTabIndex())
{
if (guiScreen.getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex() && !buttonList.contains(ACCESSORY_BUTTON))
{
int guiLeft = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiLeft", "field_147003_i");
int guiTop = ObfuscationReflectionHelper.getPrivateValue(GuiContainer.class, (GuiContainer)event.getGui(), "guiTop", "field_147009_r");
buttonList.add(ACCESSORY_BUTTON.setPosition(guiLeft + 73, guiTop + 38));
}
else if (previousSelectedTabIndex == CreativeTabs.INVENTORY.getTabIndex())
{
buttonList.remove(ACCESSORY_BUTTON);
}
previousSelectedTabIndex = guiScreen.getSelectedTabIndex();
}
}
}
示例2: handleSetSlot
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
public void handleSetSlot(S2FPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
if (packetIn.func_149175_c() == -1)
{
entityplayer.inventory.setItemStack(packetIn.func_149174_e());
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex();
}
if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45)
{
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack();
if (packetIn.func_149174_e() != null && (itemstack == null || itemstack.stackSize < packetIn.func_149174_e().stackSize))
{
packetIn.func_149174_e().animationsToGo = 5;
}
entityplayer.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
}
else if (packetIn.func_149175_c() == entityplayer.openContainer.windowId && (packetIn.func_149175_c() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
}
}
}
示例3: handleSetSlot
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open
* (non-creative) container
*/
public void handleSetSlot(S2FPacketSetSlot packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
if (packetIn.func_149175_c() == -1) {
entityplayer.inventory.setItemStack(packetIn.func_149174_e());
} else {
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative) {
GuiContainerCreative guicontainercreative = (GuiContainerCreative) this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex();
}
if (packetIn.func_149175_c() == 0 && packetIn.func_149173_d() >= 36 && packetIn.func_149173_d() < 45) {
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.func_149173_d()).getStack();
if (packetIn.func_149174_e() != null
&& (itemstack == null || itemstack.stackSize < packetIn.func_149174_e().stackSize)) {
packetIn.func_149174_e().animationsToGo = 5;
}
entityplayer.inventoryContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
} else if (packetIn.func_149175_c() == entityplayer.openContainer.windowId
&& (packetIn.func_149175_c() != 0 || !flag)) {
entityplayer.openContainer.putStackInSlot(packetIn.func_149173_d(), packetIn.func_149174_e());
}
}
}
示例4: drawGuiContainerBackgroundLayer
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Hook(value = "net.minecraft.client.gui.inventory.GuiContainerCreative#func_146976_a", type = Hook.Type.TAIL)
public static final void drawGuiContainerBackgroundLayer(GuiContainerCreative gui, float partialTicks, int mouseX, int mouseY) {
if (gui.getSelectedTabIndex() == CreativeTabs.INVENTORY.getTabIndex()) {
HUDManager.bind(GuiContainer.INVENTORY_BACKGROUND);
for (int i = 0; i < 4; i++)
gui.drawTexturedModalRect(gui.guiLeft + 126 + i / 2 * 18, gui.guiTop + 10 + i % 2 * 18, 76, 61, 18, 18);
for (int i = 0; i < 4; i++)
gui.drawTexturedModalRect(gui.guiLeft + 16 + i / 2 * 18, gui.guiTop + 10 + i % 2 * 18, 76, 61, 18, 18);
}
}
示例5: handleSetSlot
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
public void handleSetSlot(SPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.player;
ItemStack itemstack = packetIn.getStack();
int i = packetIn.getSlot();
if (packetIn.getWindowId() == -1)
{
entityplayer.inventory.setItemStack(itemstack);
}
else if (packetIn.getWindowId() == -2)
{
entityplayer.inventory.setInventorySlotContents(i, itemstack);
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex();
}
if (packetIn.getWindowId() == 0 && packetIn.getSlot() >= 36 && i < 45)
{
if (!itemstack.func_190926_b())
{
ItemStack itemstack1 = entityplayer.inventoryContainer.getSlot(i).getStack();
if (itemstack1.func_190926_b() || itemstack1.func_190916_E() < itemstack.func_190916_E())
{
itemstack.func_190915_d(5);
}
}
entityplayer.inventoryContainer.putStackInSlot(i, itemstack);
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId && (packetIn.getWindowId() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(i, itemstack);
}
}
}
示例6: handleSetSlot
import net.minecraft.client.gui.inventory.GuiContainerCreative; //导入方法依赖的package包/类
/**
* Handles pickin up an ItemStack or dropping one in your inventory or an open (non-creative) container
*/
public void handleSetSlot(SPacketSetSlot packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
if (packetIn.getWindowId() == -1)
{
entityplayer.inventory.setItemStack(packetIn.getStack());
}
else if (packetIn.getWindowId() == -2)
{
entityplayer.inventory.setInventorySlotContents(packetIn.getSlot(), packetIn.getStack());
}
else
{
boolean flag = false;
if (this.gameController.currentScreen instanceof GuiContainerCreative)
{
GuiContainerCreative guicontainercreative = (GuiContainerCreative)this.gameController.currentScreen;
flag = guicontainercreative.getSelectedTabIndex() != CreativeTabs.INVENTORY.getTabIndex();
}
if (packetIn.getWindowId() == 0 && packetIn.getSlot() >= 36 && packetIn.getSlot() < 45)
{
ItemStack itemstack = entityplayer.inventoryContainer.getSlot(packetIn.getSlot()).getStack();
if (packetIn.getStack() != null && (itemstack == null || itemstack.stackSize < packetIn.getStack().stackSize))
{
packetIn.getStack().animationsToGo = 5;
}
entityplayer.inventoryContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
else if (packetIn.getWindowId() == entityplayer.openContainer.windowId && (packetIn.getWindowId() != 0 || !flag))
{
entityplayer.openContainer.putStackInSlot(packetIn.getSlot(), packetIn.getStack());
}
}
}