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


Java BaublesApi类代码示例

本文整理汇总了Java中baubles.api.BaublesApi的典型用法代码示例。如果您正苦于以下问题:Java BaublesApi类的具体用法?Java BaublesApi怎么用?Java BaublesApi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createListOfItemsInBaublesInventory

import baubles.api.BaublesApi; //导入依赖的package包/类
private void createListOfItemsInBaublesInventory()
    {
        if (!TombManyGraves.isBaublesInstalled)
        {
            baubleItems = new ArrayList<String>();
            return;
        }
        NBTTagCompound tag = deathList.getTagCompound().getCompoundTag("Baubles");
        IBaublesItemHandler inventoryBaubles = BaublesApi.getBaublesHandler(player);

        IInventory baubles = BaubleHandler.getSavedBaubles(tag, inventoryBaubles);

//        InventoryBaubles inventoryBaubles = new InventoryBaubles(player);
//        inventoryBaubles.readNBT(tag);

        baubleItems = createListFromInventory(baubles,BAUBLES);
    }
 
开发者ID:M4thG33k,项目名称:TombManyGraves,代码行数:18,代码来源:GuiDeathItems.java

示例2: onItemRightClick

import baubles.api.BaublesApi; //导入依赖的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

示例3: findStack

import baubles.api.BaublesApi; //导入依赖的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

示例4: onHitEntity

import baubles.api.BaublesApi; //导入依赖的package包/类
@SubscribeEvent
public void onHitEntity(LivingHurtEvent event) {
	
	if (event.getAmount() <= 0 || event.getEntityLiving() instanceof EntityPlayer) return;
	
	if (!(event.getSource().getSourceOfDamage() instanceof EntityPlayer)) return;
	
	ItemStack transformer = BaublesApi.getBaublesHandler((EntityPlayer)event.getSource().getSourceOfDamage()).getStackInSlot(6);
	if (transformer == null || (transformer != null && transformer.getItem() != this)) return;
	
	Random rand = new Random();
	if (rand.nextInt(100) != 0) return;
	
	EntityLivingBase elb = event.getEntityLiving();
	List<String> entities = new ArrayList<String>(EntityList.ENTITY_EGGS.keySet());
	String randomString = entities.get(rand.nextInt(entities.size()));
	Entity entity = EntityList.createEntityByName(randomString, elb.worldObj);
	if (!entity.isNonBoss()) return;
	entity.setPositionAndRotation(elb.posX, elb.posY, elb.posZ, elb.rotationYaw, elb.rotationPitch);
	
	elb.worldObj.spawnEntityInWorld(entity);
	elb.setDead();
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:24,代码来源:EmblemTransformation.java

示例5: onSheared

import baubles.api.BaublesApi; //导入依赖的package包/类
@SubscribeEvent
public void onSheared(EntityInteractSpecific event) {
	
	ItemStack rainbow = BaublesApi.getBaublesHandler((EntityPlayer)event.getEntityPlayer()).getStackInSlot(6);
	if (rainbow == null || (rainbow != null && rainbow.getItem() != this)) return;
	
	if (!(event.getTarget() instanceof IShearable)) return;
	if (!(event.getTarget() instanceof EntitySheep) || (event.getTarget() instanceof EntitySheep && ((EntitySheep)event.getTarget()).getSheared())) return;
	if (event.getItemStack() == null || (event.getItemStack() != null && !(event.getItemStack().getItem() instanceof ItemShears))) return;
	
	int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, event.getItemStack());
	if (!event.getWorld().isRemote) {
		List<ItemStack> wools = ((IShearable)event.getTarget()).onSheared(event.getItemStack(), event.getWorld(), event.getPos(), fortune);
		for (ItemStack is : wools) {
			Random rand = new Random();
			is.setItemDamage(rand.nextInt(15));
			EntityItem wool = new EntityItem(event.getWorld(), event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, is);
			event.getWorld().spawnEntityInWorld(wool);
		}
	}
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:22,代码来源:EmblemRainbow.java

示例6: onItemRightClick

import baubles.api.BaublesApi; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
        
	ItemStack toConvert = convertEdibles(stack);
	if (!UniqueCrops.baublesLoaded) {
		if (!world.isRemote)
			player.setHeldItem(hand, toConvert);
		return ActionResult.newResult(EnumActionResult.PASS, toConvert);
	} else {
		ItemStack bauble = BaublesApi.getBaublesHandler(player).getStackInSlot(6);
		if (bauble == null || (bauble != null && bauble.getItem() != UCBaubles.emblemIronstomach)) {
			if (!world.isRemote) {
				player.setHeldItem(hand, toConvert);
			}
			return ActionResult.newResult(EnumActionResult.PASS, toConvert);
		}
	}
	return super.onItemRightClick(stack, world, player, hand);
   }
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:ItemEdibleMetal.java

示例7: onPlayerTick

import baubles.api.BaublesApi; //导入依赖的package包/类
@SubscribeEvent
public void onPlayerTick(TickEvent.PlayerTickEvent event) {
    EntityPlayer player = event.player;

    if (!player.worldObj.isRemote) {
        IInventory baublesInventory = BaublesApi.getBaubles(player);
        List<ItemStack> rings = new ArrayList<>();
        rings.add(baublesInventory.getStackInSlot(1));
        rings.add(baublesInventory.getStackInSlot(2));

        for (ItemStack ring : rings) {
            if (ring != null && ring.getItem() instanceof IBauble && NBTHelper.getBoolean(ring, IJCConstants.NBT.BAUBLE_HOLDER)) {
                ItemStack baubleAttached0 = NBTHelper.getItemStack(ring, IJCConstants.NBT.BAUBLE_ATTACHED(0));
                if (baubleAttached0 != null) {
                    ((IBauble) baubleAttached0.getItem()).onWornTick(baubleAttached0, player);
                }
                if (NBTHelper.getBoolean(ring, IJCConstants.NBT.ADVANCED_BAUBLE_HOLDER)) {
                    ItemStack baubleAttached1 = NBTHelper.getItemStack(ring, IJCConstants.NBT.BAUBLE_ATTACHED(1));
                    if (baubleAttached1 != null) {
                        ((IBauble) baubleAttached1.getItem()).onWornTick(baubleAttached1, player);
                    }
                }
            }
        }
    }
}
 
开发者ID:yolp900,项目名称:ItsJustaCharm1.10.2Dead,代码行数:27,代码来源:EventBaubleTick.java

示例8: doRenderLayer

import baubles.api.BaublesApi; //导入依赖的package包/类
@Override
public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount,
			float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
	if(player.isPotionActive(MobEffects.INVISIBILITY))
		return;

	IBaublesItemHandler inv = BaublesApi.getBaublesHandler(player);

	dispatchRenders(inv, player, RenderType.BODY, partialTicks);

	float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks;
	float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks;
	float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks;

	GlStateManager.pushMatrix();
	GlStateManager.rotate(yawOffset, 0, -1, 0);
	GlStateManager.rotate(yaw - 270, 0, 1, 0);
	GlStateManager.rotate(pitch, 0, 0, 1);
	dispatchRenders(inv, player, RenderType.HEAD, partialTicks);
	GlStateManager.popMatrix();
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:22,代码来源:BaublesRenderLayer.java

示例9: onJoin

import baubles.api.BaublesApi; //导入依赖的package包/类
public static void onJoin(EntityPlayer player) {
	ItemStack[] inv = Fidelis.getItems(Fidelis.getFidelisNBT(player).getCompoundTag(BAUBLES));
	IInventory baublesInv = BaublesApi.getBaubles(player);
	for(int i = 0; i < inv.length; i++)
		if(inv[i] != null)
			if(baublesInv.getStackInSlot(i) == null){
				baublesInv.setInventorySlotContents(i, inv[i].copy());
				inv[i] = null;
			}
	
	for(ItemStack item : inv)
		if(item != null){
			EntityItem eItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, item);
			player.worldObj.spawnEntityInWorld(eItem);
			item = null;
		}
	Fidelis.getFidelisNBT(player).removeTag(BAUBLES);
}
 
开发者ID:UnderMybrella,项目名称:Fidelis,代码行数:19,代码来源:BaubleLoyalty.java

示例10: chargeInventory

import baubles.api.BaublesApi; //导入依赖的package包/类
public void chargeInventory(EntityPlayer player)
{
  List<ItemStack> rf_items = new ArrayList<ItemStack>();

  findRFItems(player.inventory,rf_items);
  findRFItems(BaublesApi.getBaubles(player),rf_items);
  
  if(rf_items.size() > 0)
  {
    int supply = energy.extractEnergy(energy.getMaxExtract(), true) / rf_items.size();
    int used = 0;
    for(ItemStack stack : rf_items)
    {
      IEnergyContainerItem rf_item = (IEnergyContainerItem) stack.getItem();
      used += rf_item.receiveEnergy(stack, supply, false);
    }
    energy.extractEnergy(used, false);
  }
}
 
开发者ID:EXTER7,项目名称:FluxPads,代码行数:20,代码来源:TileEntityFluxPad.java

示例11: scheduleTick

import baubles.api.BaublesApi; //导入依赖的package包/类
public void scheduleTick() {
    reduceRunningCooldowns();
    if(runningTask == null) {
        selectNewTask();
    } else {
        ItemStack famStack = BaublesApi.getBaubles(owningPlayer).getStackInSlot(0);
        runningTask.tick(ticksInTask, owningPlayer.worldObj, owningPlayer, famStack);
        ticksInTask++;
        if(ticksInTask >= runningTask.getDuration()) {
            if(runningTask.getCooldownDuration(famStack) > 0) cooldownProcesses.put(runningTask, runningTask.getCooldownDuration(famStack));
            if(runningTask.tryLoop() && !requestedLoop.contains(runningTask)) requestedLoop.addLast(runningTask);
            runningTask = null;
            ticksInTask = 0;
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:17,代码来源:FamiliarAIController_Old.java

示例12: equipTick

import baubles.api.BaublesApi; //导入依赖的package包/类
public void equipTick(World world, EntityPlayer player, Aspect aspect) {
    if(world.isRemote) return;

    FamiliarData data = new FamiliarData(player.getCommandSenderName(), aspect.getTag());

    IInventory baublesInv = BaublesApi.getBaubles(player);
    if(baublesInv.getStackInSlot(0) == null) {
        handleUnequip(world, player, aspect);
        return;
    }

    if(familiarControllers.get(player) == null || !playersWithFamiliar.contains(data)) {
        handleEquip(world, player, aspect);
    }

    familiarControllers.get(player).tick();
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:18,代码来源:DataFamiliar.java

示例13: handleServer

import baubles.api.BaublesApi; //导入依赖的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

示例14: performChargeAura

import baubles.api.BaublesApi; //导入依赖的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

示例15: onArmorTick

import baubles.api.BaublesApi; //导入依赖的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


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