summaryrefslogtreecommitdiff
path: root/ihl/tunneling_shield/DriverEntity.java
blob: e7e1c90c0dd607be95cd8bf3e927602206b58d6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package ihl.tunneling_shield;

import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;

public class DriverEntity extends Entity {

	public DriverTileEntity parent;

	public DriverEntity(World arg0) 
	{
		super(arg0);
        this.ignoreFrustumCheck = true;
        this.motionX = 0.0D;
        this.motionY = 0.0D;
        this.motionZ = 0.0D;
        this.noClip=true;
	}
	
	public DriverEntity(World arg0, DriverTileEntity te, int x, int y, int z) 
	{
		super(arg0);
		this.parent=te;
        this.motionX = 0.0D;
        this.motionY = 0.0D;
        this.motionZ = 0.0D;
        this.lastTickPosX = this.prevPosX = this.posX = x;
        this.lastTickPosY = this.prevPosY = this.posY = y;
        this.lastTickPosZ = this.prevPosZ = this.posZ = z;
        this.ignoreFrustumCheck = true;
	}

	@Override
    public boolean isInRangeToRenderDist(double par1)
    {
        return true;
    }
	

    @Override
	public void onUpdate()
    {
        super.onUpdate();

        if(this.parent!=null)
        {
            this.motionX = 0.0D;
            this.motionY = 0.0D;
            this.motionZ = 0.0D;
        	this.lastTickPosX = this.prevPosX = this.posX =this.parent.xCoord+this.parent.getModelShiftAmount()*this.parent.mX();
        	this.lastTickPosY = this.prevPosY = this.posY =(this.parent.yCoord);
        	this.lastTickPosZ = this.prevPosZ = this.posZ =this.parent.zCoord+this.parent.getModelShiftAmount()*this.parent.mZ();
        }
        else
        {
        	this.setDead();
        }
    }

	@Override
	protected void entityInit() {}

	@Override
	protected void readEntityFromNBT(NBTTagCompound nbt) {}

	@Override
	protected void writeEntityToNBT(NBTTagCompound nbt) {}
}