/
NLeavesNocolor.java
128 lines (111 loc) · 3.75 KB
/
NLeavesNocolor.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
package mods.natura.blocks.trees;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import mods.natura.Natura;
import mods.natura.common.NContent;
import mods.natura.common.NaturaTab;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class NLeavesNocolor extends NLeaves
{
public NLeavesNocolor()
{
super();
this.setCreativeTab(NaturaTab.tab);
}
@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons (IIconRegister iconRegister)
{
String[] textureNames = new String[] { "sakura", "ghostwood", "bloodwood", "willow" };
this.fastIcons = new IIcon[textureNames.length];
this.fancyIcons = new IIcon[textureNames.length];
for (int i = 0; i < this.fastIcons.length; i++)
{
this.fastIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fast");
this.fancyIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fancy");
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int metadata)
{
int meta = metadata % 4;
if (field_150121_P)
return fancyIcons[meta];
else
return fastIcons[meta];
}
@SideOnly(Side.CLIENT)
public int getBlockColor ()
{
return 16777215;
}
@SideOnly(Side.CLIENT)
/**
* Returns the color this block should be rendered. Used by leaves.
*/
public int getRenderColor (int par1)
{
return 16777215;
}
@SideOnly(Side.CLIENT)
/**
* Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
* when first determining what to render.
*/
public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return 16777215;
}
public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face)
{
return metadata % 4 == 0 ? this.getFlammability(world, x, y, z, face) : 0;
}
public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face)
{
return metadata % 4 == 0 ? this.getFireSpreadSpeed(world, x, y, z, face) : 0;
}
public int damageDropped (int meta)
{
if (meta % 4 == 3)
return 4;
return (meta & 3) + 3;
}
@Override
public Item getItemDropped (int meta, Random random, int fortune)
{
if (meta % 4 == 3)
return NContent.rareSapling;
return NContent.floraSapling;
}
@Override
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int metadata, int fortune)
{
ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
if (metadata % 4 == 2 && Natura.random.nextInt(40 - fortune*10) == 0)
ret.add(new ItemStack(Items.redstone));
return ret;
}
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
par3List.add(new ItemStack(par1, 1, 2));
par3List.add(new ItemStack(par1, 1, 3));
}
public int getLightOpacity (World world, int x, int y, int z)
{
return this.getLightOpacity();
}
}