コード例 #1
0
 @Override
 public void update() {
   if (worldObj.isRemote) {
     return;
   }
   // TODO: Ugh, laaaame. Schedule a block update?
   if (!partsValidated) {
     partsValidated = true;
     Iterator<ClayLump> it = parts.iterator();
     while (it.hasNext()) {
       ClayLump lump = it.next();
       if (!isValidLump(lump)) {
         if (parts.size() == 1) {
           lump.asDefault();
         } else {
           it.remove();
           InvUtil.spawnItemStack(getCoord(), new ItemStack(Items.clay_ball));
         }
       }
     }
   }
   if (getState() == ClayState.WET) {
     if (!worldObj.isRaining()) {
       lastTouched++;
     }
     if (totalHeat > 0) {
       totalHeat--;
       lastTouched++;
     }
   }
   if (getState() != lastState) {
     lastState = getState();
     broadcastMessage(null, SculptState, lastState.ordinal());
   }
 }
コード例 #2
0
 private void readStateChange(ByteBuf input) throws IOException {
   switch (ClayState.values()[input.readInt()]) {
     case WET:
       lastTouched = 0;
       break;
     case DRY:
       lastTouched = dryTime + 10;
       break;
     case BISQUED:
       totalHeat = bisqueHeat + 1;
       break;
     case UNFIRED_GLAZED:
       totalHeat = bisqueHeat + 2;
       glazesApplied = true;
       break;
     case HIGHFIRED:
       totalHeat = highfireHeat + 1;
       break;
   }
   getCoord().redraw();
 }