mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 02:13:04 +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
@@ -21,23 +21,24 @@ import noppes.npcs.blocks.tiles.TileCouchWood;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BlockCouchWood extends BlockContainer{
|
||||
public class BlockCouchWood extends BlockContainer {
|
||||
|
||||
public int renderId = -1;
|
||||
public int renderId = -1;
|
||||
|
||||
public BlockCouchWood() {
|
||||
super(Material.wood);
|
||||
}
|
||||
@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 BlockChair.MountBlock(par1World, i, j, k, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List){
|
||||
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 BlockChair.MountBlock(par1World, i, j, k, player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
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));
|
||||
@@ -47,104 +48,101 @@ public class BlockCouchWood extends BlockContainer{
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
public int damageDropped(int par1) {
|
||||
return par1;
|
||||
}
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z){
|
||||
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 0.5, z + 1);
|
||||
}
|
||||
|
||||
@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;
|
||||
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.rotation = l;
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage(), 2);
|
||||
updateModel(par1World, par2, par3, par4, tile);
|
||||
updateModel(par1World, par2, par3, par4, tile);
|
||||
onNeighborBlockChange(par1World, par2 + 1, par3, par4, this);
|
||||
onNeighborBlockChange(par1World, par2 - 1, par3, par4, this);
|
||||
onNeighborBlockChange(par1World, par2, par3, par4 + 1, this);
|
||||
onNeighborBlockChange(par1World, par2, par3, par4 - 1, this);
|
||||
updateModel(par1World, par2, par3, par4, tile);
|
||||
updateModel(par1World, par2, par3, par4, tile);
|
||||
par1World.markBlockForUpdate(par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World worldObj, int x, int y, int z, Block block) {
|
||||
if(worldObj.isRemote || block != this)
|
||||
return;
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
if(tile == null || !(tile instanceof TileCouchWood))
|
||||
return;
|
||||
updateModel(worldObj, x, y, z, (TileCouchWood) tile);
|
||||
worldObj.markBlockForUpdate(x, y, z);
|
||||
if (worldObj.isRemote || block != this)
|
||||
return;
|
||||
TileEntity tile = worldObj.getTileEntity(x, y, z);
|
||||
if (tile == null || !(tile instanceof TileCouchWood))
|
||||
return;
|
||||
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;
|
||||
int meta = tile.getBlockMetadata();
|
||||
if(tile.rotation == 0){
|
||||
tile.hasLeft = compareTiles(tile, x - 1, y, z, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x + 1, y, z, world, meta);
|
||||
}
|
||||
else if(tile.rotation == 2){
|
||||
tile.hasLeft = compareTiles(tile, x + 1, y, z, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x - 1, y, z, world, meta);
|
||||
}
|
||||
else if(tile.rotation == 1){
|
||||
tile.hasLeft = compareTiles(tile, x, y, z - 1, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x, y, z + 1, world, meta);
|
||||
}
|
||||
else if(tile.rotation == 3){
|
||||
tile.hasLeft = compareTiles(tile, x, y, z + 1, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x, y, z - 1, world, meta);
|
||||
}
|
||||
private void updateModel(World world, int x, int y, int z, TileCouchWood tile) {
|
||||
if (world.isRemote)
|
||||
return;
|
||||
int meta = tile.getBlockMetadata();
|
||||
if (tile.rotation == 0) {
|
||||
tile.hasLeft = compareTiles(tile, x - 1, y, z, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x + 1, y, z, world, meta);
|
||||
} else if (tile.rotation == 2) {
|
||||
tile.hasLeft = compareTiles(tile, x + 1, y, z, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x - 1, y, z, world, meta);
|
||||
} else if (tile.rotation == 1) {
|
||||
tile.hasLeft = compareTiles(tile, x, y, z - 1, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x, y, z + 1, world, meta);
|
||||
} else if (tile.rotation == 3) {
|
||||
tile.hasLeft = compareTiles(tile, x, y, z + 1, world, meta);
|
||||
tile.hasRight = compareTiles(tile, x, y, z - 1, world, meta);
|
||||
}
|
||||
}
|
||||
private boolean compareTiles(TileCouchWood tile, int x, int y, int z, World world, int meta){
|
||||
int meta2 = world.getBlockMetadata(x, y, z);
|
||||
if(meta2 != meta)
|
||||
return false;
|
||||
TileEntity tile2 = world.getTileEntity(x, y, z);
|
||||
if(tile2 == null || !(tile2 instanceof TileCouchWood))
|
||||
return false;
|
||||
TileCouchWood couch = (TileCouchWood) tile2;
|
||||
return tile.rotation == couch.rotation;
|
||||
|
||||
private boolean compareTiles(TileCouchWood tile, int x, int y, int z, World world, int meta) {
|
||||
int meta2 = world.getBlockMetadata(x, y, z);
|
||||
if (meta2 != meta)
|
||||
return false;
|
||||
TileEntity tile2 = world.getTileEntity(x, y, z);
|
||||
if (tile2 == null || !(tile2 instanceof TileCouchWood))
|
||||
return false;
|
||||
TileCouchWood couch = (TileCouchWood) tile2;
|
||||
return tile.rotation == couch.rotation;
|
||||
}
|
||||
|
||||
@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)
|
||||
{
|
||||
public IIcon getIcon(int p_149691_1_, int meta) {
|
||||
return Blocks.planks.getIcon(p_149691_1_, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileCouchWood();
|
||||
}
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileCouchWood();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user