use of com.builtbroken.mc.imp.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class CuboidTest method testInsideBounds.
public void testInsideBounds() {
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
Cube above = cube.clone();
assertEquals("Failed center collision check for side " + dir, true, cube.isInsideBounds(above));
above = above.add(new Pos(dir));
assertEquals("Failed collision check one for side " + dir, false, cube.isInsideBounds(above));
above = above.add(new Pos(dir));
assertEquals("Failed collision check two for side " + dir, false, cube.isInsideBounds(above));
}
}
use of com.builtbroken.mc.imp.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class TestAbstractLocation method testToPos.
/** Tests {@link AbstractLocation#toPos() */
public void testToPos() {
TLocation location = new TLocation(world, 20, 10, 10);
Pos pos = location.toPos();
assertTrue(pos.equals(new Pos(20, 10, 10)));
}
use of com.builtbroken.mc.imp.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class TestChunkSectionShort method testGetValuePos.
@Test
public void testGetValuePos() {
ChunkSectionShort chunk = new ChunkSectionShort();
chunk.data[10] = 15;
assertEquals(15, chunk.getValue(new Pos(0, 0, 10.13)));
chunk.data[256] = 357;
assertEquals(357, chunk.getValue(new Pos(1, 0, 0)));
}
use of com.builtbroken.mc.imp.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class EffectList method trigger.
@Override
public void trigger(World world, double x, double y, double z, double mx, double my, double mz, boolean endPoint, NBTTagCompound nbt) {
for (IEffectData layer : layers) {
NBTTagCompound usedNBT;
if (nbt != null && !nbt.hasNoTags()) {
usedNBT = (NBTTagCompound) nbt.copy();
//Merges base NBT with server nbt
if (this.getNbt() != null) {
for (Object o : getNbt().func_150296_c()) {
if (o instanceof String) {
String key = (String) o;
NBTBase tag = getNbt().getTag(key);
if (tag != null) {
usedNBT.setTag(key, tag);
}
}
}
}
} else if (this.getNbt() != null) {
usedNBT = nbt;
} else {
usedNBT = new NBTTagCompound();
}
Pos renderOffset = this.renderOffset;
if (renderOffset != Pos.zero && (usedNBT.hasKey("yaw") || usedNBT.hasKey("pitch"))) {
float yaw = usedNBT.getFloat("yaw");
float pitch = usedNBT.getFloat("pitch");
angle.set(yaw, pitch, 0);
renderOffset = (Pos) angle.transform(renderOffset);
}
layer.trigger(world, x + renderOffset.x(), y + renderOffset.y(), z + renderOffset.z(), mx, my, mz, endPoint, usedNBT);
}
}
use of com.builtbroken.mc.imp.transform.vector.Pos in project Engine by VoltzEngine-Project.
the class VisualEffectProvider method displayEffect.
public void displayEffect(World world, double x, double y, double z, double mx, double my, double mz, boolean movementIsEndpoint, NBTTagCompound otherData) {
if (movementIsEndpoint) {
Pos pos = new Pos(mx, my, mz).sub(x, y, z).normalize();
if (otherData.hasKey("vel")) {
pos = pos.multiply(otherData.getFloat("vel"));
}
mx = pos.x();
my = pos.y();
mz = pos.z();
}
displayEffect(world, x, y, z, mx, my, mz, otherData);
}
Aggregations