Package net.minecraft.world

Examples of net.minecraft.world.World


  }

  @SuppressWarnings({ "rawtypes", "unchecked" })
  public static void ensureValidNetwork(IConduit conduit) {
    TileEntity te = conduit.getBundle().getEntity();
    World world = te.getWorldObj();
    Collection<? extends IConduit> connections = ConduitUtil.getConnectedConduits(world, te.xCoord, te.yCoord, te.zCoord, conduit.getBaseConduitType());

    if(reuseNetwork(conduit, connections, world)) {
      return;
    }
View Full Code Here


 

  @Override
  public boolean onBlockActivated(EntityPlayer player, RaytraceResult res, List<RaytraceResult> all) {

    World world = getBundle().getEntity().getWorldObj();
    if(!world.isRemote) {

      DyeColor col = DyeColor.getColorFromDye(player.getCurrentEquippedItem());
      if(col != null && res.component != null) {
        setSignalColor(res.component.dir, col);
        return true;
      } else if(ConduitUtil.isToolEquipped(player)) {

        if(res != null && res.component != null) {
          ForgeDirection connDir = res.component.dir;
          ForgeDirection faceHit = ForgeDirection.getOrientation(res.movingObjectPosition.sideHit);

          boolean colorHit = false;
          if(all != null && containsExternalConnection(connDir)) {
            for (RaytraceResult rtr : all) {
              if(rtr != null && rtr.component != null && COLOR_CONTROLLER_ID.equals(rtr.component.data)) {
                colorHit = true;
              }
            }
          }

          if(colorHit) {
            setSignalColor(connDir, DyeColor.getNext(getSignalColor(connDir)));
            return true;

          } else if(connDir == ForgeDirection.UNKNOWN || connDir == faceHit) {

            BlockCoord loc = getLocation().getLocation(faceHit);
            Block id = world.getBlock(loc.x, loc.y, loc.z);
            if(id == EnderIO.blockConduitBundle) {
              IRedstoneConduit neighbour = ConduitUtil.getConduit(world, loc.x, loc.y, loc.z, IRedstoneConduit.class);
              if(neighbour != null && neighbour.getConnectionMode(faceHit.getOpposite()) == ConnectionMode.DISABLED) {
                neighbour.setConnectionMode(faceHit.getOpposite(), ConnectionMode.NOT_SET);
              }
View Full Code Here

    if(block == null) {
      return false;
    }

    World world = getBundle().getEntity().getWorldObj();
    TileEntity te = world.getTileEntity(loc.x, loc.y, loc.z);

    Collection<Class<?>> conectableInterfaces = getConectableInterfaces();
    for(Class<?> conectable : conectableInterfaces) {
      if( (te != null && conectable.isAssignableFrom(te.getClass()) ) || (block != null && conectable.isAssignableFrom(block.getClass()))) {
        return true;
View Full Code Here

      System.out.println("RedstoneConduitNetwork.notifyNeigborsOfSignalUpdate: NULL BUNDLE!!!!");
      return;
    }
    TileEntity te = con.getBundle().getEntity();

    World worldObj = te.getWorldObj();
    worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);

    // Need to notify neighbours neighbours for changes to  signals
    if(signal != null /*&& signal.strength >= 15 && signal.x == te.xCoord && signal.y == te.yCoord && signal.z == te.zCoord*/) {
      if(worldObj.getBlock(te.xCoord + 1, te.yCoord, te.zCoord).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord + 1, te.yCoord, te.zCoord,  EnderIO.blockConduitBundle);
      }
      if(worldObj.getBlock(te.xCoord - 1, te.yCoord, te.zCoord).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord - 1, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
      }
      if(worldObj.getBlock(te.xCoord, te.yCoord + 1, te.zCoord).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord + 1, te.zCoord, EnderIO.blockConduitBundle);
      }
      if(worldObj.getBlock(te.xCoord, te.yCoord - 1, te.zCoord).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord - 1, te.zCoord, EnderIO.blockConduitBundle);
      }
      if(worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord + 1).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord + 1, EnderIO.blockConduitBundle);
      }
      if(worldObj.getBlock(te.xCoord, te.yCoord, te.zCoord - 1).isNormalCube()) {
        worldObj.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord - 1, EnderIO.blockConduitBundle);
      }
    }

  }
View Full Code Here

  }

  @Override
  @Method(modid = "appliedenergistics2")
  public boolean canConnectToExternal(ForgeDirection dir, boolean ignoreConnectionMode) {
    World world = getBundle().getWorld();
    BlockCoord pos = getLocation();
    TileEntity te = world.getTileEntity(pos.x + dir.offsetX, pos.y + dir.offsetY, pos.z + dir.offsetZ);

    if(!ignoreConnectionMode && getConnectionMode(dir) == ConnectionMode.DISABLED) {
      return false;
    }
View Full Code Here

    return false;
  }

  @Override
  public void updateNetwork() {
    World world = getBundle().getEntity().getWorldObj();
    if(world != null) {
      updateNetwork(world);
    }
  }
View Full Code Here

    return network.getSignals();
  }

  @Override
  public boolean onNeighborBlockChange(Block blockId) {   
    World world = getBundle().getEntity().getWorldObj();
    if(world.isRemote) {
      return false;
    }
    boolean res = super.onNeighborBlockChange(blockId);
    if(network == null || network.updatingNetwork) {
View Full Code Here

    }
  }

  //returns 16 for string power inputs
  protected int getExternalPowerLevel(ForgeDirection dir) {
    World world = getBundle().getEntity().getWorldObj();
    BlockCoord loc = getLocation();
    loc = loc.getLocation(dir);

    int strong = world.isBlockProvidingPowerTo(loc.x, loc.y, loc.z, dir.ordinal());
    if(strong > 0) {
      return 16;
    }

    int res = world.getIndirectPowerLevelTo(loc.x, loc.y, loc.z, dir.ordinal());
    if(res < 15 && world.getBlock(loc.x, loc.y, loc.z) == Blocks.redstone_wire) {
      int wireIn = world.getBlockMetadata(loc.x, loc.y, loc.z);
      res = Math.max(res, wireIn);
    }
    return res;
  }
View Full Code Here

    }
    return res;
  }

  protected int[] getExternalBundledPowerLevel(ForgeDirection dir) {
    World world = getBundle().getEntity().getWorldObj();
    BlockCoord loc = getLocation();
    loc = loc.getLocation(dir);

    Block block = world.getBlock(loc.x, loc.y, loc.z);
    if(block instanceof IRedNetOutputNode) {
      return ((IRedNetOutputNode) block).getOutputValues(world, loc.x, loc.y, loc.z, dir.getOpposite());
    }

    return null;
View Full Code Here

    }
    return result;
  }

  private boolean isRemote(ItemConduit itemConduit) {
    World world = itemConduit.getBundle().getEntity().getWorldObj();
    if(world != null && world.isRemote) {
      return true;
    }
    return false;
  }
View Full Code Here

TOP

Related Classes of net.minecraft.world.World

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.