Package buildcraft.transport.pipes

Source Code of buildcraft.transport.pipes.PipeItemsQuartz

/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.transport.pipes;

import net.minecraft.item.Item;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import net.minecraftforge.common.util.ForgeDirection;

import buildcraft.BuildCraftTransport;
import buildcraft.api.core.IIconProvider;
import buildcraft.transport.Pipe;
import buildcraft.transport.PipeIconProvider;
import buildcraft.transport.PipeTransportItems;
import buildcraft.transport.TransportConstants;
import buildcraft.transport.TravelingItem;
import buildcraft.transport.pipes.events.PipeEventItem;

public class PipeItemsQuartz extends Pipe {

  public PipeItemsQuartz(Item item) {
    super(new PipeTransportItems(), item);

  }

  @Override
  @SideOnly(Side.CLIENT)
  public IIconProvider getIconProvider() {
    return BuildCraftTransport.instance.pipeIconProvider;
  }

  @Override
  public int getIconIndex(ForgeDirection direction) {
    return PipeIconProvider.TYPE.PipeItemsQuartz.ordinal();
  }

  public void eventHandler(PipeEventItem.AdjustSpeed event) {
    event.handled = true;
    TravelingItem item = event.item;

    if (item.getSpeed() > TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(item.getSpeed() - TransportConstants.PIPE_NORMAL_SPEED / 4.0F);
    }

    if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) {
      item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
    }
  }
}
TOP

Related Classes of buildcraft.transport.pipes.PipeItemsQuartz

TOP
Copyright © 2018 www.massapi.com. 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.