mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-22 00:22:19 +00:00
Full Imports and Code Format Optimization
This commit is contained in:
1 parent
250edf099c
commit
6815f579a7
1192 files changed
+60344
-62167
No files matched your search
@@ -30,42 +30,44 @@ import java.util.List;
|
||||
import static kamkeel.npcs.util.ColorUtil.colorTableInts;
|
||||
import static noppes.npcs.items.ItemNpcTool.BRUSH_COLOR_TAG;
|
||||
|
||||
public class BlockBanner extends BlockContainer{
|
||||
public class BlockBanner extends BlockContainer {
|
||||
|
||||
public int renderId = -1;
|
||||
public int renderId = -1;
|
||||
|
||||
public BlockBanner() {
|
||||
public BlockBanner() {
|
||||
super(Material.rock);
|
||||
setBlockBounds(0, 0, 0, 1, 2, 1);
|
||||
}
|
||||
@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)
|
||||
return false;
|
||||
}
|
||||
|
||||
if(item.getItem() != null && item.getItem() instanceof ItemNpcTool && item.getItemDamage() == 0)
|
||||
@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)
|
||||
return false;
|
||||
|
||||
int meta = par1World.getBlockMetadata(i, j, k);
|
||||
if(meta >= 7)
|
||||
j--;
|
||||
TileBanner tile = (TileBanner) par1World.getTileEntity(i, j, k);
|
||||
if(tile.canEdit())
|
||||
return true;
|
||||
else if(TileColorable.allowColorChange(item) != TileColorable.ColorChangeType.DYE)
|
||||
return false;
|
||||
if (item.getItem() != null && item.getItem() instanceof ItemNpcTool && item.getItemDamage() == 0)
|
||||
return false;
|
||||
|
||||
int meta = par1World.getBlockMetadata(i, j, k);
|
||||
if (meta >= 7)
|
||||
j--;
|
||||
TileBanner tile = (TileBanner) par1World.getTileEntity(i, j, k);
|
||||
if (tile.canEdit())
|
||||
return true;
|
||||
else if (TileColorable.allowColorChange(item) != TileColorable.ColorChangeType.DYE)
|
||||
return false;
|
||||
|
||||
int color = colorTableInts[BlockColored.func_150031_c(item.getItemDamage())];
|
||||
if(tile.color != color){
|
||||
NoppesUtilServer.consumeItemStack(1, player);
|
||||
tile.color = color;
|
||||
par1World.markBlockForUpdate(i, j, k);
|
||||
}
|
||||
return true;
|
||||
if (tile.color != color) {
|
||||
NoppesUtilServer.consumeItemStack(1, player);
|
||||
tile.color = color;
|
||||
par1World.markBlockForUpdate(i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
par3List.add(new ItemStack(par1, 1, 2));
|
||||
@@ -74,94 +76,90 @@ public class BlockBanner extends BlockContainer{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
public int damageDropped(int par1) {
|
||||
return par1 % 7;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z){
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta >= 7)
|
||||
if (meta >= 7)
|
||||
setBlockBounds(0, -1, 0, 1, 1, 1);
|
||||
else
|
||||
setBlockBounds(0, 0, 0, 1, 2, 1);
|
||||
}
|
||||
|
||||
@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{
|
||||
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;
|
||||
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);
|
||||
TileBanner tile = (TileBanner) par1World.getTileEntity(par2, par3, par4);
|
||||
tile.rotation = l;
|
||||
tile.color = colorTableInts[15 - par6ItemStack.getItemDamage()];
|
||||
if(par6ItemStack.hasTagCompound() && par6ItemStack.getTagCompound().hasKey(BRUSH_COLOR_TAG)){
|
||||
if (par6ItemStack.hasTagCompound() && par6ItemStack.getTagCompound().hasKey(BRUSH_COLOR_TAG)) {
|
||||
tile.color = par6ItemStack.getTagCompound().getInteger(BRUSH_COLOR_TAG);
|
||||
}
|
||||
|
||||
tile.time = System.currentTimeMillis();
|
||||
tile.time = System.currentTimeMillis();
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() , 2);
|
||||
par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2);
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
|
||||
par1World.setBlock(par2, par3 + 1, par4, this, par6ItemStack.getItemDamage() + 7, 2);
|
||||
|
||||
if(par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote)
|
||||
((EntityPlayer)par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
|
||||
}
|
||||
if (par5EntityLivingBase instanceof EntityPlayer && par1World.isRemote)
|
||||
((EntityPlayer) par5EntityLivingBase).addChatComponentMessage(new ChatComponentTranslation("availability.editIcon"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return renderId;
|
||||
}
|
||||
public int getRenderType() {
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int meta)
|
||||
{
|
||||
meta %= 7;
|
||||
if(meta == 1)
|
||||
public IIcon getIcon(int p_149691_1_, int meta) {
|
||||
meta %= 7;
|
||||
if (meta == 1)
|
||||
return Blocks.stone.getIcon(p_149691_1_, 0);
|
||||
else if(meta == 2)
|
||||
else if (meta == 2)
|
||||
return Blocks.iron_block.getIcon(p_149691_1_, 0);
|
||||
else if(meta == 3)
|
||||
else if (meta == 3)
|
||||
return Blocks.gold_block.getIcon(p_149691_1_, 0);
|
||||
else if(meta == 4)
|
||||
else if (meta == 4)
|
||||
return Blocks.diamond_block.getIcon(p_149691_1_, 0);
|
||||
return Blocks.planks.getIcon(p_149691_1_, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
if(var2 < 7)
|
||||
return new TileBanner();
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
if (var2 < 7)
|
||||
return new TileBanner();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_)
|
||||
{
|
||||
@Override
|
||||
public void onBlockHarvested(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_) {
|
||||
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_);
|
||||
|
||||
@@ -172,7 +170,7 @@ public class BlockBanner extends BlockContainer{
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if(meta >= 7)
|
||||
if (meta >= 7)
|
||||
y--;
|
||||
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
|
||||
Reference in new issue
Block a user