mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
89 lines
5.5 KiB
Diff
89 lines
5.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
|
Date: Wed, 14 Aug 2024 01:48:14 +0800
|
|
Subject: [PATCH] Old BlockEntity behaviour
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java b/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java
|
|
index ca3a8ead09cf0d3c1352ac266b749bc0bca2ff9a..b705ee10371e77d027b88afc790f346f20c0087f 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ChiseledBookShelfBlock.java
|
|
@@ -197,6 +197,13 @@ public class ChiseledBookShelfBlock extends BaseEntityBlock {
|
|
}
|
|
|
|
chiseledBookShelfBlockEntity.clearContent();
|
|
+ // Leaves start - behaviour 1.21.1-
|
|
+ if (org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) {
|
|
+ bl = false;
|
|
+ world.updateNeighbourForOutputSignal(pos, this);
|
|
+ break label32;
|
|
+ }
|
|
+ // Leaves end - behaviour 1.21.1-
|
|
bl = true;
|
|
break label32;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/LecternBlock.java b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
|
index 3a1e2f62b297f384cc0dcfb828e523a37c703d6f..c45a636f8c3542f7a073d6b76a7bf23a91b8c7dc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/LecternBlock.java
|
|
@@ -226,10 +226,11 @@ public class LecternBlock extends BaseEntityBlock {
|
|
this.popBook(state, world, pos);
|
|
}
|
|
|
|
- super.onRemove(state, world, pos, newState, moved);
|
|
+ if (!org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
if ((Boolean) state.getValue(LecternBlock.POWERED)) {
|
|
world.updateNeighborsAt(pos.below(), this);
|
|
}
|
|
+ if (org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
|
index 8d57c68d2f20f7c0d5c1be5d5b12e6926aad8c58..f1341d0f6545dfb13d14a37a68fda5b3403604b5 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/SculkSensorBlock.java
|
|
@@ -150,10 +150,11 @@ public class SculkSensorBlock extends BaseEntityBlock implements SimpleWaterlogg
|
|
@Override
|
|
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
|
if (!state.is(newState.getBlock())) {
|
|
- super.onRemove(state, world, pos, newState, moved);
|
|
+ if (!org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
if (SculkSensorBlock.getPhase(state) == SculkSensorPhase.ACTIVE) {
|
|
SculkSensorBlock.updateNeighbours(world, pos, state);
|
|
}
|
|
+ if (org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
|
|
}
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
|
index 7d88524eb5b193600c8985c68bb9ed10e3fe3c4d..7f966d72b3124a79a5941c574ede329184666389 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java
|
|
@@ -186,10 +186,11 @@ public class ShulkerBoxBlock extends BaseEntityBlock {
|
|
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
|
if (!state.is(newState.getBlock())) {
|
|
BlockEntity blockEntity = world.getBlockEntity(pos);
|
|
- super.onRemove(state, world, pos, newState, moved);
|
|
+ if (!org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
if (blockEntity instanceof ShulkerBoxBlockEntity) {
|
|
world.updateNeighbourForOutputSignal(pos, state.getBlock());
|
|
}
|
|
+ if (org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour) super.onRemove(state, world, pos, newState, moved); // Leaves - behaviour 1.21.1-
|
|
}
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
|
index f2ef63d69bfc6fb3b3dc4b3b2938733d1c371746..e6c67426c9ea76eae2c677d796d0db579acaed6e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
|
|
@@ -67,7 +67,7 @@ public abstract class BlockEntity {
|
|
}
|
|
|
|
public boolean isValidBlockState(BlockState state) {
|
|
- return this.type.isValid(state);
|
|
+ return org.leavesmc.leaves.LeavesConfig.oldBlockEntityBehaviour || this.type.isValid(state); // Leaves - behaviour 1.21.1-
|
|
}
|
|
|
|
public static BlockPos getPosFromTag(CompoundTag nbt) {
|