Ejemplo n.º 1
0
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   Boolean value = redstoneOut.getValue();
   tagCompound.setBoolean("rs", value == null ? false : value);
   tagCompound.setBoolean("prevIn", prevIn);
 }
Ejemplo n.º 2
0
  @Override
  protected void checkStateServer() {
    super.checkStateServer();

    int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
    boolean newvalue = BlockTools.getRedstoneSignalIn(meta);
    boolean pulse = newvalue && !prevIn;
    prevIn = newvalue;

    boolean newout = false;

    if (pulse) {
      current++;
      if (current >= counter) {
        current = 0;
        newout = true;
      }

      markDirty();

      if (newout != redstoneOut.getValue()) {
        redstoneOut.setValue(newout);
        notifyBlockUpdate();
      }
    }
  }
Ejemplo n.º 3
0
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   tagCompound.setBoolean("powerOn", powerOn);
   tagCompound.setBoolean("connected", connected);
   tagCompound.setInteger("rfPerTick", totalRfPerTick);
 }
Ejemplo n.º 4
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   powerOn = tagCompound.getBoolean("powerOn");
   connected = tagCompound.getBoolean("connected");
   totalRfPerTick = tagCompound.getInteger("rfPerTick");
 }
Ejemplo n.º 5
0
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   writeBufferToNBT(tagCompound);
   tagCompound.setBoolean("large", large);
   tagCompound.setBoolean("transparent", transparent);
   tagCompound.setInteger("color", color);
 }
Ejemplo n.º 6
0
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   readBufferFromNBT(tagCompound);
   large = tagCompound.getBoolean("large");
   transparent = tagCompound.getBoolean("transparent");
   color = tagCompound.getInteger("color");
 }
Ejemplo n.º 7
0
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   counter = tagCompound.getInteger("counter");
   if (counter == 0) {
     counter = 1;
   }
   current = tagCompound.getInteger("current");
 }
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setFloat("strength", strength);
   tagCompound.setFloat("power", power);
   tagCompound.setFloat("efficiency", efficiency);
   tagCompound.setFloat("purity", purity);
   tagCompound.setBoolean("glowing", glowing);
   tagCompound.setByte("version", (byte) 2); // Legacy support to support older crystals.
 }
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   strength = tagCompound.getFloat("strength");
   power = tagCompound.getFloat("power");
   efficiency = tagCompound.getFloat("efficiency");
   purity = tagCompound.getFloat("purity");
   glowing = tagCompound.getBoolean("glowing");
   byte version = tagCompound.getByte("version");
   if (version < (byte) 2) {
     // We have to convert the power.
     power *= 20.0f;
   }
 }
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
 }
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
 }
Ejemplo n.º 12
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   redstoneOut.setValue(tagCompound.getBoolean("rs"));
   prevIn = tagCompound.getBoolean("prevIn");
 }
Ejemplo n.º 13
0
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setInteger("counter", counter);
   tagCompound.setInteger("current", current);
 }