Search in sources :

Example 1 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method setColour.

@Override
public boolean setColour(IBlockAccess world, int x, int y, int z, int colour, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return false;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
            if (parent != null) {
                ISkinType skinType = parent.getSkinType();
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int oldColour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int paintType = BitwiseUtils.getUByteFromInt(oldColour, 0);
                int newColour = BitwiseUtils.setUByteToInt(colour, 0, paintType);
                parent.updatePaintData(texturePoint.x, texturePoint.y, newColour);
                return true;
            }
        }
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) ISkinType(riskyken.armourersWorkshop.api.common.skin.type.ISkinType) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 2 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method getColour.

@Override
public int getColour(IBlockAccess world, int x, int y, int z, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return 0x00FFFFFF;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (parent != null) {
            if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
                int paintType = BitwiseUtils.getUByteFromInt(colour, 0);
                if (paintType != 0) {
                    return colour;
                } else {
                    if (te.getWorldObj().isRemote) {
                        PlayerTexture playerTexture = ClientProxy.playerTextureDownloader.getPlayerTexture(parent.getTexture());
                        BufferedImage playerSkin = SkinHelper.getBufferedImageSkin(playerTexture.getResourceLocation());
                        if (playerSkin != null) {
                            colour = playerSkin.getRGB(texturePoint.x, texturePoint.y);
                            return colour;
                        }
                    }
                }
            }
        }
    }
    return 0x00FFFFFF;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) PlayerTexture(riskyken.armourersWorkshop.client.texture.PlayerTexture) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point) BufferedImage(java.awt.image.BufferedImage)

Example 3 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class BlockBoundingBox method getPaintType.

@Override
public PaintType getPaintType(IBlockAccess world, int x, int y, int z, int side) {
    ForgeDirection sideBlock = ForgeDirection.getOrientation(side);
    if (world.getBlock(x + sideBlock.offsetX, y + sideBlock.offsetY, z + sideBlock.offsetZ) == this) {
        return PaintType.NORMAL;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if (te != null && te instanceof TileEntityBoundingBox) {
        TileEntityArmourer parent = ((TileEntityBoundingBox) te).getParent();
        if (parent != null) {
            if (((TileEntityBoundingBox) te).getSkinPart() instanceof ISkinPartTypeTextured) {
                Point texturePoint = SkinTextureHelper.getTextureLocationFromWorldBlock((TileEntityBoundingBox) te, side);
                int colour = parent.getPaintData(texturePoint.x, texturePoint.y);
                return PaintType.getPaintTypeFromColour(colour);
            }
        }
    }
    return PaintType.NORMAL;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) TileEntityBoundingBox(riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) ISkinPartTypeTextured(riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured) Point(java.awt.Point) Point(java.awt.Point)

Example 4 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class ItemColourNoiseTool method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (!player.isSneaking() & block instanceof IPantableBlock) {
        if (!world.isRemote) {
            UndoManager.begin(player);
        }
        if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
            for (int i = 0; i < 6; i++) {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
            }
        } else {
            usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
        }
        if (!world.isRemote) {
            UndoManager.end(player);
            world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.BURN, 1.0F, 1.0F);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) MessageClientToolPaintBlock(riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Example 5 with TileEntityArmourer

use of riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer in project Armourers-Workshop by RiskyKen.

the class ItemDodgeTool method onItemUse.

@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
    Block block = world.getBlock(x, y, z);
    if (block instanceof IPantableBlock) {
        if (!world.isRemote) {
            UndoManager.begin(player);
        }
        if ((Boolean) ToolOptions.FULL_BLOCK_MODE.readFromNBT(stack.getTagCompound())) {
            for (int i = 0; i < 6; i++) {
                usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, i);
            }
        } else {
            usedOnBlockSide(stack, player, world, new BlockLocation(x, y, z), block, side);
        }
        if (!world.isRemote) {
            UndoManager.end(player);
            world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, LibSounds.DODGE, 1.0F, 1.0F);
        }
        return true;
    }
    if (block == ModBlocks.armourerBrain & player.isSneaking()) {
        if (!world.isRemote) {
            TileEntity te = world.getTileEntity(x, y, z);
            if (te != null && te instanceof TileEntityArmourer) {
                ((TileEntityArmourer) te).toolUsedOnArmourer(this, world, stack, player);
            }
        }
        return true;
    }
    return false;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntityArmourer(riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer) MessageClientToolPaintBlock(riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock) Block(net.minecraft.block.Block) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock) BlockLocation(riskyken.armourersWorkshop.common.blocks.BlockLocation) IPantableBlock(riskyken.armourersWorkshop.api.common.painting.IPantableBlock)

Aggregations

TileEntityArmourer (riskyken.armourersWorkshop.common.tileentities.TileEntityArmourer)20 TileEntity (net.minecraft.tileentity.TileEntity)14 Block (net.minecraft.block.Block)8 IPantableBlock (riskyken.armourersWorkshop.api.common.painting.IPantableBlock)8 BlockLocation (riskyken.armourersWorkshop.common.blocks.BlockLocation)7 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)6 Container (net.minecraft.inventory.Container)6 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)6 ContainerArmourer (riskyken.armourersWorkshop.common.inventory.ContainerArmourer)6 Point (java.awt.Point)5 ISkinPartTypeTextured (riskyken.armourersWorkshop.api.common.skin.type.ISkinPartTypeTextured)5 MessageClientToolPaintBlock (riskyken.armourersWorkshop.common.network.messages.client.MessageClientToolPaintBlock)5 TileEntityBoundingBox (riskyken.armourersWorkshop.common.tileentities.TileEntityBoundingBox)5 IPantable (riskyken.armourersWorkshop.api.common.painting.IPantable)3 PaintType (riskyken.armourersWorkshop.common.painting.PaintType)3 ISkinType (riskyken.armourersWorkshop.api.common.skin.type.ISkinType)2 PlayerTexture (riskyken.armourersWorkshop.client.texture.PlayerTexture)2 BufferedImage (java.awt.image.BufferedImage)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 BlockMannequin (riskyken.armourersWorkshop.common.blocks.BlockMannequin)1