Skip to content

Commit

Permalink
RedstoneChangeHook tweaks for RedstoneWire, little data change to
Browse files Browse the repository at this point in the history
RedstoneBlocks  addresses #41
  • Loading branch information
darkdiplomat committed Sep 2, 2013
1 parent dda82f9 commit a8a4c04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/net/minecraft/server/BlockPoweredOre.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void a(World world, int i0, int i1, int i2) {

// CanaryMod: pull break method in to do RedstoneChange
public void a(World world, int i0, int i1, int i2, int i3, int i4) {
new RedstoneChangeHook(new CanaryBlock(BlockType.RedstoneBlock.getId(), (short) 2, i0, i1, i2, world.getCanaryWorld()), 15, 0).call();
new RedstoneChangeHook(new CanaryBlock(BlockType.RedstoneBlock.getId(), (short) i3, i0, i1, i2, world.getCanaryWorld()), 15, 0).call();
super.a(world, i0, i1, i2, i3, i4);
}
//
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/net/minecraft/server/BlockRedstoneWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import net.canarymod.api.world.blocks.BlockType;
import net.canarymod.api.world.blocks.CanaryBlock;
import net.canarymod.hook.world.RedstoneChangeHook;

public class BlockRedstoneWire extends Block {
Expand Down Expand Up @@ -181,6 +183,12 @@ public void a(World world, int i0, int i1, int i2) {
public void a(World world, int i0, int i1, int i2, int i3, int i4) {
super.a(world, i0, i1, i2, i3, i4);
if (!world.I) {
// CanaryMod: RedstoneChange (Wire Destroy)
int lvl = world.D(i0, i1, i2) - 1; // Subtract 1 from current in
if (lvl > 0) {
new RedstoneChangeHook(new CanaryBlock(BlockType.RedstoneWire.getId(), (short) i3, i0, i1, i2, world.getCanaryWorld()), lvl, 0).call();
}
//
world.f(i0, i1 + 1, i2, this.cF);
world.f(i0, i1 - 1, i2, this.cF);
world.f(i0 + 1, i1, i2, this.cF);
Expand Down

0 comments on commit a8a4c04

Please sign in to comment.