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


Java IBaublesItemHandler.getSlots方法代码示例

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


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

示例1: onItemRightClick

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	if (!world.isRemote) {
		IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
		for (int i = 0; i < baubles.getSlots(); i++)
			if (baubles.getStackInSlot(i).isEmpty() && baubles.isItemValidForSlot(i, player.getHeldItem(hand), player)) {
				baubles.setStackInSlot(i, player.getHeldItem(hand).copy());
				if (!player.capabilities.isCreativeMode) {
					player.setHeldItem(hand, ItemStack.EMPTY);
				}
				onEquipped(player.getHeldItem(hand), player);
				break;
			}
	}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:17,代码来源:ItemRemedyTalisman.java

示例2: findStack

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Nullable
public BeltGetter findStack(EntityPlayer player)
{
    IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
    for (int i = 0; i < baubles.getSlots(); i++)
    {
        ItemStack inSlot = baubles.getStackInSlot(i);
        if (inSlot.getCount() > 0)
        {
            if (inSlot.getItem() instanceof ItemToolBelt)
            {
                return new BaublesBeltGetter(player, i);
            }
        }
    }

    return super.findStack(player);
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:19,代码来源:BeltFinderBaubles.java

示例3: getBaubleNBT

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public static NBTTagCompound getBaubleNBT(IBaublesItemHandler baubles)
{
    NBTTagCompound compound = new NBTTagCompound();

    NBTTagList tagList = new NBTTagList();

    for (int i=0; i<baubles.getSlots(); i++)
    {
        ItemStack stack = baubles.getStackInSlot(i);
        if (stack != null)
        {
            NBTTagCompound slot = new NBTTagCompound();
            stack.writeToNBT(slot);
            slot.setInteger("Slot", i);

            tagList.appendTag(slot);
        }
    }

    compound.setTag(BAUBLES_NBT, tagList);
    compound.setInteger("Size", baubles.getSlots());

    return compound;
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:25,代码来源:BaubleHandler.java

示例4: handleServer

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
protected void handleServer(ActivateBaubleMessage message, EntityPlayerMP player) {
    final IBaublesItemHandler baublesItemHandler = BaublesApi.getBaublesHandler(player);

    if (baublesItemHandler == null) {
        return;
    }

    for (int i = 0; i < baublesItemHandler.getSlots(); i++) {
        final ItemStack baubleStack = baublesItemHandler.getStackInSlot(i);
        if (baubleStack != ItemStack.EMPTY
                && baubleStack.getItem() instanceof BaubleItem) {
            ((BaubleItem) baubleStack.getItem()).onBaubleActivated(baubleStack, player);
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:17,代码来源:ActivateBaubleMessage.java

示例5: performChargeAura

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
private void performChargeAura() {
    final BlockPos targetPos = getPos();
    Predicate<EntityPlayer> playerWithinRangePredicate = input -> input != null
            && input.getPosition().getDistance(targetPos.getX(), targetPos.getY(), targetPos.getZ()) < TMP_MANA_GAIN_DIST;
    List<EntityPlayer> playersWithinRange = getWorld().getEntities(EntityPlayer.class, playerWithinRangePredicate::test);

    for (EntityPlayer player : playersWithinRange) {
        IBaublesItemHandler baublesItemHandler = BaublesApi.getBaublesHandler(player);
        for (int i = 0; i < baublesItemHandler.getSlots(); i++) {
            final ItemStack baubleStack = baublesItemHandler.getStackInSlot(i);
            if (baubleStack != ItemStack.EMPTY
                    && baubleStack.getItem() instanceof IChargeable) {
                ((IChargeable) baubleStack.getItem()).incrementChargeLevel(baubleStack, CHARGE_GAIN_PER_TICK);
            }
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:18,代码来源:IncenseKindlingBoxTileEntity.java

示例6: onArmorTick

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
public void onArmorTick(World world, EntityPlayer player,ItemStack itemStack) {
	//we are in the armor slot
	if(Loader.isModLoaded("baubles")){
		if(ConfigHandler.disableDoubleInscription){
			//InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
			IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
			for(int i=0;i<baubles.getSlots();i++){
				ItemStack stack = baubles.getStackInSlot(i);
				if(!stack.isEmpty() && stack.getItem()==WizardryRegistry.inscription){
					return;
				}
			}
		}
	}
	doTick(world, player, itemStack);
}
 
开发者ID:Xilef11,项目名称:Runes-of-Wizardry,代码行数:18,代码来源:ItemInscriptionBauble.java

示例7: getWornInscription

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
//XXXuncomment if crash with no Baubles @Optional.Method(modid="Baubles")
public ItemStack getWornInscription(EntityPlayer player) {
	//InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
	IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
	ItemStack baub =ItemStack.EMPTY;
	for(int i=0;i<baubles.getSlots();i++){
		ItemStack stack = baubles.getStackInSlot(i);
		if(!stack.isEmpty() && stack.getItem()==WizardryRegistry.inscription){
			baub=stack;
			break;
		}
	}
	ItemStack chest =  super.getWornInscription(player);
	if(!baub.isEmpty()){
		if(!chest.isEmpty() && ConfigHandler.disableDoubleInscription)return null;
		else return baub;
	}
	return chest;
}
 
开发者ID:Xilef11,项目名称:Runes-of-Wizardry,代码行数:21,代码来源:ItemInscriptionBauble.java

示例8: getSavedBaubles

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public static IInventory getSavedBaubles(NBTTagCompound compound, IBaublesItemHandler baubles)
{
    InventoryBasic basic = new InventoryBasic("SavedBaubles", false, baubles.getSlots());

    NBTTagList tagList = compound.getTagList(BAUBLES_NBT, 10);

    for (int i=0; i < tagList.tagCount(); i++)
    {
        NBTTagCompound slot = (NBTTagCompound)tagList.get(i);
        basic.setInventorySlotContents(slot.getInteger("Slot"), ItemStack.loadItemStackFromNBT(slot));
    }

    return basic;
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:15,代码来源:BaubleHandler.java

示例9: getCurrentBaubles

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public static IInventory getCurrentBaubles(IBaublesItemHandler baubles)
{
    InventoryBasic basic = new InventoryBasic("CurrentBaubles", false, baubles.getSlots());

    for (int i=0; i < basic.getSizeInventory(); i++)
    {
        basic.setInventorySlotContents(i, baubles.getStackInSlot(i));
    }

    return basic;
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:12,代码来源:BaubleHandler.java

示例10: setPlayerBaubles

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public static void setPlayerBaubles(EntityPlayer player, NBTTagCompound compound)
{
    IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);

    IInventory stored = getSavedBaubles(compound, baubles);

    for (int i=0; i < baubles.getSlots(); i++)
    {
        baubles.setStackInSlot(i, stored.getStackInSlot(i));
    }
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:12,代码来源:BaubleHandler.java

示例11: clearBaubles

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public static void clearBaubles(EntityPlayer player)
{
    IBaublesItemHandler handler = BaublesApi.getBaublesHandler(player);

    for (int i=0; i < handler.getSlots(); i++)
    {
        handler.setStackInSlot(i, null);
    }
}
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:10,代码来源:BaubleHandler.java

示例12: dispatchRenders

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
private void dispatchRenders(IBaublesItemHandler inv, EntityPlayer player, RenderType type, float partialTicks) {
	for(int i = 0; i < inv.getSlots(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if(!stack.isEmpty()) {
			Item item = stack.getItem();
			if(item instanceof IRenderBauble) {
				GlStateManager.pushMatrix();
				GL11.glColor3ub((byte) 255, (byte) 255, (byte) 255); 
				GlStateManager.color(1F, 1F, 1F, 1F);
				((IRenderBauble) stack.getItem()).onPlayerBaubleRender(stack, player, type, partialTicks);
				GlStateManager.popMatrix();
			}
		}
	}
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:16,代码来源:BaublesRenderLayer.java

示例13: getPlayerBaubles

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
private NBTTagList getPlayerBaubles(EntityPlayerMP player)
  {
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
NBTTagList taglist = new NBTTagList();

      for (int i=0; i < baubles.getSlots(); i++)
      {
          ItemStack stack = baubles.getStackInSlot(i);
          NBTTagCompound tag = new NBTTagCompound();
          tag.setInteger("Slot", i);
          stack.writeToNBT(tag);
          taglist.appendTag(tag);
      }
      return taglist;
  }
 
开发者ID:maruohon,项目名称:justenoughdimensions,代码行数:16,代码来源:GamemodeInventoryBaubles.java

示例14: onItemRightClick

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {

	if(player.isSneaking()){
		//no special case if sneaking
		return super.onItemRightClick(world, player, hand);
	}
	ItemStack stack = player.getHeldItem(hand);
	ItemStack toEquip = stack.copy();
	toEquip.setCount(1);

	if(canEquip(toEquip, player) && Loader.isModLoaded("baubles")) {
		//InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
		IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
		for(int i = 0; i < baubles.getSlots(); i++) {
			if(baubles.isItemValidForSlot(i, toEquip,player)) {
				ItemStack stackInSlot = baubles.getStackInSlot(i);
				if(stackInSlot.isEmpty()) {
					if(!world.isRemote) {
						baubles.insertItem(i, toEquip,false);
						stack.setCount(stack.getCount()-1);
					}
					return ActionResult.newResult(EnumActionResult.PASS, stack);
				}
			}
		}
	}
	return super.onItemRightClick(world, player, hand);
}
 
开发者ID:Xilef11,项目名称:Runes-of-Wizardry,代码行数:30,代码来源:ItemInscriptionBauble.java

示例15: onRenderOverlay

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Optional.Method(modid = "baubles")
@SubscribeEvent()
public void onRenderOverlay(RenderGameOverlayEvent e) {
    if (e.isCancelable() || e.getType() != RenderGameOverlayEvent.ElementType.POTION_ICONS) {
        return;
    }

    IBaublesItemHandler baublesItemHandler = BaublesApi.getBaublesHandler(minecraft.player);
    for (int i = 0; i < baublesItemHandler.getSlots(); i++) {
        final ItemStack baubleStack = baublesItemHandler.getStackInSlot(i);

        if (baubleStack != ItemStack.EMPTY
                && baubleStack.getItem() instanceof BaubleItem) {
            final BaubleItem baubleItem = (BaubleItem) baubleStack.getItem();
            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
            GL11.glDisable(GL11.GL_LIGHTING);

            // Draw the background for the chargeable item
            minecraft.renderEngine.bindTexture(util.getGuiResourceLocation("chargeable_bg.png"));
            drawTexturedModalRect(BG_BORDER, (i * (ICON_HEIGHT + ICON_BORDER)) + BG_BORDER, 0, 0, BG_WIDTH, BG_HEIGHT);


            // TODO: Draw is currently activated

            // Draw the icon of the chargeable item
            minecraft.renderEngine.bindTexture(util.getGuiResourceLocation(baubleItem));
            drawTexturedModalRect(ICON_BORDER, (i * (ICON_HEIGHT + ICON_BORDER)) + ICON_BORDER, 0, 0, ICON_WIDTH, ICON_HEIGHT);

            // Draw the charge level beneath the icon
            int maxCharge = baubleItem.getMaxChargeLevel();
            int chargeLevel = baubleItem.getChargeLevel(baubleStack);
            float chargeRatio = (float) (chargeLevel) / maxCharge;

            int chargeWidth = (int) Math.floor(chargeRatio * ICON_WIDTH);
            int chargeTop = (i * (ICON_HEIGHT + ICON_BORDER)) + ICON_HEIGHT + ICON_BORDER;
            drawRect(ICON_BORDER, chargeTop, ICON_BORDER + chargeWidth, chargeTop + 2, Reference.CHARGE_COLOR);

            // TODO: (Maybe) Draw is on cooldown
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:42,代码来源:BaublesChargeGui.java


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