當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。