Skip to content

0.12

Choose a tag to compare

@kerbybit kerbybit released this 27 Mar 22:59
· 875 commits to master since this release

Tessellator

We have added the ability to render things in 3D space using a tessellator (like Renderer.shape but for 3D). These shapes can be textured, translates, rotated, and scaled. To support this, we've also added a new trigger "onRenderWorld"

var cubes = [];
register("renderWorld", "testRenderWorld");
function testRenderWorld() {
	cubes.forEach(function(cube) {cube.draw();});
}

var last = {x: Player.getX(), y: Player.getY(), z: Player.getZ()};
register("tick", "testStep");
function testStep() {
	if (Math.abs(last.x - Player.getX()) > 1
	|| Math.abs(last.y - Player.getY()) > 1
	|| Math.abs(last.z - Player.getZ()) > 1) {
		cubes.push(new Cube(Player.getX(), Player.getY(), Player.getZ(), Player.getPitch(), Player.getYaw()));
		last.x = Player.getX();
	 	last.y = Player.getY();
		last.z = Player.getZ();
	}
}


function Cube(x, y, z, pitch, yaw) {
	this.x = x;
	this.y = y;
	this.z = z;
	this.pitch = pitch;
	this.yaw = yaw;
	
	this.draw = function() {
		Tessellator.bindTexture("top.png");
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(-0.5, 0.5, -0.5).tex(0, 0)
			.pos(-0.5, 0.5, 0.5).tex(0, 1)
			.pos(0.5, 0.5, 0.5).tex(1, 1)
			.pos(0.5, 0.5, -0.5).tex(1, 0).draw();
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(-0.5, -0.5, -0.5).tex(0, 0)
			.pos(0.5, -0.5, -0.5).tex(0, 1)
			.pos(0.5, -0.5, 0.5).tex(1, 1)
			.pos(-0.5, -0.5, 0.5).tex(1, 0).draw();
		Tessellator.bindTexture("side.png");
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(-0.5, 0.5, -0.5).tex(0, 0)
			.pos(-0.5, -0.5, -0.5).tex(0, 1)
			.pos(-0.5, -0.5, 0.5).tex(1, 1)
			.pos(-0.5, 0.5, 0.5).tex(1, 0).draw();
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(-0.5, 0.5, -0.5).tex(1, 0)
			.pos(0.5, 0.5, -0.5).tex(0, 0)
			.pos(0.5, -0.5, -0.5).tex(0, 1)
			.pos(-0.5, -0.5, -0.5).tex(1, 1).draw();
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(0.5, 0.5, -0.5).tex(1, 0)
			.pos(0.5, 0.5, 0.5).tex(0, 0)
			.pos(0.5, -0.5, 0.5).tex(0, 1)
			.pos(0.5, -0.5, -0.5).tex(1, 1).draw();
		Tessellator.begin().translate(this.x, this.y, this.z)
			.rotate(this.yaw, 0, -1, 0).rotate(this.pitch, 1, 0, 0)
			.pos(-0.5, 0.5, 0.5).tex(0, 0)
			.pos(-0.5, -0.5, 0.5).tex(0, 1)
			.pos(0.5, -0.5, 0.5).tex(1, 1)
			.pos(0.5, 0.5, 0.5).tex(1, 0).draw();
	}
}

Tessellator docs

Miscellaneous

  • Improved display performance
  • Fixed /ct simulate and ChatLib.simulateChat
  • Fixed Player armor getters
  • Fixed Particles crashing on null when setting max age
  • Added more to /ct ?
  • Cleaned up /ct dump
  • Removed deprecated methods from ChatLib
  • Removed deprecated WorldLib
  • Fixed Image sometimes working and sometimes not
  • Fixed Image downloading
  • Fixed Text alpha not working properly
  • Changed Text to be automatically formatted docs
  • Fixed some docs in Gui
  • Improved the performance of the modules gui