-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDecoBlockGlass.java
61 lines (51 loc) · 1.67 KB
/
DecoBlockGlass.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
package net.minecraft.src;
import java.util.Random;
public class DecoBlockGlass extends BlockGlass implements DecoIBlockWithMetadata
{
public DecoBlockGlass(int id)
{
super(id, Material.glass, false);
this.setUnlocalizedName("glass");
this.setHardness(0.3F);
this.setStepSound(Block.soundGlassFootstep);
this.setCreativeTab(CreativeTabs.tabBlock);
this.SetPicksEffectiveOn();
}
public void onFallenUpon(World world, int x, int y, int z, Entity entity, float var6)
{
if (!world.isRemote && entity.fallDistance > 3.0F && DecoAddonManager.getConfigOption("enableGlassBreaking"))
{
world.playAuxSFX(2001, x, y, z, this.blockID);
world.destroyBlock(x, y, z, true);
}
}
public int idDropped(int metadata, Random random, int fortune)
{
if (!DecoAddonManager.getConfigOption("enableGlassShards")) return 0;
return DecoModuleTweaks.decoItemGlassShard.itemID;
}
public int quantityDropped(Random random)
{
if (!DecoAddonManager.getConfigOption("enableGlassShards")) return 0;
return random.nextInt(3);
}
public int quantityDroppedWithBonus(int fortune, Random random)
{
if (!DecoAddonManager.getConfigOption("enableGlassShards")) return 0;
return Math.min(4, this.quantityDropped(random) + random.nextInt(fortune + 1));
}
/**
* 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)
{
super.registerIcons(register);
Block.glass.registerIcons(register);
}
public boolean CanContainPistonPackingToFacing(World world, int x, int y, int z, int side)
{
return true;
}
}