Skip to content

Commit

Permalink
Fix hoppers incorrect update (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jun 2, 2023
1 parent 60340f4 commit 6769d55
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions patches/server/0068-Fix-hoppers-incorrect-update.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <[email protected]>
Date: Fri, 2 Jun 2023 17:30:48 +0800
Subject: [PATCH] Fix hoppers incorrect update


diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
index c8e7e82dd81d9faf8f06612291c40f541304eb82..f4e36bf88b1b6f044a1bb8f1785d57e52b6c8963 100644
--- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java
@@ -123,7 +123,7 @@ public class HopperBlock extends BaseEntityBlock {
@Override
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.is(state.getBlock())) {
- this.checkPoweredState(world, pos, state, 2);
+ this.checkPoweredState(world, pos, state, 2, true); // Leaves - special check
}
}

@@ -147,13 +147,18 @@ public class HopperBlock extends BaseEntityBlock {
this.checkPoweredState(world, pos, state, 4);
}

+ // Leaves start - special check
private void checkPoweredState(Level world, BlockPos pos, BlockState state, int flags) {
+ checkPoweredState(world, pos, state, flags, false);
+ }
+
+ private void checkPoweredState(Level world, BlockPos pos, BlockState state, int flags, boolean isPlace) {
boolean bl = !world.hasNeighborSignal(pos);
if (bl != state.getValue(ENABLED)) {
- world.setBlock(pos, state.setValue(ENABLED, Boolean.valueOf(bl)), flags);
+ world.setBlock(pos, state.setValue(ENABLED, Boolean.valueOf(bl)), flags, isPlace ? 0 : 512);
}
-
}
+ // Leaves end - special check

@Override
public void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {

0 comments on commit 6769d55

Please sign in to comment.