Exemplo n.º 1
0
 private static void initTransparentBlocks() {
   transparentBlocks.add(((Integer) Material.AIR.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BREWING_STAND.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.BROWN_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CAKE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.CROPS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DETECTOR_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.DIODE_BLOCK_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LADDER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LAVA.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LEVER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.LONG_GRASS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.MELON_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.NETHER_STALK.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PAINTING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PORTAL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.POWERED_RAIL.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.PUMPKIN_STEM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RAILS.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_MUSHROOM.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.RED_ROSE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_ON.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_TORCH_OFF.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.REDSTONE_WIRE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SAPLING.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SIGN_POST.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.SNOW.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.TORCH.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.VINE.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WALL_SIGN.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.WATER.getId()).byteValue());
   transparentBlocks.add(((Integer) Material.YELLOW_FLOWER.getId()).byteValue());
 }
 public void onBlockPhysics(BlockPhysicsEvent event) {
   if (event.isCancelled()) {
     return;
   }
   // Forces diode not to update and disable itself
   if (event.getBlock().getTypeId() == Material.DIODE_BLOCK_ON.getId()) {
     ConcurrentHashMap<Block, Sensor> sensorList = SensorManager.getSensorList();
     Iterator<Entry<Block, Sensor>> i = sensorList.entrySet().iterator();
     while (i.hasNext()) {
       Entry<Block, Sensor> e = i.next();
       if (SensorManager.isSign(e.getKey())
           && ((GenericSensor) e.getValue()).equals(event.getBlock().getLocation())) {
         event.setCancelled(true);
         return;
       }
     }
   }
 }