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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations