Package net.minecraft.server.v1_6_R3

Examples of net.minecraft.server.v1_6_R3.Connection


    } else return entityHeight;
  }

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


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

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

      }
      return null;
    }

    try {
      Block proxy;
      switch(use) {
        case None:
          proxy = (Block) enc.create(); break;
        case Id:
          proxy = (Block) enc.create(use.constructor, new Object[] {parent.id}); break;
        case IdAndStep:
          {
            boolean field2;
            if (parent instanceof BlockStepAbstract) {
              field2 = ((Boolean)getField(BlockStepAbstract.class, parent, "a")).booleanValue();
            } else if (parent instanceof BlockFurnace) {
              field2 = ((Boolean)getField(parent, "b")).booleanValue();
            } else if (parent instanceof BlockRedstoneTorch) {
              field2 = ((Boolean)getField(parent, "isOn")).booleanValue();
            } else if (parent instanceof BlockDiodeAbstract) {
              field2 = ((Boolean)getField(BlockDiodeAbstract.class, parent, "a")).booleanValue();
            } else {
              field2 = ((Boolean)getField(parent, "a")).booleanValue();
            }
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, field2});
          }
          break;
        case IdAndMaterial:
          proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, parent.material}); break;
        case IdAndTexture:
          proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, (Integer)getField(parent, "a")}); break;
        case IdTextureAndMaterial:
          proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, parent.material}); break;
        case IdMaterialAndFlag:
          proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, parent.material, false}); break;
        case IdAndName:
          {
            String name = (String) getField(parent, "a");
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, name});
          }
          break;
        case IdNameAndMaterial:
          {
            String name = (String) getField(parent, "a");
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, name, parent.material});
          }
          break;
        case IdNameMaterialAndDrop:
          {
            String name = (String) getField(BlockPressurePlateAbstract.class, parent, "a");
            int field4 = (Integer) getField(parent, "a");
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, name, parent.material, field4});
          }
          break;
        case IdBlockAndOther:
          {
            Block field2 = ((Block)getField(parent, "b"));
            int field3 = ((Integer)getField(parent, "c"));
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, field2, field3});
          }
          break;
        case IdMaterialAndDrop:
          {
            int field3 = ((Integer)getField(parent, "b"));
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, parent.material, field3});
          }
          break;
        case SignBlock:
          {
            Class field2 = ((Class)getField(parent, "a"));
            boolean field3 = ((Boolean)getField(parent, "b"));
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, field2, field3});
          }
          break;
        case IdTextureAndTicks:
          {
            boolean field3;
            if (parent instanceof BlockMinecartTrack || parent instanceof BlockRedstoneOre || parent instanceof BlockButtonAbstract || parent instanceof BlockPumpkin) {
              field3 = ((Boolean)getField(parent, "a")).booleanValue();
            } else {
              field3 = ((Boolean)getField(parent, "isTicking")).booleanValue();
            }
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, field3});
          }
          break;
        case PressurePlate:
          {
            EnumMobType field3 = ((EnumMobType)getField(parent, "a"));
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, field3, parent.material});
          }
          break;
        case HugeMushroom:
          {
            int field4 = ((Integer)getField(parent, "a"));
            proxy = (Block) enc.create(use.constructor, new Object[] {parent.id, parent.material, field4});
          }
          break;
        case BlockStem:
          {
            Block field2;
            if (parent instanceof BlockStem) {
              field2 = ((Block)getField(parent, "blockFruit"));
            } else {
              field2 = Block.COBBLESTONE;
            }
View Full Code Here

    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

    for (World world : worlds) {
      try {
        CraftWorld cw = (CraftWorld) world;
        Field worldServer = CraftWorld.class.getDeclaredField("world");
        worldServer.setAccessible(true);
        ChunkProviderServer cps = ((WorldServer) worldServer.get(cw)).chunkProviderServer;
        for (Chunk c : cps.chunks.values()) {
                    if (reset) {
            if (c.bukkitChunk instanceof SpoutCraftChunk) {
              ((SpoutCraftChunk) c.bukkitChunk).onReset();
            }
View Full Code Here

        iteminworldmanager.setGameMode(EnumGamemode.SURVIVAL);

        NPCSocket socket = new NPCSocket();
        NetworkManager netMgr;
        try {
            netMgr = new NPCNetworkManager(server.getLogger(), socket, "npc mgr", new Connection() {
                @Override
                public boolean a() {
                    return false;
                }
            }, server.H().getPrivate());
View Full Code Here

    } else if (method.getName().equals("b") && Arrays.deepEquals(method.getParameterTypes(), new Class[] {World.class, int.class, int.class, int.class, Entity.class})) {
      World world = (World) args[0];
      int x = (Integer) args[1];
      int y = (Integer) args[2];
      int z = (Integer) args[3];
      Entity e = (Entity) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null) {
        block.onEntityMoveAt(world.getWorld(), x, y, z, e.getBukkitEntity());
        return null;
      }
    } else if (method.getName().equals("interact")) {
      World world = (World) args[0];
      int x = (Integer) args[1];
      int y = (Integer) args[2];
      int z = (Integer) args[3];
      Entity human = (Entity) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null && human instanceof EntityPlayer) {
        return block.onBlockInteract(world.getWorld(), x, y, z, ((SpoutPlayer) human.getBukkitEntity()));
      }
    } else if (method.getName().equals("getDamage")) {
      EntityHuman human = (EntityHuman) args[0];
      World world = (World) args[1];
      int x = (Integer) args[2];
      int y = (Integer) args[3];
      int z = (Integer) args[4];
      org.getspout.spoutapi.material.CustomBlock block = getCustomBlock(world, x, y, z);
      if (block != null) {
        if (block instanceof org.getspout.spoutapi.material.CustomBlock) {
          SpoutPlayer player = (SpoutPlayer) human.getBukkitEntity();
          float def;
          SpoutItemStack inHand = player.getItemInHand() == null ? null : new SpoutItemStack(player.getItemInHand());
          org.getspout.spoutapi.material.Material item = inHand.getMaterial();

          float hardness = block.getHardness();
          if (hardness <= 0F) {
            return m.invoke(wrapped, args);
          }

          def = (!human.a(wrapped) ? 1.0F / hardness / 100.0F : human.a(wrapped, false) / hardness / 30.0F); //TODO EntityHuman.a(Block, boolean) appears to not make any use of the flag variable...

          if (!(item instanceof CustomItem)) {
            return def;
          }
View Full Code Here

TOP

Related Classes of net.minecraft.server.v1_6_R3.Connection

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.