本文整理汇总了Java中net.minecraft.entity.passive.EntityWolf类的典型用法代码示例。如果您正苦于以下问题:Java EntityWolf类的具体用法?Java EntityWolf怎么用?Java EntityWolf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EntityWolf类属于net.minecraft.entity.passive包,在下文中一共展示了EntityWolf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: apply
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
@Override
public void apply(World world, BlockPos pos, EntityLivingBase entity, int amplifier, int tick) {
if (amplifier >= 3) {
if (entity instanceof EntityWolf) {
entity.addPotionEffect(new PotionEffect(MobEffects.WITHER, 1500, 0));
entity.attackEntityFrom(DamageSource.MAGIC, 20);
}
}
if (amplifier == 2) {
if (entity instanceof EntityWolf) {
entity.attackEntityFrom(DamageSource.MAGIC, 16);
}
}
if (entity instanceof EntityWolf) {
entity.attackEntityFrom(DamageSource.MAGIC, 10);
}
}
示例2: isMobAggressive
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
/**
* Checks if the mob could be possibly hostile towards us (we can't detect their attack target easily)
* Current entities:
* PigZombie: Aggressive if arms are raised, when arms are put down a internal timer is slowly ticked down from 400
* Wolf: Aggressive if the owner isn't the local player and the wolf is angry
* Enderman: Aggressive if making screaming sounds
*/
public static boolean isMobAggressive(Entity entity) {
if(entity instanceof EntityPigZombie) {
// arms raised = aggressive, angry = either game or we have set the anger cooldown
if(((EntityPigZombie) entity).isArmsRaised() || ((EntityPigZombie) entity).isAngry()) {
if(!((EntityPigZombie) entity).isAngry()) {
// set pigmens anger to 400 if it hasn't been angered already
FastReflection.Fields.EntityPigZombie_angerLevel.set((EntityPigZombie)entity, 400);
}
return true;
}
} else if(entity instanceof EntityWolf) {
return ((EntityWolf) entity).isAngry() &&
!MC.player.equals(((EntityWolf) entity).getOwner());
} else if(entity instanceof EntityEnderman) {
return ((EntityEnderman) entity).isScreaming();
}
return false;
}
示例3: BiomeGenTaiga
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public BiomeGenTaiga(int p_i45385_1_, int p_i45385_2_)
{
super(p_i45385_1_);
this.field_150644_aH = p_i45385_2_;
this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityWolf.class, 8, 4, 4));
this.theBiomeDecorator.treesPerChunk = 10;
if (p_i45385_2_ != 1 && p_i45385_2_ != 2)
{
this.theBiomeDecorator.grassPerChunk = 1;
this.theBiomeDecorator.mushroomsPerChunk = 1;
}
else
{
this.theBiomeDecorator.grassPerChunk = 7;
this.theBiomeDecorator.deadBushPerChunk = 1;
this.theBiomeDecorator.mushroomsPerChunk = 3;
}
}
示例4: EntitySkeleton
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public EntitySkeleton(World worldIn)
{
super(worldIn);
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIRestrictSun(this));
this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D));
this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityWolf.class, 6.0F, 1.0D, 1.2D));
this.tasks.addTask(4, new EntityAIWander(this, 1.0D));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(6, new EntityAILookIdle(this));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true));
if (worldIn != null && !worldIn.isRemote)
{
this.setCombatTask();
}
}
示例5: EntityRabbit
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public EntityRabbit(World world) {
super(world);
moveType = EntityRabbit.EnumMoveType.HOP;
carrotTicks = 0;
setSize(0.4F, 0.5F);
ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitJumpHelper(this), "jumpHelper", "field_70767_i");
ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitMoveHelper(), "moveHelper", "field_70765_h");
getNavigator().setAvoidsWater(true);
// navigator.func_179678_a(2.5F);
tasks.addTask(1, new EntityAISwimming(this));
tasks.addTask(1, new EntityRabbit.AIPanic(1.33D));
tasks.addTask(2, new EntityAIMate(this, 0.8D));
tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.carrot, false));
tasks.addTask(5, new EntityRabbit.AIRaidFarm());
tasks.addTask(5, new EntityAIWander(this, 0.6D));
tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
tasks.addTask(4, new EntityAIAvoidEntity(this, EntityWolf.class, 16.0F, 1.33D, 1.33D));
tasks.addTask(4, new EntityAIAvoidEntity(this, EntityPlayer.class, 16.0F, 0.8D, 1.33D));
setMovementSpeed(0.0D);
}
示例6: spawnEvent
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
@SubscribeEvent
public void spawnEvent(EntityJoinWorldEvent event) {
if (event.entity instanceof EntityPig) {
EntityPig pig = (EntityPig) event.entity;
if (EtFuturum.enableBeetroot)
pig.tasks.addTask(4, new EntityAITempt(pig, 1.2, ModItems.beetroot, false));
} else if (event.entity instanceof EntityChicken) {
EntityChicken chicken = (EntityChicken) event.entity;
if (EtFuturum.enableBeetroot)
chicken.tasks.addTask(3, new EntityAITempt(chicken, 1.0D, ModItems.beetroot_seeds, false));
} else if (event.entity instanceof EntityWolf) {
EntityWolf wolf = (EntityWolf) event.entity;
if (EtFuturum.enableRabbit)
wolf.targetTasks.addTask(4, new EntityAITargetNonTamed(wolf, EntityRabbit.class, 200, false));
} else if (event.entity instanceof EntityVillager) {
EntityVillager villager = (EntityVillager) event.entity;
for (Object obj : villager.tasks.taskEntries) {
EntityAITaskEntry entry = (EntityAITaskEntry) obj;
if (entry.action instanceof EntityAIOpenDoor) {
villager.tasks.removeTask(entry.action);
villager.tasks.addTask(entry.priority, new EntityAIOpenCustomDoor(villager, true));
break;
}
}
}
}
示例7: entityMatchesTargetTypes
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
private boolean entityMatchesTargetTypes(EntityLivingBase entityLivingBase) {
boolean matches = false;
if (entityLivingBase instanceof EntityPlayer) {
matches = players.getValue();
} else if (entityLivingBase instanceof IMob) {
matches = mobs.getValue();
} else if (entityLivingBase instanceof IAnimals) {
matches = animals.getValue();
}
if (mobs.getValue()) {
if (entityLivingBase instanceof EntityWolf) {
EntityWolf wolf = (EntityWolf) entityLivingBase;
matches = wolf.isAngry();
}
}
return matches;
}
示例8: onItemRightClick
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
List<EntityLivingBase> elb = acquireAllLookTargets(player, 32, 3);
for (EntityLivingBase target : elb) {
if (target.canEntityBeSeen(player) && !(target instanceof EntityPlayer)) {
BlockPos targetpos = target.getPosition();
BlockPos playerpos = player.getPosition();
if (!world.isRemote) {
target.setPositionAndUpdate(playerpos.getX(), playerpos.getY(), playerpos.getZ());
player.setPositionAndUpdate(targetpos.getX(), targetpos.getY(), targetpos.getZ());
if (target instanceof EntityWolf && world.rand.nextInt(100) == 0)
target.entityDropItem(UCItems.generic.createStack(EnumItems.DOGRESIDUE), 1);
stack.damageItem(1, player);
return new ActionResult(EnumActionResult.SUCCESS, stack);
}
}
}
return new ActionResult(EnumActionResult.PASS, stack);
}
示例9: BiomeForest
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public BiomeForest(BiomeForest.Type typeIn, Biome.BiomeProperties properties)
{
super(properties);
this.type = typeIn;
this.theBiomeDecorator.treesPerChunk = 10;
this.theBiomeDecorator.grassPerChunk = 2;
if (this.type == BiomeForest.Type.FLOWER)
{
this.theBiomeDecorator.treesPerChunk = 6;
this.theBiomeDecorator.flowersPerChunk = 100;
this.theBiomeDecorator.grassPerChunk = 1;
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityRabbit.class, 4, 2, 3));
}
if (this.type == BiomeForest.Type.NORMAL)
{
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityWolf.class, 5, 4, 4));
}
if (this.type == BiomeForest.Type.ROOFED)
{
this.theBiomeDecorator.treesPerChunk = -999;
}
}
示例10: BiomeTaiga
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public BiomeTaiga(BiomeTaiga.Type typeIn, Biome.BiomeProperties properties)
{
super(properties);
this.type = typeIn;
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityWolf.class, 8, 4, 4));
this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityRabbit.class, 4, 2, 3));
this.theBiomeDecorator.treesPerChunk = 10;
if (typeIn != BiomeTaiga.Type.MEGA && typeIn != BiomeTaiga.Type.MEGA_SPRUCE)
{
this.theBiomeDecorator.grassPerChunk = 1;
this.theBiomeDecorator.mushroomsPerChunk = 1;
}
else
{
this.theBiomeDecorator.grassPerChunk = 7;
this.theBiomeDecorator.deadBushPerChunk = 1;
this.theBiomeDecorator.mushroomsPerChunk = 3;
}
}
示例11: doRenderLayer
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public void doRenderLayer(EntityWolf entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible())
{
this.wolfRenderer.bindTexture(WOLF_COLLAR);
float[] afloat = EntitySheep.getDyeRgb(entitylivingbaseIn.getCollarColor());
if (Config.isCustomColors())
{
afloat = CustomColors.getWolfCollarColors(entitylivingbaseIn.getCollarColor(), afloat);
}
GlStateManager.color(afloat[0], afloat[1], afloat[2]);
this.wolfRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
}
示例12: shouldAttackEntity
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public boolean shouldAttackEntity(EntityLivingBase target){
EntityLivingBase owner = getOwner();
if (ConfigValues.HUNTCREEPERS || !(target instanceof EntityCreeper)) {
if (target instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) target;
if (entitywolf.isTamed() && entitywolf.getOwner() == owner || Alliances.getInstance().isAlliedTo(entitywolf.getOwnerId(), getOwnerId()))
return false;
}
if (target instanceof EntityArmyMember)
if ((getAttackMode() < 2 && Enemies.getInstance().isNotEnemiesWith(((EntityArmyMember) target).getOwnerId(), getOwnerId())) || ((EntityArmyMember) target).getOwnerId().equals(getOwnerId()) || Alliances.getInstance().isAlliedTo(((EntityArmyMember) target).getOwnerId(), getOwnerId()))
return false;
return !(target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) && (!(target instanceof EntityHorse) || !((EntityHorse) target).isTame());
} else
return false;
}
示例13: syncArmor
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public static void syncArmor(EntityWolf entity, boolean sendPacket) {
if (!entity.getEntityWorld().isRemote)
{
entity.getEntityAttribute(SharedMonsterAttributes.ARMOR).removeModifier(UUID_ARMOR_ATTRIBUTE);
ItemStack wolfArmor = getWolfArmorStack(entity);
WolfArmor armor = getWolfArmor(wolfArmor);
int i = armor.getProtection();
if (i != 0)
{
entity.getEntityAttribute(SharedMonsterAttributes.ARMOR).applyModifier((new AttributeModifier(UUID_ARMOR_ATTRIBUTE, "Wolf armor bonus", i, 0)).setSaved(false));
}
//EntityUtil.getCustomEntityData(entity).setBoolean(EventHandler.NBT_NBTDIRTY, true);
if(sendPacket){
CrystalModNetwork.sendToAllAround(new PacketEntityMessage(entity, "CustomDataSync", EntityUtil.getCustomEntityData(entity)), entity);
}
}
}
示例14: handleWolfInteract
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
public static boolean handleWolfInteract(EntityPlayer player, ItemStack held, EnumHand hand, EntityWolf entity) {
if(ItemStackTools.isValid(held) && !entity.getEntityWorld().isRemote){
if(held.getItem() instanceof IWolfArmor){
ItemStack lastStack = WolfAccessories.getWolfArmorStack(entity);
if(ItemStackTools.isValid(lastStack)){
entity.entityDropItem(lastStack, 0);
}
ItemStack copy = ItemStackTools.safeCopy(held);
if(ItemStackTools.isValid(copy)){
setWolfArmor(entity, copy);
if(!player.capabilities.isCreativeMode)player.setHeldItem(hand, ItemUtil.consumeItem(held));
return true;
}
}
}
return false;
}
示例15: doRenderLayer
import net.minecraft.entity.passive.EntityWolf; //导入依赖的package包/类
@Override
public void doRenderLayer(EntityWolf entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
boolean invis = entity.isInvisible() || entity.isInvisibleToPlayer(CrystalMod.proxy.getClientPlayer());
if(invis)return;
if(ItemStackTools.isValid(WolfAccessories.getWolfArmorStack(entity))){
ItemStack armorStack = WolfAccessories.getWolfArmorStack(entity);
GlStateManager.pushMatrix();
for(int i = 0; i < 2; i++){
ModelWolfArmor model = null;
if(i == 0)model = modelWolfArmor0;
if(i == 1)model = modelWolfArmor1;
if(model !=null){
model.setModelAttributes(renderer.getMainModel());
model.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks);
//TODO Add leather armor dying support
renderer.bindTexture(getTexture(WolfAccessories.getWolfArmor(armorStack), i));
GlStateManager.color(1, 1, 1, 1);
model.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
}
GlStateManager.popMatrix();
}
}