當前位置: 首頁>>代碼示例>>Java>>正文


Java BaubleType類代碼示例

本文整理匯總了Java中baubles.api.BaubleType的典型用法代碼示例。如果您正苦於以下問題:Java BaubleType類的具體用法?Java BaubleType怎麽用?Java BaubleType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BaubleType類屬於baubles.api包,在下文中一共展示了BaubleType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onItemRightClick

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{

    ItemStack glove = playerIn.getHeldItem(handIn);
    if (handIn == EnumHand.OFF_HAND)
    {
        ItemStack shard = playerIn.getHeldItem(EnumHand.MAIN_HAND);
        if (shard.getItem() == ItemRegistry.crystal_shard)
        {
            int shrink = playerIn.isSneaking() ? shard.getCount() : 1;
            playerIn.playSound(SoundRegistry.GLASS, 1, 1);
            if (ItemSipAmulet.checkForAmulet(playerIn))
            {
                ItemStack amulet = ItemUtils.getBauble(playerIn, BaubleType.AMULET.getValidSlots()[0]);
                amulet.getCapability(CapabilityRegistry.SIP_STORE_CAP, null).add(SipUtils.getSipInStack(shard), shrink);
                ItemUtils.setBauble(playerIn, BaubleType.AMULET.getValidSlots()[0], amulet);
            }
            playerIn.getHeldItem(EnumHand.MAIN_HAND).shrink(shrink);
            return new ActionResult<>(EnumActionResult.SUCCESS, glove);
        }
    }
    return new ActionResult<>(EnumActionResult.PASS, glove);
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:25,代碼來源:ItemGlove.java

示例2: isItemValid

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public boolean isItemValid(ItemStack stack) {
    Item item = stack.getItem();
    if (type >= ARMOR_HELMET && type <= ARMOR_BOOTS) {
        return item != null && item.isValidArmor(stack, type, null);
    } else if (GearSwap.baubles && type >= BAUBLE_RING && type <= BAUBLE_BELT) {
        if (item == null) {
            return false;
        }
        if (!(item instanceof IBauble)) {
            return false;
        }
        IBauble bauble = (IBauble) item;
        BaubleType baubleType = bauble.getBaubleType(stack);
        return (baubleType == BaubleType.AMULET && type == BAUBLE_AMULET) ||
                (baubleType == BaubleType.RING && type == BAUBLE_RING) ||
                (baubleType == BaubleType.BELT && type == BAUBLE_BELT);
    } else {
        return true;
    }
}
 
開發者ID:McJty,項目名稱:GearSwapper1.8,代碼行數:22,代碼來源:GhostSlot.java

示例3: isItemValidForSlot

import baubles.api.BaubleType; //導入依賴的package包/類
/**
 * Returns true if automation is allowed to insert the given stack (ignoring
 * stack size) into the given slot.
 */
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
	if (stack == null || !(stack.getItem() instanceof IBauble)
			|| !((IBauble) stack.getItem()).canEquip(stack, player.get()))
		return false;
	if (i == 0
			&& ((IBauble) stack.getItem()).getBaubleType(stack) == BaubleType.AMULET)
		return true;
	if ((i == 1 || i == 2)
			&& ((IBauble) stack.getItem()).getBaubleType(stack) == BaubleType.RING)
		return true;
	if (i == 3
			&& ((IBauble) stack.getItem()).getBaubleType(stack) == BaubleType.BELT)
		return true;
	return false;
}
 
開發者ID:Romejanic,項目名稱:RuneMagic,代碼行數:21,代碼來源:InventoryBaubles.java

示例4: ItemLEBauble

import baubles.api.BaubleType; //導入依賴的package包/類
public ItemLEBauble(String name, BaubleType type)
{
	super();
	this.setRegistryName(Reference.MODID, name);
	this.setUnlocalizedName(name);
	this.setCreativeTab(ModTabs.tabLE);
	this.setMaxStackSize(1);
	this.type = type;
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:10,代碼來源:ItemLEBauble.java

示例5: ItemTalisman

import baubles.api.BaubleType; //導入依賴的package包/類
public ItemTalisman(BaubleType type, int enchantability, String id) {
	super(id);
	this.setCreativeTab(BewitchmentCreativeTabs.ITEMS_CREATIVE_TAB);
	this.enchantability = enchantability;
	this.setMaxStackSize(1);
	this.type = type;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:8,代碼來源:ItemTalisman.java

示例6: onMessage

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public IMessage onMessage(SPacketUseSipAmulet message, MessageContext ctx)
{
    (ctx.getServerHandler().player.getServerWorld()).addScheduledTask(() ->
    {
        EntityPlayer p = ctx.getServerHandler().player;
        if (ItemSipAmulet.checkForAmulet(p))
        {
            ItemStack amulet = ItemUtils.getBauble(p, BaubleType.AMULET.getValidSlots()[0]);
            Map<String, Integer> sips = amulet.getCapability(CapabilityRegistry.SIP_STORE_CAP, null).getStored();
            for (Map.Entry<String, Integer> entr : sips.entrySet())
            {
                SipEffect eff = PurMag.INSTANCE.getSipEffects().getMap().get(entr.getKey());
                int lvl = amulet.getMetadata();
                if (eff.getMaxLevel() != -1 && lvl > eff.getMaxLevel())
                    lvl = eff.getMaxLevel();
                p.addPotionEffect(new PotionEffect(eff.getEffect(), eff.getTicks() * entr.getValue(), lvl, false, false));
                float rads = (float) Math.toRadians(p.rotationYaw + 180);
                Vector2f vec = new Vector2f(MathHelper.sin(rads), -MathHelper.cos(rads));
                for (int i = entr.getValue(); i > 0; i -= 8)
                {
                    NetworkManager.sendToAllAround(new CPacketSpawnSipParticle(
                                    new Vector3d(p.posX, p.posY + 1.3f, p.posZ),
                                    new Vector3d(p.posX + (vec.x * 5) + (PurMag.INSTANCE.random.nextFloat() * 4 - 2), p.posY + 1.3f + (PurMag.INSTANCE.random.nextFloat() * 4 - 2), p.posZ + (vec.y * 5) + (PurMag.INSTANCE.random.nextFloat() * 4 - 2)),
                                    0.1f,
                                    entr.getKey(),
                                    i >= 8 ? 8 : i
                            ),
                            (int) p.posX, (int) p.posY, (int) p.posZ, p.dimension, 300);
                }
            }
            amulet.getCapability(CapabilityRegistry.SIP_STORE_CAP, null).clear();
            ItemUtils.setBauble(ctx.getServerHandler().player, BaubleType.AMULET.getValidSlots()[0], amulet);
        }
    });
    return null;
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:38,代碼來源:SPacketUseSipAmulet.java

示例7: checkForAmulet

import baubles.api.BaubleType; //導入依賴的package包/類
public static boolean checkForAmulet(EntityPlayer p)
{
    ItemStack amul = ItemUtils.getBauble(p, BaubleType.AMULET.getValidSlots()[0]);
    if (amul != ItemStack.EMPTY && amul.getItem() == ItemRegistry.sip_amulet)
    {
        return true;
    }
    return false;
}
 
開發者ID:PearXTeam,項目名稱:PurificatiMagicae,代碼行數:10,代碼來源:ItemSipAmulet.java

示例8: hasDragonWings

import baubles.api.BaubleType; //導入依賴的package包/類
public static boolean hasDragonWings(EntityPlayer player){
  	ItemStack chest = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if(ItemStackTools.isValid(chest) && ModEnhancements.DRAGON_WINGS.isApplied(chest)){
	return true;
}

if(BaublesIntegration.instance().hasBaubles()){
	ItemStack baubleStack = BaublesIntegration.instance().getBauble(player, BaubleType.BODY);
	if(ItemStackTools.isValid(baubleStack) && baubleStack.getItem() instanceof ItemBaubleWings){
		return true;
	}
}

  	return false;
  }
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:16,代碼來源:EventHandler.java

示例9: get

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
@Optional.Method(modid = "baubles")
public Iterable<ItemStack> get(EntityLivingBase entity) {
	if (!(entity instanceof EntityPlayer)) return entity.getArmorInventoryList();
	if (BaublesApi.getBaublesHandler((EntityPlayer) entity) == null) return entity.getArmorInventoryList();

	ImmutableList.Builder<ItemStack> stacks = ImmutableList.builder();
	IBaublesItemHandler inv = BaublesApi.getBaublesHandler((EntityPlayer) entity);
	for (BaubleType type : BaubleType.values())
		for (int slot : type.getValidSlots()) {
			stacks.add(inv.getStackInSlot(slot));
		}
	return stacks.build();
}
 
開發者ID:TeamWizardry,項目名稱:Wizardry,代碼行數:15,代碼來源:BaublesSupport.java

示例10: matches

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
	List<ItemStack> ingredients = new ArrayList<>();
	for (int i = 0; i < inv.getSizeInventory(); i++) {
		ItemStack stack = inv.getStackInSlot(i);
		if (stack != null) {
			if (stack.getItem() instanceof IBauble && ((IBauble)stack.getItem()).getBaubleType(stack) == BaubleType.RING) {
				ingredients.add(stack);
			}
		}
	}

	if (ingredients.size() != 2) return false;

	ItemStack ringHolder;
	ItemStack ring;
	if (isItemStackHolder(ingredients.get(0)) && !isItemStackHolder(ingredients.get(1))) {
		ringHolder = ingredients.get(0);
		ring = ingredients.get(1);
	} else if (isItemStackHolder(ingredients.get(1)) && !isItemStackHolder(ingredients.get(0))) {
		ringHolder = ingredients.get(1);
		ring = ingredients.get(0);
	} else return false;

	if (ring == null || ringHolder == null) return false;

	boolean canAttachRing = false;
	List<ItemStack> attachedRings = getAttachedRings(ringHolder);
	if (attachedRings.get(0) == null) {
		canAttachRing = true;
	} else if (isAdvancedHolder(ringHolder) && attachedRings.get(1) == null) {
		if (!ItemStack.areItemStacksEqual(ring, attachedRings.get(0))) {
			canAttachRing = true;
		}
	} else return false;

	return !ItemStack.areItemStacksEqual(ring, ringHolder) && canAttachRing;

}
 
開發者ID:yolp900,項目名稱:ItsJustaCharm1.10.2Dead,代碼行數:40,代碼來源:RingAttachmentRecipe.java

示例11: onItemRightClick

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	ItemStack item = player.getHeldItem(hand);
	if (Always.isServer() && canEquip(item, player)) {
		IInventory inventory = player.getCapability(AlchemyCapabilityLoader.bauble, null);
		if (inventory.getStackInSlot(BaubleType.AMULET.getValidSlots()[0]).isEmpty()) {
			inventory.setInventorySlotContents(BaubleType.AMULET.getValidSlots()[0], item.copy());
			item.setCount(item.getCount() - 1);
			return new ActionResult(EnumActionResult.SUCCESS, item);
		}
	}
       return new ActionResult(EnumActionResult.PASS, item);
   }
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:14,代碼來源:AlchemyItemBauble.java

示例12: shouldHandleInput

import baubles.api.BaubleType; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public boolean shouldHandleInput(KeyBinding binding) {
	IInventory inventory = Minecraft.getMinecraft().player.getCapability(AlchemyCapabilityLoader.bauble, null);
	if (binding == key_binding_1)
		return InventoryHelper.isItem(inventory.getStackInSlot(BaubleType.RING.getValidSlots()[0]), this);
	if (binding == key_binding_2)
		return InventoryHelper.isItem(inventory.getStackInSlot(BaubleType.RING.getValidSlots()[1]), this);
	return true;
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:10,代碼來源:AlchemyItemBauble.java

示例13: canEquip

import baubles.api.BaubleType; //導入依賴的package包/類
@Override
public boolean canEquip(ItemStack item, EntityLivingBase player) {
	IInventory inventory = player.getCapability(AlchemyCapabilityLoader.bauble, null);
	return !isOnly() ||
			!InventoryHelper.isItem(inventory.getStackInSlot(BaubleType.RING.getValidSlots()[0]), this) &&
			!InventoryHelper.isItem(inventory.getStackInSlot(BaubleType.RING.getValidSlots()[1]), this);
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:8,代碼來源:AlchemyItemBauble.java

示例14: onKeyInput

import baubles.api.BaubleType; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGH)
public static void onKeyInput(KeyInputEvent event) {
	if (System.currentTimeMillis() - lastTime > 500 && AlchemyEventSystem.isKeyBindingActive(key_follower)) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		if (player != null) {
			InventoryBauble bauble = player.getCapability(AlchemyCapabilityLoader.bauble, null);
			ItemStack head = bauble.getStackInSlot(BaubleType.HEAD.getValidSlots()[0]);
			if (head != null && head.getItem() instanceof ItemHeadFollower) {
				SingleProjection.cutoverState();
				lastTime = System.currentTimeMillis();
			}
		}
	}
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:16,代碼來源:ItemHeadFollower.java

示例15: tooltipEvent

import baubles.api.BaubleType; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.BOTTOM)
public void tooltipEvent(ItemTooltipEvent event) {
	if (event.getItemStack() != null && event.getItemStack().getItem() instanceof IBauble) {
		BaubleType type = ((IBauble) event.getItemStack().getItem()).getBaubleType(event.getItemStack());
		event.getToolTip().add(min(event.getToolTip().size(), 1), TextFormatting.GOLD + type.toString());
	}
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:8,代碼來源:CapabilityBauble.java


注:本文中的baubles.api.BaubleType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。