Пример #1
0
 private void setStateIfMobInteractsWithPlate(World world, int i, int j, int k)
 {
     bool flag = world.getBlockMetadata(i, j, k) == 1;
     bool flag1 = false;
     float f = 0.125F;
     List list = null;
     if (triggerMobType == EnumMobType.everything)
     {
         list = world.getEntitiesWithinAABBExcludingEntity(null,
                                                           AxisAlignedBB.getBoundingBoxFromPool(i + f, j,
                                                                                                k + f,
                                                                                                (i + 1) -
                                                                                                f,
                                                                                                j +
                                                                                                0.25D,
                                                                                                (k + 1) -
                                                                                                f));
     }
     if (triggerMobType == EnumMobType.mobs)
     {
         list = world.getEntitiesWithinAABB(typeof (EntityLiving),
                                            AxisAlignedBB.getBoundingBoxFromPool(i + f, j, k + f,
                                                                                 (i + 1) - f,
                                                                                 j + 0.25D,
                                                                                 (k + 1) - f));
     }
     if (triggerMobType == EnumMobType.players)
     {
         list = world.getEntitiesWithinAABB(typeof (EntityPlayer),
                                            AxisAlignedBB.getBoundingBoxFromPool(i + f, j, k + f,
                                                                                 (i + 1) - f,
                                                                                 j + 0.25D,
                                                                                 (k + 1) - f));
     }
     if (list.size() > 0)
     {
         flag1 = true;
     }
     if (flag1 && !flag)
     {
         world.setBlockMetadataWithNotify(i, j, k, 1);
         world.notifyBlocksOfNeighborChange(i, j, k, blockID);
         world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
         world.markBlocksDirty(i, j, k, i, j, k);
         world.playSoundEffect(i + 0.5D, j + 0.10000000000000001D, k + 0.5D,
                               "random.click", 0.3F, 0.6F);
     }
     if (!flag1 && flag)
     {
         world.setBlockMetadataWithNotify(i, j, k, 0);
         world.notifyBlocksOfNeighborChange(i, j, k, blockID);
         world.notifyBlocksOfNeighborChange(i, j - 1, k, blockID);
         world.markBlocksDirty(i, j, k, i, j, k);
         world.playSoundEffect(i + 0.5D, j + 0.10000000000000001D, k + 0.5D,
                               "random.click", 0.3F, 0.5F);
     }
     if (flag1)
     {
         world.func_22074_c(i, j, k, blockID, tickRate());
     }
 }