本文整理匯總了Java中net.minecraft.entity.projectile.EntityThrowable類的典型用法代碼示例。如果您正苦於以下問題:Java EntityThrowable類的具體用法?Java EntityThrowable怎麽用?Java EntityThrowable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityThrowable類屬於net.minecraft.entity.projectile包,在下文中一共展示了EntityThrowable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doRender
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
@Override
public void doRender(EntityThrowable entity, double x, double y, double z, float yaw, float partialTick) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.pushAttrib();
GlStateManager.enableBlend();
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.scale(1.5F, 0.5F, 1.5F);
this.bindTexture(this.getEntityTexture(entity));
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer renderer = tessellator.getWorldRenderer();
GlStateManager.rotate(180.0F - renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
float rgb = this.getRgb(entity);
GlStateManager.color(rgb, rgb, rgb);
renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
renderer.pos(-0.5D, -0.25D, 0.0D).tex(0, 1).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos(0.5D, -0.25D, 0.0D).tex(1, 1).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos(0.5D, 0.75D, 0.0D).tex(1, 0).normal(0.0F, 1.0F, 0.0F).endVertex();
renderer.pos(-0.5D, 0.75D, 0.0D).tex(0, 0).normal(0.0F, 1.0F, 0.0F).endVertex();
tessellator.draw();
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
示例2: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
@Override
public void attackEntityWithRangedAttack(EntityLivingBase sucker, float par2) {
if (worldObj.isRemote)
return;
final EntityCosmeticShadowRiser ecsr = new EntityCosmeticShadowRiser(worldObj);
ecsr.setPosition(posX, posY + getEyeHeight(), posZ);
worldObj.spawnEntityInWorld(ecsr);
final boolean harm_undead = sucker.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
final AxisAlignedBB bb = AxisAlignedBB.getBoundingBox(sucker.posX - 8.0, sucker.posY - 16.0, sucker.posZ - 8.0,
sucker.posX + 8.0, sucker.posY + 16.0, sucker.posZ + 8.0);
if (!harm_undead) {
final List li = worldObj.getEntitiesWithinAABBExcludingEntity(this, bb);
for (final Object obj : li)
if (obj instanceof EntityNyxSkeleton) {
final EntityThrowable entityball = new EntityShadowBall(worldObj, this, false, true);
final Entity target = (Entity) obj;
entityball.setPosition(target.posX, target.posY + 32 + worldObj.rand.nextFloat() * 32, target.posZ);
entityball.setThrowableHeading(0, -1, 0, 0.40F, 0F);
worldObj.spawnEntityInWorld(entityball);
}
}
final EntityThrowable entitysmite = new EntityShadowBall(worldObj, this, harm_undead, true);
entitysmite.setPosition(sucker.posX, sucker.posY + 32 + worldObj.rand.nextFloat() * 32, sucker.posZ);
entitysmite.setThrowableHeading(0, -1, 0, 0.40F, 0F);
worldObj.spawnEntityInWorld(entitysmite);
}
示例3: doShadowAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
public void doShadowAttack(EntityLivingBase par1EntityLiving, float par2) {
final boolean harm_undead = par1EntityLiving.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
final EntityThrowable entityball = new EntityShadowBall(worldObj, this, harm_undead,
IaSWorldHelper.getRegionLevel(par1EntityLiving) >= 6);
final double d0 = par1EntityLiving.posX + par1EntityLiving.motionX - posX;
final double d1 = par1EntityLiving.posY + par1EntityLiving.getEyeHeight() - getEyeHeight() - posY;
final double d2 = par1EntityLiving.posZ + par1EntityLiving.motionZ - posZ;
final float f1 = MathHelper.sqrt_double(d0 * d0 + d2 * d2);
if (f1 <= 2.0) {
entityball.setThrowableHeading(d0, d1, d2, 0.40F, 8.0F);
} else {
entityball.rotationPitch += 20.0F;
}
entityball.setThrowableHeading(d0, d1 + f1 * 0.2F, d2, 0.80F, 8.0F);
worldObj.spawnEntityInWorld(entityball);
}
示例4: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase,
float f) {
EntityThrowable ent = entitySelect(this.worldObj);
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth
- 1.0D - ent.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
playSound("random.bow", 1.0F,
1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent);
if (entitylivingbase instanceof EntityCreature) {
((EntityCreature) entitylivingbase).setAttackTarget(this);
}
}
示例5: attackEntityWithRangedAttack
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
public void attackEntityWithRangedAttack(EntityLivingBase entitylivingbase, float f)
{
if (entitySelect(this.worldObj) != null)
{
int numbPods = this.min + (int)(Math.random() * (this.max - this.min + 1));
for (int i = 0; i < numbPods; i++) {
EntityThrowable ent = entitySelect(this.worldObj);
double toX = entitylivingbase.posX - this.posX;
float percentToMouth = 0.5F;
double toY = entitylivingbase.posY + this.height * percentToMouth - 1.0D - ent.posY;
double toZ = entitylivingbase.posZ - this.posZ;
float f1 = MathHelper.sqrt_double(toX * toX + toZ * toZ) * 0.2F;
ent.setThrowableHeading(toX, toY + f1, toZ, 1.6F, 12.0F);
playSound("random.bow", 1.0F, 1.0F / (getRNG().nextFloat() * 0.4F + 0.8F));
this.worldObj.spawnEntityInWorld(ent);
}
}
}
示例6: initializeEntityActivationState
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
/**
* These entities are excluded from Activation range checks.
*
* @param entity
* @param world
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
// Cauldron start - another fix for Proxy Worlds
if (config == null && DimensionManager.getWorld(0) != null)
{
config = DimensionManager.getWorld(0).spigotConfig;
}
else
{
return true;
}
// Cauldron end
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|| (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
|| entity instanceof EntityThrowable
|| entity instanceof EntityDragon
|| entity instanceof EntityDragonPart
|| entity instanceof EntityWither
|| entity instanceof EntityFireball
|| entity instanceof EntityWeatherEffect
|| entity instanceof EntityTNTPrimed
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworkRocket
|| entity instanceof EntityVillager
// Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
|| (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
&& !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
&& !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
{
return true;
}
return false;
}
示例7: findTarget
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
private Entity findTarget()
{
Iterator iter = worldObj.loadedEntityList.iterator();
Entity target = null;
double priority = 0;
while(iter.hasNext())
{
Entity e = (Entity) iter.next();
if (e != this && !e.isDead && (!(e instanceof EntityLivingBase) || ((EntityLivingBase)e).getHealth()>0) && (!(e instanceof EntityRhodes) || (RivalRebels.rhodesFF && (RivalRebels.rhodesCC || ((EntityRhodes)e).colorType != colorType))) &&
!( e instanceof EntityThrowable
|| e instanceof EntityInanimate
|| e instanceof EntityItem
|| e instanceof EntityAnimal
|| e instanceof EntityVillager
|| e instanceof EntityBat
|| e instanceof EntitySquid
|| e instanceof EntityBoat
|| e instanceof EntityMinecart))
{
double prio = getPriority(e)-getDistanceToEntity(e);
if (prio > priority)
{
target = e;
priority = prio;
}
}
}
return target;
}
示例8: getShooter
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
private Entity getShooter(Entity ent)
{
return ent instanceof EntityArrow ? ((EntityArrow)ent).shootingEntity :
ent instanceof EntityThrowable ? ((EntityThrowable)ent).getThrower() :
ent instanceof EntityDartBase ? ((EntityDartBase)ent).shootingEntity :
ent instanceof EntityFireball ? ((EntityFireball)ent).shootingEntity :
null;
}
示例9: onItemRightClick
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
if (!playerIn.capabilities.isCreativeMode)
{
itemstack.shrink(1);
}
//It seems like it's playing a sound to null player.
//But it seems to work regardless? This might be a bug within multiplayer. We'll have to check.
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityThrowable rock = new EntityRockNormal(worldIn, playerIn);
switch(type)
{
case NORMAL: rock = new EntityRockNormal(worldIn, playerIn);
break;
case FLAT: rock = new EntityRockFlat(worldIn, playerIn);
break;
default:
break;
}
rock.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); //rock.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
//wtf is "shoot"? //Forge changed their shit
worldIn.spawnEntity(rock);
}
return new ActionResult<>(EnumActionResult.SUCCESS, itemstack);
}
示例10: initializeEntityActivationState
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
/**
* These entities are excluded from Activation range checks.
*
* @param entity
* @param world
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
// Cauldron start - another fix for Proxy Worlds
if (config == null && DimensionManager.getWorld(0) != null)
{
config = DimensionManager.getWorld(0).spigotConfig;
}
else
{
return true;
}
// Cauldron end
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|| (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
|| entity instanceof EntityThrowable
|| entity instanceof EntityDragon
|| entity instanceof EntityDragonPart
|| entity instanceof EntityWither
|| entity instanceof EntityFireball
|| entity instanceof EntityWeatherEffect
|| entity instanceof EntityTNTPrimed
|| entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
|| entity instanceof EntityEnderCrystal
|| entity instanceof EntityFireworkRocket
|| entity instanceof EntityVillager
// Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
|| (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
&& !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
&& !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
{
return true;
}
return false;
}
示例11: shootTwins
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
private void shootTwins(World world, EntityPlayer player, float velocityFactor, float damage) {
Vec3d vecCrossRight = player.getLookVec().normalize().crossProduct(new Vec3d(0, 2, 0));
Vec3d vecCrossLeft = player.getLookVec().normalize().crossProduct(new Vec3d(0, -2, 0));
EntityThrowable projRight = createBullet(world, player, damage);
projRight.posX += vecCrossRight.x;
projRight.posZ += vecCrossRight.z;
this.launchProjectile(world, player, projRight, velocityFactor);
EntityThrowable projLeft = createBullet(world, player, damage);
projLeft.posX += vecCrossLeft.x;
projLeft.posZ += vecCrossLeft.z;
this.launchProjectile(world, player, projLeft, velocityFactor);
}
示例12: launchProjectile
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
protected void launchProjectile(World world, EntityPlayer player, EntityThrowable thing, float velocity) {
if (!world.isRemote) {
//zero pitch offset, meaning match the players existing. 1.0 at end ins inn
thing.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, PITCHOFFSET, velocity, INACCURACY_DEFAULT);
world.spawnEntity(thing);
}
BlockPos pos = player.getPosition();
UtilSound.playSound(player, pos, getSound(), SoundCategory.PLAYERS);
}
示例13: shootTwins
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
private void shootTwins(World world, EntityPlayer player, float velocityFactor, float damage) {
Vec3d vecCrossRight = player.getLookVec().normalize().crossProduct(new Vec3d(0, 2, 0));
Vec3d vecCrossLeft = player.getLookVec().normalize().crossProduct(new Vec3d(0, -2, 0));
EntityThrowable projRight = createBullet(world, player, damage);
projRight.posX += vecCrossRight.x;
projRight.posZ += vecCrossRight.z;
this.launchProjectile(world, player, projRight, velocityFactor * VELOCITY_MAX);
EntityThrowable projLeft = createBullet(world, player, damage);
projLeft.posX += vecCrossLeft.x;
projLeft.posZ += vecCrossLeft.z;
this.launchProjectile(world, player, projLeft, velocityFactor * VELOCITY_MAX);
}
示例14: doThrow
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
public void doThrow(World world, EntityPlayer player, EnumHand hand, EntityThrowable thing, float velocity) {
if (!world.isRemote) {
// func_184538_a
//zero pitch offset, meaning match the players existing. 1.0 at end ins inn
thing.setHeadingFromThrower(player, player.rotationPitch, player.rotationYaw, PITCHOFFSET, velocity, INACCURACY_DEFAULT);
world.spawnEntity(thing);
}
player.swingArm(hand);
BlockPos pos = player.getPosition();
UtilSound.playSound(player, pos, getSound(), SoundCategory.PLAYERS, 0.5F);
}
示例15: initializeEntityActivationState
import net.minecraft.entity.projectile.EntityThrowable; //導入依賴的package包/類
/**
* These entities are excluded from Activation range checks.
*
* @param entity
* @param world
* @return boolean If it should always tick.
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
// Cauldron start - another fix for Proxy Worlds
if (config == null && DimensionManager.getWorld(0) != null)
{
config = DimensionManager.getWorld(0).spigotConfig;
}
else
{
return true;
}
// Cauldron end
if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
|| ( entity.activationType == 2 && config.animalActivationRange == 0 )
|| ( entity.activationType == 1 && config.monsterActivationRange == 0 )
|| (entity.getClass().equals(EntityPlayer.class) && !(entity.getClass().equals(FakePlayer.class))) // Cauldron
|| entity.getClass().equals(EntityThrowable.class)
|| entity.getClass().equals(EntityDragon.class)
|| entity.getClass().equals(EntityDragonPart.class)
|| entity.getClass().equals(EntityWither.class)
|| entity.getClass().equals(EntityFireball.class)
|| entity.getClass().equals(EntityWeatherEffect.class)
|| entity.getClass().equals(EntityTNTPrimed.class)
|| entity.getClass().equals(EntityFallingBlock.class)
|| entity.getClass().equals(EntityEnderCrystal.class)
|| entity.getClass().equals(EntityFireworkRocket.class)
|| entity.getClass().equals(EntityVillager.class)
// Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
|| (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
&& !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
&& !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
{
return true;
}
return false;
}