public void mirror(Mirror p_189668_1_) { if (this.world != null && this.world.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189668_1_.mirrorRotation(this.skullRotation, 16); } }
public void rotate(Rotation p_189667_1_) { if (this.world != null && this.world.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189667_1_.rotate(this.skullRotation, 16); } }
public void mirror(Mirror p_189668_1_) { if (this.worldObj != null && this.worldObj.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189668_1_.mirrorRotation(this.skullRotation, 16); } }
public void rotate(Rotation p_189667_1_) { if (this.worldObj != null && this.worldObj.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189667_1_.rotate(this.skullRotation, 16); } }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockRailDetector || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.field_150444_as || block == Blocks.field_150472_an || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator || block instanceof BlockTrapDoor || block instanceof BlockHugeMushroom || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireHook || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockRailDetector || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.wall_sign || block == Blocks.standing_sign || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator || block instanceof BlockTrapDoor || block instanceof BlockHugeMushroom || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
public void drawBlockDamageTexture(Tessellator tessellatorIn, WorldRenderer worldRendererIn, Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; if (!this.damagedBlocks.isEmpty()) { this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); this.preRenderDamagedBlocks(); worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation(-d0, -d1, -d2); worldRendererIn.markDirty(); Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator(); while (iterator.hasNext()) { DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); BlockPos blockpos = destroyblockprogress.getPosition(); double d3 = (double)blockpos.getX() - d0; double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull)) { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { iterator.remove(); } else { IBlockState iblockstate = this.theWorld.getBlockState(blockpos); if (iblockstate.getBlock().getMaterial() != Material.air) { int i = destroyblockprogress.getPartialBlockDamage(); TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i]; BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); } } } } tessellatorIn.draw(); worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); this.postRenderDamagedBlocks(); } }
public void drawBlockDamageTexture(Tessellator tessellatorIn, WorldRenderer worldRendererIn, Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; if (!this.damagedBlocks.isEmpty()) { this.renderEngine.bindTexture(TextureMap.locationBlocksTexture); this.preRenderDamagedBlocks(); worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation(-d0, -d1, -d2); worldRendererIn.markDirty(); Iterator iterator = this.damagedBlocks.values().iterator(); while (iterator.hasNext()) { DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); BlockPos blockpos = destroyblockprogress.getPosition(); double d3 = (double)blockpos.getX() - d0; double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); boolean flag; if (Reflector.ForgeTileEntity_canRenderBreaking.exists()) { boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; if (!flag1) { TileEntity tileentity = this.theWorld.getTileEntity(blockpos); if (tileentity != null) { flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]); } } flag = !flag1; } else { flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull); } if (flag) { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { iterator.remove(); } else { IBlockState iblockstate = this.theWorld.getBlockState(blockpos); if (iblockstate.getBlock().getMaterial() != Material.air) { int i = destroyblockprogress.getPartialBlockDamage(); TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i]; BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); } } } } tessellatorIn.draw(); worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); this.postRenderDamagedBlocks(); } }
@Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (facing == EnumFacing.DOWN) { return EnumActionResult.FAIL; } else { if (worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) { facing = EnumFacing.UP; pos = pos.down(); } IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); boolean flag = block.isReplaceable(worldIn, pos); if (!flag) { if (!worldIn.getBlockState(pos).getMaterial().isSolid() && !worldIn.isSideSolid(pos, facing, true)) { return EnumActionResult.FAIL; } pos = pos.offset(facing); } ItemStack stack = player.getHeldItem(hand); if (player.canPlayerEdit(pos, facing, stack) && Blocks.SKULL.canPlaceBlockAt(worldIn, pos)) { if (worldIn.isRemote || skullBlock == null) { return EnumActionResult.SUCCESS; } else { worldIn.setBlockState(pos, skullBlock.getDefaultState().withProperty(BlockSkull.FACING, facing), 11); int i = 0; if (facing == EnumFacing.UP) { i = MathUtils.floor(player.rotationYaw * 16.0F / 360.0F + 0.5D) & 15; } TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileBlockSkull) { TileBlockSkull tileentityskull = (TileBlockSkull) tileentity; tileentityskull.setSkullRotation(i); } stack.shrink(1); return EnumActionResult.SUCCESS; } } else { return EnumActionResult.FAIL; } } }
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; if (!this.damagedBlocks.isEmpty()) { this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); this.preRenderDamagedBlocks(); worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation(-d0, -d1, -d2); worldRendererIn.noColor(); Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator(); while (iterator.hasNext()) { DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); BlockPos blockpos = destroyblockprogress.getPosition(); double d3 = (double)blockpos.getX() - d0; double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); boolean flag; if (Reflector.ForgeTileEntity_canRenderBreaking.exists()) { boolean flag1 = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; if (!flag1) { TileEntity tileentity = this.theWorld.getTileEntity(blockpos); if (tileentity != null) { flag1 = Reflector.callBoolean(tileentity, Reflector.ForgeTileEntity_canRenderBreaking, new Object[0]); } } flag = !flag1; } else { flag = !(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull); } if (flag) { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { iterator.remove(); } else { IBlockState iblockstate = this.theWorld.getBlockState(blockpos); if (iblockstate.getMaterial() != Material.AIR) { int i = destroyblockprogress.getPartialBlockDamage(); TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i]; BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); } } } } tessellatorIn.draw(); worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); this.postRenderDamagedBlocks(); } }
public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer worldRendererIn, Entity entityIn, float partialTicks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; if (!this.damagedBlocks.isEmpty()) { this.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); this.preRenderDamagedBlocks(); worldRendererIn.begin(7, DefaultVertexFormats.BLOCK); worldRendererIn.setTranslation(-d0, -d1, -d2); worldRendererIn.noColor(); Iterator<DestroyBlockProgress> iterator = this.damagedBlocks.values().iterator(); while (iterator.hasNext()) { DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next(); BlockPos blockpos = destroyblockprogress.getPosition(); double d3 = (double)blockpos.getX() - d0; double d4 = (double)blockpos.getY() - d1; double d5 = (double)blockpos.getZ() - d2; Block block = this.theWorld.getBlockState(blockpos).getBlock(); TileEntity te = this.theWorld.getTileEntity(blockpos); boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; if (!hasBreak) hasBreak = te != null && te.canRenderBreaking(); if (!hasBreak) { if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D) { iterator.remove(); } else { IBlockState iblockstate = this.theWorld.getBlockState(blockpos); if (iblockstate.getMaterial() != Material.AIR) { int i = destroyblockprogress.getPartialBlockDamage(); TextureAtlasSprite textureatlassprite = this.destroyBlockIcons[i]; BlockRendererDispatcher blockrendererdispatcher = this.mc.getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, this.theWorld); } } } } tessellatorIn.draw(); worldRendererIn.setTranslation(0.0D, 0.0D, 0.0D); this.postRenderDamagedBlocks(); } }
public void func_189668_a(Mirror p_189668_1_) { if(this.world != null && this.world.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189668_1_.mirrorRotation(this.skullRotation, 16); } }
public void func_189667_a(Rotation p_189667_1_) { if(this.world != null && this.world.getBlockState(this.getPos()).getValue(BlockSkull.FACING) == EnumFacing.UP) { this.skullRotation = p_189667_1_.rotate(this.skullRotation, 16); } }
@SuppressWarnings("deprecation") public void drawBlockDamageTexture(Tessellator tessellatorIn, VertexBuffer vertexBuffer, Entity entityIn, float partialTicks, World world, List<BlockPos> blocks) { double d0 = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * partialTicks; double d1 = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * partialTicks; double d2 = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * partialTicks; TextureManager renderEngine = Minecraft.getMinecraft().renderEngine; float curBlockDamageMP = ObfuscationReflectionHelper.getPrivateValue(PlayerControllerMP.class, Minecraft.getMinecraft().playerController, 4); int progress = (int) (curBlockDamageMP * 10f) - 1; // 0-10 if(progress < 0) { return; } renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); //preRenderDamagedBlocks BEGIN GlStateManager.tryBlendFuncSeparate(774, 768, 1, 0); GlStateManager.enableBlend(); GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F); GlStateManager.doPolygonOffset(-3.0F, -3.0F); GlStateManager.enablePolygonOffset(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.enableAlpha(); GlStateManager.pushMatrix(); //preRenderDamagedBlocks END vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); vertexBuffer.setTranslation(-d0, -d1, -d2); vertexBuffer.noColor(); for(BlockPos blockpos : blocks) { blockpos.getX(); blockpos.getY(); blockpos.getZ(); Block block = world.getBlockState(blockpos).getBlock(); TileEntity te = world.getTileEntity(blockpos); boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull; if(!hasBreak) { hasBreak = te != null && te.canRenderBreaking(); } if(!hasBreak) { IBlockState iblockstate = world.getBlockState(blockpos); if(iblockstate.getBlock().getMaterial(iblockstate) != Material.AIR) { TextureAtlasSprite textureatlassprite = RenderUtil.getSprite("minecraft:blocks/destroy_stage_"+progress)/*ClientProxy.destroyBlockIcons[progress]*/; BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher(); blockrendererdispatcher.renderBlockDamage(iblockstate, blockpos, textureatlassprite, world); } } } tessellatorIn.draw(); vertexBuffer.setTranslation(0.0D, 0.0D, 0.0D); // postRenderDamagedBlocks BEGIN GlStateManager.disableAlpha(); GlStateManager.doPolygonOffset(0.0F, 0.0F); GlStateManager.disablePolygonOffset(); GlStateManager.enableAlpha(); GlStateManager.depthMask(true); GlStateManager.popMatrix(); // postRenderDamagedBlocks END }
private static BlockType getBlockType(Block block) { if(block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockCocoa) { return BlockType.BED; } if(block instanceof BlockRail) { return BlockType.RAIL; } if(block instanceof BlockRailPowered || block instanceof BlockRailDetector) { return BlockType.RAIL_POWERED; } if(block instanceof BlockStairs) { return BlockType.STAIR; } if(block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block == Blocks.wall_sign) { return BlockType.CHEST; } if(block == Blocks.standing_sign) { return BlockType.SIGNPOST; } if(block instanceof BlockDoor) { return BlockType.DOOR; } if(block instanceof BlockButton) { return BlockType.BUTTON; } if(block instanceof BlockRedstoneRepeater || block instanceof BlockRedstoneComparator) { return BlockType.REDSTONE_REPEATER; } if(block instanceof BlockTrapDoor) { return BlockType.TRAPDOOR; } if(block instanceof BlockHugeMushroom) { return BlockType.MUSHROOM_CAP; } if(block instanceof BlockVine) { return BlockType.VINE; } if(block instanceof BlockSkull) { return BlockType.SKULL; } if(block instanceof BlockAnvil) { return BlockType.ANVIL; } if(block instanceof BlockLog) { return BlockType.LOG; } if(block instanceof BlockDispenser || block instanceof BlockPistonBase || block instanceof BlockPistonExtension || block instanceof BlockHopper) { return BlockType.DISPENSER; } if(block instanceof BlockTorch) { return BlockType.TORCH; } if(block instanceof BlockLever) { return BlockType.LEVER; } if(block instanceof BlockTripWireHook) { return BlockType.TRIP_WIRE_HOOK; } return null; }
/** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par7 == 0) { return false; } else if (!par3World.getBlock(par4, par5, par6).getMaterial().isSolid()) { return false; } else { if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else if (!Blocks.skull.canPlaceBlockAt(par3World, par4, par5, par6)) { return false; } else { par3World.setBlock(par4, par5, par6, Blocks.skull, par7, 2); int var11 = 0; if (par7 == 1) { var11 = MathHelper.floor_double((double)(par2EntityPlayer.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15; } TileEntity var12 = par3World.getTileEntity(par4, par5, par6); if (var12 != null && var12 instanceof TileEntitySkull) { String var13 = ""; if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().func_150297_b("SkullOwner", 8)) { var13 = par1ItemStack.getTagCompound().getString("SkullOwner"); } ((TileEntitySkull)var12).func_145905_a(par1ItemStack.getItemDamage(), var13); ((TileEntitySkull)var12).func_145903_a(var11); ((BlockSkull)Blocks.skull).func_149965_a(par3World, par4, par5, par6, (TileEntitySkull)var12); } --par1ItemStack.stackSize; return true; } } }
public boolean func_77648_a(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) { if(p_77648_7_ == 0) { return false; } else if(!p_77648_3_.func_72803_f(p_77648_4_, p_77648_5_, p_77648_6_).func_76220_a()) { return false; } else { if(p_77648_7_ == 1) { ++p_77648_5_; } if(p_77648_7_ == 2) { --p_77648_6_; } if(p_77648_7_ == 3) { ++p_77648_6_; } if(p_77648_7_ == 4) { --p_77648_4_; } if(p_77648_7_ == 5) { ++p_77648_4_; } if(!p_77648_2_.func_82247_a(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_)) { return false; } else if(!Block.field_82512_cj.func_71930_b(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_)) { return false; } else { p_77648_3_.func_72832_d(p_77648_4_, p_77648_5_, p_77648_6_, Block.field_82512_cj.field_71990_ca, p_77648_7_, 2); int var11 = 0; if(p_77648_7_ == 1) { var11 = MathHelper.func_76128_c((double)(p_77648_2_.field_70177_z * 16.0F / 360.0F) + 0.5D) & 15; } TileEntity var12 = p_77648_3_.func_72796_p(p_77648_4_, p_77648_5_, p_77648_6_); if(var12 != null && var12 instanceof TileEntitySkull) { String var13 = ""; if(p_77648_1_.func_77942_o() && p_77648_1_.func_77978_p().func_74764_b("SkullOwner")) { var13 = p_77648_1_.func_77978_p().func_74779_i("SkullOwner"); } ((TileEntitySkull)var12).func_82118_a(p_77648_1_.func_77960_j(), var13); ((TileEntitySkull)var12).func_82116_a(var11); ((BlockSkull)Block.field_82512_cj).func_82529_a(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, (TileEntitySkull)var12); } --p_77648_1_.field_77994_a; return true; } } }
public static ForgeDirection[] getValidVanillaBlockRotations(Block block) { return (block instanceof BlockBed || block instanceof BlockPumpkin || block instanceof BlockFenceGate || block instanceof BlockEndPortalFrame || block instanceof BlockTripWireSource || block instanceof BlockCocoa || block instanceof BlockRailPowered || block instanceof BlockDetectorRail || block instanceof BlockStairs || block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockFurnace || block instanceof BlockLadder || block.blockID == Block.signWall.blockID || block.blockID == Block.signPost.blockID || block instanceof BlockDoor || block instanceof BlockRail || block instanceof BlockButton || block instanceof BlockRedstoneRepeater || block instanceof BlockComparator || block instanceof BlockTrapDoor || block instanceof BlockMushroomCap || block instanceof BlockVine || block instanceof BlockSkull || block instanceof BlockAnvil) ? UP_DOWN_AXES : VALID_DIRECTIONS; }
/** * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return * True if something happen and false if it don't. This is for ITEMS, not BLOCKS */ public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par7 == 0) { return false; } else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid()) { return false; } else { if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else if (!Block.skull.canPlaceBlockAt(par3World, par4, par5, par6)) { return false; } else { par3World.setBlock(par4, par5, par6, Block.skull.blockID, par7, 2); int i1 = 0; if (par7 == 1) { i1 = MathHelper.floor_double((double)(par2EntityPlayer.rotationYaw * 16.0F / 360.0F) + 0.5D) & 15; } TileEntity tileentity = par3World.getBlockTileEntity(par4, par5, par6); if (tileentity != null && tileentity instanceof TileEntitySkull) { String s = ""; if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("SkullOwner")) { s = par1ItemStack.getTagCompound().getString("SkullOwner"); } ((TileEntitySkull)tileentity).setSkullType(par1ItemStack.getItemDamage(), s); ((TileEntitySkull)tileentity).setSkullRotation(i1); ((BlockSkull)Block.skull).makeWither(par3World, par4, par5, par6, (TileEntitySkull)tileentity); } --par1ItemStack.stackSize; return true; } } }
/** * Callback for item usage. If the item does something special on right * clicking, he will have one of those. Return True if something happen and * false if it don't. This is for ITEMS, not BLOCKS */ @Override public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if (par7 == 0) return false; else if (!par3World.getBlockMaterial(par4, par5, par6).isSolid()) return false; else { if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) return false; else if (!Block.skull.canPlaceBlockAt(par3World, par4, par5, par6)) return false; else { par3World.setBlock(par4, par5, par6, Block.skull.blockID, par7, 2); int i1 = 0; if (par7 == 1) { i1 = MathHelper.floor_double(par2EntityPlayer.rotationYaw * 16.0F / 360.0F + 0.5D) & 15; } TileEntity tileentity = par3World.getBlockTileEntity(par4, par5, par6); if (tileentity != null && tileentity instanceof TileEntitySkull) { String s = ""; if (par1ItemStack.hasTagCompound() && par1ItemStack.getTagCompound().hasKey("SkullOwner")) { s = par1ItemStack.getTagCompound().getString("SkullOwner"); } ((TileEntitySkull) tileentity).setSkullType(par1ItemStack.getItemDamage(), s); ((TileEntitySkull) tileentity).setSkullRotation(i1); ((BlockSkull) Block.skull).makeWither(par3World, par4, par5, par6, (TileEntitySkull) tileentity); } --par1ItemStack.stackSize; return true; } } }