コード例 #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);
 }
コード例 #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();
      }
    }
  }
コード例 #3
0
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
   tagCompound.setBoolean("powerOn", powerOn);
   tagCompound.setBoolean("connected", connected);
   tagCompound.setInteger("rfPerTick", totalRfPerTick);
 }
コード例 #4
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   powerOn = tagCompound.getBoolean("powerOn");
   connected = tagCompound.getBoolean("connected");
   totalRfPerTick = tagCompound.getInteger("rfPerTick");
 }
コード例 #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);
 }
コード例 #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");
 }
コード例 #7
0
 @Override
 public void readRestorableFromNBT(NBTTagCompound tagCompound) {
   super.readRestorableFromNBT(tagCompound);
   counter = tagCompound.getInteger("counter");
   if (counter == 0) {
     counter = 1;
   }
   current = tagCompound.getInteger("current");
 }
コード例 #8
0
 @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.
 }
コード例 #9
0
 @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;
   }
 }
コード例 #10
0
 @Override
 public void writeToNBT(NBTTagCompound tagCompound) {
   super.writeToNBT(tagCompound);
 }
コード例 #11
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
 }
コード例 #12
0
 @Override
 public void readFromNBT(NBTTagCompound tagCompound) {
   super.readFromNBT(tagCompound);
   redstoneOut.setValue(tagCompound.getBoolean("rs"));
   prevIn = tagCompound.getBoolean("prevIn");
 }
コード例 #13
0
 @Override
 public void writeRestorableToNBT(NBTTagCompound tagCompound) {
   super.writeRestorableToNBT(tagCompound);
   tagCompound.setInteger("counter", counter);
   tagCompound.setInteger("current", current);
 }