mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 10:06:11 +03:00
51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneTorch.java
|
|
@@ -6,6 +6,9 @@
|
|
import java.util.Map;
|
|
import java.util.Random;
|
|
import javax.annotation.Nullable;
|
|
+
|
|
+import org.bukkit.event.block.BlockRedstoneEvent;
|
|
+
|
|
import net.minecraft.block.state.IBlockState;
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
@@ -120,10 +123,23 @@
|
|
list.remove(0);
|
|
}
|
|
|
|
+ org.bukkit.plugin.PluginManager manager = worldIn.getServer().getPluginManager();
|
|
+ org.bukkit.block.Block block = worldIn.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ());
|
|
+ int oldCurrent = this.isOn ? 15 : 0;
|
|
+
|
|
+ BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent);
|
|
+
|
|
if (this.isOn)
|
|
{
|
|
if (flag)
|
|
{
|
|
+ if (oldCurrent != 0) {
|
|
+ event.setNewCurrent(0);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 0) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
worldIn.setBlockState(pos, Blocks.UNLIT_REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
|
|
|
|
if (this.isBurnedOut(worldIn, pos, true))
|
|
@@ -144,6 +160,13 @@
|
|
}
|
|
else if (!flag && !this.isBurnedOut(worldIn, pos, false))
|
|
{
|
|
+ if (oldCurrent != 15) {
|
|
+ event.setNewCurrent(15);
|
|
+ manager.callEvent(event);
|
|
+ if (event.getNewCurrent() != 15) {
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
worldIn.setBlockState(pos, Blocks.REDSTONE_TORCH.getDefaultState().withProperty(FACING, state.getValue(FACING)), 3);
|
|
}
|
|
}
|