本文整理汇总了Java中baubles.api.cap.IBaublesItemHandler类的典型用法代码示例。如果您正苦于以下问题:Java IBaublesItemHandler类的具体用法?Java IBaublesItemHandler怎么用?Java IBaublesItemHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IBaublesItemHandler类属于baubles.api.cap包,在下文中一共展示了IBaublesItemHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createListOfItemsInBaublesInventory
import baubles.api.cap.IBaublesItemHandler; //导入依赖的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);
}
示例2: onItemRightClick
import baubles.api.cap.IBaublesItemHandler; //导入依赖的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));
}
示例3: 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);
}
示例4: 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;
}
示例5: doRenderLayer
import baubles.api.cap.IBaublesItemHandler; //导入依赖的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();
}
示例6: 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);
}
}
}
示例7: 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);
}
}
}
}
示例8: 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);
}
示例9: 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;
}
示例10: getBaublesHandler
import baubles.api.cap.IBaublesItemHandler; //导入依赖的package包/类
/**
* Retrieves the baubles inventory capability handler for the supplied player
*/
public static IBaublesItemHandler getBaublesHandler(EntityPlayer player)
{
IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
handler.setPlayer(player);
return handler;
}
示例11: getBaubles
import baubles.api.cap.IBaublesItemHandler; //导入依赖的package包/类
/**
* Retrieves the baubles capability handler wrapped as a IInventory for the supplied player
*/
@Deprecated
public static IInventory getBaubles(EntityPlayer player)
{
IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
handler.setPlayer(player);
return new BaublesInventoryWrapper(handler, player);
}
示例12: 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);
}
}
示例13: onTake
import baubles.api.cap.IBaublesItemHandler; //导入依赖的package包/类
@Override
public ItemStack onTake(EntityPlayer playerIn, ItemStack stack) {
if (!getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked()) {
((IBauble)stack.getItem()).onUnequipped(stack, playerIn);
}
return super.onTake(playerIn, stack);
}
示例14: putStack
import baubles.api.cap.IBaublesItemHandler; //导入依赖的package包/类
@Override
public void putStack(ItemStack stack) {
if (getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked()) {
((IBauble)getStack().getItem()).onUnequipped(getStack(), player);
}
super.putStack(stack);
if (this.getHasStack() && !((IBaublesItemHandler)getItemHandler()).isEventBlocked()) {
((IBauble)getStack().getItem()).onEquipped(getStack(), player);
}
}
示例15: getSavedBaubles
import baubles.api.cap.IBaublesItemHandler; //导入依赖的package包/类
public static IInventory getSavedBaubles(NBTTagCompound compound, IBaublesItemHandler baubles)
{
InventoryBasic basic = new InventoryBasic("SavedBaubles", false, baubles.getSlots());
NBTTagList tagList = compound.getTagList(BAUBLES_NBT, 10);
for (int i=0; i < tagList.tagCount(); i++)
{
NBTTagCompound slot = (NBTTagCompound)tagList.get(i);
basic.setInventorySlotContents(slot.getInteger("Slot"), ItemStack.loadItemStackFromNBT(slot));
}
return basic;
}