Search in sources :

Example 1 with Point3D

use of riskyken.armourersWorkshop.api.common.skin.Point3D in project Armourers-Workshop by RiskyKen.

the class ModelSkinWings method renderRightWing.

private void renderRightWing(SkinPart part, float scale, ISkinDye skinDye, byte[] extraColour, double distance, double angle, boolean doLodLoading, MovementType movmentType) {
    GL11.glPushMatrix();
    Point3D point = new Point3D(0, 0, 0);
    ForgeDirection axis = ForgeDirection.DOWN;
    if (part.getMarkerCount() > 0) {
        point = part.getMarker(0);
        axis = part.getMarkerSide(0);
    }
    GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleZ), 0, 0, 1);
    GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleY), 0, 1, 0);
    // GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleX), 1, 0, 0);
    GL11.glTranslated(SCALE * 0.5F, SCALE * 0.5F, SCALE * 0.5F);
    GL11.glTranslated(SCALE * point.getX(), SCALE * point.getY(), SCALE * point.getZ());
    switch(axis) {
        case UP:
            GL11.glRotated(angle, 0, 1, 0);
            break;
        case DOWN:
            GL11.glRotated(angle, 0, -1, 0);
            break;
        case SOUTH:
            GL11.glRotated(angle, 0, 0, -1);
            break;
        case NORTH:
            GL11.glRotated(angle, 0, 0, 1);
            break;
        case EAST:
            GL11.glRotated(angle, 1, 0, 0);
            break;
        case WEST:
            GL11.glRotated(angle, -1, 0, 0);
            break;
        case UNKNOWN:
            break;
    }
    GL11.glTranslated(SCALE * -point.getX(), SCALE * -point.getY(), SCALE * -point.getZ());
    GL11.glTranslated(SCALE * -0.5F, SCALE * -0.5F, SCALE * -0.5F);
    renderPart(part, scale, skinDye, extraColour, distance, doLodLoading);
    GL11.glPopMatrix();
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D) ForgeDirection(net.minecraftforge.common.util.ForgeDirection)

Example 2 with Point3D

use of riskyken.armourersWorkshop.api.common.skin.Point3D in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method sitOnSeat.

private boolean sitOnSeat(World world, int x, int y, int z, EntityPlayer player, Skin skin) {
    List<Seat> seats = world.getEntitiesWithinAABB(Seat.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1));
    if (seats.size() == 0) {
        Point3D point = null;
        if (skin.getParts().get(0).getMarkerCount() > 0) {
            point = skin.getParts().get(0).getMarker(0);
        } else {
            point = new Point3D(0, 0, 0);
        }
        int rotation = world.getBlockMetadata(x, y, z);
        skin.getParts().get(0).getMarker(0);
        Seat seat = new Seat(world, x, y, z, point, rotation);
        world.spawnEntityInWorld(seat);
        player.mountEntity(seat);
        return true;
    }
    return false;
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D)

Example 3 with Point3D

use of riskyken.armourersWorkshop.api.common.skin.Point3D in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method sleepInBed.

private boolean sleepInBed(World world, int x, int y, int z, EntityPlayer player, Skin skin, ForgeDirection direction, TileEntitySkinnable tileEntity) {
    if (world.isRemote) {
        return true;
    }
    Point3D point = null;
    if (skin.getParts().get(0).getMarkerCount() > 0) {
        point = skin.getParts().get(0).getMarker(0);
    } else {
        point = new Point3D(0, 0, 16);
    }
    int xBlockOffset = MathHelper.floor_double(((double) point.getX() + 8) / 16D);
    int zBlockOffset = MathHelper.floor_double(((double) point.getZ() + 8) / 16D);
    int xOffset = (point.getX() + 8) - x * 16;
    int zOffset = (point.getY() + 8) - y * 16;
    x -= xBlockOffset * direction.offsetZ + zBlockOffset * direction.offsetX;
    ;
    z -= zBlockOffset * direction.offsetZ + xBlockOffset * direction.offsetX;
    float scale = 1F / 16F;
    EntityPlayer.EnumStatus enumstatus = player.sleepInBedAt(x, y, z);
    if (enumstatus == EntityPlayer.EnumStatus.OK) {
        tileEntity.setBedOccupied(true);
        ModLogger.log("sleeping!");
        player.field_71079_bU = 0.0F;
        player.field_71089_bV = 0.0F;
        player.setPosition(x + 10, y - 0.5F, z + 1);
        player.playerLocation = new ChunkCoordinates(x, y, z);
        world.updateAllPlayersSleepingFlag();
        return true;
    } else {
        if (enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) {
            player.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
        } else if (enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) {
            player.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
        }
        return true;
    }
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ChunkCoordinates(net.minecraft.util.ChunkCoordinates)

Example 4 with Point3D

use of riskyken.armourersWorkshop.api.common.skin.Point3D in project Armourers-Workshop by RiskyKen.

the class BlockSkinnable method addCollisionBoxesToList.

@Override
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB mask, List list, Entity entity) {
    if (entity instanceof Seat) {
        return;
    }
    if (entity != null && entity instanceof EntityPlayer) {
        if (((EntityPlayer) entity).isPlayerSleeping()) {
            Skin skin = getSkin(world, x, y, z);
            if (skin != null) {
                Point3D point = null;
                if (skin.getParts().get(0).getMarkerCount() > 0) {
                    point = skin.getParts().get(0).getMarker(0);
                } else {
                    point = new Point3D(0, 0, 16);
                }
                float scale = 1F / 16F;
            // list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F + -point.getY() * scale, z + 1F));
            // ModLogger.log(-point.getY() * scale);
            } else {
            // list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F, z + 1F));
            }
            list.add(AxisAlignedBB.getBoundingBox(x, y, z, x + 1F, y + 0.5F, z + 1F));
            return;
        }
    }
    super.addCollisionBoxesToList(world, x, y, z, mask, list, entity);
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Skin(riskyken.armourersWorkshop.common.skin.data.Skin)

Example 5 with Point3D

use of riskyken.armourersWorkshop.api.common.skin.Point3D in project Armourers-Workshop by RiskyKen.

the class ModelSkinWings method renderLeftWing.

private void renderLeftWing(SkinPart part, float scale, ISkinDye skinDye, byte[] extraColour, double distance, double angle, boolean doLodLoading, MovementType movmentType) {
    GL11.glPushMatrix();
    Point3D point = new Point3D(0, 0, 0);
    ForgeDirection axis = ForgeDirection.DOWN;
    if (part.getMarkerCount() > 0) {
        point = part.getMarker(0);
        axis = part.getMarkerSide(0);
    }
    GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleZ), 0, 0, 1);
    GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleY), 0, 1, 0);
    // GL11.glRotatef((float) Math.toDegrees(this.bipedBody.rotateAngleX), 1, 0, 0);
    GL11.glTranslated(SCALE * 0.5F, SCALE * 0.5F, SCALE * 0.5F);
    GL11.glTranslated(SCALE * point.getX(), SCALE * point.getY(), SCALE * point.getZ());
    switch(axis) {
        case UP:
            GL11.glRotated(angle, 0, 1, 0);
            break;
        case DOWN:
            GL11.glRotated(angle, 0, -1, 0);
            break;
        case SOUTH:
            GL11.glRotated(angle, 0, 0, -1);
            break;
        case NORTH:
            GL11.glRotated(angle, 0, 0, 1);
            break;
        case EAST:
            GL11.glRotated(angle, 1, 0, 0);
            break;
        case WEST:
            GL11.glRotated(angle, -1, 0, 0);
            break;
        case UNKNOWN:
            break;
    }
    GL11.glTranslated(SCALE * -point.getX(), SCALE * -point.getY(), SCALE * -point.getZ());
    GL11.glTranslated(SCALE * -0.5F, SCALE * -0.5F, SCALE * -0.5F);
    renderPart(part, scale, skinDye, extraColour, distance, doLodLoading);
    GL11.glPopMatrix();
}
Also used : Point3D(riskyken.armourersWorkshop.api.common.skin.Point3D) ForgeDirection(net.minecraftforge.common.util.ForgeDirection)

Aggregations

Point3D (riskyken.armourersWorkshop.api.common.skin.Point3D)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Skin (riskyken.armourersWorkshop.common.skin.data.Skin)2 Color (java.awt.Color)1 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 ChunkCoordinates (net.minecraft.util.ChunkCoordinates)1 ISkinDye (riskyken.armourersWorkshop.api.common.skin.data.ISkinDye)1 MannequinFakePlayer (riskyken.armourersWorkshop.client.render.MannequinFakePlayer)1 SkinModelRenderer (riskyken.armourersWorkshop.client.render.SkinModelRenderer)1 PlayerPointer (riskyken.armourersWorkshop.common.data.PlayerPointer)1 EquipmentWardrobeData (riskyken.armourersWorkshop.common.skin.EquipmentWardrobeData)1 SkinPart (riskyken.armourersWorkshop.common.skin.data.SkinPart)1 MovementType (riskyken.armourersWorkshop.common.skin.type.wings.SkinWings.MovementType)1