mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
e035fd7034
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: cc9aa21a SPIGOT-6399, SPIGOT-7344: Clarify collidable behavior for player entities f23325b6 Add API for per-world simulation distances 26e1774e Add API for per-world view distances 0b541e60 Add PlayerLoginEvent#getRealAddress 5f027d2d PR-949: Add Vector#fromJOML() overloads for read-only vector types CraftBukkit Changes: bcf56171a PR-1321: Clean up some stuff which got missed during previous PRs 7f833a2d1 SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst 752aac669 Implement APIs for per world view and simulation distances 57d7ef433 Preserve empty enchantment tags for glow effect 465ec3fb4 Remove connected check on setScoreboard f90ce621e Use one PermissibleBase for all command blocks 5876cca44 SPIGOT-7550: Fix creation of Arrow instances f03fc3aa3 SPIGOT-7549: ServerTickManager#setTickRate incorrect Precondition 9d7f49b01 SPIGOT-7548: Fix wrong spawn location for experience orb and dropped item Spigot Changes: ed9ba9a4 Drop no longer required patch ignoring -o option 86b5dd6a SPIGOT-7546: Fix hardcoded check for outdated client message aa7cde7a Remove obsolete APIs for per world view and simulation distances 6dff577e Remove obsolete patch preserving empty `ench` tags a3bf95b8 Remove obsolete PlayerLoginEvent#getRealAddress 1b02f5d6 Remove obsolete connected check on setScoreboard patch acf717eb Remove obsolete command block PermissibleBase patch 053fa2a9 Remove redundant patch dealing with null tile entities
176 lines
13 KiB
Diff
176 lines
13 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 a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c759bf55a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java
|
|
@@ -29,6 +29,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());
|
|
}
|
|
|
|
@@ -45,6 +46,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
public 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);
|
|
@@ -56,6 +58,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
public 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);
|
|
}
|
|
@@ -64,6 +67,7 @@ public class ChorusPlantBlock extends PipeBlock {
|
|
|
|
@Override
|
|
public 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 4fe30b867d7fc39c53307496458b3e438d4f2397..e049e702f58053431bf3e438ea37850c86ae3b7b 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java
|
|
@@ -34,6 +34,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().setValue(DOWN, Boolean.valueOf(!blockGetter.getBlockState(blockPos.below()).is(this))).setValue(UP, Boolean.valueOf(!blockGetter.getBlockState(blockPos.above()).is(this))).setValue(NORTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.north()).is(this))).setValue(EAST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.east()).is(this))).setValue(SOUTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.south()).is(this))).setValue(WEST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.west()).is(this)));
|
|
@@ -41,16 +42,19 @@ public class HugeMushroomBlock extends Block {
|
|
|
|
@Override
|
|
public 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);
|
|
}
|
|
|
|
@Override
|
|
public 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)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.DOWN)), state.getValue(DOWN));
|
|
}
|
|
|
|
@Override
|
|
public 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)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.DOWN)), state.getValue(DOWN));
|
|
}
|
|
|
|
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 f32334f9e0f13a227bef8ffb135dda82b2ec39f2..ff16075fbfe664c73a46bc4b002450867974114e 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
|
|
@@ -65,11 +65,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
|
|
public 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);
|
|
@@ -77,6 +79,7 @@ public class NoteBlock extends Block {
|
|
|
|
@Override
|
|
public 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)) {
|
|
@@ -114,7 +117,7 @@ public class NoteBlock extends Block {
|
|
} else 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 1a0c5fb62e80681604110e95c1ae7b3684c21946..2f947997ca746d18544940ef67ff550a95946edd 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/TripWireBlock.java
|
|
@@ -66,6 +66,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();
|
|
|
|
@@ -74,11 +75,13 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public 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
|
|
public 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);
|
|
}
|
|
@@ -86,6 +89,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public 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), true); // Paper - fix state inconsistency
|
|
}
|
|
@@ -93,6 +97,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, GameEvent.SHEAR, pos);
|
|
@@ -102,6 +107,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
|
|
// Paper start - fix state inconsistency
|
|
this.updateSource(world, pos, state, false);
|
|
}
|
|
@@ -140,6 +146,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public 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
|
|
if (!world.isClientSide) {
|
|
if (!(Boolean) state.getValue(TripWireBlock.POWERED)) {
|
|
@@ -150,6 +157,7 @@ public class TripWireBlock extends Block {
|
|
|
|
@Override
|
|
public 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);
|
|
}
|