initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
125
java/src/game/entity/item/EntityCrystal.java
Executable file
125
java/src/game/entity/item/EntityCrystal.java
Executable file
|
@ -0,0 +1,125 @@
|
|||
package game.entity.item;
|
||||
|
||||
import game.entity.DamageSource;
|
||||
import game.entity.Entity;
|
||||
import game.nbt.NBTTagCompound;
|
||||
import game.world.World;
|
||||
|
||||
public class EntityCrystal extends Entity
|
||||
{
|
||||
public int innerRotation;
|
||||
// public int health;
|
||||
|
||||
public EntityCrystal(World worldIn)
|
||||
{
|
||||
super(worldIn);
|
||||
this.preventSpawning = true;
|
||||
this.setSize(2.0F, 2.0F);
|
||||
// this.health = 5;
|
||||
this.innerRotation = this.rand.zrange(100000);
|
||||
}
|
||||
|
||||
public EntityCrystal(World worldIn, double x, double y, double z)
|
||||
{
|
||||
this(worldIn);
|
||||
this.setPosition(x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
protected void entityInit()
|
||||
{
|
||||
// this.dataWatcher.addObject(8, Integer.valueOf(this.health));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevX = this.posX;
|
||||
this.prevY = this.posY;
|
||||
this.prevZ = this.posZ;
|
||||
++this.innerRotation;
|
||||
// this.dataWatcher.updateObject(8, Integer.valueOf(this.health));
|
||||
// int i = MathHelper.floor_double(this.posX);
|
||||
// int j = MathHelper.floor_double(this.posY);
|
||||
// int k = MathHelper.floor_double(this.posZ);
|
||||
//
|
||||
// if (this.worldObj.dimension instanceof AreaEnd && this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock() != Blocks.fire)
|
||||
// {
|
||||
// this.worldObj.setBlockState(new BlockPos(i, j, k), Blocks.fire.getDefaultState());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||
*/
|
||||
protected void writeEntityToNBT(NBTTagCompound tagCompound)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||
*/
|
||||
protected void readEntityFromNBT(NBTTagCompound tagCompund)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if other Entities should be prevented from moving through this Entity.
|
||||
*/
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the entity is attacked.
|
||||
*/
|
||||
public boolean attackEntityFrom(DamageSource source, int amount)
|
||||
{
|
||||
if (this.isEntityInvulnerable(source))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.dead && !this.worldObj.client)
|
||||
{
|
||||
// this.health = 0;
|
||||
//
|
||||
// if (this.health <= 0)
|
||||
// {
|
||||
this.setDead();
|
||||
|
||||
// if (!this.worldObj.client)
|
||||
// {
|
||||
this.worldObj.createExplosion(null, this.posX, this.posY, this.posZ, 6.0F, true);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int getTrackingRange() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
public int getUpdateFrequency() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public boolean isSendingVeloUpdates() {
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue