Hex Color Update

This commit is contained in:
Kam committed 2025-02-13 03:12:46 -05:00
1 parent 3c610e7105
commit 3a00d08304
50 files changed
+456 -360

No files matched your search

@@ -0,0 +1,31 @@
package kamkeel.npcs.util;
public class ColorUtil {
public static int[] colorTableInts = {
0xFFFFFF , // White
0xF2B233 , // Light Orange
0xE680D9 , // Pinkish Purple
0x99B2F2 , // Light Blue
0xE6E633 , // Yellow
0x80CC1A , // Green
0xF2B2CC , // Light Pink
0x4D4D4D , // Dark Gray
0x999999 , // Gray
0x4D99B2 , // Teal
0xB266E6 , // Purple
0x3366CC , // Deep Blue
0x805D4D , // Brown
0x668033 , // Olive Green
0xCC4D4D , // Red
0x1A1A1A // Black
};
public static float[] hexToRGB(int hex) {
float r = ((hex >> 16) & 0xFF) / 255.0F;
float g = ((hex >> 8) & 0xFF) / 255.0F;
float b = (hex & 0xFF) / 255.0F;
return new float[]{r, g, b};
}
}
@@ -24,15 +24,17 @@ import noppes.npcs.blocks.tiles.TileBanner;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
public class BlockBanner extends BlockContainer{
public int renderId = -1;
public BlockBanner() {
super(Material.rock);
setBlockBounds(0, 0, 0, 1, 2, 1);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
ItemStack item = player.inventory.getCurrentItem();
if(item == null)
@@ -45,8 +47,8 @@ public class BlockBanner extends BlockContainer{
return true;
else if(item.getItem() != Items.dye)
return false;
int color = BlockColored.func_150031_c(item.getItemDamage());
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
if(tile.color != color){
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
@@ -54,7 +56,7 @@ public class BlockBanner extends BlockContainer{
}
return true;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -63,13 +65,13 @@ public class BlockBanner extends BlockContainer{
par3List.add(new ItemStack(par1, 1, 4));
}
@Override
@Override
public int damageDropped(int par1)
{
return par1 % 7;
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
int meta = world.getBlockMetadata(x, y, z);
if(meta >= 7)
@@ -78,22 +80,22 @@ public class BlockBanner extends BlockContainer{
setBlockBounds(0, 0, 0, 1, 2, 1);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
if(!par1World.isAirBlock(par2, par3 + 1, par4)){
par1World.setBlockToAir(par2, par3, par4);
}
else{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileBanner tile = (TileBanner) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
tile.rotation = l;
tile.color = colorTableInts[15 - par6ItemStack.getItemDamage()];
tile.time = System.currentTimeMillis();
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2);
@@ -102,25 +104,25 @@ public class BlockBanner extends BlockContainer{
}
}
@Override
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
@Override
public int getRenderType(){
return renderId;
return renderId;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
@@ -150,7 +152,7 @@ public class BlockBanner extends BlockContainer{
{
if (p_149681_5_ >= 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this)
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
else if (p_149681_5_ < 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this)
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ + 1, p_149681_4_);
}
@@ -9,17 +9,17 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileBeam;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import java.util.List;
public class BlockBeam extends BlockRotated{
public BlockBeam() {
super(Blocks.planks);
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -29,18 +29,18 @@ public class BlockBeam extends BlockRotated{
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public int damageDropped(int par1){
return par1;
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
if(tile.rotation == 0){
setBlockBounds(0.33f, 0.33f, 0.25f, 0.67f, 0.67f, 1f );
}
@@ -55,7 +55,7 @@ public class BlockBeam extends BlockRotated{
}
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
@@ -20,7 +20,7 @@ import noppes.npcs.CustomNpcs;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.blocks.tiles.TileBigSign;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.constants.EnumGuiType;
public class BlockBigSign extends BlockContainer{
@@ -70,11 +70,11 @@ public class BlockBigSign extends BlockContainer{
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
int meta = tile.getBlockMetadata();
float xStart = 0;
float zStart = 0;
@@ -11,7 +11,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.tiles.TileCandle;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import java.util.Random;
@@ -30,12 +30,12 @@ public class BlockCandle extends BlockLightable{
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
if(tile.color == 2){
TileVariant tile = (TileVariant) tileentity;
if(tile.variant == 2){
float xOffset = 0;
float yOffset = 0;
if(tile.rotation == 0)
@@ -49,7 +49,7 @@ public class BlockCandle extends BlockLightable{
setBlockBounds(0.2f + xOffset, 0.4f, 0.2f + yOffset, 0.8f + xOffset, 0.9f, 0.8f + yOffset);
}
else if(tile.color == 1)
else if(tile.variant == 1)
setBlockBounds(0.1f, 0.1f, 0.1f, 0.9f, 0.8f, 0.9f);
else
setBlockBounds(0.3f, 0, 0.3f, 0.7f, 0.5f, 0.7f);
@@ -66,11 +66,11 @@ public class BlockCandle extends BlockLightable{
public void onPostBlockPlaced(World world, int x, int y, int z, int meta) {
TileCandle tile = (TileCandle) world.getTileEntity(x, y, z);
if(meta == 1)
tile.color = 0;
tile.variant = 0;
else if(meta == 0)
tile.color = 1;
tile.variant = 1;
else{
tile.color = 2;
tile.variant = 2;
if(meta == 2)
tile.rotation = 0;
else if(meta == 3)
@@ -105,7 +105,7 @@ public class BlockCandle extends BlockLightable{
return;
TileCandle tile = (TileCandle) world.getTileEntity(x, y, z);
if(tile.color == 1){
if(tile.variant == 1){
if(tile.rotation % 2 == 0){
world.spawnParticle("smoke", x + 0.5f, y + 0.66f, z + 0.13f, 0.0D, 0.0D, 0.0D);
world.spawnParticle("flame", x + 0.5f, y + 0.65f, z + 0.13f, 0.0D, 0.0D, 0.0D);
@@ -137,7 +137,7 @@ public class BlockCandle extends BlockLightable{
else{
float xOffset = 0.5f, yOffset = 0.45f, zOffset = 0.5f;
if(tile.color == 2){
if(tile.variant == 2){
yOffset = 1.05f;
if(tile.rotation == 0)
zOffset += 0.12f;
@@ -3,7 +3,6 @@ package noppes.npcs.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -11,7 +10,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -19,38 +17,26 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileCouchWood;
import java.util.List;
public class BlockCouchWood extends BlockContainer{
public int renderId = -1;
public BlockCouchWood() {
super(Material.wood);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
ItemStack item = player.inventory.getCurrentItem();
if(item == null || item.getItem() != Items.dye)
if(item == null)
return BlockChair.MountBlock(par1World, i, j, k, player);
int meta = par1World.getBlockMetadata(i, j, k);
if(meta >= 7)
j--;
TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k);
int color = BlockColored.func_150031_c(item.getItemDamage());
if(tile.color != color){
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
par1World.markBlockForUpdate(i, j, k);
}
return true;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -60,7 +46,7 @@ public class BlockCouchWood extends BlockContainer{
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public int damageDropped(int par1)
{
return par1;
@@ -69,15 +55,13 @@ public class BlockCouchWood extends BlockContainer{
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.5, z + 1);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileCouchWood tile = (TileCouchWood) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
updateModel(par1World, par2, par3, par4, tile);
onNeighborBlockChange(par1World, par2 + 1, par3, par4, this);
@@ -88,7 +72,7 @@ public class BlockCouchWood extends BlockContainer{
par1World.markBlockForUpdate(par2, par3, par4);
}
@Override
@Override
public void onNeighborBlockChange(World worldObj, int x, int y, int z, Block block) {
if(worldObj.isRemote || block != this)
return;
@@ -98,7 +82,7 @@ public class BlockCouchWood extends BlockContainer{
updateModel(worldObj, x, y, z, (TileCouchWood) tile);
worldObj.markBlockForUpdate(x, y, z);
}
private void updateModel(World world, int x, int y, int z, TileCouchWood tile){
if(world.isRemote)
return;
@@ -131,25 +115,25 @@ public class BlockCouchWood extends BlockContainer{
return tile.rotation == couch.rotation;
}
@Override
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
@Override
public int getRenderType(){
return renderId;
return renderId;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
@@ -25,6 +25,8 @@ import noppes.npcs.blocks.tiles.TileCouchWool;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
public class BlockCouchWool extends BlockContainer{
public int renderId = -1;
@@ -40,8 +42,8 @@ public class BlockCouchWool extends BlockContainer{
int meta = par1World.getBlockMetadata(i, j, k);
if(meta >= 7)
j--;
TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k);
int color = BlockColored.func_150031_c(item.getItemDamage());
TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k);
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
if(tile.color != color){
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
@@ -75,8 +77,8 @@ public class BlockCouchWool extends BlockContainer{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileCouchWool tile = (TileCouchWool) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
tile.rotation = l;
tile.color = colorTableInts[15 - par6ItemStack.getItemDamage()];
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
updateModel(par1World, par2, par3, par4, tile);
@@ -10,7 +10,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileLamp;
public class BlockLantern extends BlockLightable{
@@ -28,12 +28,12 @@ public class BlockLantern extends BlockLightable{
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
if(tile.color == 2){
TileVariant tile = (TileVariant) tileentity;
if(tile.variant == 2){
float xOffset = 0;
float yOffset = 0;
if(tile.rotation == 0)
@@ -61,11 +61,11 @@ public class BlockLantern extends BlockLightable{
public void onPostBlockPlaced(World world, int x, int y, int z, int meta) {
TileLamp tile = (TileLamp) world.getTileEntity(x, y, z);
if(meta == 1)
tile.color = 0;
tile.variant = 0;
else if(meta == 0)
tile.color = 1;
tile.variant = 1;
else{
tile.color = 2;
tile.variant = 2;
if(meta == 2)
tile.rotation = 0;
else if(meta == 3)
@@ -14,25 +14,25 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileNpcContainer;
import noppes.npcs.blocks.tiles.TilePedestal;
import java.util.List;
public class BlockPedestal extends BlockTrigger{
public BlockPedestal() {
super(Blocks.stone);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
if(par1World.isRemote)
return true;
TilePedestal tile = (TilePedestal) par1World.getTileEntity(i, j, k);
ItemStack item = player.getCurrentEquippedItem();
ItemStack weapon = tile.getStackInSlot(0);
if(item == null && weapon != null){
@@ -51,8 +51,8 @@ public class BlockPedestal extends BlockTrigger{
}
return true;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -61,18 +61,18 @@ public class BlockPedestal extends BlockTrigger{
par3List.add(new ItemStack(par1, 1, 4));
}
@Override
@Override
public int damageDropped(int par1){
return par1;
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
if(tile.rotation % 2 == 0){
setBlockBounds(0f, 0, 0.2f, 1, 0.5f, 0.8f );
}
@@ -81,12 +81,12 @@ public class BlockPedestal extends BlockTrigger{
}
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int p_149691_1_, int meta)
@@ -108,7 +108,7 @@ public class BlockPedestal extends BlockTrigger{
public TileEntity createNewTileEntity(World var1, int var2) {
return new TilePedestal();
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int p_149749_6_){
TileNpcContainer tile = (TileNpcContainer)world.getTileEntity(x, y, z);
@@ -13,7 +13,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
public abstract class BlockRotated extends BlockContainer {
private Block block;
@@ -29,7 +29,7 @@ public abstract class BlockRotated extends BlockContainer {
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * maxRotation() / 360.0F) + 0.5D) & (maxRotation() - 1);
l %= maxRotation();
TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4);
TileVariant tile = (TileVariant) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
}
@@ -9,30 +9,30 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileShelf;
import java.util.List;
public class BlockShelf extends BlockRotated{
public BlockShelf() {
super(Blocks.planks);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
}
@Override
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){
setBlockBoundsBasedOnState(p_149668_1_, x, y, z);
return AxisAlignedBB.getBoundingBox(x + minX, y + 0.9f, z + minZ, x + maxX, y + 1, z + maxZ);
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -41,14 +41,14 @@ public class BlockShelf extends BlockRotated{
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
float xStart = 0;
float zStart = 0;
float xEnd = 1;
@@ -64,7 +64,7 @@ public class BlockShelf extends BlockRotated{
setBlockBounds(xStart, 0.44f, zStart, xEnd, 1, zEnd);
}
@Override
@Override
public int damageDropped(int par1){
return par1;
}
@@ -25,6 +25,8 @@ import noppes.npcs.blocks.tiles.TileShortLamp;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
public class BlockShortLamp extends BlockContainer {
public int renderId = -1;
@@ -42,7 +44,7 @@ public class BlockShortLamp extends BlockContainer {
return false;
int meta = world.getBlockMetadata(x, y, z);
TileColorable tile = (TileColorable) world.getTileEntity(x, y, z);
int color = BlockColored.func_150031_c(item.getItemDamage());
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
if (tile.color != color) {
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
@@ -78,7 +80,7 @@ public class BlockShortLamp extends BlockContainer {
l %= 4;
TileColorable tile = (TileColorable) world.getTileEntity(x, y, z);
tile.rotation = l;
tile.color = 15 - stack.getItemDamage();
tile.color = colorTableInts[BlockColored.func_150031_c(15 - stack.getItemDamage())];
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 2);
}
+11 -11
View File
@@ -12,7 +12,7 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileBanner;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileSign;
import java.util.List;
@@ -23,7 +23,7 @@ public class BlockSign extends BlockRotated{
super(Blocks.planks);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@@ -36,13 +36,13 @@ public class BlockSign extends BlockRotated{
((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
}
@Override
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
TileBanner tile = (TileBanner) world.getTileEntity(x, y, z);
return tile.canEdit();
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -51,22 +51,22 @@ public class BlockSign extends BlockRotated{
par3List.add(new ItemStack(par1, 1, 4));
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
if(tile.rotation % 2 == 1)
setBlockBounds(0, 0.3f, 0.3f, 1, 1, 0.7f);
else
else
setBlockBounds(0.3f, 0.3f, 0, 0.7f, 1, 1);
}
@Override
@Override
public int damageDropped(int par1){
return par1;
}
@@ -16,13 +16,13 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileStool;
import java.util.List;
public class BlockStool extends BlockContainer{
public int renderId = -1;
public BlockStool() {
@@ -30,12 +30,12 @@ public class BlockStool extends BlockContainer{
setBlockBounds(0.1f, 0, 0.1f, 0.9f, 0.6f, 0.9f);
}
@Override
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){
return AxisAlignedBB.getBoundingBox(x + 0.1f, y, z + 0.1f, x + 0.9f, y + 0.5f, z + 0.9f);
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -45,48 +45,48 @@ public class BlockStool extends BlockContainer{
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public int damageDropped(int par1)
{
return par1;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_){
return BlockChair.MountBlock(world, x, y, z, player);
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4);
TileVariant tile = (TileVariant) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
}
@Override
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
@Override
public int getRenderType(){
return renderId;
return renderId;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
@@ -25,6 +25,8 @@ import noppes.npcs.blocks.tiles.TileTallLamp;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
public class BlockTallLamp extends BlockContainer {
public int renderId = -1;
@@ -43,7 +45,7 @@ public class BlockTallLamp extends BlockContainer {
if(meta >= 7)
j--;
TileColorable tile = (TileColorable) par1World.getTileEntity(i, j, k);
int color = BlockColored.func_150031_c(item.getItemDamage());
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
if(tile.color != color){
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
@@ -88,7 +90,7 @@ public class BlockTallLamp extends BlockContainer {
TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
tile.color = colorTableInts[15 - par6ItemStack.getItemDamage()];
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2);
@@ -22,7 +22,7 @@ import noppes.npcs.CustomNpcs;
import noppes.npcs.CustomNpcsPermissions;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.blocks.tiles.TileBigSign;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileTombstone;
import noppes.npcs.constants.EnumGuiType;
@@ -79,11 +79,11 @@ public class BlockTombstone extends BlockContainer{
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
if(tile.rotation % 2 == 0)
setBlockBounds(0, 0, 0.3f, 1, 1, 0.7f);
else
@@ -3,7 +3,7 @@ package noppes.npcs.blocks;
import net.minecraft.block.Block;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
public abstract class BlockTrigger extends BlockRotated{
@@ -23,7 +23,7 @@ public abstract class BlockTrigger extends BlockRotated{
@Override
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int p_149709_5_){
TileColorable tile = (TileColorable)world.getTileEntity(x, y, z);
TileVariant tile = (TileVariant)world.getTileEntity(x, y, z);
if(tile != null)
return tile.powerProvided();
return 0;
@@ -24,14 +24,16 @@ import noppes.npcs.blocks.tiles.TileWallBanner;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
public class BlockWallBanner extends BlockContainer{
public int renderId = -1;
public BlockWallBanner() {
super(Material.rock);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
ItemStack item = player.inventory.getCurrentItem();
if(item == null)
@@ -41,8 +43,8 @@ public class BlockWallBanner extends BlockContainer{
return true;
else if(item.getItem() != Items.dye)
return false;
int color = BlockColored.func_150031_c(item.getItemDamage());
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
if(tile.color != color){
NoppesUtilServer.consumeItemStack(1, player);
tile.color = color;
@@ -51,28 +53,28 @@ public class BlockWallBanner extends BlockContainer{
return true;
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileWallBanner tile = (TileWallBanner) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
tile.color = 15 - par6ItemStack.getItemDamage();
tile.rotation = l;
tile.color = colorTableInts[15 - par6ItemStack.getItemDamage()];
tile.time = System.currentTimeMillis();
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote)
((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -82,31 +84,31 @@ public class BlockWallBanner extends BlockContainer{
}
@Override
@Override
public int damageDropped(int par1)
{
return par1;
}
@Override
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
@Override
public int getRenderType(){
return renderId;
return renderId;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister)
{
}
@Override
@SideOnly(Side.CLIENT)
@@ -13,7 +13,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileNpcContainer;
import noppes.npcs.blocks.tiles.TileWeaponRack;
@@ -24,7 +24,7 @@ public class BlockWeaponRack extends BlockTrigger{
public BlockWeaponRack() {
super(Blocks.planks);
}
@Override
@Override
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
if(par1World.isRemote)
return true;
@@ -39,7 +39,7 @@ public class BlockWeaponRack extends BlockTrigger{
hit = 1 - hitZ;
if(tile.rotation == 1)
hit = hitZ;
int selected = 2 - (int) (hit / 0.34);
ItemStack item = player.getCurrentEquippedItem();
ItemStack weapon = tile.getStackInSlot(selected);
@@ -59,7 +59,7 @@ public class BlockWeaponRack extends BlockTrigger{
}
return true;
}
@Override
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
@@ -69,13 +69,13 @@ public class BlockWeaponRack extends BlockTrigger{
par3List.add(new ItemStack(par1, 1, 5));
}
@Override
@Override
public int damageDropped(int par1){
return par1 % 7;
}
@Override
@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
if(!par1World.isAirBlock(par2, par3 + 1, par4)){
par1World.setBlockToAir(par2, par3, par4);
@@ -83,31 +83,31 @@ public class BlockWeaponRack extends BlockTrigger{
else{
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
l %= 4;
TileColorable tile = (TileColorable) par1World.getTileEntity(par2, par3, par4);
TileVariant tile = (TileVariant) par1World.getTileEntity(par2, par3, par4);
tile.rotation = l;
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2);
}
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z){
setBlockBoundsBasedOnState(world, x, y, z);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
@Override
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
int meta = world.getBlockMetadata(x, y, z);
if(meta >= 7)
y--;
TileEntity tileentity = world.getTileEntity(x, y, z);
if(!(tileentity instanceof TileColorable)){
if(!(tileentity instanceof TileVariant)){
super.setBlockBoundsBasedOnState(world, x, y, z);
return;
}
TileColorable tile = (TileColorable) tileentity;
TileVariant tile = (TileVariant) tileentity;
float xStart = 0;
float zStart = 0;
float xEnd = 1;
@@ -139,7 +139,7 @@ public class BlockWeaponRack extends BlockTrigger{
{
if (p_149681_5_ >= 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ - 1, p_149681_4_) == this)
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ - 1, p_149681_4_);
else if (p_149681_5_ < 7 && p_149681_1_.getBlock(p_149681_2_, p_149681_3_ + 1, p_149681_4_) == this)
p_149681_1_.setBlockToAir(p_149681_2_, p_149681_3_ + 1, p_149681_4_);
}
@@ -1,5 +1,5 @@
package noppes.npcs.blocks.tiles;
public class TileBeam extends TileColorable {
public class TileBeam extends TileVariant {
}
@@ -5,7 +5,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TileBook extends TileColorable {
public class TileBook extends TileVariant {
public ItemStack book = new ItemStack(Items.writable_book);
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
@@ -2,13 +2,12 @@ package noppes.npcs.blocks.tiles;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.CustomNpcs;
import java.util.Random;
public class TileCampfire extends TileColorable {
public class TileCampfire extends TileVariant {
public static final Random RAND = new Random();
private boolean rainAndSky = false;
@@ -1,5 +1,5 @@
package noppes.npcs.blocks.tiles;
public class TileChair extends TileColorable {
public class TileChair extends TileVariant {
}
@@ -7,47 +7,17 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileColorable extends TileEntity {
public int color = 14;
public int rotation;
public class TileColorable extends TileVariant {
public int color = 0xFFFFFF;
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
color = compound.getInteger("BannerColor");
rotation = compound.getInteger("BannerRotation");
color = compound.getInteger("BrushColor");
}
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("BannerColor", color);
compound.setInteger("BannerRotation", rotation);
compound.setInteger("BrushColor", color);
}
public boolean canUpdate(){
return false;
}
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
NBTTagCompound compound = pkt.func_148857_g();
readFromNBT(compound);
}
@Override
public Packet getDescriptionPacket(){
NBTTagCompound compound = new NBTTagCompound();
writeToNBT(compound);
compound.removeTag("Items");
S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound);
return packet;
}
@Override
public AxisAlignedBB getRenderBoundingBox(){
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
}
public int powerProvided(){
return 0;
}
}
@@ -3,10 +3,10 @@ package noppes.npcs.blocks.tiles;
import net.minecraft.nbt.NBTTagCompound;
public class TileCouchWood extends TileColorable {
public class TileCouchWood extends TileVariant {
public boolean hasLeft = false;
public boolean hasRight = false;
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
@@ -8,7 +8,6 @@ public class TileCouchWool extends TileColorable {
public boolean hasRight = false;
public boolean hasCornerLeft = false;
public boolean hasCornerRight = false;
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
@@ -2,6 +2,6 @@ package noppes.npcs.blocks.tiles;
public class TileLamp extends TileColorable {
public class TileLamp extends TileVariant {
}
@@ -9,11 +9,11 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.world.World;
public abstract class TileNpcContainer extends TileColorable implements IInventory {
public abstract class TileNpcContainer extends TileVariant implements IInventory {
private ItemStack[] chestContents;
public String customName = "";
public int playerUsing = 0;
public TileNpcContainer(){
chestContents = new ItemStack[getSizeInventory()];
}
@@ -66,7 +66,7 @@ public abstract class TileNpcContainer extends TileColorable implements IInvento
compound.setString("CustomName", this.customName);
}
}
public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_)
{
if (p_145842_1_ == 1)
@@ -152,7 +152,7 @@ public abstract class TileNpcContainer extends TileColorable implements IInvento
public String getInventoryName() {
return hasCustomInventoryName()?customName:getName();
}
public abstract String getName();
@Override
@@ -190,7 +190,7 @@ public abstract class TileNpcContainer extends TileColorable implements IInvento
ItemStack itemstack = this.getStackInSlot(i1);
if (itemstack == null)
continue;
float f = world.rand.nextFloat() * 0.8F + 0.1F;
float f1 = world.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
@@ -212,11 +212,11 @@ public abstract class TileNpcContainer extends TileColorable implements IInvento
if (itemstack.hasTagCompound()){
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
}
}
}
}
}
@@ -1,5 +1,5 @@
package noppes.npcs.blocks.tiles;
public class TileShelf extends TileColorable {
public class TileShelf extends TileVariant {
}
@@ -1,6 +1,32 @@
package noppes.npcs.blocks.tiles;
public class TileSign extends TileBanner {
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
public class TileSign extends TileVariant {
public ItemStack icon;
public long time = 0;
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
icon = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("BannerIcon"));
}
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
if(icon != null)
compound.setTag("BannerIcon", icon.writeToNBT(new NBTTagCompound()));
}
@Override
public AxisAlignedBB getRenderBoundingBox(){
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 2, zCoord + 1);
}
public boolean canEdit(){
return System.currentTimeMillis() - time < 20000;
}
}
@@ -1,5 +1,5 @@
package noppes.npcs.blocks.tiles;
public class TileStool extends TileColorable {
public class TileStool extends TileVariant {
}
@@ -2,7 +2,7 @@ package noppes.npcs.blocks.tiles;
public class TileTable extends TileColorable{
public class TileTable extends TileVariant {
}
@@ -0,0 +1,102 @@
package noppes.npcs.blocks.tiles;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
public class TileVariant extends TileEntity {
public static int variantVersion = 1;
int version = variantVersion;
public int variant = 14;
public int rotation;
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
version = compound.getInteger("CNPCVersion");
FixTileData(version, compound, this);
variant = compound.getInteger("CNPCVersion");
rotation = compound.getInteger("CNPCRotation");
}
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("CNPCVersion", version);
compound.setInteger("CNPCVariant", variant);
compound.setInteger("CNPCRotation", rotation);
}
public boolean canUpdate(){
return false;
}
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){
NBTTagCompound compound = pkt.func_148857_g();
readFromNBT(compound);
}
@Override
public Packet getDescriptionPacket(){
NBTTagCompound compound = new NBTTagCompound();
writeToNBT(compound);
compound.removeTag("Items");
S35PacketUpdateTileEntity packet = new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, compound);
return packet;
}
@Override
public AxisAlignedBB getRenderBoundingBox(){
return AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
}
public int powerProvided(){
return 0;
}
public static void FixTileData(int version, NBTTagCompound compound, TileEntity tileEntity){
if(version == variantVersion)
return;
boolean fixMade = false;
if(version < 1){
if(compound.hasKey("BannerColor")){
int bannerColor = compound.getInteger("BannerColor");
if(isColorTile(tileEntity)){
compound.setInteger("BrushColor", ColorUtil.colorTableInts[bannerColor]);
}
compound.setInteger("CNPCVariant", bannerColor);
compound.removeTag("BannerColor");
fixMade = true;
}
if(compound.hasKey("BannerRotation")){
compound.setInteger("CNPCRotation", compound.getInteger("BannerRotation"));
compound.removeTag("BannerRotation");
fixMade = true;
}
}
if(fixMade)
tileEntity.markDirty();
}
public static boolean isColorTile(TileEntity tileEntity){
if(tileEntity instanceof TileShortLamp)
return true;
if(tileEntity instanceof TileBanner)
return true;
if(tileEntity instanceof TileWallBanner)
return true;
if(tileEntity instanceof TileCouchWool)
return true;
return false;
}
}
@@ -1,6 +1,7 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -70,7 +71,7 @@ public class BlockBannerRenderer extends BlockRendererInterface{
legacyBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(legacyFlagResource);
float[] color = colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glColor3f(color[0], color[1], color[2]);
legacyFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -92,7 +93,7 @@ public class BlockBannerRenderer extends BlockRendererInterface{
banner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
setFlagType(tile.bannerTrim);
float[] color = colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glPushMatrix();
GL11.glColor3f(color[0], color[1], color[2]);
flag.render(null, 0, 0, 0, f3, 0.0F, 0.0625F);
@@ -195,7 +196,7 @@ public class BlockBannerRenderer extends BlockRendererInterface{
legacyBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(legacyFlagResource);
float[] color = colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
legacyFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
@@ -204,7 +205,7 @@ public class BlockBannerRenderer extends BlockRendererInterface{
banner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(normalFlag);
float[] color = colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockBarrel;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.barrel.ModelBarrel;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBarrel;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyBarrelLid;
@@ -44,7 +44,7 @@ public class BlockBarrelRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glPushMatrix();
@@ -7,7 +7,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockRotated;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileShelf;
import noppes.npcs.client.model.blocks.ModelBeam;
import org.lwjgl.opengl.GL11;
@@ -16,7 +16,7 @@ import org.lwjgl.opengl.GL12;
public class BlockBeamRenderer extends BlockRendererInterface{
private final ModelBeam model = new ModelBeam();
public BlockBeamRenderer(){
((BlockRotated)CustomItems.beam).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -24,7 +24,7 @@ public class BlockBeamRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
@@ -32,7 +32,7 @@ public class BlockBeamRenderer extends BlockRendererInterface{
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
GL11.glColor3f(1, 1, 1);
setWoodTexture(var1.getBlockMetadata());
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -57,7 +57,7 @@ public class BlockBeamRenderer extends BlockRendererInterface{
setWoodTexture(metadata);
GL11.glColor3f(1, 1, 1);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
@@ -10,7 +10,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockRotated;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.ModelInk;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -22,7 +22,7 @@ public class BlockBookRenderer extends BlockRendererInterface{
private final ResourceLocation resource = new ResourceLocation("textures/entity/enchanting_table_book.png");
private final ResourceLocation resource2 = new ResourceLocation("customnpcs:textures/models/Ink.png");
private final ModelBook book = new ModelBook();
public BlockBookRenderer(){
((BlockRotated)CustomItems.book).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -30,7 +30,7 @@ public class BlockBookRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
@@ -73,7 +73,7 @@ public class BlockBookRenderer extends BlockRendererInterface{
GL11.glRotatef(-90, 0, 0, 1);
GL11.glTranslatef(-1.45f, -0.18f, 0);
book.render(null, 0, 0, 1, 1.24f, 1.0F, 0.0625F);
GL11.glPopMatrix();
}
@@ -6,10 +6,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.IBlockAccess;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockRotated;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.ModelCampfire;
import noppes.npcs.client.model.blocks.campfire.ModelCampfireCoals;
import noppes.npcs.client.model.blocks.campfire.ModelCampfireFlame;
@@ -41,7 +40,7 @@ public class BlockCampfireRenderer extends BlockRendererInterface {
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
@@ -19,7 +19,6 @@ import noppes.npcs.client.model.blocks.legacy.ModelLegacyCandle;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyCandleCeiling;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyCandleWall;
import noppes.npcs.config.ConfigClient;
import noppes.npcs.config.legacy.LegacyConfig;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -57,9 +56,9 @@ public class BlockCandleRenderer extends TileEntitySpecialRenderer implements IS
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
GL11.glColor3f(1, 1, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(legacy);
if(tile.color == 0)
if(tile.variant == 0)
legacyCandle.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
else if(tile.color == 1)
else if(tile.variant == 1)
legacyCandleCeiling.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
else{
GL11.glRotatef(180, 0, 1, 0);
@@ -67,12 +66,12 @@ public class BlockCandleRenderer extends TileEntitySpecialRenderer implements IS
}
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
if(tile.color == 0){
if(tile.variant == 0){
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
GL11.glColor3f(1, 1, 1);
candle.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
else if(tile.color == 1){
else if(tile.variant == 1){
GL11.glPushMatrix();
GL11.glColor3f(1, 1, 1);
GL11.glRotatef( 90, 0, 1, 0);
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockChair;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.chair.ModelChair;
import noppes.npcs.client.model.blocks.chair.ModelChairSpoof;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyChair;
@@ -38,7 +38,7 @@ public class BlockChairRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
@@ -1,6 +1,7 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
@@ -82,7 +83,7 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
modelLegacyCouchMiddle.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(BlockTallLampRenderer.resourceTop);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glColor3f(color[0], color[1], color[2]);
if(tile.hasCornerLeft || tile.hasCornerRight)
@@ -116,7 +117,7 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
}
Minecraft.getMinecraft().getTextureManager().bindTexture(wool);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glColor3f(color[0], color[1], color[2]);
if(tile.hasCornerLeft)
@@ -152,7 +153,7 @@ public class BlockCouchWoolRenderer extends BlockRendererInterface{
modelLegacyCouchMiddle.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(BlockTallLampRenderer.resourceTop);
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
modelLegacyCouchMiddleWool.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glPopMatrix();
@@ -6,7 +6,7 @@ import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.tileentity.TileEntity;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockCrate;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.ModelCrate;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -14,7 +14,7 @@ import org.lwjgl.opengl.GL12;
public class BlockCrateRenderer extends BlockRendererInterface{
private final ModelCrate model = new ModelCrate();
public BlockCrateRenderer(){
((BlockCrate)CustomItems.crate).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -22,7 +22,7 @@ public class BlockCrateRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
@@ -30,7 +30,7 @@ public class BlockCrateRenderer extends BlockRendererInterface{
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
GL11.glColor3f(1, 1, 1);
setWoodTexture(var1.getBlockMetadata());
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -49,7 +49,7 @@ public class BlockCrateRenderer extends BlockRendererInterface{
setWoodTexture(metadata);
GL11.glColor3f(1, 1, 1);
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
@@ -55,19 +55,19 @@ public class BlockLanternRenderer extends TileEntitySpecialRenderer implements I
if(ConfigClient.LegacyLantern){
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
Minecraft.getMinecraft().getTextureManager().bindTexture(legacyTexture);
if(tile.color == 0)
if(tile.variant == 0)
modelLegacyLantern.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
else if(tile.color == 1)
else if(tile.variant == 1)
modelLegacyCeiling.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
else
modelLegacyWall.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
if(tile.color == 0){
if(tile.variant == 0){
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
modelLantern.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
else if(tile.color == 1){
else if(tile.variant == 1){
GL11.glRotatef(90, 0, 1, 0);
modelLanternCeiling.Chain.render(0.0625F);
GL11.glRotatef(45 * tile.rotation, 0, 1, 0);
@@ -32,68 +32,41 @@ public abstract class BlockRendererInterface extends TileEntitySpecialRenderer i
protected static final RenderItem renderer = new RenderItem();
public static float colorTable[][] = {
{
1.0F, 1.0F, 1.0F
}, {
0.95F, 0.7F, 0.2F
}, {
0.9F, 0.5F, 0.85F
}, {
0.6F, 0.7F, 0.95F
}, {
0.9F, 0.9F, 0.2F
}, {
0.5F, 0.8F, 0.1F
}, {
0.95F, 0.7F, 0.8F
}, {
0.3F, 0.3F, 0.3F
}, {
0.6F, 0.6F, 0.6F
}, {
0.3F, 0.6F, 0.7F
}, {
0.7F, 0.4F, 0.9F
}, {
0.2F, 0.4F, 0.8F
}, {
0.5F, 0.4F, 0.3F
}, {
0.4F, 0.5F, 0.2F
}, {
0.8F, 0.3F, 0.3F
}, {
0.1F, 0.1F, 0.1F
}
};
public static int colorTableInts[][] = {
{ 0xFFFFFF }, // White
{ 0xF2B233 }, // Light Orange
{ 0xE680D9 }, // Pinkish Purple
{ 0x99B2F2 }, // Light Blue
{ 0xE6E633 }, // Yellow
{ 0x80CC1A }, // Green
{ 0xF2B2CC }, // Light Pink
{ 0x4D4D4D }, // Dark Gray
{ 0x999999 }, // Gray
{ 0x4D99B2 }, // Teal
{ 0xB266E6 }, // Purple
{ 0x3366CC }, // Deep Blue
{ 0x805D4D }, // Brown
{ 0x668033 }, // Olive Green
{ 0xCC4D4D }, // Red
{ 0x1A1A1A } // Black
};
public static float[] hexToRGB(int hex) {
float r = ((hex >> 16) & 0xFF) / 255.0F;
float g = ((hex >> 8) & 0xFF) / 255.0F;
float b = (hex & 0xFF) / 255.0F;
return new float[]{r, g, b};
}
// public static float colorTable[][] = {
// {
// 1.0F, 1.0F, 1.0F
// }, {
// 0.95F, 0.7F, 0.2F
// }, {
// 0.9F, 0.5F, 0.85F
// }, {
// 0.6F, 0.7F, 0.95F
// }, {
// 0.9F, 0.9F, 0.2F
// }, {
// 0.5F, 0.8F, 0.1F
// }, {
// 0.95F, 0.7F, 0.8F
// }, {
// 0.3F, 0.3F, 0.3F
// }, {
// 0.6F, 0.6F, 0.6F
// }, {
// 0.3F, 0.6F, 0.7F
// }, {
// 0.7F, 0.4F, 0.9F
// }, {
// 0.2F, 0.4F, 0.8F
// }, {
// 0.5F, 0.4F, 0.3F
// }, {
// 0.4F, 0.5F, 0.2F
// }, {
// 0.8F, 0.3F, 0.3F
// }, {
// 0.1F, 0.1F, 0.1F
// }
// };
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
@@ -7,7 +7,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockRotated;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.blocks.tiles.TileShelf;
import noppes.npcs.client.model.blocks.ModelShelf;
import org.lwjgl.opengl.GL11;
@@ -16,7 +16,7 @@ import org.lwjgl.opengl.GL12;
public class BlockShelfRenderer extends BlockRendererInterface{
private final ModelShelf model = new ModelShelf();
public BlockShelfRenderer(){
((BlockRotated)CustomItems.shelf).renderId = RenderingRegistry.getNextAvailableRenderId();
RenderingRegistry.registerBlockHandler(this);
@@ -24,7 +24,7 @@ public class BlockShelfRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
@@ -32,7 +32,7 @@ public class BlockShelfRenderer extends BlockRendererInterface{
GL11.glRotatef(180, 0, 0, 1);
GL11.glRotatef(90 * tile.rotation, 0, 1, 0);
GL11.glColor3f(1, 1, 1);
boolean drawLeft = true;
boolean drawRight = true;
@@ -52,11 +52,11 @@ public class BlockShelfRenderer extends BlockRendererInterface{
drawLeft = shouldDraw(var1.getWorldObj(), var1.xCoord - 1, var1.yCoord, var1.zCoord, 2);
drawRight = shouldDraw(var1.getWorldObj(), var1.xCoord + 1, var1.yCoord, var1.zCoord, 2);
}
model.SupportLeft1.showModel = model.SupportLeft2.showModel = drawLeft;
model.SupportRight1.showModel = model.SupportRight2.showModel = drawRight;
setWoodTexture(var1.getBlockMetadata());
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -83,7 +83,7 @@ public class BlockShelfRenderer extends BlockRendererInterface{
model.SupportLeft1.showModel = model.SupportLeft2.showModel = true;
model.SupportRight1.showModel = model.SupportRight2.showModel = true;
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
GL11.glPopMatrix();
}
@@ -1,6 +1,7 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -55,8 +56,7 @@ public class BlockShortLampRenderer extends BlockRendererInterface {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)fullBrightX, (float)fullBrightY);
model.Light.render(0.0625F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)brightX, (float)brightY);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glColor3f(color[0], color[1], color[2]);
model.Shade.render(0.0625F);
@@ -76,7 +76,7 @@ public class BlockShortLampRenderer extends BlockRendererInterface {
setLampTexture(metadata);
model.Lamp.render(0.0625F);
model.Light.render(0.0625F);
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
model.Shade.render(0.0625F);
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockStool;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.ModelStool;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyStool;
import noppes.npcs.config.ConfigClient;
@@ -35,7 +35,7 @@ public class BlockStoolRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.65f, (float)var6 + 0.5f);
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.CustomItems;
import noppes.npcs.blocks.BlockTable;
import noppes.npcs.blocks.tiles.TileColorable;
import noppes.npcs.blocks.tiles.TileVariant;
import noppes.npcs.client.model.blocks.ModelTable;
import noppes.npcs.client.model.blocks.legacy.ModelLegacyTable;
import noppes.npcs.config.ConfigClient;
@@ -34,7 +34,7 @@ public class BlockTableRenderer extends BlockRendererInterface{
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4,
double var6, float var8) {
TileColorable tile = (TileColorable) var1;
TileVariant tile = (TileVariant) var1;
GL11.glPushMatrix();
GL11.glTranslatef((float)var2 + 0.5f, (float)var4 + 1.5f, (float)var6 + 0.5f);
GL11.glRotatef(180, 0, 0, 1);
@@ -1,6 +1,7 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -55,7 +56,7 @@ public class BlockTallLampRenderer extends BlockRendererInterface{
modelLegacy.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(resourceTop);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[tile.color]);
GL11.glColor3f(color[0], color[1], color[2]);
topLegacy.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
@@ -73,7 +74,7 @@ public class BlockTallLampRenderer extends BlockRendererInterface{
model.Light.render(0.0625F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)brightX, (float)brightY);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[tile.color]);
GL11.glColor3f(color[0], color[1], color[2]);
model.Shade.render(0.0625F);
}
@@ -96,14 +97,14 @@ public class BlockTallLampRenderer extends BlockRendererInterface{
modelLegacy.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(resourceTop);
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
topLegacy.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
} else {
setLampTexture(metadata);
model.Lamp.render(0.0625F);
model.Light.render(0.0625F);
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
model.Shade.render(0.0625F);
}
@@ -1,6 +1,7 @@
package noppes.npcs.client.renderer.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import kamkeel.npcs.util.ColorUtil;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -56,7 +57,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
modelLegacyWallBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
float[] color = BlockBannerRenderer.colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glColor3f(color[0], color[1], color[2]);
modelLegacyWallBannerFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
@@ -78,7 +79,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
BlockBannerRenderer.setFlagType(tile.bannerTrim);
float[] color = colorTable[tile.color];
float[] color = ColorUtil.hexToRGB(tile.color);
GL11.glPushMatrix();
GL11.glColor3f(color[0], color[1], color[2]);
flag.render(null, 0, 0, 0, f3, 0.0F, 0.0625F);
@@ -200,7 +201,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
modelLegacyWallBanner.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(BlockBannerRenderer.legacyFlagResource);
float[] color = BlockBannerRenderer.colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
modelLegacyWallBannerFlag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}
@@ -210,7 +211,7 @@ public class BlockWallBannerRenderer extends BlockRendererInterface{
model.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
this.bindTexture(BlockBannerRenderer.normalFlag);
float[] color = colorTable[15 - metadata];
float[] color = ColorUtil.hexToRGB(ColorUtil.colorTableInts[15 - metadata]);
GL11.glColor3f(color[0], color[1], color[2]);
flag.render(null, 0, 0, 0, 0, 0.0F, 0.0625F);
}