_AMDG_ icon

OOP Minecraft!

_AMDG_ | PRO | 08/05/14 04:31:00 AM UTC | 0 ⭐ | 548 👁️ | Never ⏰ | []
Java |

2 KB

|

None

|

0 👍

/

0 👎

/**
 * Hello! If you are a staff member of Mojang, I hope you see this! If not well then thats fine. I just made this!
 * I think I speak for all of us when I say, "Minecraft has bad code". I am attempting an OOP aproach to MC and give it to
 * Mojang for them to use. this is just the Block class. Im constructing the other parts atm, and this will only use Java3D.
 * No lwjgl. I am making my own 3D rasterizer to add onto this. For now, I need to clean the original files up.
 */
package minecraft.object;
 
import java.io.File;
 
import minecraft.render.Graphics3D;
 
/**
 * @author remade by Link_The_Programmer
 *
 */
public class Block {
    private final String name;
    private float scale = 1.0f;
    private float rotX, rotY, rotZ;
    private float x, y, z; // coordinates in world
    private float xos, yos, zos; // coordinates on screen to render block
    private byte data;
    private byte blockNumber;
    private File blockFile;
    private File[] blockImgs;
 
    public Block() {
      this.name = "new block";
    }
 
    public Block(String name, byte data, byte blockNum) {
        this.name = name;
        this.data = data;
        this.blockNumber = blockNum;
    }
    
    protected void draw(Graphics3D g3d) {
        g3D.draw(this.blockImgs[0]);
        g3D.draw(this.blockImgs[1]);
        g3D.draw(this.blockImgs[2]);
    }
    //no update method: uses listeners instead.
    public String getName() {
        return this.name;
    }
 
    public float getX() {
        return this.x;
    }
 
    public float getXOS() {
        return this.xos;
    }
 
    public void setX(float x) {
        this.x = x;
    }
 
    public void setXOS(float xos) {
        this.xos = xos;
    }
 
    public float getY() {
        return this.y;
    }
 
    public float getYOS() {
        return this.yos;
    }
 
    public void setY(float y) {
        this.y = y;
    }
 
    public void setYOS(float yos) {
        this.yos = yos;
    }
 
    public float getZ() {
        return this.z;
    }
 
    public float getZOS() {
        return this.zos;
    }
 
    public void setZ(float z) {
        this.z = z;
    }
 
    public void setZOS(float zos) {
        this.zos = zos;
    }
 
}

Comments