Skip to content

Commit

Permalink
Fix NotifyNeighborBlockEvent root cause. Fixes #1174
Browse files Browse the repository at this point in the history
  • Loading branch information
bloodmc committed Feb 4, 2017
1 parent ed6df70 commit bf0cc9f
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,16 +336,15 @@ public static NotifyNeighborBlockEvent callNotifyNeighborEvent(World world, Bloc
rootCause = phaseContext.first(Object.class).orElse(null);
}

final BlockState blockstate = (BlockState)((net.minecraft.world.World) world).getBlockState(sourcePos);
final LocatableBlock locatable = LocatableBlock.builder()
.location(new Location<World>((World) world, sourcePos.getX(), sourcePos.getY(), sourcePos.getZ()))
.state(blockstate)
.build();
builder = Cause.source(locatable);
if (rootCause instanceof User) {
final BlockState blockstate = (BlockState)((net.minecraft.world.World) world).getBlockState(sourcePos);
final LocatableBlock locatable = LocatableBlock.builder()
.location(new Location<World>((World) world, sourcePos.getX(), sourcePos.getY(), sourcePos.getZ()))
.state(blockstate)
.build();
builder = Cause.source(locatable);
builder.named(NamedCause.notifier(rootCause));
} else {
builder = Cause.source(rootCause);
if (user != null) {
builder.named(NamedCause.notifier(user));
} else {
Expand Down

0 comments on commit bf0cc9f

Please sign in to comment.