mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-12 09:51:12 +01:00
Redstone torch fix
This commit is contained in:
parent
437025a179
commit
11590f49f0
1 changed files with 22 additions and 5 deletions
|
@ -7,6 +7,7 @@ import java.util.Random;
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
import org.bukkit.craftbukkit.block.CraftBlock;
|
import org.bukkit.craftbukkit.block.CraftBlock;
|
||||||
import org.bukkit.event.block.BlockRedstoneEvent;
|
import org.bukkit.event.block.BlockRedstoneEvent;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
public class BlockRedstoneTorch extends BlockTorch {
|
public class BlockRedstoneTorch extends BlockTorch {
|
||||||
|
@ -100,15 +101,22 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
|
||||||
BlockRedstoneEvent event = new BlockRedstoneEvent(block, flag ? 15 : 0, flag ? 0 : 15);
|
PluginManager man = ((WorldServer) world).getServer().getPluginManager();
|
||||||
((WorldServer) world).getServer().getPluginManager().callEvent(event);
|
int oldCurrent = this.a ? 15 : 0;
|
||||||
if ((event.getNewCurrent() != 0) == flag) {
|
BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
||||||
return;
|
|
||||||
}
|
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
if (this.a) {
|
if (this.a) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
|
// CraftBukkit start
|
||||||
|
if (oldCurrent != 0) {
|
||||||
|
event.setNewCurrent(0);
|
||||||
|
man.callEvent(event);
|
||||||
|
if (event.getNewCurrent() != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
world.b(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
|
||||||
if (this.a(world, i, j, k, true)) {
|
if (this.a(world, i, j, k, true)) {
|
||||||
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
|
world.a((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.k.nextFloat() - world.k.nextFloat()) * 0.8F);
|
||||||
|
@ -123,6 +131,15 @@ public class BlockRedstoneTorch extends BlockTorch {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!flag && !this.a(world, i, j, k, false)) {
|
} else if (!flag && !this.a(world, i, j, k, false)) {
|
||||||
|
// CraftBukkit start
|
||||||
|
if (oldCurrent != 15) {
|
||||||
|
event.setNewCurrent(15);
|
||||||
|
man.callEvent(event);
|
||||||
|
if (event.getNewCurrent() != 15) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
world.b(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
world.b(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue