Ejemplo n.º 1
0
 @Override
 public void writeToNBT(NBTTagCompound compound) {
   super.writeToNBT(compound);
   // LogHelper.debugInfo("write mode = " + mode.getID());
   compound.setInteger("mode", mode.getID());
   if (stack != null) compound.setTag("item", stack.serializeNBT());
 }
Ejemplo n.º 2
0
  @Override
  public void readFromNBT(NBTTagCompound compound) {
    super.readFromNBT(compound);
    // LogHelper.debugInfo("read mode = " + ModeProximityTrigger.get(compound.getInteger("mode")));
    mode = ModeProximityTrigger.get(compound.getInteger("mode"));

    if (compound.hasKey("item"))
      stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("item"));
  }
Ejemplo n.º 3
0
 @Override
 public void checkStateServer() {
   super.checkStateServer();
   // if (canProceed())
   if (entityIsInMe) {
     if (timeCount >= DELAY_LENGTH) {
       if (oldCounter != counter) {
         oldCounter = counter;
         if (!isActive()) {
           setActive(true);
         }
       } else {
         setEntityIsInMe(false);
         setActive(false);
       }
       timeCount = 0;
     }
     timeCount++;
   }
 }