本文整理匯總了Java中net.minecraft.entity.monster.EntitySkeleton類的典型用法代碼示例。如果您正苦於以下問題:Java EntitySkeleton類的具體用法?Java EntitySkeleton怎麽用?Java EntitySkeleton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntitySkeleton類屬於net.minecraft.entity.monster包,在下文中一共展示了EntitySkeleton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateTask
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
/**
* Updates the task
*/
public void updateTask()
{
DifficultyInstance difficultyinstance = this.horse.world.getDifficultyForLocation(new BlockPos(this.horse));
this.horse.func_190691_p(false);
this.horse.setHorseTamed(true);
this.horse.setGrowingAge(0);
this.horse.world.addWeatherEffect(new EntityLightningBolt(this.horse.world, this.horse.posX, this.horse.posY, this.horse.posZ, true));
EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
entityskeleton.startRiding(this.horse);
for (int i = 0; i < 3; ++i)
{
AbstractHorse abstracthorse = this.createHorse(difficultyinstance);
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, abstracthorse);
entityskeleton1.startRiding(abstracthorse);
abstracthorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
}
}
示例2: createSkeleton
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, AbstractHorse p_188514_2_)
{
EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.world);
entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
entityskeleton.hurtResistantTime = 60;
entityskeleton.enablePersistence();
if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD).func_190926_b())
{
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
}
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false));
entityskeleton.world.spawnEntityInWorld(entityskeleton);
return entityskeleton;
}
示例3: updateTask
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
/**
* Updates the task
*/
public void updateTask()
{
DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
this.horse.setSkeletonTrap(false);
this.horse.setType(HorseType.SKELETON);
this.horse.setHorseTamed(true);
this.horse.setGrowingAge(0);
this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
entityskeleton.startRiding(this.horse);
for (int i = 0; i < 3; ++i)
{
EntityHorse entityhorse = this.createHorse(difficultyinstance);
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
entityskeleton1.startRiding(entityhorse);
entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
}
}
示例4: createSkeleton
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
entityskeleton.hurtResistantTime = 60;
entityskeleton.enablePersistence();
if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
{
entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
}
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
return entityskeleton;
}
示例5: initEntityAI
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
protected void initEntityAI()
{
this.aiSit = new EntityAISit(this);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, this.aiSit);
this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
this.tasks.addTask(4, new EntityAIAttackMelee(this, 1.0D, true));
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
this.tasks.addTask(8, new EntityAIBeg(this, 8.0F));
this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(9, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true, new Class[0]));
this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate<Entity>()
{
public boolean apply(@Nullable Entity p_apply_1_)
{
return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit;
}
}));
this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false));
}
示例6: setLivingAnimations
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
this.rightArmPose = ModelBiped.ArmPose.EMPTY;
this.leftArmPose = ModelBiped.ArmPose.EMPTY;
ItemStack itemstack = entitylivingbaseIn.getHeldItem(EnumHand.MAIN_HAND);
if (itemstack != null && itemstack.getItem() == Items.BOW && ((EntitySkeleton)entitylivingbaseIn).isSwingingArms())
{
if (entitylivingbaseIn.getPrimaryHand() == EnumHandSide.RIGHT)
{
this.rightArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
else
{
this.leftArmPose = ModelBiped.ArmPose.BOW_AND_ARROW;
}
}
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
}
示例7: setRotationAngles
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
{
super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
ItemStack itemstack = ((EntityLivingBase)entityIn).getHeldItemMainhand();
EntitySkeleton entityskeleton = (EntitySkeleton)entityIn;
if (entityskeleton.isSwingingArms() && (itemstack == null || itemstack.getItem() != Items.BOW))
{
float f = MathHelper.sin(this.swingProgress * (float)Math.PI);
float f1 = MathHelper.sin((1.0F - (1.0F - this.swingProgress) * (1.0F - this.swingProgress)) * (float)Math.PI);
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f * 0.6F);
this.bipedLeftArm.rotateAngleY = 0.1F - f * 0.6F;
this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F);
this.bipedRightArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f * 1.2F - f1 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(ageInTicks * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(ageInTicks * 0.067F) * 0.05F;
}
}
示例8: onMobDrops
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@SubscribeEvent
public void onMobDrops(LivingDropsEvent e)
{
World world = e.getEntity().getEntityWorld();
Random rng = world.rand;
if (e.getEntity() instanceof EntitySkeleton) {
EntitySkeleton skele = (EntitySkeleton) e.getEntity();
if (skele.getSkeletonType() == 1) {
if (rng.nextFloat() < 0.20 + (e.getLootingLevel() + 1 * 0.05))
e.getDrops().add(new EntityItem(world, skele.posX, skele.posY, skele.posZ, new ItemStack(ModItems.MobDust, 1, 0)));
}
}
if (e.getEntity() instanceof EntityCaveSpider) {
if (rng.nextFloat() < 0.20 + (e.getLootingLevel() + 1 * 0.05))
e.getDrops().add(new EntityItem(world, e.getEntity().posX, e.getEntity().posY, e.getEntity().posZ, new ItemStack(ModItems.MobDust, 1, 1)));
}
}
示例9: onImpact
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@Override
protected void onImpact(@Nonnull RayTraceResult mop) {
if (!this.world.isRemote) {
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().grow(4.0D, 2.0D, 4.0D);
List<EntityLivingBase> list = this.world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (!list.isEmpty()) {
for (EntityLivingBase entitylivingbase : list) {
if (entitylivingbase instanceof EntitySkeletonWarrior || entitylivingbase instanceof EntityBabySkeleton || entitylivingbase instanceof EntitySkeleton || entitylivingbase instanceof EntitySkeletonHorse) {
double d0 = this.getDistanceSqToEntity(entitylivingbase);
if (d0 < 16.0D)
entitylivingbase.heal(1);
}
}
}
world.playSound(null, posX, posY, posZ, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.NEUTRAL, 0.5F, 0.8F / (rand.nextFloat() * 0.4F + 0.8F));
this.setDead();
}
}
示例10: getRandomSkeletonClasse
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
public static EntitySkeleton getRandomSkeletonClasse(World w, double x, double y, double z, Random r)
{
EntitySkeleton skeleton = new EntitySkeleton(w);
skeleton.setLocationAndAngles(x, y + 1.0D, z, 0.0F, 0.0F);
skeleton.setSkeletonType(1);
int alea = r.nextInt(4);
if (alea == 0)
{
}
else if (alea == 1)
{}
else
{}
return skeleton;
}
示例11: saveCurrentRenderers
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
private void saveCurrentRenderers(RenderManager rm) {
// villagers
saveRenderer(rm, EntityVillager.class);
saveRenderer(rm, EntityZombieVillager.class);
// zombies
saveRenderer(rm, EntityZombie.class);
saveRenderer(rm, EntityHusk.class);
// pig zombie
saveRenderer(rm, EntityPigZombie.class);
// skeletons
saveRenderer(rm, EntitySkeleton.class);
saveRenderer(rm, EntityStray.class);
saveRenderer(rm, EntityWitherSkeleton.class);
// illagers
saveRenderer(rm, EntityVex.class);
saveRenderer(rm, EntityEvoker.class);
saveRenderer(rm, EntityVindicator.class);
saveRenderer(rm, EntityIllusionIllager.class);
}
示例12: onEntitySpawn
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@SubscribeEvent
public void onEntitySpawn(EntityJoinWorldEvent event)
{
if(event.getEntity().world.isRemote)
{
Minecraft mc = Minecraft.getMinecraft();
if(event.getEntity() instanceof EntityFishHook)
{
fishHooks.add((EntityFishHook)event.getEntity());
}
if(event.getEntity() instanceof EntityZombie && !(event.getEntity() instanceof EntityZombieVillager) || event.getEntity() instanceof EntitySkeleton || MobAmputation.config.playerGibs == 1 && event.getEntity() instanceof EntityPlayer && event.getEntity() != mc.player)
{
EntityLivingBase living = (EntityLivingBase)event.getEntity();
if(!amputationMap.containsKey(living) && !living.isChild())
{
attachGibs(event.getEntity().world, living);
}
}
}
}
示例13: onInitialSpawn
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@Nullable
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
if(!worldObj.isRemote){
for(int i = 0; i < 4; i++){
EntitySkeleton mob = new EntitySkeleton(worldObj);
mob.setSkeletonType(SkeletonType.WITHER);
mob.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.DIAMOND_SWORD));
mob.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(4.0D);
BlockPos pos = pickSpawnPoint();
mob.setLocationAndAngles(0.5 + pos.getX(), pos.getY(), 0.5 + pos.getZ(), CMath.random.nextFloat() * 360,0);
worldObj.spawnEntityInWorld(mob);
}
}
return super.onInitialSpawn(difficulty, livingdata);
}
示例14: onLeftClickEntity
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
if(entity instanceof EntitySkeleton)
{
EntitySkeleton skele = (EntitySkeleton) entity;
if(skele.getSkeletonType() == 1)
{
skele.attackEntityFrom(DamageSource.causePlayerDamage(player),2.0F);
return false;
}
}
if(entity instanceof EntityLivingBase)
{
entity.worldObj.newExplosion(entity,entity.posX,entity.posY,entity.posZ,3.0F,false,true);
player.attackEntityFrom(DamageSource.magic,1000.0F);
stack.stackSize = 0;
return false;
}
return true;
}
示例15: onSkeletonUpdate
import net.minecraft.entity.monster.EntitySkeleton; //導入依賴的package包/類
@SubscribeEvent
public void onSkeletonUpdate(LivingEvent.LivingUpdateEvent event) {
if (!(event.getEntityLiving() instanceof EntitySkeleton)) {
return;
}
EntitySkeleton skeleton = (EntitySkeleton) event.getEntityLiving();
EntityAITasks tasks = skeleton.tasks;
boolean containsOld = false;
Iterator<EntityAITasks.EntityAITaskEntry> itr = tasks.taskEntries.iterator();
while (itr.hasNext()) {
EntityAITasks.EntityAITaskEntry entry = itr.next();
if (entry.action instanceof EntityAIAttackRangedBow) {
itr.remove();
}
if (entry.action instanceof EntityAIAttackRanged) {
containsOld = true;
}
}
if (!containsOld) {
tasks.addTask(4, new EntityAIAttackRanged(skeleton, 1.0D, 20, 15.0F));
}
}