use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class GuiColourMixer method updateColour.
private void updateColour() {
Color colourOld = new Color(tileEntityColourMixer.getColour(0));
PaintType paintType = PaintType.values()[paintTypeDropDown.getListSelectedIndex()];
if (this.colour.equals(colourOld)) {
if (paintType == tileEntityColourMixer.getPaintType(0))
return;
}
MessageClientGuiColourUpdate message = new MessageClientGuiColourUpdate(this.colour.getRGB(), false, paintType);
PacketHandler.networkWrapper.sendToServer(message);
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class EntityTextureInfo method applySkinsToTexture.
private void applySkinsToTexture() {
for (int i = 0; i < skins.length; i++) {
Skin skin = skins[i];
if (skin != null && skin.hasPaintData()) {
for (int ix = 0; ix < textureWidth; ix++) {
for (int iy = 0; iy < textureHeight; iy++) {
int paintColour = skin.getPaintData()[ix + (iy * textureWidth)];
PaintType paintType = PaintType.getPaintTypeFromColour(paintColour);
if (paintType == PaintType.NORMAL) {
bufferedEntitySkinnedImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
}
if (paintType == PaintType.HAIR) {
int colour = dyeColour(lastEntityHairColour, paintColour, 9, skin);
bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
}
if (paintType == PaintType.SKIN) {
int colour = dyeColour(lastEntitySkinColour, paintColour, 8, skin);
bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
}
if (paintType.getKey() >= 1 && paintType.getKey() <= 8) {
int dyeNumber = paintType.getKey() - 1;
if (dyes != null && dyes[i] != null && dyes[i].haveDyeInSlot(dyeNumber)) {
byte[] dye = dyes[i].getDyeColour(dyeNumber);
int colour = dyeColour(dye, paintColour, dyeNumber, skin);
bufferedEntitySkinnedImage.setRGB(ix, iy, colour);
} else {
bufferedEntitySkinnedImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
}
}
}
}
}
}
for (int i = 0; i < skins.length; i++) {
Skin skin = skins[i];
if (skin != null && SkinProperties.PROP_ARMOUR_OVERRIDE.getValue(skin.getProperties())) {
for (int j = 0; j < skin.getPartCount(); j++) {
SkinPart skinPart = skin.getParts().get(j);
if (skinPart.getPartType() instanceof ISkinPartTypeTextured) {
ISkinPartTypeTextured typeTextured = (ISkinPartTypeTextured) skinPart.getPartType();
Point texLoc = typeTextured.getTextureLocation();
IPoint3D texSize = typeTextured.getTextureModelSize();
for (int ix = 0; ix < texSize.getZ() * 2 + texSize.getX() * 2; ix++) {
for (int iy = 0; iy < texSize.getZ() + texSize.getY(); iy++) {
if (skin.getSkinType() == SkinTypeRegistry.skinLegs) {
if (iy >= 12) {
continue;
}
if (iy < 4 & ix > 7 & ix < 12) {
continue;
}
}
if (skin.getSkinType() == SkinTypeRegistry.skinFeet) {
if (iy < 12) {
if (!(iy < 4 & ix > 7 & ix < 12)) {
continue;
}
}
}
bufferedEntitySkinnedImage.setRGB((int) texLoc.getX() + ix, (int) texLoc.getY() + iy, 0x00FFFFFF);
}
}
}
}
}
}
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class SkinTexture method applyPaintToTexture.
private void applyPaintToTexture() {
for (int ix = 0; ix < TEXTURE_WIDTH; ix++) {
for (int iy = 0; iy < TEXTURE_HEIGHT; iy++) {
int paintColour = paintData[ix + (iy * TEXTURE_WIDTH)];
PaintType paintType = PaintType.getPaintTypeFromColour(paintColour);
if (paintType != PaintType.NONE) {
bufferedSkinImage.setRGB(ix, iy, BitwiseUtils.setUByteToInt(paintColour, 0, 255));
}
}
}
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class RenderBlockColourable method renderTileEntityAt.
public void renderTileEntityAt(TileEntityColourable tileEntity, double x, double y, double z, float partialTickTime) {
ICubeColour cubeColour = tileEntity.getColour();
// ModRenderHelper.disableLighting();
GL11.glDisable(GL11.GL_LIGHTING);
ModRenderHelper.enableAlphaBlend();
renderer.startDrawingQuads();
renderer.setColourRGBA_F(0.7F, 0.7F, 0.7F, markerAlpha);
if (markerAlpha > 0F) {
for (int i = 0; i < 6; i++) {
ForgeDirection dir = ForgeDirection.getOrientation(i);
int paintType = cubeColour.getPaintType(i) & 0xFF;
if (paintType != 255) {
bindTexture(MARKERS);
GL11.glColor3f(0.77F, 0.77F, 0.77F);
PaintType pt = PaintType.getPaintTypeFromUKey(paintType);
renderFaceWithMarker(x, y, z, dir, pt.ordinal());
}
}
}
renderer.draw();
GL11.glColor4f(1F, 1F, 1F, 1F);
ModRenderHelper.disableAlphaBlend();
ModRenderHelper.enableLighting();
RenderHelper.enableStandardItemLighting();
}
use of riskyken.armourersWorkshop.common.painting.PaintType in project Armourers-Workshop by RiskyKen.
the class ItemColourNoiseTool method usedOnBlockSide.
@SuppressWarnings("deprecation")
@Override
public void usedOnBlockSide(ItemStack stack, EntityPlayer player, World world, BlockLocation bl, Block block, int side) {
int intensity = UtilItems.getIntensityFromStack(stack, 16);
IPantableBlock worldColourable = (IPantableBlock) block;
if (worldColourable.isRemoteOnly(world, bl.x, bl.y, bl.z, side) & world.isRemote) {
byte[] rgbt = new byte[4];
int oldColour = worldColourable.getColour(world, bl.x, bl.y, bl.z, side);
PaintType oldPaintType = worldColourable.getPaintType(world, bl.x, bl.y, bl.z, side);
Color c = UtilColour.addColourNoise(new Color(oldColour), intensity);
rgbt[0] = (byte) c.getRed();
rgbt[1] = (byte) c.getGreen();
rgbt[2] = (byte) c.getBlue();
rgbt[3] = (byte) oldPaintType.getKey();
if (block == ModBlocks.boundingBox && oldPaintType == PaintType.NONE) {
rgbt[3] = (byte) PaintType.NORMAL.getKey();
}
MessageClientToolPaintBlock message = new MessageClientToolPaintBlock(bl.x, bl.y, bl.z, (byte) side, rgbt);
PacketHandler.networkWrapper.sendToServer(message);
} else if (!worldColourable.isRemoteOnly(world, bl.x, bl.y, bl.z, side) & !world.isRemote) {
int oldColour = worldColourable.getColour(world, bl.x, bl.y, bl.z, side);
byte oldPaintType = (byte) worldColourable.getPaintType(world, bl.x, bl.y, bl.z, side).getKey();
int newColour = UtilColour.addColourNoise(new Color(oldColour), intensity).getRGB();
UndoManager.blockPainted(player, world, bl.x, bl.y, bl.z, oldColour, oldPaintType, side);
((IPantableBlock) block).setColour(world, bl.x, bl.y, bl.z, newColour, side);
}
}
Aggregations