-
Notifications
You must be signed in to change notification settings - Fork 497
/
ItemBuildCraft.java
57 lines (48 loc) · 1.81 KB
/
ItemBuildCraft.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
52
53
54
55
56
57
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
* <p/>
* 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.core.lib.items;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import buildcraft.core.BCCreativeTab;
import buildcraft.core.lib.utils.IModelRegister;
import buildcraft.core.lib.utils.ModelHelper;
public class ItemBuildCraft extends Item implements IModelRegister {
private boolean passSneakClick = false;
protected String textureName = null;
public ItemBuildCraft() {
this(BCCreativeTab.get("main"));
}
public ItemBuildCraft(CreativeTabs creativeTab) {
super();
setCreativeTab(creativeTab);
}
/** Sets the custom name (can use slashes for folders) for the model location. */
public ItemBuildCraft setTextureLocation(String name) {
textureName = name;
return this;
}
public Item setPassSneakClick(boolean passClick) {
this.passSneakClick = passClick;
return this;
}
@Override
public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) {
return passSneakClick;
}
@Override
@SideOnly(Side.CLIENT)
public void registerModels() {
if (textureName == null) {
ModelHelper.registerItemModel(this, 0, "");
} else {
ModelHelper.registerItemModel(this, 0, textureName, "");
}
}
}