mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 20:53:08 +00:00
Hex Color Update
This commit is contained in:
1 parent
3c610e7105
commit
3a00d08304
50 files changed
+456
-360
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user