Repository navigation
Expand file tree
/
Copy pathDecoBlockLog.java
More file actions
78 lines (64 loc) · 2.85 KB
/
Copy pathDecoBlockLog.java
File metadata and controls
78 lines (64 loc) · 2.85 KB
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
package net.minecraft.src;
public class DecoBlockLog extends FCBlockLog
{
private Icon[] m_IconTreeSideArray;
private Icon[] m_IconTreeTopArray;
private Icon[] m_IconTrunkSideArray;
private Icon[] m_IconTrunkTopArray;
public DecoBlockLog(int id)
{
super(id);
this.setUnlocalizedName("log");
this.setStepSound(soundWoodFootstep);
this.SetCanBeCookedByKiln(true);
this.SetItemIndexDroppedWhenCookedByKiln(Item.coal.itemID);
this.SetItemDamageDroppedWhenCookedByKiln(1);
ItemAxe.SetAllAxesToBeEffectiveVsBlock(this);
}
public void OnDestroyedByFire(World world, int x, int y, int z)
{
dropBlockAsItem_do(world, x, y, z, new ItemStack(DecoModuleTweaks.decoItemAsh.itemID, 1, 0));
}
public float getBlockHardness(World world, int x, int y, int z)
{
float multiplier = 1;
int metadata = world.getBlockMetadata(x, y, z);
if ((metadata & 12) == 12) multiplier = 3;
if ((metadata & 3) == 1) return 1.3F * multiplier;
if ((metadata & 3) == 3) return 1.0F * multiplier;
return 1.5F * multiplier;
}
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public Icon getIcon(int side, int metadata)
{
int pos = metadata & 12;
int type = metadata & 3;
if (pos == 12)
{
if (side <= 1) return this.m_IconTrunkTopArray[type];
return this.m_IconTrunkSideArray[type];
}
return ((pos == 0 && (side == 1 || side == 0)) || (pos == 4 && (side == 5 || side == 4)) || (pos == 8 && (side == 2 || side == 3))) ? this.m_IconTrunkTopArray[type] : this.m_IconTreeSideArray[type];
}
/**
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
* is the only chance you get to register icons.
*/
public void registerIcons(IconRegister register)
{
this.m_IconTreeSideArray = new Icon[DecoUtilsStrings.TREE_SIDE_TEXTURE_PATHS.length];
this.m_IconTreeTopArray = new Icon[DecoUtilsStrings.TREE_TOP_TEXTURE_PATHS.length];
this.m_IconTrunkSideArray = new Icon[DecoUtilsStrings.TRUNK_SIDE_TEXTURE_PATHS.length];
this.m_IconTrunkTopArray = new Icon[DecoUtilsStrings.TRUNK_TOP_TEXTURE_PATHS.length];
for (int index = 0; index < this.m_IconTreeSideArray.length; index++)
{
this.m_IconTreeSideArray[index] = register.registerIcon(DecoUtilsStrings.TREE_SIDE_TEXTURE_PATHS[index]);
this.m_IconTreeTopArray[index] = register.registerIcon(DecoUtilsStrings.TREE_TOP_TEXTURE_PATHS[index]);
this.m_IconTrunkSideArray[index] = register.registerIcon(DecoUtilsStrings.TRUNK_SIDE_TEXTURE_PATHS[index]);
this.m_IconTrunkTopArray[index] = register.registerIcon(DecoUtilsStrings.TRUNK_TOP_TEXTURE_PATHS[index]);
}
super.registerIcons(register);
}
}