Package net.minecraft.tileentity

Examples of net.minecraft.tileentity.TileEntity


  }

  /* IFluidHandler Interaction */
  public static FluidStack extractFluidFromAdjacentFluidHandler(TileEntity tile, int side, int maxDrain, boolean doDrain) {

    TileEntity handler = BlockHelper.getAdjacentTileEntity(tile, side);

    return handler instanceof IFluidHandler ? ((IFluidHandler) handler).drain(ForgeDirection.VALID_DIRECTIONS[side ^ 1], maxDrain, doDrain) : null;
  }
View Full Code Here


    return handler instanceof IFluidHandler ? ((IFluidHandler) handler).drain(ForgeDirection.VALID_DIRECTIONS[side ^ 1], maxDrain, doDrain) : null;
  }

  public static int insertFluidIntoAdjacentFluidHandler(TileEntity tile, int side, FluidStack fluid, boolean doFill) {

    TileEntity handler = BlockHelper.getAdjacentTileEntity(tile, side);

    return handler instanceof IFluidHandler ? ((IFluidHandler) handler).fill(ForgeDirection.VALID_DIRECTIONS[side ^ 1], fluid, doFill) : 0;
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public <T> T getTileEntity(World world, Class<T> targetClass) {

    TileEntity te = world.getTileEntity(x, y, z);
    if (targetClass.isInstance(te)) {
      return (T) te;
    } else {
      return null;
    }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public static <T> T getTileEntityRaw(World world, int x, int y, int z, Class<T> targetClass) {

    TileEntity te = getTileEntityRaw(world, x, y, z);
    if (targetClass.isInstance(te)) {
      return (T) te;
    } else {
      return null;
    }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public static <T> T getAdjacentTileEntity(TileEntity start, ForgeDirection direction, Class<T> targetClass) {

    TileEntity te = getAdjacentTileEntity(start, direction);
    if (targetClass.isInstance(te)) {
      return (T) te;
    } else {
      return null;
    }
View Full Code Here

        Log.warn(t, "Can't get inventory name for %s", cls);
      }
    }

    if (target instanceof TileEntity) {
      TileEntity te = (TileEntity)target;

      try {
        String mapping = getClassToNameMap().get(cls);
        if (!Strings.isNullOrEmpty(mapping)) return mapping;
      } catch (Throwable t) {
        Log.warn(t, "Failed to map class %s to name", cls);
      }

      try {
        Block block = te.getBlockType();
        if (block != null) {
          int dmg = te.getBlockMetadata();

          ItemStack is = new ItemStack(block, 1, dmg);
          try {
            String name = is.getDisplayName();
            if (!Strings.isNullOrEmpty(name)) return name;
View Full Code Here

    return (IPeripheral)Proxy.newProxyInstance(targetClass.getClassLoader(), interfaces, handler);
  }

  @Override
  public IPeripheral getPeripheral(World world, int x, int y, int z, int side) {
    TileEntity te = world.getTileEntity(x, y, z);
    if (te == null) return null;

    IPeripheralFactory<TileEntity> factory = getFactoryForClass(te.getClass());

    return factory.getPeripheral(te, side);
  }
View Full Code Here

    @ForgeSubscribe
    public void onPaint(PaintEvent event)
    {
        if (!(Block.blocksList[event.world.getBlockId(event.x, event.y, event.z)] instanceof BlockWireBase))
            return;
        TileEntity te = event.world.getBlockTileEntity(event.x, event.y, event.z);
        if (event.color != ((TileEntityConductorBase) te).getFrequency().getIndex())
        {
            ((TileEntityConductorBase) event.world.getBlockTileEntity(event.x, event.y, event.z)).setFrequency((byte) event.color);
           
View Full Code Here

        super.updateEntity();
       
        if (!this.worldObj.isRemote)
        {
            ForgeDirection inputDirection = ForgeDirection.getOrientation(this.getBlockMetadata() + 2);
            TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), inputDirection);
           
            if (inputTile instanceof INetworkProvider)
                this.network = ((INetworkProvider) inputTile).getNetwork();
            else
                this.network = null;
View Full Code Here

    {
        super.updateEntity();
       
        if (!this.worldObj.isRemote && this.ticks % 3 == 0)
        {
            TileEntity inputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), this.input);
           
            // Check if requesting power on output
            TileEntity outputTile = VectorHelper.getTileEntityFromSide(this.worldObj, new Vector3(this), this.output);
           
            this.inputNetwork = ElectricityHelper.getNetworkFromTileEntity(inputTile, this.input);
            this.outputNetwork = ElectricityHelper.getNetworkFromTileEntity(outputTile, this.output);
           
            PacketManager.sendPacketToClients(this.getDescriptionPacket(), this.worldObj, new Vector3(this), 12);
View Full Code Here

TOP

Related Classes of net.minecraft.tileentity.TileEntity

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.