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
|
package darkknight.jewelrycraft.block;
import java.util.Random;
import darkknight.jewelrycraft.tileentity.TileEntityMidasTouch;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockMidasTouch extends BlockContainer {
protected BlockMidasTouch(Material mat) {
super(mat);
setHarvestLevel("pickaxe", 2);
}
@Override
public TileEntity createNewTileEntity(World world, int var2) {
return new TileEntityMidasTouch();
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess iblockaccess,
int i, int j, int k, int l) {
return false;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public int getRenderType() {
return -1;
}
@Override
public int quantityDropped(Random rand) {
return 0;
}
@Override
public Item getItemDropped(int id, Random rand, int size) {
return Items.gold_nugget;
}
@Override
public void onBlockHarvested(World world, int i, int j, int k,
int meta, EntityPlayer player) {
// Do nothing
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x,
int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (((TileEntityMidasTouch) tile).target != null)
this.setBlockBounds(0.5f
- ((TileEntityMidasTouch) tile).target.width
/ 2,
0F,
0.5f - ((TileEntityMidasTouch) tile).target.width
/ 2,
0.5f + ((TileEntityMidasTouch) tile).target.width
/ 2,
((TileEntityMidasTouch) tile).target.height,
0.5f + ((TileEntityMidasTouch) tile).target.width
/ 2);
}
@Override
public void registerBlockIcons(IIconRegister icon) {
blockIcon = icon.registerIcon("minecraft:gold_block");
}
}
|