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


Java BaublesApi.getBaubles方法代码示例

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


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

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

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

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

示例4: onLivingUpdate

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@SubscribeEvent
public void onLivingUpdate(LivingUpdateEvent event) {
	if (event.entityLiving.worldObj.isRemote) {return;}

	if (event.entityLiving instanceof EntityPlayer) {
		EntityPlayer player = (EntityPlayer)(event.entityLiving);
		IInventory baubles = BaublesApi.getBaubles(player);
		
		for (int i=0; i<baubles.getSizeInventory(); i++) {
			ItemStack stack = baubles.getStackInSlot(i);
			if (stack != null) {
				ArtifactEventHandler.doTriggerUpdate(stack, player);
				ArtifactEventHandler.doTriggerEquippedUpdate(stack, player);
			}
		}
	}
}
 
开发者ID:TTFTCUTS,项目名称:ShadowsOfPhysis,代码行数:18,代码来源:CompatBaubles.java

示例5: onItemRightClick

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
	if (!par2World.isRemote) {
		IInventory baubles = BaublesApi.getBaubles(par3EntityPlayer);
		for (int i = 0; i < baubles.getSizeInventory(); i++)
			if (baubles.getStackInSlot(i) == null && baubles.isItemValidForSlot(i, par1ItemStack)) {
				baubles.setInventorySlotContents(i, par1ItemStack.copy());
				if (!par3EntityPlayer.capabilities.isCreativeMode) {
					par3EntityPlayer.inventory.setInventorySlotContents(par3EntityPlayer.inventory.currentItem, null);
				}
				onEquipped(par1ItemStack, par3EntityPlayer);
				break;
			}
	}
	return par1ItemStack;
}
 
开发者ID:jaredlll08,项目名称:Fluxed-Trinkets,代码行数:17,代码来源:ModularTrinketItem.java

示例6: onMessage

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
public IMessage onMessage(PacketTogglePlayerMagnetism message, MessageContext ctx) {
	EntityPlayer player = getClientPlayer();
	EntityPlayer p = player.worldObj.getPlayerEntityByName(message.playerName);
	if (p != null) {
		IInventory inv = BaublesApi.getBaubles(p);
		ItemStack stack = inv.getStackInSlot(3);
		if (stack != null) {
			if (stack.getItem() == Baubles.MagnetismController) {
				boolean val = !ItemMagnetismController.getNBTData(stack);
				ItemMagnetismController.setNBTData(stack, val);
				if (player.getCommandSenderName().equals(message.playerName)) {
					Baubles.renderDisplayTicks = player.worldObj.getTotalWorldTime() + 100L;
					Baubles.renderDisplay = true;
					Baubles.enabledMagnetism = val;
				}
			}
		}
	}
	return null;
}
 
开发者ID:AlexDGr8r,项目名称:MeteorsMod,代码行数:22,代码来源:PacketTogglePlayerMagnetism.java

示例7: onDeath

import baubles.api.BaublesApi; //导入方法依赖的package包/类
public static void onDeath(EntityPlayer player) {
	IInventory inv = BaublesApi.getBaubles(player);
	ItemStack[] items = new ItemStack[inv.getSizeInventory()];
	for(int i = 0; i < items.length; i++)
		items[i] = inv.getStackInSlot(i);
	Fidelis.setFidelisNBT(player, BAUBLES, Fidelis.setItems(Fidelis.getSoulboundItems(Fidelis.getID(player), items)));
	for(int i = 0; i < items.length; i++)
		inv.setInventorySlotContents(i, items[i]);
}
 
开发者ID:UnderMybrella,项目名称:Fidelis,代码行数:10,代码来源:BaubleLoyalty.java

示例8: checkPlayerEquipment

import baubles.api.BaublesApi; //导入方法依赖的package包/类
public void checkPlayerEquipment(EntityPlayer p) {
    IInventory baublesInv = BaublesApi.getBaubles(p);
    if(baublesInv.getStackInSlot(0) != null) {
        ItemStack amulet = baublesInv.getStackInSlot(0);
        if(amulet.getItem() != null && amulet.getItem() instanceof ItemEtherealFamiliar) {
            Aspect a = ItemEtherealFamiliar.getFamiliarAspect(amulet);
            if(a != null) {
                handleEquip(p.worldObj, p, a);
            }
        }
    }
}
 
开发者ID:makeoo,项目名称:Gadomancy,代码行数:13,代码来源:DataFamiliar.java

示例9: getBaubleFromInv

import baubles.api.BaublesApi; //导入方法依赖的package包/类
public static ItemStack getBaubleFromInv(Class<? extends IBauble> clazz, EntityPlayer player) {
    IInventory inv = BaublesApi.getBaubles(player);
    for (int i = 0; i < 4; i++) {
        ItemStack stack = inv.getStackInSlot(i);
        if (stack != null && clazz.isInstance(stack.getItem())) {
            return stack;
        }
    }
    return null;
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:11,代码来源:EventHandler.java

示例10: itemInteractionForEntity

import baubles.api.BaublesApi; //导入方法依赖的package包/类
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
@Override
public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity)
{
    if (entity.worldObj.isRemote)
    {
        return false;
    }
    if (entity instanceof EntityPlayer)
    {
        EntityPlayer sub = (EntityPlayer)entity;
        IInventory baubles = BaublesApi.getBaubles(sub);
        if(baubles.getStackInSlot(0) == null) {
            if(!itemstack.hasTagCompound()){
                NBTTagCompound tag = new NBTTagCompound();
                itemstack.setTagCompound(tag);
            }
            itemstack.stackTagCompound.setString("owner", player.getDisplayName());
            baubles.setInventorySlotContents(0, itemstack.copy());
            itemstack.stackSize = 0;
            sub.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.placescollar").replace("%s", player.getDisplayName())));
            player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.youplacecollar").replace("%s", sub.getDisplayName())));
            return true;
        }
        else
            player.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("message.collar.alreadywearing").replace("%s", sub.getDisplayName())));
    }
    return false;
}
 
开发者ID:SpitefulFox,项目名称:ForbiddenMagic,代码行数:32,代码来源:ItemSubCollar.java

示例11: onKeyInput

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
	if (toggleMagnetism.isPressed()) {
		IInventory inv = BaublesApi.getBaubles(Minecraft.getMinecraft().thePlayer);
		ItemStack stack = inv.getStackInSlot(3);
		if (stack != null) {
			if (stack.getItem() == Baubles.MagnetismController) {
				MeteorsMod.network.sendToServer(new PacketToggleMagnetism());
			}
		}
	}
}
 
开发者ID:AlexDGr8r,项目名称:MeteorsMod,代码行数:13,代码来源:HandlerKey.java

示例12: onMessage

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
public IMessage onMessage(PacketToggleMagnetism message, MessageContext ctx) {
	IInventory inv = BaublesApi.getBaubles(ctx.getServerHandler().playerEntity);
	ItemStack stack = inv.getStackInSlot(3);
	if (stack != null) {
		if (stack.getItem() == Baubles.MagnetismController) {
			if (MinecraftServer.getServer().isDedicatedServer()) {
				boolean val = !ItemMagnetismController.getNBTData(stack);
				ItemMagnetismController.setNBTData(stack, val);	
			}
			MeteorsMod.network.sendToAll(new PacketTogglePlayerMagnetism(ctx.getServerHandler().playerEntity.getCommandSenderName()));
		}
	}
	return null;
}
 
开发者ID:AlexDGr8r,项目名称:MeteorsMod,代码行数:16,代码来源:PacketToggleMagnetism.java

示例13: isMagnetizationEnabled

import baubles.api.BaublesApi; //导入方法依赖的package包/类
public static int isMagnetizationEnabled(EntityPlayer player, int def) {
	IInventory inv = BaublesApi.getBaubles(player);
	ItemStack stack = inv.getStackInSlot(3);
	if (stack != null) {
		if (stack.getItem() == Baubles.MagnetismController) {
			return (getNBTData(stack) ? Math.max(EnchantmentHelper.getEnchantmentLevel(MeteorsMod.Magnetization.effectId, stack), def) : 0);
		}
	}
	return def;
}
 
开发者ID:AlexDGr8r,项目名称:MeteorsMod,代码行数:11,代码来源:ItemMagnetismController.java

示例14: getInventory

import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
protected IInventory getInventory(final EntityPlayer player) {
	return BaublesApi.getBaubles(player);
}
 
开发者ID:benblank,项目名称:Ice,代码行数:5,代码来源:BaublesInventoryManager.java

示例15: getBaubles

import baubles.api.BaublesApi; //导入方法依赖的package包/类
public IInventory getBaubles(EntityPlayer player) {
    return BaublesApi.getBaubles(player);
}
 
开发者ID:InfinityRaider,项目名称:3DManeuverGear,代码行数:4,代码来源:BaublesWrapper.java


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