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


Java IProjectile类代码示例

本文整理汇总了Java中net.minecraft.entity.IProjectile的典型用法代码示例。如果您正苦于以下问题:Java IProjectile类的具体用法?Java IProjectile怎么用?Java IProjectile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: dispense

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public ItemStack dispense(IBlockSource block, final ItemStack stack) {
	return new BehaviorProjectileDispense() {

		@Override
		protected IProjectile getProjectileEntity(World world, IPosition pos) {
			return new EntityLingeringPotion(world, pos.getX(), pos.getY(), pos.getZ(), stack.copy());
		}

		@Override
		protected float func_82498_a() {
			return super.func_82498_a() * 0.5F;
		}

		@Override
		protected float func_82500_b() {
			return super.func_82500_b() * 1.25F;
		}
	}.dispense(block, stack);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:21,代码来源:DispenserBehaviourLingeringPotion.java

示例2: apply

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public boolean apply(Entity entity) {
    if (entity instanceof EntityItem) {
        return true;
    }
    if (target_speed <= 1) {
        return false;
    }
    if (entity instanceof EntityLiving || entity instanceof IProjectile || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) {
        return true;
    }
    if (FzConfig.fanturpeller_works_on_players && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        found_player = true;
        return !player.capabilities.isCreativeMode && !player.isSneaking();
    }
    return false;
    // Falling sand doesn't work too well with this
    // Minecarts seem to just jump back down (and would be too heavy anyways.)
    // Let's try to keep this method light, hmm?
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:22,代码来源:BlowEntities.java

示例3: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) {
    World world = par1IBlockSource.getWorld();
    IPosition iposition = BlockDispenser.func_149939_a(par1IBlockSource);
    EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata());
    ItemStack stack = par2ItemStack.splitStack(1);
    if (matchesItem(par2ItemStack)) {
        // dispense item as projectile because the item matches
        IProjectile iprojectile = this.getProjectileEntity(world, iposition, par2ItemStack);
        iprojectile.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
        world.spawnEntityInWorld((Entity) iprojectile);
    } else {
        // dispense item as item because it doesn't match
        BehaviorDefaultDispenseItem.doDispense(world, stack, 6, enumfacing, iposition);
    }
    return par2ItemStack;
}
 
开发者ID:meew0,项目名称:AdvancedPotions,代码行数:20,代码来源:BehaviorAdvancedProjectileDispense.java

示例4: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing var5 = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile var6 = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(var6 != null)
      {
      	var6.setThrowableHeading((double)var5.getFrontOffsetX(), 0.10000000149011612D*y, (double)var5.getFrontOffsetY(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)var6);
      	stack.splitStack(1);
      }
      return stack;
  }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:17,代码来源:DispenseBombMF.java

示例5: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
  {
float y = 1.1F;
      World var3 = source.getWorld();
      IPosition var4 = BlockDispenser.getIPositionFromBlockSource(source);
      EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
      
      IProjectile iprojectile = this.getProjectileEntity(var3, var4, stack.getItemDamage());
      if(iprojectile != null)
      {
      	iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
      	var3.spawnEntityInWorld((Entity)iprojectile);
      	stack.splitStack(1);
      }
      return stack;
  }
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:17,代码来源:DispenseArrowMF.java

示例6: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
    IProjectile iprojectile = this.getProjectileEntity(world, iposition);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.func_82500_b(), this.func_82498_a());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:BehaviorProjectileDispense.java

示例7: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource block, final ItemStack stack) {
	return new BehaviorProjectileDispense() {

		@Override
		protected IProjectile getProjectileEntity(World world, IPosition pos) {
			EntityTippedArrow entity = new EntityTippedArrow(world, pos.getX(), pos.getY(), pos.getZ());
			entity.canBePickedUp = 1;
			entity.setEffect(TippedArrow.getEffect(stack));
			return entity;
		}
	}.dispense(block, stack);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:14,代码来源:DispenserBehaviourTippedArrow.java

示例8: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.func_190918_g(1);
    return stack;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:BehaviorProjectileDispense.java

示例9: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
/**
 * Dispense the specified stack, play the dispense sound and spawn particles.
 */
public ItemStack dispenseStack(IBlockSource source, ItemStack stack)
{
    World world = source.getWorld();
    IPosition iposition = BlockDispenser.getDispensePosition(source);
    EnumFacing enumfacing = (EnumFacing)source.getBlockState().getValue(BlockDispenser.FACING);
    IProjectile iprojectile = this.getProjectileEntity(world, iposition, stack);
    iprojectile.setThrowableHeading((double)enumfacing.getFrontOffsetX(), (double)((float)enumfacing.getFrontOffsetY() + 0.1F), (double)enumfacing.getFrontOffsetZ(), this.getProjectileVelocity(), this.getProjectileInaccuracy());
    world.spawnEntityInWorld((Entity)iprojectile);
    stack.splitStack(1);
    return stack;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:BehaviorProjectileDispense.java

示例10: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
       World world = source.getWorld();
       BlockPos pos = source.getBlockPos();
       Vec3d pos2 = new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
       Vec3d dir = this.getNearestTargetDirection(world, pos);
       if(dir == null) return null;
       IPosition ipos = new PositionImpl(pos2.x + dir.x * .75, pos2.y + dir.y * .75, pos2.z + dir.z * .75);
       IProjectile iproj = this.getProjectileEntity(standard, world, ipos, stack);
       iproj.shoot(dir.x, dir.y + 0.1F, dir.z, 
       		this.getProjectileVelocity(standard), this.getProjectileInaccuracy(standard));
       world.spawnEntity((Entity)iproj);
       stack.splitStack(1);
       return stack;
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:16,代码来源:TrackingDispenserBehavior.java

示例11: getProjectileEntity

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
/** Get the projectile entity via reflection */
private IProjectile getProjectileEntity(BehaviorProjectileDispense standard, World world, IPosition pos, ItemStack stack) {
	Method m = ACUtils.findMethod(BehaviorProjectileDispense.class, standard, new String[]{"getProjectileEntity", "func_82499_a"}, 
			World.class, IPosition.class, ItemStack.class);
	try {
		return (IProjectile)m.invoke(standard, world, pos, stack);
	} catch (Exception e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:sblectric,项目名称:AdvancedCombat,代码行数:12,代码来源:TrackingDispenserBehavior.java

示例12: init

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
	AugmentRegistry.registerAugment(new ItemStack(Items.GOLDEN_APPLE), new AugmentSlowRegen());
	AugmentRegistry.registerAugment(new ItemStack(Items.GOLDEN_APPLE, 1, 1), new AugmentFastRegen());
	AugmentRegistry.registerAugment(new ItemStack(Items.IRON_INGOT), new AugmentIron());
	AugmentRegistry.registerAugment(new ItemStack(Blocks.OBSIDIAN), new AugmentObsidian());
	AugmentRegistry.registerAugment(new ItemStack(Blocks.ANVIL), new AugmentAnvil());
	AugmentRegistry.registerAugment(new ItemStack(Items.SKULL, 1, 1), new AugmentWither());
	AugmentRegistry.registerAugment(new ItemStack(Items.SUGAR), new AugmentJitters());
	AugmentRegistry.registerAugment(new ItemStack(skinsuit_mummy), new AugmentMummy());

	OreDictionary.registerOre("book", squad_editor);

	MilkRegistry.getInstance().registerMilk(new ItemStack(Items.MILK_BUCKET), new ItemStack(Items.BUCKET));
	MilkRegistry.getInstance().registerMilk(new ItemStack(milk_bottle), new ItemStack(Items.GLASS_BOTTLE));

	BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(keychain_occupied, new DispenseBehaviorKeychain());
	BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(milk_bottle, new BehaviorProjectileDispense() {
		@Override
		@Nonnull
		protected IProjectile getProjectileEntity(@Nonnull World worldIn, @Nonnull IPosition position, @Nonnull ItemStack stackIn) {
			return new EntityMilkBottle(worldIn, position.getX(), position.getY(), position.getZ());
		}
	});

	if (Loader.isModLoaded("ic2")) {
		modCompat = new IC2Compat();
		modCompat.init(event);
	}
}
 
开发者ID:The-Fireplace-Minecraft-Mods,项目名称:Overlord,代码行数:31,代码来源:Overlord.java

示例13: track

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
public static <T extends Entity & IProjectile> void track(T entity, Entity target) {
	double dx = target.posX - entity.posX;
	double dy = target.getEntityBoundingBox().minY + target.height / 3 - entity.posY;
	double dz = target.posZ - entity.posZ;
	double dr = sqrt(dx * dx + dz * dz);
	entity.setThrowableHeading(dx, dy + dr * 0.2, dz, 1.6F, 2);
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:8,代码来源:EntityProjectileTracker.java

示例14: onDeath

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public void onDeath(DamageSource cause)
{
	super.onDeath(cause);

	Entity killedBy = cause.getSourceOfDamage();
	Entity indirect = cause.getEntity();

	Entity actualKiller;

	if (indirect != null && killedBy instanceof IProjectile)
	{
		actualKiller = indirect;
	}
	else
	{
		actualKiller = killedBy;
	}

	// TODO grant xp if creature is ridden (possible to kill while ridden)
	// TODO grant xp to owner nearby
	if (actualKiller instanceof EntityARKCreature)
	{
		if (((EntityARKCreature) killedBy)
				.isOwned()) ((EntityARKCreature) killedBy).addXP(creature.getBaseKillXP());
	}
	else if (actualKiller instanceof EntityPlayer)
	{
		ARKPlayer data = ARKPlayer.get((EntityPlayer) actualKiller);
		data.addXP(getKillXP());
	}
}
 
开发者ID:Archiving,项目名称:ARKCraft-Code,代码行数:33,代码来源:EntityARKCreature.java

示例15: dispenseStack

import net.minecraft.entity.IProjectile; //导入依赖的package包/类
@Override
public ItemStack dispenseStack(IBlockSource blocksource, ItemStack itemstack)
{
    World world = blocksource.getWorld();
    IPosition pos = BlockDispenser.getDispensePosition(blocksource);
    EnumFacing face = BlockDispenser.getFacing(blocksource.getBlockMetadata());
    IProjectile projectile = getProjectileEntity(world, pos, itemstack);
    projectile.setThrowableHeading(face.getFrontOffsetX(), face.getFrontOffsetY() + getYVel(), face.getFrontOffsetZ(), getVelocity(), getDeviation());
    world.spawnEntityInWorld((Entity) projectile);
    itemstack.splitStack(1);
    return itemstack;
}
 
开发者ID:Archiving,项目名称:ARKCraft-Code,代码行数:13,代码来源:DispenseWeaponProjectile.java


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