mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
Reverted onPlace changes.
This commit is contained in:
parent
9d90839723
commit
7bdfea4820
@ -1,159 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockDiode extends Block {
|
||||
|
||||
public static final double[] a = new double[] { -0.0625D, 0.0625D, 0.1875D, 0.3125D};
|
||||
private static final int[] b = new int[] { 1, 2, 3, 4};
|
||||
private final boolean c;
|
||||
|
||||
protected BlockDiode(int i, boolean flag) {
|
||||
super(i, 6, Material.ORIENTABLE);
|
||||
this.c = flag;
|
||||
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return !world.e(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
|
||||
}
|
||||
|
||||
public boolean f(World world, int i, int j, int k) {
|
||||
return !world.e(i, j - 1, k) ? false : super.f(world, i, j, k);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
int l = world.getData(i, j, k);
|
||||
boolean flag = this.f(world, i, j, k, l);
|
||||
|
||||
if (this.c && !flag) {
|
||||
world.setTypeIdAndData(i, j, k, Block.DIODE_OFF.id, l);
|
||||
this.postPlace(world, i, j, k, this.id); // CraftBukkit - update indirect neighbors
|
||||
} else if (!this.c) {
|
||||
world.setTypeIdAndData(i, j, k, Block.DIODE_ON.id, l);
|
||||
this.postPlace(world, i, j, k, this.id); // CraftBukkit - update indirect neighbors
|
||||
if (!flag) {
|
||||
int i1 = (l & 12) >> 2;
|
||||
|
||||
world.c(i, j, k, Block.DIODE_ON.id, b[i1] * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int a(int i, int j) {
|
||||
return i == 0 ? (this.c ? 99 : 115) : (i == 1 ? (this.c ? 147 : 131) : 5);
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 15;
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
return this.a(i, 0);
|
||||
}
|
||||
|
||||
public boolean d(World world, int i, int j, int k, int l) {
|
||||
return this.a(world, i, j, k, l);
|
||||
}
|
||||
|
||||
public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
if (!this.c) {
|
||||
return false;
|
||||
} else {
|
||||
int i1 = iblockaccess.getData(i, j, k) & 3;
|
||||
|
||||
return i1 == 0 && l == 3 ? true : (i1 == 1 && l == 4 ? true : (i1 == 2 && l == 2 ? true : i1 == 3 && l == 5));
|
||||
}
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (!this.f(world, i, j, k)) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
} else {
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag = this.f(world, i, j, k, i1);
|
||||
int j1 = (i1 & 12) >> 2;
|
||||
|
||||
if (this.c && !flag) {
|
||||
world.c(i, j, k, this.id, b[j1] * 2);
|
||||
} else if (!this.c && flag) {
|
||||
world.c(i, j, k, this.id, b[j1] * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean f(World world, int i, int j, int k, int l) {
|
||||
int i1 = l & 3;
|
||||
|
||||
switch (i1) {
|
||||
case 0:
|
||||
return world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) || world.getTypeId(i, j, k + 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k + 1) > 0;
|
||||
|
||||
case 1:
|
||||
return world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) || world.getTypeId(i - 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i - 1, j, k) > 0;
|
||||
|
||||
case 2:
|
||||
return world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) || world.getTypeId(i, j, k - 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k - 1) > 0;
|
||||
|
||||
case 3:
|
||||
return world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) || world.getTypeId(i + 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i + 1, j, k) > 0;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
int l = world.getData(i, j, k);
|
||||
int i1 = (l & 12) >> 2;
|
||||
|
||||
i1 = i1 + 1 << 2 & 12;
|
||||
world.setData(i, j, k, i1 | l & 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isPowerSource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
|
||||
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
|
||||
|
||||
world.setData(i, j, k, l);
|
||||
boolean flag = this.f(world, i, j, k, l);
|
||||
|
||||
if (flag) {
|
||||
world.c(i, j, k, this.id, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) { // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
}
|
||||
|
||||
public void postBreak(World world, int i, int j, int k, int l) {
|
||||
if (this.c) {
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
}
|
||||
|
||||
super.postBreak(world, i, j, k, l);
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
return Item.DIODE.id;
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ public class BlockDragonEgg extends Block {
|
||||
super(i, j, Material.DRAGON_EGG);
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) { // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
world.c(i, j, k, this.id, this.d());
|
||||
}
|
||||
|
||||
|
@ -1,238 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BlockFluids extends Block {
|
||||
|
||||
protected BlockFluids(int i, Material material) {
|
||||
super(i, (material == Material.LAVA ? 14 : 12) * 16 + 13, material);
|
||||
float f = 0.0F;
|
||||
float f1 = 0.0F;
|
||||
|
||||
this.a(0.0F + f1, 0.0F + f, 0.0F + f1, 1.0F + f1, 1.0F + f, 1.0F + f1);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public static float d(int i) {
|
||||
if (i >= 8) {
|
||||
i = 0;
|
||||
}
|
||||
|
||||
float f = (float) (i + 1) / 9.0F;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
return i != 0 && i != 1 ? this.textureId + 1 : this.textureId;
|
||||
}
|
||||
|
||||
protected int g(World world, int i, int j, int k) {
|
||||
return world.getMaterial(i, j, k) != this.material ? -1 : world.getData(i, j, k);
|
||||
}
|
||||
|
||||
protected int b(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
if (iblockaccess.getMaterial(i, j, k) != this.material) {
|
||||
return -1;
|
||||
} else {
|
||||
int l = iblockaccess.getData(i, j, k);
|
||||
|
||||
if (l >= 8) {
|
||||
l = 0;
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean a(int i, boolean flag) {
|
||||
return flag && i == 0;
|
||||
}
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
|
||||
Material material = iblockaccess.getMaterial(i, j, k);
|
||||
|
||||
return material == this.material ? false : (l == 1 ? true : (material == Material.ICE ? false : super.b(iblockaccess, i, j, k, l)));
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int getDropType(int i, Random random, int j) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Vec3D c(IBlockAccess iblockaccess, int i, int j, int k) {
|
||||
Vec3D vec3d = Vec3D.create(0.0D, 0.0D, 0.0D);
|
||||
int l = this.b(iblockaccess, i, j, k);
|
||||
|
||||
for (int i1 = 0; i1 < 4; ++i1) {
|
||||
int j1 = i;
|
||||
int k1 = k;
|
||||
|
||||
if (i1 == 0) {
|
||||
j1 = i - 1;
|
||||
}
|
||||
|
||||
if (i1 == 1) {
|
||||
k1 = k - 1;
|
||||
}
|
||||
|
||||
if (i1 == 2) {
|
||||
++j1;
|
||||
}
|
||||
|
||||
if (i1 == 3) {
|
||||
++k1;
|
||||
}
|
||||
|
||||
int l1 = this.b(iblockaccess, j1, j, k1);
|
||||
int i2;
|
||||
|
||||
if (l1 < 0) {
|
||||
if (!iblockaccess.getMaterial(j1, j, k1).isSolid()) {
|
||||
l1 = this.b(iblockaccess, j1, j - 1, k1);
|
||||
if (l1 >= 0) {
|
||||
i2 = l1 - (l - 8);
|
||||
vec3d = vec3d.add((double) ((j1 - i) * i2), (double) ((j - j) * i2), (double) ((k1 - k) * i2));
|
||||
}
|
||||
}
|
||||
} else if (l1 >= 0) {
|
||||
i2 = l1 - l;
|
||||
vec3d = vec3d.add((double) ((j1 - i) * i2), (double) ((j - j) * i2), (double) ((k1 - k) * i2));
|
||||
}
|
||||
}
|
||||
|
||||
if (iblockaccess.getData(i, j, k) >= 8) {
|
||||
boolean flag = false;
|
||||
|
||||
if (flag || this.b(iblockaccess, i, j, k - 1, 2)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i, j, k + 1, 3)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i - 1, j, k, 4)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i + 1, j, k, 5)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i, j + 1, k - 1, 2)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i, j + 1, k + 1, 3)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i - 1, j + 1, k, 4)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || this.b(iblockaccess, i + 1, j + 1, k, 5)) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
vec3d = vec3d.b().add(0.0D, -6.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
|
||||
vec3d = vec3d.b();
|
||||
return vec3d;
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {
|
||||
Vec3D vec3d1 = this.c(world, i, j, k);
|
||||
|
||||
vec3d.a += vec3d1.a;
|
||||
vec3d.b += vec3d1.b;
|
||||
vec3d.c += vec3d1.c;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.material == Material.WATER ? 5 : (this.material == Material.LAVA ? 30 : 0);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
super.a(world, i, j, k, random);
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
|
||||
private void i(World world, int i, int j, int k) {
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
if (this.material == Material.LAVA) {
|
||||
boolean flag = false;
|
||||
|
||||
if (flag || world.getMaterial(i, j, k - 1) == Material.WATER) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || world.getMaterial(i, j, k + 1) == Material.WATER) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || world.getMaterial(i - 1, j, k) == Material.WATER) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || world.getMaterial(i + 1, j, k) == Material.WATER) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag || world.getMaterial(i, j + 1, k) == Material.WATER) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
if (l == 0) {
|
||||
world.setTypeId(i, j, k, Block.OBSIDIAN.id);
|
||||
} else if (l <= 4) {
|
||||
world.setTypeId(i, j, k, Block.COBBLESTONE.id);
|
||||
}
|
||||
|
||||
this.fizz(world, i, j, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void fizz(World world, int i, int j, int k) {
|
||||
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l) {
|
||||
world.a("largesmoke", (double) i + Math.random(), (double) j + 1.2D, (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
@ -77,11 +77,11 @@ public class BlockMinecartTrack extends Block {
|
||||
return world.e(i, j - 1, k);
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) { // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (!world.isStatic) {
|
||||
this.a(world, i, j, k, true);
|
||||
if (this.id == Block.GOLDEN_RAIL.id) {
|
||||
this.doPhysics(world, i, j, k, this.id); // CraftBukkit - Fix dupe with pistons
|
||||
//this.doPhysics(world, i, j, k, this.id); // CraftBukkit - Fix dupe with pistons
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) { // CraftBukkit
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) {
|
||||
this.g(world, i, j, k);
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public class BlockPumpkin extends Block {
|
||||
return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16));
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int m) { // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
super.postPlace(world, i, j, k, m); // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
|
||||
if (!world.isStatic && world.getServer().getServer().spawnAnimals) { // CraftBukkit - make snowmen obey spawning rules
|
||||
world.setTypeId(i, j, k, 0);
|
||||
|
@ -50,19 +50,15 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
if (world.getData(i, j, k) == 0) {
|
||||
super.onPlace(world, i, j, k);
|
||||
}
|
||||
// CraftBukkit start - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
super.postPlace(world, i, j, k, l);
|
||||
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
// CraftBukkit end
|
||||
if (this.isOn) {
|
||||
world.applyPhysics(i, j - 1, k, this.id);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
world.applyPhysics(i - 1, j, k, this.id);
|
||||
world.applyPhysics(i + 1, j, k, this.id);
|
||||
world.applyPhysics(i, j, k - 1, this.id);
|
||||
world.applyPhysics(i, j, k + 1, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
public void remove(World world, int i, int j, int k) {
|
||||
@ -120,7 +116,6 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
||||
this.postPlace(world, i, j, k, this.id); // CraftBukkit - update indirect neighbors
|
||||
if (this.a(world, i, j, k, true)) {
|
||||
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
|
||||
|
||||
@ -145,7 +140,6 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||
// CraftBukkit end
|
||||
|
||||
world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
||||
this.postPlace(world, i, j, k, this.id); // CraftBukkit - update indirect neighbors
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,8 @@ public class BlockRedstoneWire extends Block {
|
||||
}
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) { // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
super.postPlace(world, i, j, k, l); // CraftBukkit - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
if (!world.isStatic) {
|
||||
this.g(world, i, j, k);
|
||||
world.applyPhysics(i, j + 1, k, this.id);
|
||||
|
@ -1,75 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTNT extends Block {
|
||||
|
||||
public BlockTNT(int i, int j) {
|
||||
super(i, j, Material.TNT);
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
return i == 0 ? this.textureId + 2 : (i == 1 ? this.textureId + 1 : this.textureId);
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
super.onPlace(world, i, j, k);
|
||||
// CraftBukkit start - onPlace(World, int, int, int) -> postPlace(World, int, int, int, int)
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
super.postPlace(world, i, j, k, l);
|
||||
// CraftBukkit end
|
||||
if (world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
this.postBreak(world, i, j, k, 1);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (l > 0 && Block.byId[l].isPowerSource() && world.isBlockIndirectlyPowered(i, j, k)) {
|
||||
this.postBreak(world, i, j, k, 1);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public int a(Random random) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void wasExploded(World world, int i, int j, int k) {
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
|
||||
|
||||
entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
|
||||
world.addEntity(entitytntprimed);
|
||||
}
|
||||
|
||||
public void postBreak(World world, int i, int j, int k, int l) {
|
||||
if (!world.isStatic) {
|
||||
if ((l & 1) == 0) {
|
||||
this.a(world, i, j, k, new ItemStack(Block.TNT.id, 1, 0));
|
||||
} else {
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
|
||||
|
||||
world.addEntity(entitytntprimed);
|
||||
world.makeSound(entitytntprimed, "random.fuse", 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
if (entityhuman.Q() != null && entityhuman.Q().id == Item.FLINT_AND_STEEL.id) {
|
||||
world.setRawData(i, j, k, 1);
|
||||
}
|
||||
|
||||
super.attack(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman) {
|
||||
return super.interact(world, i, j, k, entityhuman);
|
||||
}
|
||||
|
||||
protected ItemStack a_(int i) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class BlockTorch extends Block {
|
||||
|
||||
protected BlockTorch(int i, int j) {
|
||||
super(i, j, Material.ORIENTABLE);
|
||||
this.a(true);
|
||||
}
|
||||
|
||||
public AxisAlignedBB e(World world, int i, int j, int k) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
private boolean g(World world, int i, int j, int k) {
|
||||
if (world.b(i, j, k, true)) {
|
||||
return true;
|
||||
} else {
|
||||
int l = world.getTypeId(i, j, k);
|
||||
|
||||
return l == Block.FENCE.id || l == Block.NETHER_FENCE.id;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canPlace(World world, int i, int j, int k) {
|
||||
return world.b(i - 1, j, k, true) ? true : (world.b(i + 1, j, k, true) ? true : (world.b(i, j, k - 1, true) ? true : (world.b(i, j, k + 1, true) ? true : this.g(world, i, j - 1, k))));
|
||||
}
|
||||
|
||||
public void postPlace(World world, int i, int j, int k, int l) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
|
||||
if (l == 1 && this.g(world, i, j - 1, k)) {
|
||||
i1 = 5;
|
||||
}
|
||||
|
||||
if (l == 2 && world.b(i, j, k + 1, true)) {
|
||||
i1 = 4;
|
||||
}
|
||||
|
||||
if (l == 3 && world.b(i, j, k - 1, true)) {
|
||||
i1 = 3;
|
||||
}
|
||||
|
||||
if (l == 4 && world.b(i + 1, j, k, true)) {
|
||||
i1 = 2;
|
||||
}
|
||||
|
||||
if (l == 5 && world.b(i - 1, j, k, true)) {
|
||||
i1 = 1;
|
||||
}
|
||||
|
||||
world.setData(i, j, k, i1);
|
||||
}
|
||||
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
super.a(world, i, j, k, random);
|
||||
if (world.getData(i, j, k) == 0) {
|
||||
this.onPlace(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlace(World world, int i, int j, int k) {
|
||||
/* // CraftBukkit start - we do this, correctly, in postPlace
|
||||
if (world.b(i - 1, j, k, true)) {
|
||||
world.setData(i, j, k, 1);
|
||||
} else if (world.b(i + 1, j, k, true)) {
|
||||
world.setData(i, j, k, 2);
|
||||
} else if (world.b(i, j, k - 1, true)) {
|
||||
world.setData(i, j, k, 3);
|
||||
} else if (world.b(i, j, k + 1, true)) {
|
||||
world.setData(i, j, k, 4);
|
||||
} else if (this.g(world, i, j - 1, k)) {
|
||||
world.setData(i, j, k, 5);
|
||||
}
|
||||
|
||||
this.h(world, i, j, k);
|
||||
*/ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void doPhysics(World world, int i, int j, int k, int l) {
|
||||
if (this.h(world, i, j, k)) {
|
||||
int i1 = world.getData(i, j, k);
|
||||
boolean flag = false;
|
||||
|
||||
if (!world.b(i - 1, j, k, true) && i1 == 1) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.b(i + 1, j, k, true) && i1 == 2) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.b(i, j, k - 1, true) && i1 == 3) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!world.b(i, j, k + 1, true) && i1 == 4) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (!this.g(world, i, j - 1, k) && i1 == 5) {
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean h(World world, int i, int j, int k) {
|
||||
if (!this.canPlace(world, i, j, k)) {
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
this.b(world, i, j, k, world.getData(i, j, k), 0);
|
||||
world.setTypeId(i, j, k, 0);
|
||||
}
|
||||
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
|
||||
int l = world.getData(i, j, k) & 7;
|
||||
float f = 0.15F;
|
||||
|
||||
if (l == 1) {
|
||||
this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
|
||||
} else if (l == 2) {
|
||||
this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
|
||||
} else if (l == 3) {
|
||||
this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
|
||||
} else if (l == 4) {
|
||||
this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
|
||||
} else {
|
||||
f = 0.1F;
|
||||
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
|
||||
}
|
||||
|
||||
return super.a(world, i, j, k, vec3d, vec3d1);
|
||||
}
|
||||
}
|
@ -61,7 +61,6 @@ public class ItemRedstone extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
Block.REDSTONE_WIRE.postPlace( world, i, j, k, Block.REDSTONE_WIRE.id); // Call postPlace since it is now used.
|
||||
world.update(i, j, k, Block.REDSTONE_WIRE.id); // Must take place after BlockPlaceEvent, we need to update all other blocks.
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -83,8 +83,6 @@ public class TileEntityPiston extends TileEntity {
|
||||
this.i();
|
||||
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
|
||||
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
|
||||
Block block = Block.byId[this.world.getTypeId(this.x, this.y, this.z)];
|
||||
if (block != null) block.postPlace(this.world, this.x, this.y, this.z, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,8 +97,6 @@ public class TileEntityPiston extends TileEntity {
|
||||
this.i();
|
||||
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
|
||||
this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
|
||||
Block block = Block.byId[this.world.getTypeId(this.x, this.y, this.z)];
|
||||
if (block != null) block.postPlace(this.world, this.x, this.y, this.z, 0);
|
||||
}
|
||||
} else {
|
||||
this.f += 0.5F;
|
||||
|
Loading…
Reference in New Issue
Block a user