-
Notifications
You must be signed in to change notification settings - Fork 497
/
PipeItemsStone.java
51 lines (43 loc) · 1.63 KB
/
PipeItemsStone.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* BuildCraft is open-source. It is distributed under the terms of the
* BuildCraft Open Source License. It grants rights to read, modify, compile or
* run the code. It does *NOT* grant the right to redistribute this software or
* its modifications in any form, binary or source, except if expressively
* granted by the copyright holder.
*/
package buildcraft.transport.pipes;
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraftforge.common.util.ForgeDirection;
public class PipeItemsStone extends Pipe {
public PipeItemsStone(int itemID) {
super(new PipeTransportItems(), itemID);
}
@Override
@SideOnly(Side.CLIENT)
public IIconProvider getIconProvider() {
return BuildCraftTransport.instance.pipeIconProvider;
}
@Override
public int getIconIndex(ForgeDirection direction) {
return PipeIconProvider.TYPE.PipeItemsStone.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 / 2.0F);
}
if (item.getSpeed() < TransportConstants.PIPE_NORMAL_SPEED) {
item.setSpeed(TransportConstants.PIPE_NORMAL_SPEED);
}
}
}