-
Notifications
You must be signed in to change notification settings - Fork 755
/
MultiBrickFancy.java
166 lines (153 loc) · 6.05 KB
/
MultiBrickFancy.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.*;
import net.minecraft.world.*;
import tconstruct.blocks.TConstructBlock;
public class MultiBrickFancy extends TConstructBlock
{
static String blockTextures[] = { "fancybrick_obsidian", "fancybrick_sandstone", "fancybrick_netherrack", "fancybrick_stone_refined", "fancybrick_iron", "fancybrick_gold", "fancybrick_lapis", "fancybrick_diamond", "fancybrick_redstone", "fancybrick_bone", "fancybrick_slime", "fancybrick_blueslime", "fancybrick_endstone", "fancybrick_obsidian_ingot", "fancybrick_stone", "road_stone" };
public MultiBrickFancy()
{
super(Material.rock, 3f, blockTextures);
}
// TODO getBlockHardness
@Override
public float getBlockHardness (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
return Blocks.obsidian.getBlockHardness(world, x, y, z);
case 1:
return Blocks.sandstone.getBlockHardness(world, x, y, z);
case 2:
return Blocks.netherrack.getBlockHardness(world, x, y, z);
case 4:
return Blocks.iron_block.getBlockHardness(world, x, y, z);
case 5:
return Blocks.gold_block.getBlockHardness(world, x, y, z);
case 6:
return Blocks.lapis_block.getBlockHardness(world, x, y, z);
case 7:
return Blocks.diamond_block.getBlockHardness(world, x, y, z);
case 8:
return Blocks.redstone_block.getBlockHardness(world, x, y, z);
case 9:
return 1.0F;
case 10:
return 1.5F;
case 11:
return 1.5F;
case 12:
return Blocks.end_stone.getBlockHardness(world, x, y, z);
case 13:
return Blocks.obsidian.getBlockHardness(world, x, y, z);
case 3:
case 14:
case 15:
return Blocks.stone.getBlockHardness(world, x, y, z);
default:
return blockHardness;
}
}
@Override
public float getExplosionResistance (Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ)
{
int meta = world.getBlockMetadata(x, y, z);
switch (meta)
{
case 0:
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 1:
return Blocks.sandstone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 2:
return Blocks.netherrack.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 4:
return Blocks.iron_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 5:
return Blocks.gold_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 6:
return Blocks.lapis_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 7:
return Blocks.diamond_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 8:
return Blocks.redstone_block.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 9:
return 1.0F;
case 10:
return 1.5F;
case 11:
return 1.5F;
case 12:
return Blocks.end_stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 13:
return Blocks.obsidian.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 3:
case 14:
case 15:
return Blocks.stone.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
default:
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
}
}
// TODO onEntityCollidedWithBlock
@Override
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
{
if (entity.motionY < 0)
entity.motionY *= -1.2F;
entity.fallDistance = 0;
}
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 10 || meta == 11)
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
return super.getCollisionBoundingBoxFromPool(world, x, y, z);
}
/*
* @Override public int getRenderType () { return BrickRender.model; }
*/
@Override
public boolean canProvidePower ()
{
return true;
}
@Override
public int isProvidingWeakPower (IBlockAccess world, int x, int y, int z, int side)
{
if (world.getBlockMetadata(x, y, z) == 8)
return 4;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons (IIconRegister iconRegister)
{
this.icons = new IIcon[textureNames.length];
for (int i = 0; i < this.icons.length; ++i)
{
this.icons[i] = iconRegister.registerIcon("tinker:bricks/" + textureNames[i]);
}
}
@Override
public boolean isNormalCube (IBlockAccess world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta != 8)
{
return true;
}
return super.isNormalCube(world, x, y, z);
}
}