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


Java IBaublesItemHandler.getStackInSlot方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: onPostRender

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@SubscribeEvent
public void onPostRender(RenderWorldLastEvent evt) {
	if (!Loader.isModLoaded("baubles")) return;
	
	EntityPlayer thePlayer = Minecraft.getMinecraft().player;
	
	for(EntityPlayer entity : Minecraft.getMinecraft().world.playerEntities) {
		IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(entity);
		ItemStack scarfStack = baubles.getStackInSlot(BAUBLE_AMULET);
		if (scarfStack==null || scarfStack.isEmpty() || scarfStack.getItem()!=ThermionicsItems.SCARF) return;
		Scarf scarf = scarfCache.getIfPresent(entity);
		if (scarf==null) {
			scarf = new Scarf();
			scarfCache.put(entity, scarf);
			scarf.readFromNBT(scarfStack.getTagCompound());
			//System.out.println("Created scarf:"+(scarf.leftScarf.size()+scarf.rightScarf.size())+" nodes.");
		} else {
			
			scarf.updateFromNBT(scarfStack.getTagCompound());
			//System.out.println("Updated scarf:"+(scarf.leftScarf.size()+scarf.rightScarf.size())+" nodes.");
		}
		
		double dx = thePlayer.prevPosX + (thePlayer.posX - thePlayer.prevPosX) * evt.getPartialTicks();
		double dy = thePlayer.prevPosY + (thePlayer.posY - thePlayer.prevPosY) * evt.getPartialTicks();
		double dz = thePlayer.prevPosZ + (thePlayer.posZ - thePlayer.prevPosZ) * evt.getPartialTicks();
		
		LayerScarf.renderScarf(
				dx, dy, dz,
				entity, null, scarf, evt.getPartialTicks(),
				Minecraft.getMinecraft().world);
	}
}
 
开发者ID:elytra,项目名称:Thermionics,代码行数:33,代码来源:ClientProxy.java

示例8: 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

示例9: 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

示例10: 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

示例11: getBelt

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
@Override
public ItemStack getBelt()
{
    IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(thePlayer);
    return baubles.getStackInSlot(slotNumber);
}
 
开发者ID:gigaherz,项目名称:ToolBelt,代码行数:7,代码来源:BeltFinderBaubles.java

示例12: 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

示例13: getBauble

import baubles.api.cap.IBaublesItemHandler; //导入方法依赖的package包/类
public ItemStack getBauble(EntityPlayer player, BaubleType type) {
    
    final IBaublesItemHandler inv = getBaubles(player);
    
    for (final int slotId : type.getValidSlots())
        if (inv != null) {
            
            final ItemStack stack = inv.getStackInSlot(slotId);
            
            if (ItemStackTools.isValid(stack))
                return stack;
        }
    
    return ItemStackTools.getEmptyStack();
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:16,代码来源:BaublesIntegration.java


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