mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
fat pigeons
This commit is contained in:
parent
eb602d2707
commit
189d56a322
@ -239,7 +239,7 @@ public class EntityMappings {
|
||||
addMob(EntityMaskMan.class, "entity_mob_mask_man", 0x818572, 0xC7C1B7);
|
||||
addMob(EntityDuck.class, "entity_fucc_a_ducc", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityQuackos.class, "entity_elder_one", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityPigeon.class, "entity_pigeon", 0xd0d0d0, 0xFFBF00);
|
||||
addMob(EntityPigeon.class, "entity_pigeon", 0xC8C9CD, 0x858894);
|
||||
addMob(EntityFBI.class, "entity_ntm_fbi", 0x008000, 0x404040);
|
||||
addMob(EntityFBIDrone.class, "entity_ntm_fbi_drone", 0x008000, 0x404040);
|
||||
addMob(EntityRADBeast.class, "entity_ntm_radiation_blaze", 0x303030, 0x008000);
|
||||
|
||||
@ -2,17 +2,24 @@ package com.hbm.entity.mob;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import com.hbm.entity.mob.ai.EntityAIFlutterAroundAimlessly;
|
||||
import com.hbm.entity.mob.ai.EntityAIEatBread;
|
||||
import com.hbm.entity.mob.ai.EntityAIStartFlying;
|
||||
import com.hbm.entity.mob.ai.EntityAIStopFlying;
|
||||
import com.hbm.entity.mob.ai.EntityAISwimmingConditional;
|
||||
import com.hbm.entity.mob.ai.EntityAIWanderConditional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAILookIdle;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.IAnimals;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAnimals {
|
||||
@ -29,14 +36,37 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
this.tasks.addTask(0, new EntityAIStartFlying(this, this));
|
||||
this.tasks.addTask(0, new EntityAIStopFlying(this, this));
|
||||
this.tasks.addTask(1, new EntityAISwimmingConditional(this, noFlyCondition));
|
||||
this.tasks.addTask(2, new EntityAIFlutterAroundAimlessly(this, this));
|
||||
//this.tasks.addTask(2, new EntityAIPanicConditional(this, 1.4D, noFlyCondition));
|
||||
this.tasks.addTask(2, new EntityAIEatBread(this, 0.4D));
|
||||
this.tasks.addTask(5, new EntityAIWanderConditional(this, 0.2D, noFlyCondition));
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
|
||||
this.tasks.addTask(7, new EntityAILookIdle(this));
|
||||
this.setSize(0.5F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
|
||||
if(amount >= this.getMaxHealth() * 2 && !worldObj.isRemote) {
|
||||
this.setDead();
|
||||
|
||||
for(int i = 0; i < 10; i++) {
|
||||
Vec3 vec = Vec3.createVectorHelper(rand.nextGaussian(), rand.nextGaussian(), rand.nextGaussian()).normalize();
|
||||
|
||||
EntityItem feather = new EntityItem(worldObj);
|
||||
feather.setEntityItemStack(new ItemStack(Items.feather));
|
||||
feather.setPosition(posX + vec.xCoord, posY + height / 2D + vec.yCoord, posZ + vec.zCoord);
|
||||
feather.motionX = vec.xCoord * 0.5;
|
||||
feather.motionY = vec.yCoord * 0.5;
|
||||
feather.motionZ = vec.zCoord * 0.5;
|
||||
worldObj.spawnEntityInWorld(feather);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.attackEntityFrom(source, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAIEnabled() {
|
||||
return true;
|
||||
@ -46,6 +76,32 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0));
|
||||
this.dataWatcher.addObject(13, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem() {
|
||||
return Items.feather;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void func_145780_a(int x, int y, int z, Block block) {
|
||||
this.playSound("mob.chicken.step", 0.15F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropFewItems(boolean byPlayer, int looting) {
|
||||
int j = this.rand.nextInt(3) + this.rand.nextInt(1 + looting);
|
||||
|
||||
for(int k = 0; k < j; ++k) {
|
||||
this.dropItem(Items.feather, 1);
|
||||
}
|
||||
|
||||
if(this.isBurning()) {
|
||||
this.dropItem(Items.cooked_chicken, this.isFat() ? 3 : 1);
|
||||
} else {
|
||||
this.dropItem(Items.chicken, this.isFat() ? 3 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,6 +114,14 @@ public class EntityPigeon extends EntityCreature implements IFlyingCreature, IAn
|
||||
this.dataWatcher.updateObject(12, (byte) state);
|
||||
}
|
||||
|
||||
public boolean isFat() {
|
||||
return this.dataWatcher.getWatchableObjectByte(13) == 1;
|
||||
}
|
||||
|
||||
public void setFat(boolean fat) {
|
||||
this.dataWatcher.updateObject(13, (byte) (fat ? 1 : 0));
|
||||
}
|
||||
|
||||
protected String getLivingSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
71
src/main/java/com/hbm/entity/mob/ai/EntityAIEatBread.java
Normal file
71
src/main/java/com/hbm/entity/mob/ai/EntityAIEatBread.java
Normal file
@ -0,0 +1,71 @@
|
||||
package com.hbm.entity.mob.ai;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.mob.EntityPigeon;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class EntityAIEatBread extends EntityAIBase {
|
||||
|
||||
private EntityPigeon pigeon;
|
||||
private double speed;
|
||||
private EntityItem item;
|
||||
|
||||
public EntityAIEatBread(EntityPigeon pigeon, double speed) {
|
||||
this.pigeon = pigeon;
|
||||
this.speed = speed;
|
||||
this.setMutexBits(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute() {
|
||||
if(pigeon.isFat() || pigeon.getFlyingState() != pigeon.STATE_WALKING) return false;
|
||||
|
||||
List<EntityItem> items = pigeon.worldObj.getEntitiesWithinAABB(EntityItem.class, this.pigeon.boundingBox.expand(10, 10, 10));
|
||||
|
||||
for(EntityItem item : items) {
|
||||
if(item.getEntityItem().getItem() == Items.bread) {
|
||||
this.item = item;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting() {
|
||||
return this.item != null && !this.item.isDead && this.shouldExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTask() {
|
||||
this.pigeon.getLookHelper().setLookPositionWithEntity(this.item, 30.0F, (float) this.pigeon.getVerticalFaceSpeed());
|
||||
|
||||
if(this.pigeon.getDistanceToEntity(this.item) > 1) {
|
||||
this.pigeon.getNavigator().tryMoveToEntityLiving(this.item, this.speed);
|
||||
} else {
|
||||
|
||||
if(this.pigeon.getRNG().nextInt(3) == 0) {
|
||||
ItemStack stack = this.item.getEntityItem();
|
||||
|
||||
if(stack.stackSize > 1) {
|
||||
stack.stackSize--;
|
||||
EntityItem newItem = new EntityItem(this.pigeon.worldObj);
|
||||
newItem.setPosition(this.item.posX, this.item.posY, this.item.posZ);
|
||||
newItem.setEntityItemStack(stack);
|
||||
this.pigeon.worldObj.spawnEntityInWorld(newItem);
|
||||
}
|
||||
|
||||
this.item.setDead();
|
||||
}
|
||||
this.pigeon.setFat(true);
|
||||
this.pigeon.playSound("random.eat", 0.5F + 0.5F * this.pigeon.getRNG().nextInt(2), (this.pigeon.getRNG().nextFloat() - this.pigeon.getRNG().nextFloat()) * 0.2F + 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package com.hbm.entity.mob.ai;
|
||||
|
||||
import com.hbm.entity.mob.IFlyingCreature;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.ai.EntityAIBase;
|
||||
|
||||
public class EntityAIFlutterAroundAimlessly extends EntityAIBase {
|
||||
|
||||
private EntityLivingBase living;
|
||||
private IFlyingCreature flying;
|
||||
|
||||
public EntityAIFlutterAroundAimlessly(EntityLivingBase living, IFlyingCreature flying) {
|
||||
this.living = living;
|
||||
this.flying = flying;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecute() {
|
||||
return this.flying.getFlyingState() == this.flying.STATE_FLYING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueExecuting() {
|
||||
return shouldExecute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startExecuting() {
|
||||
|
||||
/*this.living.motionX = this.living.getRNG().nextGaussian() * 0.1;
|
||||
this.living.motionY = this.living.getRNG().nextGaussian() * 0.1;
|
||||
this.living.motionZ = this.living.getRNG().nextGaussian() * 0.1;*/
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,6 @@ public class EntityAIMaskmanCasualApproach extends EntityAIBase {
|
||||
EntityLivingBase entitylivingbase = this.attacker.getAttackTarget();
|
||||
this.attacker.getLookHelper().setLookPositionWithEntity(entitylivingbase, 30.0F, 30.0F);
|
||||
double d0 = this.attacker.getDistanceSq(entitylivingbase.posX, entitylivingbase.boundingBox.minY, entitylivingbase.posZ);
|
||||
double d1 = (double) (this.attacker.width * 2.0F * this.attacker.width * 2.0F + entitylivingbase.width);
|
||||
|
||||
this.pathTimer--;
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.hbm.render.model;
|
||||
|
||||
import com.hbm.entity.mob.EntityPigeon;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -24,14 +26,12 @@ public class ModelPigeon extends ModelBase {
|
||||
|
||||
private void initModel() {
|
||||
|
||||
boolean fat = false;
|
||||
|
||||
this.head = new ModelRenderer(this, 0, 0);
|
||||
this.head.addBox(-2F, -6F, -2F, 4, 6, 4);
|
||||
this.head.setRotationPoint(0F, 16F, -2F - (fat ? 2F : 0F));
|
||||
this.head.setRotationPoint(0F, 16F, -2F);
|
||||
this.beak = new ModelRenderer(this, 14, 0);
|
||||
this.beak.addBox(-1F, -4F, -4F, 2, 2, 2);
|
||||
this.beak.setRotationPoint(0F, 16F, -2F - (fat ? 2F : 0F));
|
||||
this.beak.setRotationPoint(0F, 16F, -2F);
|
||||
|
||||
this.body = new ModelRenderer(this, 0, 10);
|
||||
this.body.addBox(-3F, -3F, -4F, 6, 6, 8, 0);
|
||||
@ -41,10 +41,10 @@ public class ModelPigeon extends ModelBase {
|
||||
this.bodyFat.setRotationPoint(0F, 17F, 0F);
|
||||
this.ass = new ModelRenderer(this, 0, 24);
|
||||
this.ass.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
this.ass.setRotationPoint(0F, 20F, 4F + (fat ? 1F : 0F));
|
||||
this.ass.setRotationPoint(0F, 20F, 4F);
|
||||
this.feathers = new ModelRenderer(this, 16, 24);
|
||||
this.feathers.addBox(-1F, -0.5F, -2F, 2, 1, 4);
|
||||
this.feathers.setRotationPoint(0F, 21.5F, 7.5F + (fat ? 1F : 0F));
|
||||
this.feathers.setRotationPoint(0F, 21.5F, 7.5F);
|
||||
|
||||
this.leftLeg = new ModelRenderer(this, 20, 0);
|
||||
this.leftLeg.addBox(-1F, 0F, 0F, 2, 4, 2);
|
||||
@ -55,10 +55,10 @@ public class ModelPigeon extends ModelBase {
|
||||
|
||||
this.leftWing = new ModelRenderer(this, 28, 0);
|
||||
this.leftWing.addBox(0F, 0F, -3F, 1, 4, 6);
|
||||
this.leftWing.setRotationPoint(3F + (fat ? 1F : 0F), -2F, 0F);
|
||||
this.leftWing.setRotationPoint(3F, -2F, 0F);
|
||||
this.rightWing = new ModelRenderer(this, 28, 10);
|
||||
this.rightWing.addBox(-1F, 0F, -3F, 1, 4, 6);
|
||||
this.rightWing.setRotationPoint(-3F - (fat ? 1F : 0F), -2F, 0F);
|
||||
this.rightWing.setRotationPoint(-3F, -2F, 0F);
|
||||
|
||||
this.body.addChild(this.leftWing);
|
||||
this.body.addChild(this.rightWing);
|
||||
@ -70,7 +70,11 @@ public class ModelPigeon extends ModelBase {
|
||||
this.setRotationAngles(f0, f1, f2, f3, f4, scale, entity);
|
||||
this.head.render(scale);
|
||||
this.beak.render(scale);
|
||||
this.body.render(scale);
|
||||
if(((EntityPigeon) entity).isFat()) {
|
||||
this.bodyFat.render(scale);
|
||||
} else {
|
||||
this.body.render(scale);
|
||||
}
|
||||
this.rightLeg.render(scale);
|
||||
this.leftLeg.render(scale);
|
||||
this.ass.render(scale);
|
||||
@ -86,5 +90,21 @@ public class ModelPigeon extends ModelBase {
|
||||
this.leftLeg.rotateAngleX = MathHelper.cos(walkLoop * 0.6662F + (float) Math.PI) * 1.4F * legAmplitude;
|
||||
this.rightWing.rotateAngleZ = armSwing;
|
||||
this.leftWing.rotateAngleZ = -armSwing;
|
||||
|
||||
if(((EntityPigeon) entity).isFat()) {
|
||||
this.head.rotationPointZ = -4F;
|
||||
this.beak.rotationPointZ = -4F;
|
||||
this.ass.rotationPointZ = 5F;
|
||||
this.feathers.rotationPointZ = 8.5F;
|
||||
this.leftWing.rotationPointX = 4F;
|
||||
this.rightWing.rotationPointX = -4F;
|
||||
} else {
|
||||
this.head.rotationPointZ = -2F;
|
||||
this.beak.rotationPointZ = -2F;
|
||||
this.ass.rotationPointZ = 4F;
|
||||
this.feathers.rotationPointZ = 7.5F;
|
||||
this.leftWing.rotationPointX = 3F;
|
||||
this.rightWing.rotationPointX = -3F;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -537,6 +537,7 @@ entity.entity_mob_nuclear_creeper.name=Nuklearer Creeper
|
||||
entity.entity_mob_phosgene_creeper.name=Phosgen-Creeper
|
||||
entity.entity_mob_tainted_creeper.name=Verseuchter Creeper
|
||||
entity.entity_mob_volatile_creeper.name=Instabiler Creeper
|
||||
entity.entity_pigeon.name=Taube
|
||||
entity.entity_plastic_bag.name=Plastiktüte
|
||||
entity.entity_taint_crab.name=Verseuchte Krabbe
|
||||
entity.entity_tesla_crab.name=Tesla-Krabbe
|
||||
|
||||
@ -1050,6 +1050,7 @@ entity.entity_mob_nuclear_creeper.name=Nuclear Creeper
|
||||
entity.entity_mob_phosgene_creeper.name=Phosgene Creeper
|
||||
entity.entity_mob_tainted_creeper.name=Tainted Creeper
|
||||
entity.entity_mob_volatile_creeper.name=Volatile Creeper
|
||||
entity.entity_pigeon.name=Pigeon
|
||||
entity.entity_plastic_bag.name=Plastic Bag
|
||||
entity.entity_taint_crab.name=Taint Crab
|
||||
entity.entity_tesla_crab.name=Tesla Crab
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 771 B |
Loading…
x
Reference in New Issue
Block a user