Package net.minecraft.server.v1_6_R1

Examples of net.minecraft.server.v1_6_R1.Block


    final int[] lightEmission = new int[Block.lightEmission.length];
    System.arraycopy(Block.lightEmission, 0, lightEmission, 0, Block.lightEmission.length);

    for (int i = 0; i < Block.byId.length; i++) {
      if (Block.byId[i] != null) {
        Block parent = Block.byId[i];
        Block.byId[i] = null;

        float strength = 0;
        try {
          final Field field = getField(parent.getClass(), "strength");
          field.setAccessible(true);
          strength = field.getFloat(parent);
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (NoSuchFieldException e) {
          e.printStackTrace();
        }

        float durability = 0;
        try {
          final Field field = getField(parent.getClass(), "durability");
          field.setAccessible(true);
          durability = field.getFloat(parent);
        } catch (IllegalAccessException e) {
          e.printStackTrace();
        } catch (NoSuchFieldException e) {
          e.printStackTrace();
        }

        try {
          Block fake  = createProxy(parent);

          if (fake != null) {
            Block.byId[i] = fake;
          } else {
            Block.byId[i] = parent;
          }
          final Field strengthField = getField(fake.getClass(), "strength");
          strengthField.setAccessible(true);
          strengthField.setFloat(fake, strength);

          final Field durabilityField = getField(fake.getClass(), "durability");
          durabilityField.setAccessible(true);
          durabilityField.setFloat(fake, durability);

        } catch (Throwable t) {
          System.err.println("Error replacing : " + parent.getClass().getName());
View Full Code Here


  }

  public static void resetBlocks() {
    for (int i = 0; i < Block.byId.length; i++) {
      if (Block.byId[i] != null) {
        Block parent = Block.byId[i];
        if (parent instanceof WrappedMCBlock) {
          WrappedMCBlock wrapped = (WrappedMCBlock) parent;
          Block.byId[i] = null;
          Block.byId[i] = wrapped.getWrapped();
        }
View Full Code Here

    int id = block.getRawId();
    if (block instanceof CustomBlock) {
      id = ((CustomBlock) block).getBlockId();
    }
    // Access the protected strength field in Block
    Block mBlock = Block.byId[id];
    float hardness = 999999999f; // Probably useless safeguard
    try {
      Field field = Block.class.getDeclaredField("strength");
      field.setAccessible(true);
      hardness = field.getFloat(mBlock);
View Full Code Here

    }
    int data = block.getRawData();
    if (!originalHardness.containsKey(id, data)) {
      originalHardness.put(id, data, getHardness(block));
    }
    Block b = Block.byId[id];
    if (b instanceof WrappedMCBlock) {
      ((WrappedMCBlock) b).setHardness(hardness);
    }
    updateBlockAttributes(id, (short) data); // Invalidate cache
  }
View Full Code Here

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.getMaterial().isSolid());
  }
View Full Code Here

    else return AlmostBoolean.match(block.getMaterial().isSolid());
  }

  @Override
  public AlmostBoolean isBlockLiquid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.getMaterial().isLiquid());
  }
View Full Code Here

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.getMaterial().isSolid());
  }
View Full Code Here

    else return AlmostBoolean.match(block.getMaterial().isSolid());
  }

  @Override
  public AlmostBoolean isBlockLiquid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) return AlmostBoolean.MAYBE;
    else return AlmostBoolean.match(block.getMaterial().isLiquid());
  }
View Full Code Here

    } else return entityHeight;
  }

  @Override
  public AlmostBoolean isBlockSolid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) {
      return AlmostBoolean.MAYBE;
    }
    else {
      return AlmostBoolean.match(block.getMaterial().isSolid());
    }
  }
View Full Code Here

    }
  }

  @Override
  public AlmostBoolean isBlockLiquid(final int id) {
    final Block block = Block.e(id);
    if (block == null || block.getMaterial() == null) {
      return AlmostBoolean.MAYBE;
    }
    else {
      return AlmostBoolean.match(block.getMaterial().isLiquid());
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.server.v1_6_R1.Block

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.