Пример #1
0
 @Override
 public boolean a(IBlockAccess iblockaccess, int x, int y, int z, int face) {
   int index = CustomBlock.getIndex(x, y, z);
   Chunk chunk = ((World) iblockaccess).getChunkAt(x >> 4, z >> 4).bukkitChunk;
   if (chunk.getClass().equals(SpoutCraftChunk.class)) {
     TIntIntHashMap powerOverrides = ((SpoutCraftChunk) chunk).powerOverrides;
     if (powerOverrides.containsKey(index)) {
       int powerbits = powerOverrides.get(index);
       switch (face) {
         case 0:
           return (powerbits & (1 << 0)) != 0;
         case 1:
           return (powerbits & (1 << 1)) != 0;
         case 2:
           return (powerbits & (1 << 2)) != 0;
         case 3:
           return (powerbits & (1 << 3)) != 0;
         case 4:
           return (powerbits & (1 << 4)) != 0;
         case 5:
           return (powerbits & (1 << 5)) != 0;
         default:
           return parent.a(iblockaccess, x, y, z, face);
       }
     }
   }
   return parent.a(iblockaccess, x, y, z, face);
 }
Пример #2
0
 @Override
 public float getDamage(EntityHuman entityhuman) {
   if (entityhuman instanceof EntityPlayer) {
     SpoutCraftPlayer player =
         (SpoutCraftPlayer)
             SpoutManager.getPlayer((Player) ((EntityPlayer) entityhuman).getBukkitEntity());
     Location target = player.getRawLastClickedLocation();
     if (target != null) {
       int index =
           CustomBlock.getIndex((int) target.getX(), (int) target.getY(), (int) target.getZ());
       Chunk chunk = target.getWorld().getChunkAt(target);
       if (chunk.getClass().equals(SpoutCraftChunk.class)) {
         TIntFloatHashMap hardnessOverrides = ((SpoutCraftChunk) chunk).hardnessOverrides;
         if (hardnessOverrides.containsKey(index)) {
           return hardnessOverrides.get(index);
         }
       }
     }
   }
   return parent.getDamage(entityhuman);
 }