9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-20 07:19:33 +00:00
Files
SakuraMC/sakura-server/minecraft-patches/features/0005-Add-redstone-implementation-api.patch
Samsuik 7abe0b920b Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@056268e [ci skip] Correct javadoc for Weapon Component (#13096)
PaperMC/Paper@a0ea729 Fix minimum tick time reporting and off thread reading
PaperMC/Paper@ba2fb8c Update spark-paper dependency version (#13171)
PaperMC/Paper@ce983d7 Misc fixes to tick reporting (#13174)
PaperMC/Paper@9d95cd5 Use BUILD_STARTED_AT instead of Instant.now() for build timestamp (#13175)
PaperMC/Paper@610f1d2 Update fill-gradle to v1.0.9
PaperMC/Paper@ffcb7b2 Update Parchment (#13177)
PaperMC/Paper@c33a9ce Fix incorrect variable use in Entity#startRiding
PaperMC/Paper@c710b66 Add MapPalette.getNearestColor (#13104)
PaperMC/Paper@b57d641 Expose isReplaceable on BlockData (#13180)
PaperMC/Paper@af1823d Reduce impact of tick time calculations (#13188)
PaperMC/Paper@89ca94a [ci skip] Rebuild patches
PaperMC/Paper@e5cc256 [ci skip] Update CONTRIBUTING.md for Gradle and Windows Docs (#13190)
PaperMC/Paper@ab99393 Fix charged creeper explosions not dropping mob skulls (#13167)
2025-10-16 13:58:47 +01:00

47 lines
3.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Mon, 7 Apr 2025 00:29:00 +0100
Subject: [PATCH] Add redstone implementation api
diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java
index 052ca983df58329d513373e14a0ed726005edd9b..fc75ecd9f56526b213b348d1243834eb21abfc34 100644
--- a/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -275,7 +275,7 @@ public class RedStoneWireBlock extends Block {
* Note: Added 'source' argument so as to help determine direction of information flow
*/
private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, @Nullable Orientation orientation, boolean blockAdded) {
- if (worldIn.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) {
+ if (worldIn.localConfig().at(pos).paperRedstoneImplementation() == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.EIGENCRAFT) { // Sakura - redstone implementation api
// since 24w33a the source pos is no longer given, but instead an Orientation parameter
// when this is not null, it can be used to find the source pos, which the turbo uses
// to find the direction of information flow
@@ -348,7 +348,7 @@ public class RedStoneWireBlock extends Block {
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) {
if (!oldState.is(state.getBlock()) && !level.isClientSide()) {
// Paper start - optimize redstone - replace call to updatePowerStrength
- if (level.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (level.localConfig().at(pos).paperRedstoneImplementation() == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura - redstone implementation api
level.getWireHandler().onWireAdded(pos, state); // Alternate Current
} else {
this.updateSurroundingRedstone(level, pos, state, null, true); // Vanilla/Eigencraft
@@ -371,7 +371,7 @@ public class RedStoneWireBlock extends Block {
}
// Paper start - optimize redstone - replace call to updatePowerStrength
- if (level.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (level.localConfig().at(pos).paperRedstoneImplementation() == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura - redstone implementation api
level.getWireHandler().onWireRemoved(pos, state); // Alternate Current
} else {
this.updateSurroundingRedstone(level, pos, state, null, false); // Vanilla/Eigencraft
@@ -401,7 +401,7 @@ public class RedStoneWireBlock extends Block {
if (!level.isClientSide()) {
// Paper start - optimize redstone (Alternate Current)
// Alternate Current handles breaking of redstone wires in the WireHandler.
- if (level.paperConfig().misc.redstoneImplementation == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) {
+ if (level.localConfig().at(pos).paperRedstoneImplementation() == io.papermc.paper.configuration.WorldConfiguration.Misc.RedstoneImplementation.ALTERNATE_CURRENT) { // Sakura - redstone implementation api
level.getWireHandler().onWireUpdated(pos, state, orientation);
} else
// Paper end - optimize redstone (Alternate Current)