mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
77a5779e24
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2ec53f49 PR-1050: Fix empty result check for Complex Recipes 10671012 PR-1044: Add CrafterCraftEvent 4d87ffe0 Use correct method in JavaDoc ae5e5817 SPIGOT-7850: Add API for Bogged shear state 46b6d445 SPIGOT-7837: Support data pack banner patterns d5d0cefc Fix JavaDoc error b3c2b83d PR-1036: Add API for InventoryView derivatives 1fe2c75a SPIGOT-7809: Add ShieldMeta CraftBukkit Changes: 8ee6fd1b8 SPIGOT-7857: Improve ItemMeta block data deserialization 8f26c30c6 SPIGOT-7857: Fix spurious internal NBT tag when deserializing BlockStateMeta 759061b93 SPIGOT-7855: Fire does not spread or burn blocks 00fc9fb64 SPIGOT-7853: AnvilInventory#getRepairCost() always returns 0 7501e2e04 PR-1450: Add CrafterCraftEvent 8c51673e7 SPIGOT-5731: PortalCreateEvent#getEntity returns null for nether portals ignited by flint and steel d53d0d0b1 PR-1456: Fix inverted logic in CraftCrafterView#setSlotDisabled 682a678c8 SPIGOT-7850: Add API for Bogged shear state fccf5243a SPIGOT-7837: Support data pack banner patterns 9c3bd4390 PR-1431: Add API for InventoryView derivatives 0cc6acbc4 SPIGOT-7849: Fix FoodComponent serialize with "using-converts-to" using null 2c5474952 Don't rely on tags for CraftItemMetas 20d107e46 SPIGOT-7846: Fix ItemMeta for hanging signs 76f59e315 Remove redundant clone in Dropper InventoryMoveItemEvent e61a53d25 SPIGOT-7817: Call InventoryMoveItemEvent for Crafters 894682e2d SPIGOT-7839: Remove redundant Java version checks 2c12b2187 SPIGOT-7809: Add ShieldMeta and fix setting shield base colours Spigot Changes: fb8fb722 Rebuild patches 34bd42b7 SPIGOT-7835: Fix issue with custom hopper settings
180 lines
12 KiB
Diff
180 lines
12 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Boy <sivertpaulsen2@gmail.com>
|
|
Date: Sun, 18 Jun 2023 17:45:33 +0200
|
|
Subject: [PATCH] Add option to disable block updates
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
|
index 06f0e5afdab6274154213d82ab3278e08c4ba1b7..8569ad43985fa60d5196ae4bc21646406d8b2adc 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
|
@@ -38,6 +38,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableChorusPlantUpdates) return this.defaultBlockState(); // Paper - add option to disable block updates
|
|
return getStateWithConnections(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState());
|
|
}
|
|
|
|
@@ -59,6 +60,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableChorusPlantUpdates) return state; // Paper - add option to disable block updates
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.scheduleTick(pos, this, 1);
|
|
return super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
|
@@ -70,6 +72,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableChorusPlantUpdates) return; // Paper - add option to disable block updates
|
|
if (!state.canSurvive(world, pos)) {
|
|
world.destroyBlock(pos, true);
|
|
}
|
|
@@ -77,6 +80,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
protected boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableChorusPlantUpdates) return true; // Paper - add option to disable block updates
|
|
BlockState blockState = world.getBlockState(pos.below());
|
|
boolean bl = !world.getBlockState(pos.above()).isAir() && !blockState.isAir();
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
|
index 3f45058eee0c78f50c119da5da4c7d2af0251a27..d16aad72c90bbde158b845759eef227546d12e24 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
|
@@ -43,6 +43,7 @@ public class HugeMushroomBlock extends Block {
|
|
|
|
@Override
|
|
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return this.defaultBlockState(); // Paper - add option to disable block updates
|
|
BlockGetter blockGetter = ctx.getLevel();
|
|
BlockPos blockPos = ctx.getClickedPos();
|
|
return this.defaultBlockState()
|
|
@@ -56,6 +57,7 @@ public class HugeMushroomBlock extends Block {
|
|
|
|
@Override
|
|
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates
|
|
return neighborState.is(this)
|
|
? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false))
|
|
: super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
|
@@ -63,6 +65,7 @@ public class HugeMushroomBlock extends Block {
|
|
|
|
@Override
|
|
protected BlockState rotate(BlockState state, Rotation rotation) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates
|
|
return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH))
|
|
.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH))
|
|
.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST))
|
|
@@ -73,6 +76,7 @@ public class HugeMushroomBlock extends Block {
|
|
|
|
@Override
|
|
protected BlockState mirror(BlockState state, Mirror mirror) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates
|
|
return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH))
|
|
.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH))
|
|
.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST))
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
index f77d51d10e01fc4eaf5516c05c8be0ef7a425893..1d82cfe7af0dc42f88901fb0c44896771fdf8a93 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
@@ -66,11 +66,13 @@ public class NoteBlock extends Block {
|
|
|
|
@Override
|
|
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return this.defaultBlockState(); // Paper - place without considering instrument
|
|
return this.setInstrument(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState());
|
|
}
|
|
|
|
@Override
|
|
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return state; // Paper - prevent noteblock instrument from updating
|
|
boolean flag = direction.getAxis() == Direction.Axis.Y;
|
|
|
|
return flag ? this.setInstrument(world, pos, state) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
|
@@ -78,6 +80,7 @@ public class NoteBlock extends Block {
|
|
|
|
@Override
|
|
protected void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) return; // Paper - prevent noteblock powered-state from updating
|
|
boolean flag1 = world.hasNeighborSignal(pos);
|
|
|
|
if (flag1 != (Boolean) state.getValue(NoteBlock.POWERED)) {
|
|
@@ -116,7 +119,7 @@ public class NoteBlock extends Block {
|
|
if (world.isClientSide) {
|
|
return InteractionResult.SUCCESS;
|
|
} else {
|
|
- state = (BlockState) state.cycle(NoteBlock.NOTE);
|
|
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableNoteblockUpdates) state = (BlockState) state.cycle(NoteBlock.NOTE); // Paper - prevent noteblock note from updating
|
|
world.setBlock(pos, state, 3);
|
|
this.playNote(player, state, world, pos);
|
|
player.awardStat(Stats.TUNE_NOTEBLOCK);
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
index e032d8907045c653c3dd449f65e93e40fd0bb6be..6fe5be785423a35b6ff4e6206ca281b66845b979 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
@@ -67,6 +67,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return this.defaultBlockState(); // Paper - place tripwire without updating
|
|
Level world = ctx.getLevel();
|
|
BlockPos blockposition = ctx.getClickedPos();
|
|
|
|
@@ -75,11 +76,13 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent tripwire from updating
|
|
return direction.getAxis().isHorizontal() ? (BlockState) state.setValue((Property) TripWireBlock.PROPERTY_BY_DIRECTION.get(direction), this.shouldConnectTo(neighborState, direction)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos);
|
|
}
|
|
|
|
@Override
|
|
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
|
if (!oldState.is(state.getBlock())) {
|
|
this.updateSource(world, pos, state);
|
|
}
|
|
@@ -87,6 +90,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
protected void onRemove(BlockState state, Level world, BlockPos pos, BlockState newState, boolean moved) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
|
if (!moved && !state.is(newState.getBlock())) {
|
|
this.updateSource(world, pos, (BlockState) state.setValue(TripWireBlock.POWERED, true));
|
|
}
|
|
@@ -94,6 +98,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return state; // Paper - prevent disarming tripwires
|
|
if (!world.isClientSide && !player.getMainHandItem().isEmpty() && player.getMainHandItem().is(Items.SHEARS)) {
|
|
world.setBlock(pos, (BlockState) state.setValue(TripWireBlock.DISARMED, true), 4);
|
|
world.gameEvent((Entity) player, (Holder) GameEvent.SHEAR, pos);
|
|
@@ -103,6 +108,7 @@ public class TripWireBlock extends Block {
|
|
}
|
|
|
|
private void updateSource(Level world, BlockPos pos, BlockState state) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent adjacent tripwires from updating
|
|
Direction[] aenumdirection = new Direction[]{Direction.SOUTH, Direction.WEST};
|
|
int i = aenumdirection.length;
|
|
int j = 0;
|
|
@@ -135,6 +141,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwires from detecting collision
|
|
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
|
if (!world.isClientSide) {
|
|
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
|
|
@@ -145,6 +152,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
|
+ if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates) return; // Paper - prevent tripwire pressed check
|
|
if ((Boolean) world.getBlockState(pos).getValue(TripWireBlock.POWERED)) {
|
|
this.checkPressed(world, pos);
|
|
}
|