-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
60340f4
commit 6769d55
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |