本文整理汇总了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);
}
}
}
}
}
}
示例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);
}
示例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();
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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]);
}
示例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);
}
}
}
}
示例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;
}
示例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;
}
示例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());
}
}
}
}
示例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;
}
示例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;
}
示例14: getInventory
import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
protected IInventory getInventory(final EntityPlayer player) {
return BaublesApi.getBaubles(player);
}
示例15: getBaubles
import baubles.api.BaublesApi; //导入方法依赖的package包/类
public IInventory getBaubles(EntityPlayer player) {
return BaublesApi.getBaubles(player);
}