package com.choonster.testmod3.block;

import com.choonster.testmod3.TestMod3;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

/**
 * A block that forces a player to right click (from the client side) every 10 ticks (0.5 seconds) while standing on it.
 * <p>
 * Uses the pressure plate model, placement and piston movement behaviour; but doesn't depress when stood on.
 * <p>
 * Test for this thread:
 * http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2512904-make-the-player-perform-a-right-click-on-non
 */
public class BlockClientPlayerRightClick extends Block {
	public static final IProperty POWERED = PropertyBool.create("powered");

	public BlockClientPlayerRightClick() {
		super(Material.rock);
		setCreativeTab(TestMod3.creativeTab);
		setUnlocalizedName("clientPlayerRightClick");
	}

	public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state) {
		return null;
	}

	public boolean isOpaqueCube() {
		return false;
	}

	public boolean isFullCube() {
		return false;
	}

	public boolean isPassable(IBlockAccess worldIn, BlockPos pos) {
		return true;
	}

	public boolean canPlaceBlockAt(World worldIn, BlockPos pos) {
		return World.doesBlockHaveSolidTopSurface(worldIn, pos) || worldIn.getBlockState(pos).getBlock() instanceof BlockFence;
	}

	@Override
	public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) {
		setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.0625F, 0.9375F);
	}

	public void setBlockBoundsForItemRender() {
		this.setBlockBounds(0.0F, 0.375F, 0.0F, 1.0F, 0.625F, 1.0F);
	}

	public int getMobilityFlag() {
		return 1;
	}

	@Override
	public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
		// If on the client side, the colliding Entity is the client player and the total world time is a multiple of 10
		if (worldIn.isRemote && entityIn == TestMod3.proxy.getClientPlayer() && worldIn.getTotalWorldTime() % 10 == 0) {
			// Make the player right click
			entityIn.addChatMessage(new ChatComponentText("Right click!!"));
			TestMod3.proxy.doClientRightClick();
		}
	}
}

@@ -195,109 +195,8 @@
 al;%0A
-import net.minecraft.block.properties.IProperty;%0Aimport net.minecraft.block.properties.PropertyBool;%0A
 impo
@@ -237,16 +237,16 @@
 kState;%0A
+
 import n
@@ -963,82 +963,8 @@
 k %7B%0A
-%09public static final IProperty POWERED = PropertyBool.create(%22powered%22);%0A%0A
 %09pub
@@ -1111,24 +1111,35 @@
 lick%22);%0A%09%7D%0A%0A
+%09@Override%0A
 %09public Axis
@@ -1237,24 +1237,35 @@
 n null;%0A%09%7D%0A%0A
+%09@Override%0A
 %09public bool
@@ -1297,32 +1297,43 @@
 turn false;%0A%09%7D%0A%0A
+%09@Override%0A
 %09public boolean 
@@ -1363,24 +1363,35 @@
  false;%0A%09%7D%0A%0A
+%09@Override%0A
 %09public bool
@@ -1458,24 +1458,35 @@
 n true;%0A%09%7D%0A%0A
+%09@Override%0A
 %09public bool
@@ -1816,32 +1816,43 @@
 , 0.9375F);%0A%09%7D%0A%0A
+%09@Override%0A
 %09public void set
@@ -1947,16 +1947,27 @@
 F);%0A%09%7D%0A%0A
+%09@Override%0A
 %09public 

Clean up code