Beispiel #1
0
  /** Send and apply locally all pending BlockEvents to each player with 64m radius of the event. */
  private void sendAndApplyBlockEvents() {
    while (!this.blockEventCache[this.blockEventCacheIndex].isEmpty()) {
      int var1 = this.blockEventCacheIndex;
      this.blockEventCacheIndex ^= 1;
      Iterator var2 = this.blockEventCache[var1].iterator();

      while (var2.hasNext()) {
        BlockEventData var3 = (BlockEventData) var2.next();

        if (this.onBlockEventReceived(var3)) {
          this.mcServer
              .getConfigurationManager()
              .sendToAllNear(
                  (double) var3.getX(),
                  (double) var3.getY(),
                  (double) var3.getZ(),
                  64.0D,
                  this.provider.dimensionId,
                  new Packet54PlayNoteBlock(
                      var3.getX(),
                      var3.getY(),
                      var3.getZ(),
                      var3.getBlockID(),
                      var3.getEventID(),
                      var3.getEventParameter()));
        }
      }

      this.blockEventCache[var1].clear();
    }
  }
Beispiel #2
0
 /** Called to apply a pending BlockEvent to apply to the current world. */
 private boolean onBlockEventReceived(BlockEventData par1BlockEventData) {
   int var2 =
       this.getBlockId(
           par1BlockEventData.getX(), par1BlockEventData.getY(), par1BlockEventData.getZ());
   return var2 == par1BlockEventData.getBlockID()
       ? Block.blocksList[var2].onBlockEventReceived(
           this,
           par1BlockEventData.getX(),
           par1BlockEventData.getY(),
           par1BlockEventData.getZ(),
           par1BlockEventData.getEventID(),
           par1BlockEventData.getEventParameter())
       : false;
 }