Search in sources :

Example 96 with Pos

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));
    }
}
Also used : Cube(com.builtbroken.mc.imp.transform.region.Cube) Pos(com.builtbroken.mc.imp.transform.vector.Pos) ForgeDirection(net.minecraftforge.common.util.ForgeDirection)

Example 97 with Pos

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)));
}
Also used : Pos(com.builtbroken.mc.imp.transform.vector.Pos)

Example 98 with Pos

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)));
}
Also used : Pos(com.builtbroken.mc.imp.transform.vector.Pos) ChunkSectionShort(com.builtbroken.mc.lib.world.map.data.s.ChunkSectionShort) Test(org.junit.Test)

Example 99 with Pos

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);
    }
}
Also used : IEffectData(com.builtbroken.mc.client.json.imp.IEffectData) NBTBase(net.minecraft.nbt.NBTBase) Pos(com.builtbroken.mc.imp.transform.vector.Pos) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Example 100 with Pos

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);
}
Also used : Pos(com.builtbroken.mc.imp.transform.vector.Pos)

Aggregations

Pos (com.builtbroken.mc.imp.transform.vector.Pos)105 Block (net.minecraft.block.Block)25 TileEntity (net.minecraft.tileentity.TileEntity)13 Location (com.builtbroken.mc.imp.transform.vector.Location)11 Entity (net.minecraft.entity.Entity)11 Cube (com.builtbroken.mc.imp.transform.region.Cube)8 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 Test (org.junit.Test)7 FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)6 EntityMissile (icbm.classic.content.entity.EntityMissile)6 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)6 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)6 IPos3D (com.builtbroken.jlib.data.vector.IPos3D)5 PacketTile (com.builtbroken.mc.core.network.packet.PacketTile)5 EntityFlyingBlock (icbm.classic.content.entity.EntityFlyingBlock)5 ItemStack (net.minecraft.item.ItemStack)5 EulerAngle (com.builtbroken.mc.imp.transform.rotation.EulerAngle)4 BlockTile (com.builtbroken.mc.prefab.tile.BlockTile)4 Tile (com.builtbroken.mc.prefab.tile.Tile)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4