Turn Redstone Torch off?

Discussion in 'Plugin Development' started by gameguy27, Jul 7, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    gameguy27

    I'm trying to turn a redstone torch off if a certain condition isn't met. I got it to turn off but when you place redstone wire next to it the torch turns back on. I have a scheduler event that checks certain torches, if a condition is not met the torch will be turned off.
    Code:
    Block above_block = block.getWorld().getBlockAt((int) entry.getX(), (int) entry.getY() + 1, (int) entry.getZ());
    above_block.setType(Material.REDSTONE_TORCH_OFF);
     	        	}
    Here's the code that I'm running to turn the torch off. This is in a method that updates ever second. Anyway to keep this torch turned off?
     
  2. Offline

    bleachisback

    add the torch to a hashmap of torches you don't want to turn on, and add a BlockPhysicsEvent. Then just do this:
    Code:
    if(hashmapname.containsKey(event.getBlock())
    {
    event.setCancelled(true);
    }
    
     
  3. Offline

    cholo71796

    Actually, after testing, cancelling the BlockPhysicsEvent seems ineffective. However, setting the torch to the off state on a physics check works just fine.
     
Thread Status:
Not open for further replies.

Share This Page