当前位置: 首页>>代码示例>>Java>>正文


Java Slot.getSlotIndex方法代码示例

本文整理汇总了Java中net.minecraft.inventory.Slot.getSlotIndex方法的典型用法代码示例。如果您正苦于以下问题:Java Slot.getSlotIndex方法的具体用法?Java Slot.getSlotIndex怎么用?Java Slot.getSlotIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.inventory.Slot的用法示例。


在下文中一共展示了Slot.getSlotIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMouseClick

import net.minecraft.inventory.Slot; //导入方法依赖的package包/类
@Override
protected void handleMouseClick(Slot slot, int slotId, int clickedButton, ClickType clickType) {
    if (slot instanceof SlotPhantom && Minecraft.getMinecraft().player.inventory.getItemStack().isEmpty() && !slot.getHasStack() && clickedButton == 1) {
        editingSlot = slot.getSlotIndex();
        Minecraft.getMinecraft().displayGuiScreen(searchGui = new GuiSearcher(Minecraft.getMinecraft().player));
    } else {
        super.handleMouseClick(slot, slotId, clickedButton, clickType);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:GuiLogisticsBase.java

示例2: onContainerOpened

import net.minecraft.inventory.Slot; //导入方法依赖的package包/类
@SubscribeEvent
public void onContainerOpened(PlayerContainerEvent.Open event)
{
       if (!SettingsFlags.instance.enableCustomInventory)
       {
           return;
       }

	try
	{
		Container c = event.getContainer();
		for (int i = 0; i < c.inventorySlots.size(); ++i)
		{
			Slot s = c.inventorySlots.get(i);
			if (s.getClass().equals(Slot.class) && s.inventory instanceof InventoryPlayer && !(s instanceof ManagedSlot) && s.getSlotIndex() >= 9 && s.getSlotIndex() < 36)
			{
				ManagedSlot wrapper = new ManagedSlot(s);
				c.inventorySlots.remove(i);
				c.inventorySlots.add(i, wrapper);
			}
		}
	}
	catch (Exception ex)
	{
		ExPMisc.modLogger.log(LogLevel.Error, "ExPetrum was unable to initialize it's inventory system! This is most likely caused by another mod!", ex);
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:28,代码来源:ExPHandlerServer.java

示例3: onOpenGui

import net.minecraft.inventory.Slot; //导入方法依赖的package包/类
@SubscribeEvent
public static void onOpenGui(GuiScreenEvent.InitGuiEvent event)
{
	if (event.getGui() instanceof GuiContainer)
	{
           if (!SettingsFlags.instance.enableCustomInventory)
           {
               return;
           }

		GuiContainer gc = (GuiContainer) event.getGui();
		if ((gc instanceof GuiInventory || gc instanceof GuiContainerCreative) && Minecraft.getMinecraft().player.capabilities.isCreativeMode)
		{
			return;
		}
		
		Container c = gc.inventorySlots;
		for (int i = 0; i < c.inventorySlots.size(); ++i)
		{
			Slot s = c.inventorySlots.get(i);
			if (s.getClass().equals(Slot.class) && s.inventory instanceof InventoryPlayer && !(s instanceof ManagedSlot) && s.getSlotIndex() >= 9 && s.getSlotIndex() < 36)
			{
				ManagedSlot wrapper = new ManagedSlot(s);
				c.inventorySlots.remove(i);
				c.inventorySlots.add(i, wrapper);
			}
		}
	}

       if (event.getGui() instanceof GuiCreateWorld)
       {
           if (!SettingsFlags.instance.enableInvasiveChanges)
           {
               return;
           }

           try
           {
               Field f = null;
               Field[] allFlds = GuiCreateWorld.class.getDeclaredFields();
               for (int i = allFlds.length - 1; i >= 0; --i)
               {
                   if (allFlds[i].getType() == Integer.TYPE)
                   {
                       f = allFlds[i];
                       break;
                   }
               }

               f.setAccessible(true);
               f.set(event.getGui(), ExPMisc.worldTypeExP.getId());
           }
           catch (Exception ex)
           {
               ExPMisc.modLogger.log(LogLevel.Debug, "Could not reflect GuiCreateWorld!", ex);
           }
       }
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:59,代码来源:ExPHandlerClient.java


注:本文中的net.minecraft.inventory.Slot.getSlotIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。