removed herobrine??!
This commit is contained in:
parent
560bc1399a
commit
3a38411e13
242 changed files with 749 additions and 1407 deletions
|
@ -3,14 +3,14 @@ package common.ai;
|
|||
import common.entity.types.EntityLiving;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityAIOcelotAttack extends EntityAIBase
|
||||
public class EntityAICatAttack extends EntityAIBase
|
||||
{
|
||||
World theWorld;
|
||||
EntityLiving theEntity;
|
||||
EntityLiving theVictim;
|
||||
int attackCountdown;
|
||||
|
||||
public EntityAIOcelotAttack(EntityLiving theEntityIn)
|
||||
public EntityAICatAttack(EntityLiving theEntityIn)
|
||||
{
|
||||
this.theEntity = theEntityIn;
|
||||
this.theWorld = theEntityIn.worldObj;
|
|
@ -2,7 +2,7 @@ package common.ai;
|
|||
|
||||
import common.block.Block;
|
||||
import common.block.artificial.BlockBed;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.entity.animal.EntityCat;
|
||||
import common.init.Blocks;
|
||||
import common.tileentity.TileEntity;
|
||||
import common.tileentity.TileEntityChest;
|
||||
|
@ -10,14 +10,14 @@ import common.util.BlockPos;
|
|||
import common.world.State;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityAIOcelotSit extends EntityAIMoveToBlock
|
||||
public class EntityAICatSit extends EntityAIMoveToBlock
|
||||
{
|
||||
private final EntityOcelot ocelot;
|
||||
private final EntityCat cat;
|
||||
|
||||
public EntityAIOcelotSit(EntityOcelot ocelotIn, double p_i45315_2_)
|
||||
public EntityAICatSit(EntityCat cat, double p_i45315_2_)
|
||||
{
|
||||
super(ocelotIn, p_i45315_2_, 8);
|
||||
this.ocelot = ocelotIn;
|
||||
super(cat, p_i45315_2_, 8);
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@ public class EntityAIOcelotSit extends EntityAIMoveToBlock
|
|||
*/
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return this.ocelot.isTamed() && !this.ocelot.isSitting() && super.shouldExecute();
|
||||
return this.cat.isTamed() && !this.cat.isSitting() && super.shouldExecute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -42,7 +42,7 @@ public class EntityAIOcelotSit extends EntityAIMoveToBlock
|
|||
public void startExecuting()
|
||||
{
|
||||
super.startExecuting();
|
||||
this.ocelot.getAISit().setSitting(false);
|
||||
this.cat.getAISit().setSitting(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public class EntityAIOcelotSit extends EntityAIMoveToBlock
|
|||
public void resetTask()
|
||||
{
|
||||
super.resetTask();
|
||||
this.ocelot.setSitting(false);
|
||||
this.cat.setSitting(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,15 +60,15 @@ public class EntityAIOcelotSit extends EntityAIMoveToBlock
|
|||
public void updateTask()
|
||||
{
|
||||
super.updateTask();
|
||||
this.ocelot.getAISit().setSitting(false);
|
||||
this.cat.getAISit().setSitting(false);
|
||||
|
||||
if (!this.getIsAboveDestination())
|
||||
{
|
||||
this.ocelot.setSitting(false);
|
||||
this.cat.setSitting(false);
|
||||
}
|
||||
else if (!this.ocelot.isSitting())
|
||||
else if (!this.cat.isSitting())
|
||||
{
|
||||
this.ocelot.setSitting(true);
|
||||
this.cat.setSitting(true);
|
||||
}
|
||||
}
|
||||
|
26
common/src/main/java/common/ai/EntityAISwimNavigate.java
Normal file
26
common/src/main/java/common/ai/EntityAISwimNavigate.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package common.ai;
|
||||
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.pathfinding.PathNavigateGround;
|
||||
|
||||
public class EntityAISwimNavigate extends EntityAIBase
|
||||
{
|
||||
private EntityNPC theEntity;
|
||||
|
||||
public EntityAISwimNavigate(EntityNPC entitylivingIn)
|
||||
{
|
||||
this.theEntity = entitylivingIn;
|
||||
this.setMutexBits(4);
|
||||
((PathNavigateGround)entitylivingIn.getNavigator()).setCanSwim(true);
|
||||
}
|
||||
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return (this.theEntity.isInLiquid() || this.theEntity.isInMolten()) && !this.theEntity.getNavigator().noPath() && !this.theEntity.getMoveHelper().isUpdating() && this.theEntity.posY < this.theEntity.getMoveHelper().getY() - 1.15;
|
||||
}
|
||||
|
||||
public void updateTask()
|
||||
{
|
||||
this.theEntity.getJumpHelper().setJumping();
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ import common.block.Rotatable;
|
|||
import common.block.Material;
|
||||
import common.color.TextColor;
|
||||
import common.entity.Entity;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.entity.animal.EntityCat;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Items;
|
||||
|
@ -571,7 +571,7 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
|
||||
private boolean isBlocked(World worldIn, BlockPos pos)
|
||||
{
|
||||
return this.isBelowSolidBlock(worldIn, pos) || this.isOcelotSittingOnChest(worldIn, pos);
|
||||
return this.isBelowSolidBlock(worldIn, pos) || this.isCatSittingOnChest(worldIn, pos);
|
||||
}
|
||||
|
||||
private boolean isBelowSolidBlock(World worldIn, BlockPos pos)
|
||||
|
@ -579,13 +579,13 @@ public class BlockChest extends BlockContainer implements Rotatable
|
|||
return worldIn.getState(pos.up()).getBlock().isNormalCube();
|
||||
}
|
||||
|
||||
private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos)
|
||||
private boolean isCatSittingOnChest(World worldIn, BlockPos pos)
|
||||
{
|
||||
for (Entity entity : worldIn.getEntitiesWithinAABB(EntityOcelot.class, new BoundingBox((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1))))
|
||||
for (Entity entity : worldIn.getEntitiesWithinAABB(EntityCat.class, new BoundingBox((double)pos.getX(), (double)(pos.getY() + 1), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 2), (double)(pos.getZ() + 1))))
|
||||
{
|
||||
EntityOcelot entityocelot = (EntityOcelot)entity;
|
||||
EntityCat cat = (EntityCat)entity;
|
||||
|
||||
if (entityocelot.isSitting())
|
||||
if (cat.isSitting())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -149,6 +149,8 @@ public abstract class Dimension extends Nameable {
|
|||
private int skyColor = 0x000000;
|
||||
private int fogColor = 0x000000;
|
||||
private int cloudColor = 0x000000;
|
||||
private int lightColor = 0xffffffff;
|
||||
private int blockColor = 0xffffffff;
|
||||
private float starBrightness = 0.0f;
|
||||
private float deepstarBrightness = 0.0f;
|
||||
private CloudType cloudTexture = CloudType.NORMAL;
|
||||
|
@ -549,6 +551,16 @@ public abstract class Dimension extends Nameable {
|
|||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setLightColor(int value) {
|
||||
this.lightColor = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Dimension setBlockColor(int value) {
|
||||
this.blockColor = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public final Dimension setTimeQualifier(int value) {
|
||||
this.timeQualifier = value;
|
||||
|
@ -698,6 +710,14 @@ public abstract class Dimension extends Nameable {
|
|||
return this.cloudColor;
|
||||
}
|
||||
|
||||
public final int getLightColor() {
|
||||
return this.lightColor;
|
||||
}
|
||||
|
||||
public final int getBlockColor() {
|
||||
return this.blockColor;
|
||||
}
|
||||
|
||||
public final String getCloudTexture() {
|
||||
return "textures/world/" + this.cloudTexture.getTexture() + ".png";
|
||||
}
|
||||
|
@ -1005,6 +1025,8 @@ public abstract class Dimension extends Nameable {
|
|||
this.skyColor = tag.getInt("SkyColor");
|
||||
this.fogColor = tag.getInt("FogColor");
|
||||
this.cloudColor = tag.getInt("CloudColor");
|
||||
this.lightColor = tag.getInt("LightColor");
|
||||
this.blockColor = tag.getInt("BlockColor");
|
||||
this.gravity = tag.getFloat("Gravity");
|
||||
this.temperature = tag.getFloat("Temperature");
|
||||
this.orbitOffset = tag.getFloat("OrbitOffset");
|
||||
|
@ -1181,6 +1203,8 @@ public abstract class Dimension extends Nameable {
|
|||
tag.setInt("SkyColor", this.skyColor);
|
||||
tag.setInt("FogColor", this.fogColor);
|
||||
tag.setInt("CloudColor", this.cloudColor);
|
||||
tag.setInt("LightColor", this.lightColor);
|
||||
tag.setInt("BlockColor", this.blockColor);
|
||||
tag.setFloat("Gravity", this.gravity);
|
||||
tag.setFloat("Temperature", this.temperature);
|
||||
tag.setFloat("OrbitOffset", this.orbitOffset);
|
||||
|
|
|
@ -6,8 +6,8 @@ import common.ai.EntityAIAvoidEntity;
|
|||
import common.ai.EntityAIFollowOwner;
|
||||
import common.ai.EntityAILeapAtTarget;
|
||||
import common.ai.EntityAIMate;
|
||||
import common.ai.EntityAIOcelotAttack;
|
||||
import common.ai.EntityAIOcelotSit;
|
||||
import common.ai.EntityAICatAttack;
|
||||
import common.ai.EntityAICatSit;
|
||||
import common.ai.EntityAISwimming;
|
||||
import common.ai.EntityAITargetNonTamed;
|
||||
import common.ai.EntityAITempt;
|
||||
|
@ -30,7 +30,7 @@ import common.tags.TagObject;
|
|||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityOcelot extends EntityTameable
|
||||
public class EntityCat extends EntityTameable
|
||||
{
|
||||
private EntityAIAvoidEntity<EntityNPC> avoidEntity;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class EntityOcelot extends EntityTameable
|
|||
private EntityAITempt aiTempt;
|
||||
private boolean wasTempted;
|
||||
|
||||
public EntityOcelot(World worldIn)
|
||||
public EntityCat(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.setSize(0.6F, 0.7F);
|
||||
|
@ -49,9 +49,9 @@ public class EntityOcelot extends EntityTameable
|
|||
this.tasks.addTask(2, this.aiSit);
|
||||
this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, stack -> stack.getItem() instanceof ItemFishFood fish && !fish.isCooked(), true));
|
||||
this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F));
|
||||
this.tasks.addTask(6, new EntityAIOcelotSit(this, 0.8D));
|
||||
this.tasks.addTask(6, new EntityAICatSit(this, 0.8D));
|
||||
this.tasks.addTask(7, new EntityAILeapAtTarget(this, 0.3F));
|
||||
this.tasks.addTask(8, new EntityAIOcelotAttack(this));
|
||||
this.tasks.addTask(8, new EntityAICatAttack(this));
|
||||
this.tasks.addTask(9, new EntityAIMate(this, 0.8D));
|
||||
this.tasks.addTask(10, new EntityAIWander(this, 0.8D));
|
||||
this.tasks.addTask(11, new EntityAIWatchClosest(this, null, 10.0F));
|
||||
|
@ -248,18 +248,17 @@ public class EntityOcelot extends EntityTameable
|
|||
return super.interact(player);
|
||||
}
|
||||
|
||||
public EntityOcelot createChild(EntityLiving ageable)
|
||||
public EntityCat createChild(EntityLiving ageable)
|
||||
{
|
||||
EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
|
||||
EntityCat child = new EntityCat(this.worldObj);
|
||||
|
||||
if (this.isTamed())
|
||||
{
|
||||
// entityocelot.setOwnerId(this.getOwnerId());
|
||||
entityocelot.setTamed(true);
|
||||
entityocelot.setTameSkin(this.getTameSkin());
|
||||
child.setTamed(true);
|
||||
child.setTameSkin(this.getTameSkin());
|
||||
}
|
||||
|
||||
return entityocelot;
|
||||
return child;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,14 +283,14 @@ public class EntityOcelot extends EntityTameable
|
|||
// {
|
||||
// return false;
|
||||
// }
|
||||
else if (!(otherAnimal instanceof EntityOcelot))
|
||||
else if (!(otherAnimal instanceof EntityCat))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
EntityOcelot entityocelot = (EntityOcelot)otherAnimal;
|
||||
return (entityocelot.isTamed() != this.isTamed()) ? false : this.isInLove() && entityocelot.isInLove();
|
||||
EntityCat cat = (EntityCat)otherAnimal;
|
||||
return (cat.isTamed() != this.isTamed()) ? false : this.isInLove() && cat.isInLove();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -380,10 +379,10 @@ public class EntityOcelot extends EntityTameable
|
|||
{
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
|
||||
entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, 0.0F);
|
||||
entityocelot.setGrowingAge(-24000);
|
||||
this.worldObj.spawnEntityInWorld(entityocelot);
|
||||
EntityCat baby = new EntityCat(this.worldObj);
|
||||
baby.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, 0.0F);
|
||||
baby.setGrowingAge(-24000);
|
||||
this.worldObj.spawnEntityInWorld(baby);
|
||||
}
|
||||
}
|
||||
|
|
@ -49,9 +49,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
private static final String[] horseArmorTextures = new String[] {null, "textures/armor/horse_armor_iron.png", "textures/armor/horse_armor_gold.png", "textures/armor/horse_armor_diamond.png"};
|
||||
private static final String[] HORSE_ARMOR_TEXTURES_ABBR = new String[] {"", "meo", "goo", "dio"};
|
||||
private static final int[] armorValues = new int[] {0, 5, 7, 11};
|
||||
private static final String[] horseTextures = new String[] {"textures/entity/horse_white.png", "textures/entity/horse_creamy.png", "textures/entity/horse_chestnut.png", "textures/entity/horse_brown.png", "textures/entity/horse_black.png", "textures/entity/horse_gray.png", "textures/entity/horse_darkbrown.png"};
|
||||
private static final String[] horseTextures = new String[] {"textures/creature/horse_white.png", "textures/creature/horse_creamy.png", "textures/creature/horse_chestnut.png", "textures/creature/horse_brown.png", "textures/creature/horse_black.png", "textures/creature/horse_gray.png", "textures/creature/horse_darkbrown.png"};
|
||||
private static final String[] HORSE_TEXTURES_ABBR = new String[] {"hwh", "hcr", "hch", "hbr", "hbl", "hgr", "hdb"};
|
||||
private static final String[] horseMarkingTextures = new String[] {null, "textures/entity/horse_markings_white.png", "textures/entity/horse_markings_whitefield.png", "textures/entity/horse_markings_whitedots.png", "textures/entity/horse_markings_blackdots.png"};
|
||||
private static final String[] horseMarkingTextures = new String[] {null, "textures/creature/horse_markings_white.png", "textures/creature/horse_markings_whitefield.png", "textures/creature/horse_markings_whitedots.png", "textures/creature/horse_markings_blackdots.png"};
|
||||
private static final String[] HORSE_MARKING_TEXTURES_ABBR = new String[] {"", "wo_", "wmo", "wdo", "bdo"};
|
||||
private int eatingHaystackCounter;
|
||||
private int openMouthCounter;
|
||||
|
@ -116,7 +116,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the horse type. 0 = Normal, 1 = Donkey, 2 = Mule, 3 = Undead Horse, 4 = Skeleton Horse
|
||||
* Returns the horse type. 0 = Normal, 1 = Donkey, 2 = Mule
|
||||
*/
|
||||
public int getHorseType()
|
||||
{
|
||||
|
@ -250,11 +250,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
this.horseJumping = jumping;
|
||||
}
|
||||
|
||||
public boolean allowLeashing()
|
||||
{
|
||||
return !this.isUndead() && super.allowLeashing();
|
||||
}
|
||||
|
||||
protected void onUpdateLeashed(float distance)
|
||||
{
|
||||
if (distance > 6.0F && this.isEatingHaystack())
|
||||
|
@ -570,9 +565,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
|
||||
protected Item getDropItem()
|
||||
{
|
||||
boolean flag = this.rand.chance(4);
|
||||
int i = this.getHorseType();
|
||||
return i == 4 ? Items.bone : (i == 3 ? (flag ? null : Items.rotten_flesh) : Items.leather);
|
||||
return Items.leather;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -805,10 +798,6 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
{
|
||||
return super.interact(player);
|
||||
}
|
||||
else if (!this.isTame() && this.isUndead())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (this.isTame() && this.isAdultHorse() && player.isSneaking())
|
||||
{
|
||||
this.openGUI(player);
|
||||
|
@ -854,7 +843,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
}
|
||||
|
||||
if (!flag && !this.isUndead())
|
||||
if (!flag)
|
||||
{
|
||||
int hp = 0;
|
||||
int j = 0;
|
||||
|
@ -1027,20 +1016,11 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
}
|
||||
|
||||
/**
|
||||
* Used to know if the horse can be leashed, if he can mate, or if we can interact with him
|
||||
*/
|
||||
public boolean isUndead()
|
||||
{
|
||||
int i = this.getHorseType();
|
||||
return i == 3 || i == 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the horse entity is sterile (Undead || Mule)
|
||||
* Return true if the horse entity is sterile (Mule)
|
||||
*/
|
||||
public boolean isSterile()
|
||||
{
|
||||
return this.isUndead() || this.getHorseType() == 2;
|
||||
return this.getHorseType() == 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1540,56 +1520,56 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
{
|
||||
EntityHorse entityhorse = (EntityHorse)ageable;
|
||||
EntityHorse entityhorse1 = new EntityHorse(this.worldObj);
|
||||
int i = this.getHorseType();
|
||||
int j = entityhorse.getHorseType();
|
||||
int k = 0;
|
||||
int t1 = this.getHorseType();
|
||||
int t2 = entityhorse.getHorseType();
|
||||
int type = 0;
|
||||
|
||||
if (i == j)
|
||||
if (t1 == t2)
|
||||
{
|
||||
k = i;
|
||||
type = t1;
|
||||
}
|
||||
else if (i == 0 && j == 1 || i == 1 && j == 0)
|
||||
else if (t1 == 0 && t2 == 1 || t1 == 1 && t2 == 0)
|
||||
{
|
||||
k = 2;
|
||||
type = 2;
|
||||
}
|
||||
|
||||
if (k == 0)
|
||||
if (type == 0)
|
||||
{
|
||||
int i1 = this.rand.zrange(9);
|
||||
int l;
|
||||
int variant;
|
||||
|
||||
if (i1 < 4)
|
||||
{
|
||||
l = this.getHorseVariant() & 255;
|
||||
variant = this.getHorseVariant() & 255;
|
||||
}
|
||||
else if (i1 < 8)
|
||||
{
|
||||
l = entityhorse.getHorseVariant() & 255;
|
||||
variant = entityhorse.getHorseVariant() & 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = this.rand.zrange(7);
|
||||
variant = this.rand.zrange(7);
|
||||
}
|
||||
|
||||
int j1 = this.rand.zrange(5);
|
||||
|
||||
if (j1 < 2)
|
||||
{
|
||||
l = l | this.getHorseVariant() & 65280;
|
||||
variant = variant | this.getHorseVariant() & 65280;
|
||||
}
|
||||
else if (j1 < 4)
|
||||
{
|
||||
l = l | entityhorse.getHorseVariant() & 65280;
|
||||
variant = variant | entityhorse.getHorseVariant() & 65280;
|
||||
}
|
||||
else
|
||||
{
|
||||
l = l | this.rand.zrange(5) << 8 & 65280;
|
||||
variant = variant | this.rand.zrange(5) << 8 & 65280;
|
||||
}
|
||||
|
||||
entityhorse1.setHorseVariant(l);
|
||||
entityhorse1.setHorseVariant(variant);
|
||||
}
|
||||
|
||||
entityhorse1.setHorseType(k);
|
||||
entityhorse1.setHorseType(type);
|
||||
int d1 = this.getMaxHealth() + ageable.getMaxHealth() + this.getModifiedMaxHealth();
|
||||
entityhorse1.setMaxHealth(d1 / 3);
|
||||
float d2 = this.getHorseJumpStrength() + entityhorse.getHorseJumpStrength() + this.getModifiedJumpStrength();
|
||||
|
@ -1602,59 +1582,51 @@ public class EntityHorse extends EntityAnimal implements IInvBasic
|
|||
public Object onInitialSpawn(Object livingdata)
|
||||
{
|
||||
livingdata = super.onInitialSpawn(livingdata);
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
int type = 0;
|
||||
int variant = 0;
|
||||
|
||||
if (livingdata instanceof EntityHorse.GroupData)
|
||||
{
|
||||
i = ((EntityHorse.GroupData)livingdata).horseType;
|
||||
j = ((EntityHorse.GroupData)livingdata).horseVariant & 255 | this.rand.zrange(5) << 8;
|
||||
type = ((EntityHorse.GroupData)livingdata).horseType;
|
||||
variant = ((EntityHorse.GroupData)livingdata).horseVariant & 255 | this.rand.zrange(5) << 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.rand.chance(10))
|
||||
{
|
||||
i = 1;
|
||||
type = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
int k = this.rand.zrange(7);
|
||||
int l = this.rand.zrange(5);
|
||||
i = 0;
|
||||
j = k | l << 8;
|
||||
type = 0;
|
||||
variant = k | l << 8;
|
||||
}
|
||||
|
||||
livingdata = new EntityHorse.GroupData(i, j);
|
||||
livingdata = new EntityHorse.GroupData(type, variant);
|
||||
}
|
||||
|
||||
this.setHorseType(i);
|
||||
this.setHorseVariant(j);
|
||||
this.setHorseType(type);
|
||||
this.setHorseVariant(variant);
|
||||
|
||||
if (this.rand.chance(5))
|
||||
{
|
||||
this.setGrowingAge(-24000);
|
||||
}
|
||||
|
||||
if (i != 4 && i != 3)
|
||||
{
|
||||
this.setMaxHealth(this.getModifiedMaxHealth());
|
||||
this.setMaxHealth(this.getModifiedMaxHealth());
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
this.setSpeedBase(this.getModifiedMovementSpeed());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setSpeedBase(0.17499999701976776f);
|
||||
}
|
||||
if (type == 0)
|
||||
{
|
||||
this.setSpeedBase(this.getModifiedMovementSpeed());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setMaxHealth(15);
|
||||
this.setSpeedBase(0.20000000298023224f);
|
||||
this.setSpeedBase(0.17499999701976776f);
|
||||
}
|
||||
|
||||
if (i != 2 && i != 1)
|
||||
if (type != 2 && type != 1)
|
||||
{
|
||||
this.setHorseJumpStrength(this.getModifiedJumpStrength());
|
||||
}
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
package common.entity.animal;
|
||||
|
||||
import common.entity.item.EntityItem;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.types.EntityLiving;
|
||||
import common.init.Blocks;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.ItemStack;
|
||||
import common.item.tool.ItemShears;
|
||||
import common.util.ParticleType;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityMooshroom extends EntityCow
|
||||
{
|
||||
public EntityMooshroom(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.setSize(0.9F, 1.3F);
|
||||
this.spawnableBlocks.clear();
|
||||
this.spawnableBlocks.add(Blocks.mycelium);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
|
||||
*/
|
||||
public boolean interact(EntityNPC player)
|
||||
{
|
||||
ItemStack itemstack = player.inventory.getCurrentItem();
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.bowl && !this.isChild())
|
||||
{
|
||||
if (itemstack.getSize() == 1)
|
||||
{
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(Items.mushroom_stew));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player.inventory.addItemStackToInventory(new ItemStack(Items.mushroom_stew))) // && !player.creative)
|
||||
{
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemstack != null && itemstack.getItem() instanceof ItemShears && !this.isChild())
|
||||
{
|
||||
this.setDead();
|
||||
this.worldObj.spawnParticle(ParticleType.EXPLOSION_LARGE, this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 100);
|
||||
|
||||
if (!this.worldObj.client)
|
||||
{
|
||||
EntityCow entitycow = new EntityCow(this.worldObj);
|
||||
entitycow.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotYaw, this.rotPitch);
|
||||
entitycow.setHealth(this.getHealth());
|
||||
entitycow.yawOffset = this.yawOffset;
|
||||
|
||||
if (this.hasCustomName())
|
||||
{
|
||||
entitycow.setCustomNameTag(this.getCustomNameTag());
|
||||
}
|
||||
|
||||
this.worldObj.spawnEntityInWorld(entitycow);
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Items.red_mushroom)));
|
||||
}
|
||||
|
||||
itemstack.damage(1, player);
|
||||
this.playSound(SoundEvent.CUT, 1.0F);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.interact(player);
|
||||
}
|
||||
}
|
||||
|
||||
public EntityMooshroom createChild(EntityLiving ageable)
|
||||
{
|
||||
return new EntityMooshroom(this.worldObj);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0x7c4c83;
|
||||
}
|
||||
}
|
|
@ -1,292 +0,0 @@
|
|||
package common.entity.animal;
|
||||
|
||||
import common.ai.EntityAIBase;
|
||||
import common.entity.npc.Alignment;
|
||||
import common.entity.types.EntityWaterMob;
|
||||
import common.init.Items;
|
||||
import common.init.SoundEvent;
|
||||
import common.item.Item;
|
||||
import common.item.ItemStack;
|
||||
import common.util.ExtMath;
|
||||
import common.world.World;
|
||||
|
||||
public class EntitySquid extends EntityWaterMob
|
||||
{
|
||||
public float squidPitch;
|
||||
public float prevSquidPitch;
|
||||
public float squidYaw;
|
||||
public float prevSquidYaw;
|
||||
|
||||
/**
|
||||
* appears to be rotation in radians; we already have pitch & yaw, so this completes the triumvirate.
|
||||
*/
|
||||
public float squidRotation;
|
||||
|
||||
/** previous squidRotation in radians */
|
||||
public float prevSquidRotation;
|
||||
|
||||
/** angle of the tentacles in radians */
|
||||
public float tentacleAngle;
|
||||
|
||||
/** the last calculated angle of the tentacles in radians */
|
||||
public float lastTentacleAngle;
|
||||
private float randomMotionSpeed;
|
||||
|
||||
/** change in squidRotation in radians. */
|
||||
private float rotationVelocity;
|
||||
private float field_70871_bB;
|
||||
private float randomMotionVecX;
|
||||
private float randomMotionVecY;
|
||||
private float randomMotionVecZ;
|
||||
|
||||
public EntitySquid(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.setSize(0.95F, 0.95F);
|
||||
this.rand.setSeed((long)(1 + this.getId()));
|
||||
this.rotationVelocity = 1.0F / (this.rand.floatv() + 1.0F) * 0.2F;
|
||||
this.tasks.addTask(0, new EntitySquid.AIMoveRandom(this));
|
||||
}
|
||||
|
||||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.setMaxHealth(10);
|
||||
}
|
||||
|
||||
public float getEyeHeight()
|
||||
{
|
||||
return this.height * 0.5F;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Returns the sound this mob makes while it's alive.
|
||||
// */
|
||||
// protected String getLivingSound()
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes when it is hurt.
|
||||
*/
|
||||
protected SoundEvent getHurtSound()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sound this mob makes on death.
|
||||
*/
|
||||
protected SoundEvent getDeathSound()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the volume for the sounds this mob makes.
|
||||
*/
|
||||
protected float getSoundVolume()
|
||||
{
|
||||
return 0.4F;
|
||||
}
|
||||
|
||||
protected Item getDropItem()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||
* prevent them from trampling crops
|
||||
*/
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drop 0-2 items of this living's type
|
||||
*
|
||||
* @param wasRecentlyHit true if this this entity was recently hit by appropriate entity (generally only if player
|
||||
* or tameable)
|
||||
* @param lootingModifier level of enchanment to be applied to this drop
|
||||
*/
|
||||
protected void dropFewItems(boolean wasRecentlyHit, int lootingModifier)
|
||||
{
|
||||
int i = this.rand.roll(3 + lootingModifier);
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
this.entityDropItem(new ItemStack(Items.ink_sack), 0.0F);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this entity is inside water (if inWater field is true as a result of handleWaterMovement() returning
|
||||
* true)
|
||||
*/
|
||||
public boolean isInLiquid()
|
||||
{
|
||||
return this.worldObj.handleLiquidAcceleration(this.getEntityBoundingBox().expand(0.0D, -0.6000000238418579D, 0.0D), this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
|
||||
* use this to react to sunlight and start to burn.
|
||||
*/
|
||||
public void onLivingUpdate()
|
||||
{
|
||||
super.onLivingUpdate();
|
||||
this.prevSquidPitch = this.squidPitch;
|
||||
this.prevSquidYaw = this.squidYaw;
|
||||
this.prevSquidRotation = this.squidRotation;
|
||||
this.lastTentacleAngle = this.tentacleAngle;
|
||||
this.squidRotation += this.rotationVelocity;
|
||||
|
||||
if ((double)this.squidRotation > (Math.PI * 2D))
|
||||
{
|
||||
if (this.worldObj.client)
|
||||
{
|
||||
this.squidRotation = ((float)Math.PI * 2F);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.squidRotation = (float)((double)this.squidRotation - (Math.PI * 2D));
|
||||
|
||||
if (this.rand.chance(10))
|
||||
{
|
||||
this.rotationVelocity = 1.0F / (this.rand.floatv() + 1.0F) * 0.2F;
|
||||
}
|
||||
|
||||
this.worldObj.setEntityState(this, (byte)19);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.inLiquid)
|
||||
{
|
||||
if (this.squidRotation < (float)Math.PI)
|
||||
{
|
||||
float f = this.squidRotation / (float)Math.PI;
|
||||
this.tentacleAngle = ExtMath.sin(f * f * (float)Math.PI) * (float)Math.PI * 0.25F;
|
||||
|
||||
if ((double)f > 0.75D)
|
||||
{
|
||||
this.randomMotionSpeed = 1.0F;
|
||||
this.field_70871_bB = 1.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.field_70871_bB *= 0.8F;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tentacleAngle = 0.0F;
|
||||
this.randomMotionSpeed *= 0.9F;
|
||||
this.field_70871_bB *= 0.99F;
|
||||
}
|
||||
|
||||
if (!this.worldObj.client)
|
||||
{
|
||||
this.motionX = (double)(this.randomMotionVecX * this.randomMotionSpeed);
|
||||
this.motionY = (double)(this.randomMotionVecY * this.randomMotionSpeed);
|
||||
this.motionZ = (double)(this.randomMotionVecZ * this.randomMotionSpeed);
|
||||
}
|
||||
|
||||
float f1 = ExtMath.sqrtd(this.motionX * this.motionX + this.motionZ * this.motionZ);
|
||||
this.yawOffset += (-((float)ExtMath.atan2(this.motionX, this.motionZ)) * 180.0F / (float)Math.PI - this.yawOffset) * 0.1F;
|
||||
this.rotYaw = this.yawOffset;
|
||||
this.squidYaw = (float)((double)this.squidYaw + Math.PI * (double)this.field_70871_bB * 1.5D);
|
||||
this.squidPitch += (-((float)ExtMath.atan2((double)f1, this.motionY)) * 180.0F / (float)Math.PI - this.squidPitch) * 0.1F;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.tentacleAngle = ExtMath.absf(ExtMath.sin(this.squidRotation)) * (float)Math.PI * 0.25F;
|
||||
|
||||
if (!this.worldObj.client)
|
||||
{
|
||||
this.motionX = 0.0D;
|
||||
this.motionY -= 0.08D;
|
||||
this.motionY *= 0.9800000190734863D;
|
||||
this.motionZ = 0.0D;
|
||||
}
|
||||
|
||||
this.squidPitch = (float)((double)this.squidPitch + (double)(-90.0F - this.squidPitch) * 0.02D);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the entity based on the specified heading. Args: strafe, forward
|
||||
*/
|
||||
public void moveEntityWithHeading(float strafe, float forward)
|
||||
{
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
}
|
||||
|
||||
public void handleStatusUpdate(byte id)
|
||||
{
|
||||
if (id == 19)
|
||||
{
|
||||
this.squidRotation = 0.0F;
|
||||
}
|
||||
else
|
||||
{
|
||||
super.handleStatusUpdate(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRandomMotion(float randomMotionVecXIn, float randomMotionVecYIn, float randomMotionVecZIn)
|
||||
{
|
||||
this.randomMotionVecX = randomMotionVecXIn;
|
||||
this.randomMotionVecY = randomMotionVecYIn;
|
||||
this.randomMotionVecZ = randomMotionVecZIn;
|
||||
}
|
||||
|
||||
public boolean hasRandomMotion()
|
||||
{
|
||||
return this.randomMotionVecX != 0.0F || this.randomMotionVecY != 0.0F || this.randomMotionVecZ != 0.0F;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0x0000ff;
|
||||
}
|
||||
|
||||
public Alignment getAlignment() {
|
||||
return Alignment.CHAOTIC_GOOD;
|
||||
}
|
||||
|
||||
static class AIMoveRandom extends EntityAIBase
|
||||
{
|
||||
private EntitySquid squid;
|
||||
|
||||
public AIMoveRandom(EntitySquid p_i45859_1_)
|
||||
{
|
||||
this.squid = p_i45859_1_;
|
||||
}
|
||||
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void updateTask()
|
||||
{
|
||||
// int i = this.squid.getAge();
|
||||
//
|
||||
// if (i > 100)
|
||||
// {
|
||||
// this.squid.func_175568_b(0.0F, 0.0F, 0.0F);
|
||||
// }
|
||||
// else
|
||||
if (this.squid.getRNG().chance(50) || !this.squid.inLiquid || !this.squid.hasRandomMotion())
|
||||
{
|
||||
float f = this.squid.getRNG().floatv() * (float)Math.PI * 2.0F;
|
||||
float f1 = ExtMath.cos(f) * 0.2F;
|
||||
float f2 = -0.1F + this.squid.getRNG().floatv() * 0.2F;
|
||||
float f3 = ExtMath.sin(f) * 0.2F;
|
||||
this.squid.setRandomMotion(f1, f2, f3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,14 +9,12 @@ public class CharacterInfo extends NpcInfo {
|
|||
public final int color1;
|
||||
public final int color2;
|
||||
|
||||
public CharacterInfo(SpeciesInfo species, Enum type, String name, String skin, String cape, Alignment align, float height, int color1, int color2, boolean spawner) {
|
||||
super(type, name, skin, cape, align, height, (ItemStack[])null);
|
||||
public CharacterInfo(SpeciesInfo species, Enum type, String name, String skin, Alignment align, float height, int color1, int color2, boolean spawner) {
|
||||
super(type, name, skin, align, height, (ItemStack[])null);
|
||||
this.spawner = spawner;
|
||||
this.species = species;
|
||||
this.color1 = color1;
|
||||
this.color2 = color2;
|
||||
SpeciesRegistry.SKINS.put(skin, species.renderer);
|
||||
if(!cape.isEmpty())
|
||||
SpeciesRegistry.CAPES.add(cape);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,4 +72,8 @@ public class EntityBloodElf extends EntityNPC {
|
|||
protected ItemStack pickItem() {
|
||||
return new ItemStack(this.rand.chance(4) ? this.rand.pick(Items.bow, Items.stone_sword) : Items.iron_sword);
|
||||
}
|
||||
|
||||
public String getCape() {
|
||||
return "dark";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class EntityHaunter extends EntityNPC {
|
|||
public EntityHaunter(World worldIn) {
|
||||
super(worldIn);
|
||||
this.tasks.addTask(2, new EntityAIExplode(this));
|
||||
// this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
|
||||
// this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityCat.class, 6.0F, 1.0D, 1.2D));
|
||||
}
|
||||
|
||||
protected void applyEntityAttributes()
|
||||
|
|
34
common/src/main/java/common/entity/npc/EntityMerfolk.java
Executable file
34
common/src/main/java/common/entity/npc/EntityMerfolk.java
Executable file
|
@ -0,0 +1,34 @@
|
|||
package common.entity.npc;
|
||||
|
||||
import common.rng.Random;
|
||||
import common.world.World;
|
||||
|
||||
public class EntityMerfolk extends EntityWaterNPC {
|
||||
public EntityMerfolk(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return 0x0000ff;
|
||||
}
|
||||
|
||||
public float getSpeciesBaseSize() {
|
||||
return 1.95f;
|
||||
}
|
||||
|
||||
public float getHeightDeviationMin() {
|
||||
return -0.05f;
|
||||
}
|
||||
|
||||
public float getHeightDeviationMax() {
|
||||
return 0.25f;
|
||||
}
|
||||
|
||||
public int getBaseHealth(Random rand) {
|
||||
return rand.range(24, 32);
|
||||
}
|
||||
|
||||
public Alignment getNaturalAlign() {
|
||||
return Alignment.CHAOTIC;
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import common.ai.EntityAINpcInteract;
|
|||
import common.ai.EntityAINpcMate;
|
||||
import common.ai.EntityAIOpenDoor;
|
||||
import common.ai.EntityAIPlay;
|
||||
import common.ai.EntityAISwimNavigate;
|
||||
import common.ai.EntityAISwimming;
|
||||
import common.ai.EntityAIWander;
|
||||
import common.ai.EntityAIWatchClosest;
|
||||
|
@ -126,12 +127,7 @@ public abstract class EntityNPC extends EntityLiving
|
|||
|
||||
public static String getSkinTexture(String skin)
|
||||
{
|
||||
return "textures/entity/" + skin + ".png";
|
||||
}
|
||||
|
||||
public static String getCapeTexture(String cape)
|
||||
{
|
||||
return "textures/entity/cape_" + cape + ".png";
|
||||
return "textures/npc/" + skin + ".png";
|
||||
}
|
||||
|
||||
// public static String getSpeciesName(String character) {
|
||||
|
@ -260,9 +256,12 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.setSize(this.getSpeciesBaseSize() * this.species.renderer.width / this.species.renderer.height, this.getSpeciesBaseSize()); // /* 0.6F, */ 1.8F);
|
||||
if(this.getNavigator() instanceof PathNavigateGround) {
|
||||
((PathNavigateGround)this.getNavigator()).setBreakDoors(true);
|
||||
((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
|
||||
((PathNavigateGround)this.getNavigator()).setAvoidsWater(this.canSwim());
|
||||
}
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
if(this.canSwim())
|
||||
this.tasks.addTask(0, new EntityAISwimming(this));
|
||||
else
|
||||
this.tasks.addTask(0, new EntityAISwimNavigate(this));
|
||||
// this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityNPC.class, 0.6D, true, true));
|
||||
// this.tasks.addTask(1, new EntityAIAttackOnCollide(this, EntityLivingBase.class, 0.6D, true, true));
|
||||
this.tasks.addTask(1, new EntityAINpcMate(this));
|
||||
|
@ -463,6 +462,14 @@ public abstract class EntityNPC extends EntityLiving
|
|||
return 20;
|
||||
}
|
||||
|
||||
public boolean canSwim() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getVisionBrightness() {
|
||||
return 0.1f;
|
||||
}
|
||||
|
||||
// public void setScaleForAge()
|
||||
// {
|
||||
// }
|
||||
|
@ -518,6 +525,10 @@ public abstract class EntityNPC extends EntityLiving
|
|||
public boolean hasSlimArms() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getCape() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isCharged()
|
||||
{
|
||||
|
@ -784,16 +795,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
return this.dataWatcher.getWatchableObjectString(9);
|
||||
}
|
||||
|
||||
public void setCape(String cape)
|
||||
{
|
||||
this.dataWatcher.updateObject(17, cape);
|
||||
}
|
||||
|
||||
public String getCape()
|
||||
{
|
||||
return this.dataWatcher.getWatchableObjectString(17);
|
||||
}
|
||||
|
||||
public void setNpcClass(Enum type)
|
||||
{
|
||||
this.dataWatcher.updateObject(10, (byte)(type == null ? -1 : type.ordinal()));
|
||||
|
@ -2959,8 +2960,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
this.dataWatcher.addObject(13, 0); // max mana
|
||||
this.dataWatcher.addObject(14, 0); // mana
|
||||
this.dataWatcher.addObject(15, 0.7f);
|
||||
|
||||
this.dataWatcher.addObject(17, ""); // TODO: remove capes
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3317,7 +3316,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
}
|
||||
// this.setSpecies(tagCompund.getString("Species"));
|
||||
this.setChar(tagCompund.getString("Char"));
|
||||
this.setCape(tagCompund.getString("Cape"));
|
||||
this.isWilling = tagCompund.getBool("Willing");
|
||||
this.setMating(tagCompund.getBool("Mating"));
|
||||
Alignment // align;
|
||||
|
@ -3458,7 +3456,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
tagCompound.setList("Equipment", nbttaglist0);
|
||||
// tagCompound.setString("Species", this.getSpecies());
|
||||
tagCompound.setString("Char", this.getChar());
|
||||
tagCompound.setString("Cape", this.getCape());
|
||||
tagCompound.setBool("Willing", this.isWilling);
|
||||
tagCompound.setBool("Mating", this.isMating());
|
||||
tagCompound.setString("Align", this.alignment.name);
|
||||
|
@ -4295,7 +4292,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
public void setStats(NpcInfo info) {
|
||||
this.setNpcClass(info.type == null ? this.pickRandomClass() : info.type);
|
||||
this.setChar(info.skin != null ? info.skin : this.pickRandomTexture());
|
||||
this.setCape(info.cape != null ? info.cape : this.pickRandomAccessory());
|
||||
this.setCustomNameTag(info.name.isEmpty() ? this.pickRandomName() : info.name);
|
||||
this.setAlignment(info.align != null ? info.align : this.getNaturalAlign());
|
||||
this.setHeight(info.height > 0.0f ? info.height : this.getBaseSize());
|
||||
|
@ -4333,10 +4329,6 @@ public abstract class EntityNPC extends EntityLiving
|
|||
return "";
|
||||
}
|
||||
|
||||
public String pickRandomAccessory() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public Enum pickRandomClass() {
|
||||
return null;
|
||||
}
|
||||
|
|
83
common/src/main/java/common/entity/npc/EntityWaterNPC.java
Executable file
83
common/src/main/java/common/entity/npc/EntityWaterNPC.java
Executable file
|
@ -0,0 +1,83 @@
|
|||
package common.entity.npc;
|
||||
|
||||
import common.entity.DamageSource;
|
||||
import common.tags.TagObject;
|
||||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityWaterNPC extends EntityNPC {
|
||||
public EntityWaterNPC(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
protected void entityInit() {
|
||||
super.entityInit();
|
||||
this.dataWatcher.addObject(23, this.getMaxMoisture());
|
||||
}
|
||||
|
||||
public int getMaxMoisture() {
|
||||
return 500;
|
||||
}
|
||||
|
||||
public int getMoisture() {
|
||||
return this.dataWatcher.getWatchableObjectInt(23);
|
||||
}
|
||||
|
||||
public void setMoisture(int moisture) {
|
||||
this.dataWatcher.updateObject(23, moisture);
|
||||
}
|
||||
|
||||
public boolean canSpawnInLiquid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getVisionBrightness() {
|
||||
return 0.35f;
|
||||
}
|
||||
|
||||
public float getArmRotation() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
public float getLegRotation() {
|
||||
return 0.6f;
|
||||
}
|
||||
|
||||
public void onEntityUpdate() {
|
||||
super.onEntityUpdate();
|
||||
if(!this.worldObj.client && this.isEntityAlive()) {
|
||||
int moisture = this.getMoisture();
|
||||
if(!this.isInLiquid()) {
|
||||
if(moisture > 0)
|
||||
this.setMoisture(moisture - 1);
|
||||
else if(Vars.waterMobDry && this.rand.chance(30))
|
||||
this.attackEntityFrom(DamageSource.dry, 2);
|
||||
}
|
||||
else if(moisture < this.getMaxMoisture()) {
|
||||
this.setMoisture(moisture + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPushedByWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canSwim() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getCanSpawnHere() {
|
||||
return this.isPlayer() || this.posY < (double)this.worldObj.getSeaLevel();
|
||||
}
|
||||
|
||||
public void writeEntity(TagObject tag) {
|
||||
super.writeEntity(tag);
|
||||
tag.setInt("Moisture", this.getMoisture());
|
||||
}
|
||||
|
||||
public void readEntity(TagObject tag) {
|
||||
super.readEntity(tag);
|
||||
this.setMoisture(tag.getInt("Moisture"));
|
||||
}
|
||||
}
|
|
@ -6,16 +6,14 @@ public class NpcInfo {
|
|||
public final Enum type;
|
||||
public final String name;
|
||||
public final String skin;
|
||||
public final String cape;
|
||||
public final Alignment align;
|
||||
public final float height;
|
||||
public final ItemStack[] items;
|
||||
|
||||
public NpcInfo(Enum type, String name, String skin, String cape, Alignment align, float height, ItemStack ... items) {
|
||||
public NpcInfo(Enum type, String name, String skin, Alignment align, float height, ItemStack ... items) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.skin = skin;
|
||||
this.cape = cape;
|
||||
this.align = align;
|
||||
this.height = height;
|
||||
this.items = items;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class SpeciesInfo {
|
|||
scolor2 = ((Integer)names[++z]).intValue();
|
||||
}
|
||||
chars.add(new CharacterInfo(this, ctype, tok[0], tok.length > 1 && !tok[1].isEmpty() ? tok[1] : (tok[0].isEmpty() ? this.id : tok[0]).toLowerCase().replace(' ', '_'),
|
||||
tok.length > 2 ? tok[2] : "", align, height, scolor1, scolor2, names.length > 1));
|
||||
align, height, scolor1, scolor2, names.length > 1));
|
||||
}
|
||||
this.chars = chars.toArray(new CharacterInfo[chars.size()]);
|
||||
SpeciesRegistry.CLASSES.put(this.clazz, this);
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
package common.entity.types;
|
||||
|
||||
import common.entity.DamageSource;
|
||||
import common.entity.EntityType;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.vars.Vars;
|
||||
import common.world.World;
|
||||
|
||||
public abstract class EntityWaterMob extends EntityLiving
|
||||
{
|
||||
public EntityWaterMob(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
}
|
||||
|
||||
// public boolean canBreatheUnderwater()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Checks if the entity's current position is a valid location to spawn this entity.
|
||||
// */
|
||||
// public boolean getCanSpawnHere()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * Checks that the entity is not colliding with any blocks / liquids
|
||||
// */
|
||||
// public boolean isNotColliding()
|
||||
// {
|
||||
// return this.worldObj.checkNoEntityCollision(this.getEntityBoundingBox(), this) &&
|
||||
// this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox()).isEmpty(); //TODO: check
|
||||
// }
|
||||
|
||||
public boolean canSpawnInLiquid() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of ticks, at least during which the living entity will be silent.
|
||||
*/
|
||||
public int getTalkInterval()
|
||||
{
|
||||
return 120;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Determines if an entity can be despawned, used on idle far away entities
|
||||
// */
|
||||
// protected boolean canDespawn()
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the experience points the entity currently has.
|
||||
*/
|
||||
protected int getExperiencePoints(EntityNPC player)
|
||||
{
|
||||
return this.worldObj.rand.roll(3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets called every tick from main Entity class
|
||||
*/
|
||||
public void onEntityUpdate()
|
||||
{
|
||||
// int i = this.getAir();
|
||||
super.onEntityUpdate();
|
||||
|
||||
if (this.isEntityAlive() && (this.worldObj.client || Vars.waterMobDry) && !this.isInLiquid() && this.rand.chance(30))
|
||||
{
|
||||
// --i;
|
||||
// this.setAir(i);
|
||||
//
|
||||
// if (this.getAir() == -20)
|
||||
// {
|
||||
// this.setAir(0);
|
||||
this.attackEntityFrom(DamageSource.dry, 2);
|
||||
// }
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// this.setAir(300);
|
||||
// }
|
||||
}
|
||||
|
||||
public boolean isPushedByWater()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getTrackingRange() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public int getUpdateFrequency() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public boolean isSendingVeloUpdates() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean getCanSpawnHere()
|
||||
{
|
||||
return this.posY > 45.0D && this.posY < (double)this.worldObj.getSeaLevel();
|
||||
}
|
||||
|
||||
public EntityType getType() {
|
||||
return EntityType.ANIMAL;
|
||||
}
|
||||
}
|
|
@ -11,13 +11,11 @@ import common.entity.animal.EntityCow;
|
|||
import common.entity.animal.EntityDragon;
|
||||
import common.entity.animal.EntityFox;
|
||||
import common.entity.animal.EntityHorse;
|
||||
import common.entity.animal.EntityMooshroom;
|
||||
import common.entity.animal.EntityMouse;
|
||||
import common.entity.animal.EntityOcelot;
|
||||
import common.entity.animal.EntityCat;
|
||||
import common.entity.animal.EntityPig;
|
||||
import common.entity.animal.EntityRabbit;
|
||||
import common.entity.animal.EntitySheep;
|
||||
import common.entity.animal.EntitySquid;
|
||||
import common.entity.animal.EntityWolf;
|
||||
import common.entity.item.EntityBoat;
|
||||
import common.entity.item.EntityChestCart;
|
||||
|
@ -221,10 +219,8 @@ public abstract class EntityRegistry {
|
|||
registerEntity("Sheep", EntitySheep.class, "terra", "Schaf", 15198183, 16758197);
|
||||
registerEntity("Cow", EntityCow.class, "terra", "Kuh", 4470310, 10592673);
|
||||
registerEntity("Chicken", EntityChicken.class, "terra", "Huhn", 10592673, 16711680);
|
||||
registerEntity("Squid", EntitySquid.class, "tbd", "Tintenfisch", 2243405, 7375001);
|
||||
registerEntity("Wolf", EntityWolf.class, "terra", "Wolf", 14144467, 13545366);
|
||||
registerEntity("Mooshroom", EntityMooshroom.class, "tbd", "Pilzkuh", 10489616, 12040119);
|
||||
registerEntity("Ocelot", EntityOcelot.class, "terra", "Ozelot", 15720061, 5653556);
|
||||
registerEntity("Cat", EntityCat.class, "terra", "Ozelot", 15720061, 5653556);
|
||||
registerEntity("Horse", EntityHorse.class, "terra", "Pferd", 12623485, 15656192);
|
||||
registerEntity("Rabbit", EntityRabbit.class, "terra", "Kaninchen", 10051392, 7555121);
|
||||
registerEntity("Mouse", EntityMouse.class, "terra", "Maus", 0x606060, 0xb0b0b0);
|
||||
|
|
|
@ -2,11 +2,8 @@ package common.init;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import common.collect.Lists;
|
||||
import common.collect.Maps;
|
||||
import common.collect.Sets;
|
||||
import common.entity.npc.EntityArachnoid;
|
||||
import common.entity.npc.EntityBloodElf;
|
||||
import common.entity.npc.EntityChaosMarine;
|
||||
|
@ -21,6 +18,7 @@ import common.entity.npc.EntityGoblin;
|
|||
import common.entity.npc.EntityHaunter;
|
||||
import common.entity.npc.EntityHuman;
|
||||
import common.entity.npc.EntityMage;
|
||||
import common.entity.npc.EntityMerfolk;
|
||||
import common.entity.npc.EntityMetalhead;
|
||||
import common.entity.npc.EntityNPC;
|
||||
import common.entity.npc.EntityOrc;
|
||||
|
@ -59,7 +57,6 @@ public abstract class SpeciesRegistry {
|
|||
}
|
||||
|
||||
public static final Map<String, ModelType> SKINS = Maps.newTreeMap();
|
||||
public static final Set<String> CAPES = Sets.newTreeSet();
|
||||
public static final Map<Class<? extends EntityNPC>, SpeciesInfo> CLASSES = Maps.newHashMap();
|
||||
public static final List<SpeciesInfo> SPECIMEN = Lists.<SpeciesInfo>newArrayList();
|
||||
|
||||
|
@ -89,7 +86,7 @@ public abstract class SpeciesRegistry {
|
|||
}
|
||||
|
||||
static void register() {
|
||||
registerSpecies("Cpu", EntityCpu.class, null, "Test-NSC", 0x202020, 0x8000ff, "Sen", "Troll:trollface", "Hacker", "Herobrine");
|
||||
registerSpecies("Cpu", EntityCpu.class, null, "Test-NSC", 0x202020, 0x8000ff, "Test:char", "Troll:trollface", "Hacker");
|
||||
registerSpecies("Cultivator", EntityCultivator.class, "nienrath", "Kultivator", 0x000000, 0xff0000, "Wei Wuxian", 0x000000, 0xff0000,
|
||||
"Lan Wangji", 0xffffff, 0x80e0ff, "Jiang Cheng", 0x200000, 0xaf00ff, "Shen Qingqiu", 0xffffff, 0x80ff80,
|
||||
"Luo Binghe", 0x600000, 0x000000);
|
||||
|
@ -99,7 +96,7 @@ public abstract class SpeciesRegistry {
|
|||
":metalhead_11", ":metalhead_12", ":metalhead_13", ":metalhead_14");
|
||||
registerSpecies("Elf", EntityElf.class, "gharoth", "Elbe", 0x054100, 0xd2d2d2, ":highelf", "Thranduil", 0x82888b, 0xeae7bd);
|
||||
registerSpecies("WoodElf", EntityWoodElf.class, "gharoth", "Waldelbe", 0x054100, 0x00bb00);
|
||||
registerSpecies("BloodElf", EntityBloodElf.class, "kyroth", "Blutelbe", 0x054100, 0x960000, "::bloodelf");
|
||||
registerSpecies("BloodElf", EntityBloodElf.class, "kyroth", "Blutelbe", 0x054100, 0x960000);
|
||||
registerSpecies("Human", EntityHuman.class, EntityHuman.ClassType.class, "terra", "NSC", 0x4f7d9a, 0x034c7a,
|
||||
EntityHuman.ClassType.KNIGHT,
|
||||
":knight_1", ":knight_2", ":knight_3",
|
||||
|
@ -136,5 +133,6 @@ public abstract class SpeciesRegistry {
|
|||
registerSpecies("ChaosMarine", EntityChaosMarine.class, EntityChaosMarine.Legion.class, true, "warp", "Chaos Marine", ModelType.SPACE_MARINE,
|
||||
0x000000, 0xff0000, EntityChaosMarine.Legion.MARINES);
|
||||
registerSpecies("Goblin", EntityGoblin.class, "luna", "Goblin", ModelType.HALFLING, 0x50af50, 0x504050);
|
||||
registerSpecies("Merfolk", EntityMerfolk.class, "tbd", "Meeresbewohner", 0x3f3fff, 0x0000ff);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -583,7 +583,7 @@ public abstract class UniverseRegistry {
|
|||
.setStarColorSin(25.0f, 0.1f, 0.25f, 0xff00ff, 1, 4).setDeepStarColorSin(25.0f, 0.1f, 0.5f, 0xff00ff, 1, 4));
|
||||
|
||||
registerDomain("tianxin", "Tian'Xin");
|
||||
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 276.15f, 1)
|
||||
registerArea("nienrath", "Ni'enrath", new Area(0x7f00ff, 0x7f00ff, 276.15f, 1).setLightColor(0x7f00ff).setBlockColor(0xcf6fff)
|
||||
.setPerlinGen(Blocks.tian.getState(), Blocks.springwater.getState(), 63).setBiome(Biome.TIAN)
|
||||
.setBiomeReplacer(Blocks.tian.getState()).enableLongCaves().enableMobs().enableSnow()
|
||||
.addLake(Blocks.springwater.getState(), Blocks.tian.getState(), Blocks.tian.getState(), 4, 0, 255, false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue