本文整理汇总了Java中baubles.api.BaublesApi.getBaublesHandler方法的典型用法代码示例。如果您正苦于以下问题:Java BaublesApi.getBaublesHandler方法的具体用法?Java BaublesApi.getBaublesHandler怎么用?Java BaublesApi.getBaublesHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类baubles.api.BaublesApi
的用法示例。
在下文中一共展示了BaublesApi.getBaublesHandler方法的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);
}
示例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));
}
示例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);
}
示例4: 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();
}
示例5: 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);
}
}
}
示例6: 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);
}
}
}
}
示例7: 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);
}
示例8: getWornInscription
import baubles.api.BaublesApi; //导入方法依赖的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;
}
示例9: onPostRender
import baubles.api.BaublesApi; //导入方法依赖的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);
}
}
示例10: setPlayerBaubles
import baubles.api.BaublesApi; //导入方法依赖的package包/类
public static void setPlayerBaubles(EntityPlayer player, NBTTagCompound compound)
{
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
IInventory stored = getSavedBaubles(compound, baubles);
for (int i=0; i < baubles.getSlots(); i++)
{
baubles.setStackInSlot(i, stored.getStackInSlot(i));
}
}
示例11: clearBaubles
import baubles.api.BaublesApi; //导入方法依赖的package包/类
public static void clearBaubles(EntityPlayer player)
{
IBaublesItemHandler handler = BaublesApi.getBaublesHandler(player);
for (int i=0; i < handler.getSlots(); i++)
{
handler.setStackInSlot(i, null);
}
}
示例12: get
import baubles.api.BaublesApi; //导入方法依赖的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();
}
示例13: getPlayerBaubles
import baubles.api.BaublesApi; //导入方法依赖的package包/类
private NBTTagList getPlayerBaubles(EntityPlayerMP player)
{
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
NBTTagList taglist = new NBTTagList();
for (int i=0; i < baubles.getSlots(); i++)
{
ItemStack stack = baubles.getStackInSlot(i);
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("Slot", i);
stack.writeToNBT(tag);
taglist.appendTag(tag);
}
return taglist;
}
示例14: setPlayerBaubles
import baubles.api.BaublesApi; //导入方法依赖的package包/类
private void setPlayerBaubles(EntityPlayerMP player, NBTTagList taglist)
{
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
for (int i=0; i < taglist.tagCount(); i++)
{
NBTTagCompound slot = (NBTTagCompound)taglist.get(i);
baubles.setStackInSlot(slot.getInteger("Slot"), new ItemStack(slot));
}
}
示例15: onItemRightClick
import baubles.api.BaublesApi; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
if(player.isSneaking()){
//no special case if sneaking
return super.onItemRightClick(world, player, hand);
}
ItemStack stack = player.getHeldItem(hand);
ItemStack toEquip = stack.copy();
toEquip.setCount(1);
if(canEquip(toEquip, player) && Loader.isModLoaded("baubles")) {
//InventoryBaubles baubles = PlayerHandler.getPlayerBaubles(player);
IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
for(int i = 0; i < baubles.getSlots(); i++) {
if(baubles.isItemValidForSlot(i, toEquip,player)) {
ItemStack stackInSlot = baubles.getStackInSlot(i);
if(stackInSlot.isEmpty()) {
if(!world.isRemote) {
baubles.insertItem(i, toEquip,false);
stack.setCount(stack.getCount()-1);
}
return ActionResult.newResult(EnumActionResult.PASS, stack);
}
}
}
}
return super.onItemRightClick(world, player, hand);
}