package org.craft.entity;

import org.craft.blocks.*;
import org.craft.client.*;
import org.craft.utils.*;
import org.craft.utils.CollisionInfos.CollisionType;
import org.craft.world.*;
import org.lwjgl.input.*;

public class EntityPlayer extends Entity
{

    public EntityPlayer(World world)
    {
        super(world);
        setSize(0.75f, 1.80f, 0.75f);
    }

    public void onEntityUpdate()
    {
        float speed = 1f / 10f;
        if(!isOnGround())
            speed /= 50f;
        if(Keyboard.isKeyDown(Keyboard.KEY_Z))
        {
            this.moveForward(speed);
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_S))
        {
            this.moveBackwards(speed);
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_Q))
        {
            this.moveLeft(speed);
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_D))
        {
            this.moveRight(speed);
        }

        yaw += (float) Math.toRadians(OurCraft.getOurCraft().getMouseHandler().getDX());
        pitch += (float) Math.toRadians(-OurCraft.getOurCraft().getMouseHandler().getDY());

        CollisionInfos infos = OurCraft.getOurCraft().getObjectInFront();
        if(infos.type == CollisionType.BLOCK)
        {
            if(Mouse.isButtonDown(0))
                getWorld().setBlock((int) infos.x + infos.side.getTranslationX(), (int) (infos.y) + infos.side.getTranslationY(), (int) (infos.z + infos.side.getTranslationZ()), Blocks.glass);
            else if(Mouse.isButtonDown(1))
                getWorld().setBlock((int) Math.round(infos.x), (int) Math.round(infos.y), (int) Math.round(infos.z), Blocks.air);
        }
    }

    public float getEyeOffset()
    {
        return 1.7f;
    }

}

@@ -1234,218 +1234,253 @@
 use.
-isButtonDown(0))%0A                getWorld().setBlock((int) infos.x + infos.side.getTranslationX(), (int) (infos.y) + infos.side.getTranslationY(), (int) (infos.z + infos.side.getTranslationZ()), Blocks.glass);%0A
+next())%0A            %7B%0A                if ((Mouse.getEventButton() == 0) && (Mouse.getEventButtonState())) %0A                    getWorld().setBlock((int) Math.round(infos.x), (int) Math.round(infos.y), (int) Math.round(infos.z), Blocks.air);%0A    
     
@@ -1498,161 +1498,297 @@
 e if
+ (
 (Mouse.
-isButtonDown(1))%0A                getWorld().setBlock((int) Math.round(infos.x), (int) Math.round(infos.y), (int) Math.round(infos.z), Blocks.air);
+getEventButton() == 1) && (Mouse.getEventButtonState())) %0A                    getWorld().setBlock((int) infos.x + infos.side.getTranslationX(), (int) (infos.y) + infos.side.getTranslationY(), (int) (infos.z + infos.side.getTranslationZ()), Blocks.glass);%0A            %7D%0A           
 %0A   

Change mouse click (now place and break block by block