Skip to content

Instantly share code, notes, and snippets.

@Keridos
Created November 28, 2014 14:59
Show Gist options
  • Save Keridos/eb4325b8696ca53e1359 to your computer and use it in GitHub Desktop.
Save Keridos/eb4325b8696ca53e1359 to your computer and use it in GitHub Desktop.
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float p_149727_7_, float p_149727_8_, float p_149727_9_) {
if (player.getHeldItem() == null && !world.isRemote && player.isSneaking()) {
((TileEntityElectricFloodlight) world.getTileEntity(x, y, z)).toggleInverted();
boolean b = ((TileEntityElectricFloodlight) world.getTileEntity(x, y, z)).getInverted();
player.addChatMessage(new ChatComponentText("Light now: " + (b ? "inverted" : "not inverted")));
} else if (player.getHeldItem() != null && !world.isRemote && player.isSneaking()) {
Logger.getGlobal().info("poke, found item") ;
if (player.getHeldItem().getItem() == getMinecraftItem("stick")) {
((TileEntityElectricFloodlight) world.getTileEntity(x, y, z)).changeMode(player);
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment