mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-28 07:36:01 +00:00
Move the directory structure around to a more conventional one and start out on the 1.7 update.
3797 errors. We have a long way to go.
This commit is contained in:
1 parent
3a0de87a09
commit
ab47724473
1245 files changed
+1764
-5953
No files matched your search
@@ -0,0 +1,132 @@
|
||||
package mekanism.common.entity;
|
||||
|
||||
import mekanism.common.Mekanism;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityObsidianTNT extends Entity
|
||||
{
|
||||
/** How long the fuse is */
|
||||
public int fuse;
|
||||
|
||||
/** Whether or not the TNT has exploded */
|
||||
private boolean hasExploded = false;
|
||||
|
||||
public EntityObsidianTNT(World world)
|
||||
{
|
||||
super(world);
|
||||
fuse = 0;
|
||||
preventEntitySpawning = true;
|
||||
setSize(0.98F, 0.98F);
|
||||
yOffset = height / 2.0F;
|
||||
}
|
||||
|
||||
public EntityObsidianTNT(World world, double x, double y, double z)
|
||||
{
|
||||
this(world);
|
||||
|
||||
setPosition(x, y, z);
|
||||
|
||||
float randPi = (float)(Math.random()*Math.PI*2);
|
||||
|
||||
motionX = -(Math.sin(randPi))*0.02F;
|
||||
motionY = 0.2;
|
||||
motionZ = -(Math.cos(randPi))*0.02F;
|
||||
|
||||
fuse = Mekanism.obsidianTNTDelay;
|
||||
|
||||
prevPosX = x;
|
||||
prevPosY = y;
|
||||
prevPosZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entityInit() {}
|
||||
|
||||
@Override
|
||||
protected boolean canTriggerWalking()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith()
|
||||
{
|
||||
return !isDead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBePushed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate()
|
||||
{
|
||||
prevPosX = posX;
|
||||
prevPosY = posY;
|
||||
prevPosZ = posZ;
|
||||
|
||||
motionY -= 0.04;
|
||||
|
||||
moveEntity(motionX, motionY, motionZ);
|
||||
|
||||
motionX *= 0.98;
|
||||
motionY *= 0.98;
|
||||
motionZ *= 0.98;
|
||||
|
||||
if(onGround)
|
||||
{
|
||||
motionX *= 0.7;
|
||||
motionZ *= 0.7;
|
||||
motionY *= -0.5;
|
||||
}
|
||||
|
||||
if(fuse-- <= 0)
|
||||
{
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setDead();
|
||||
explode();
|
||||
}
|
||||
else {
|
||||
if(hasExploded)
|
||||
{
|
||||
setDead();
|
||||
}
|
||||
else {
|
||||
worldObj.spawnParticle("lava", posX, posY + 0.5, posZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
worldObj.spawnParticle("lava", posX, posY + 0.5, posZ, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void explode()
|
||||
{
|
||||
worldObj.createExplosion(null, posX, posY, posZ, Mekanism.obsidianTNTBlastRadius, true);
|
||||
hasExploded = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeEntityToNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
nbtTags.setByte("Fuse", (byte)fuse);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readEntityFromNBT(NBTTagCompound nbtTags)
|
||||
{
|
||||
fuse = nbtTags.getByte("Fuse");
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user