Paper/src/main/java/net/minecraft/server/BlockIce.java

66 Zeilen
2.0 KiB
Java

package net.minecraft.server;
import java.util.Random;
2013-11-04 14:07:38 +01:00
public class BlockIce extends BlockHalfTransparent {
2013-11-04 14:07:38 +01:00
public BlockIce() {
super("ice", Material.ICE, false);
this.frictionFactor = 0.98F;
2013-11-04 14:07:38 +01:00
this.a(true);
2012-07-29 09:33:13 +02:00
this.a(CreativeModeTab.b);
}
2011-07-08 14:25:53 +02:00
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
2014-03-21 05:26:30 +01:00
entityhuman.a(StatisticList.MINE_BLOCK_COUNT[Block.b((Block) this)], 1);
2013-07-01 13:03:00 +02:00
entityhuman.a(0.025F);
2013-11-04 14:07:38 +01:00
if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
ItemStack itemstack = this.j(l);
2012-07-29 09:33:13 +02:00
if (itemstack != null) {
2013-11-04 14:07:38 +01:00
this.a(world, i, j, k, itemstack);
2012-07-29 09:33:13 +02:00
}
} else {
2013-07-01 13:03:00 +02:00
if (world.worldProvider.f) {
2013-03-13 23:33:27 +01:00
world.setAir(i, j, k);
2012-07-29 09:33:13 +02:00
return;
}
int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
2012-07-29 09:33:13 +02:00
2013-11-04 14:07:38 +01:00
this.b(world, i, j, k, l, i1);
Material material = world.getType(i, j - 1, k).getMaterial();
2012-07-29 09:33:13 +02:00
if (material.isSolid() || material.isLiquid()) {
2013-11-04 14:07:38 +01:00
world.setTypeUpdate(i, j, k, Blocks.WATER);
2012-07-29 09:33:13 +02:00
}
}
}
public int a(Random random) {
return 0;
}
2013-03-13 23:33:27 +01:00
public void a(World world, int i, int j, int k, Random random) {
2013-11-04 14:07:38 +01:00
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - this.k()) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), world.worldProvider.f ? Blocks.AIR : Blocks.STATIONARY_WATER).isCancelled()) {
return;
}
// CraftBukkit end
2013-07-01 13:03:00 +02:00
if (world.worldProvider.f) {
2013-03-13 23:33:27 +01:00
world.setAir(i, j, k);
2012-07-29 09:33:13 +02:00
return;
}
2013-11-04 14:07:38 +01:00
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setTypeUpdate(i, j, k, Blocks.STATIONARY_WATER);
}
}
2011-07-08 14:25:53 +02:00
2013-03-13 23:33:27 +01:00
public int h() {
2011-07-08 14:25:53 +02:00
return 0;
}
}