mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
de04cbced5
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: f29cb801 Separate checkstyle-suppressions file is not required 86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack 9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode() 994a6163 Attempt upgrade of resolver libraries CraftBukkit Changes: b3b43a6ad Add Checkstyle check for unused imports 13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names 3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API 2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor 1dbdbbed4 PR-1238: Remove unnecessary sign ticking 659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper e37e29ce0 Increase outdated build delay c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack 492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode() e11fbb9d7 Upgrade MySQL driver 9f3a0bd2a Attempt upgrade of resolver libraries 60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion Spigot Changes: 06d602e7 Rebuild patches
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);
|
|
}
|