Package net.minecraft.world

Examples of net.minecraft.world.World


  //      if (this == Blocks.yellow_flower)  return Plains;       
  //      return Plains;
  //  }

  protected boolean plantFromInventory(TileFarmStation farm, BlockCoord bc, IPlantable plantable) {
    World worldObj = farm.getWorldObj();
    if(canPlant(worldObj, bc, plantable) && farm.takeSeedFromSupplies(bc) != null) {
      return plant(farm, worldObj, bc, plantable);
    }
    return false;
  }
View Full Code Here


    if(!farm.hasHoe()) {
      farm.setNotification(TileFarmStation.NOTIFICATION_NO_HOE);
      return null;
    }

    World worldObj = farm.getWorldObj();
    List<EntityItem> result = new ArrayList<EntityItem>();

    ItemStack removedPlantable = null;

    ArrayList<ItemStack> drops = block.getDrops(worldObj, bc.x, bc.y, bc.z, meta, farm.getMaxLootingValue());
    farm.damageHoe(1, bc);
    farm.actionPerformed(false);
    boolean removed = false;
    if(drops != null) {
      for (ItemStack stack : drops) {
        if(stack != null && !removed && isPlantableForBlock(stack, block)) {
          stack.stackSize--;
          removed = true;
          removedPlantable = stack.copy();
          if(stack.stackSize > 0) {
            result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, stack.copy()));
          }
        } else {
          result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, stack.copy()));
        }
      }
    }

    if(removed) {
      if(!plant(farm, worldObj, bc, (IPlantable) removedPlantable.getItem())) {
        result.add(new EntityItem(worldObj, bc.x + 0.5, bc.y + 0.5, bc.z + 0.5, removedPlantable.copy()));
        worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
      }
    } else {
      worldObj.setBlock(bc.x, bc.y, bc.z, Blocks.air, 0, 1 | 2);
    }

    return new HarvestResult(result, bc);
  }
View Full Code Here

  @Override
  public void onAddedToBundle() {

    TileEntity te = bundle.getEntity();
    World world = te.getWorldObj();

    conduitConnections.clear();
    for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
      IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
      if(neighbour != null && neighbour.canConnectToConduit(dir.getOpposite(), this)) {
View Full Code Here

  }

  @Override
  public void onRemovedFromBundle() {
    TileEntity te = bundle.getEntity();
    World world = te.getWorldObj();

    for (ForgeDirection dir : conduitConnections) {
      IConduit neighbour = ConduitUtil.getConduit(world, te, dir, getBaseConduitType());
      if(neighbour != null) {
        neighbour.conduitConnectionRemoved(dir.getOpposite());
      }
    }
    conduitConnections.clear();

    if(!externalConnections.isEmpty()) {
      world.notifyBlocksOfNeighborChange(te.xCoord, te.yCoord, te.zCoord, EnderIO.blockConduitBundle);
    }
    externalConnections.clear();

    AbstractConduitNetwork<?, ?> network = getNetwork();
    if(network != null) {
View Full Code Here

    conType = ConTypeEnum.values()[ordinal];
  }

  @SuppressWarnings("unchecked")
  protected T getTileCasted(MessageContext ctx) {
    World world = getWorld(ctx);
    if(world == null) {
      return null;
    }
    TileEntity te = world.getTileEntity(x, y, z);
    if( ! (te instanceof IConduitBundle)) {
      return null;
    }
   
    IConduitBundle bundle = (IConduitBundle)te;
View Full Code Here

    }
  }

  @Override
  public void onUpdateEntity(IConduit conduit) {
    World world = conduit.getBundle().getEntity().getWorldObj();
    if(world == null) {
      return;
    }
    if(world.isRemote) {
      return;
    }

    long curTime = world.getTotalWorldTime();
    if(curTime > 0 && curTime != timeAtLastApply) {
      timeAtLastApply = curTime;
      ConduitNetworkTickHandler.instance.addListener(tickHandler);
    }
View Full Code Here

    }
    return false;
  }

  public IFluidHandler getTankContainer(BlockCoord bc) {
    World w = getWorld();
    if(w == null) {
      return null;
    }
    TileEntity te = w.getTileEntity(bc.x, bc.y, bc.z);
    if(te instanceof IFluidHandler) {
      if(te instanceof IPipeTile) {
        if(((IPipeTile) te).getPipeType() != PipeType.FLUID) {
          return null;
        }
View Full Code Here

    return powerReceptors.values();
  }

  @Override
  public void onUpdateEntity(IConduit conduit) {
    World world = conduit.getBundle().getEntity().getWorldObj();
    if(world == null) {
      return;
    }
    if(world.isRemote) {
      return;
    }
    long curTime = world.getTotalWorldTime();
    if(curTime != timeAtLastApply) {
      timeAtLastApply = curTime;
      powerManager.applyRecievedPower();
    }
  }
View Full Code Here

  }

  @Override
  public IPowerInterface getExternalPowerReceptor(ForgeDirection direction) {
    TileEntity te = bundle.getEntity();
    World world = te.getWorldObj();
    if(world == null) {
      return null;
    }
    TileEntity test = world.getTileEntity(te.xCoord + direction.offsetX, te.yCoord + direction.offsetY, te.zCoord + direction.offsetZ);
    if(test == null) {
      return null;
    }
    if(test instanceof IConduitBundle) {
      return null;
View Full Code Here

    inputLocked = false;
  }

  @Override
  public void onUpdateEntity(IConduit conduit) {
    World world = conduit.getBundle().getEntity().getWorldObj();
    if(world == null) {
      return;
    }
    if(world.isRemote || liquidType == null) {
      return;
    }

    long curTime = world.getTotalWorldTime();
    if(curTime > 0 && curTime != timeAtLastApply) {
      timeAtLastApply = curTime;
      ConduitNetworkTickHandler.instance.addListener(tickHandler);
    }
  }
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.