mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
Fix hoppers incorrect update (#31)
This commit is contained in:
40
patches/server/0068-Fix-hoppers-incorrect-update.patch
Normal file
40
patches/server/0068-Fix-hoppers-incorrect-update.patch
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||||
|
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) {
|
||||||
Reference in New Issue
Block a user