mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 17:37:42 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: 12dec20 Bump paerweight to 1.1.7 e33ed89 Get short commit ref using a more proper method 7d6147d Remove now unneeded patch due to paperweight 1.1.7 e72fa41 Update task dependency for includeMappings so the new task isn't skipped 0ad5526 Trim whitspace off of git hash (oops) Tuinity Changes: e878ba9 Update paper 2bd2849 Bring back fix codec spam patch
80 lines
4.1 KiB
Diff
80 lines
4.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sun, 21 Mar 2021 15:49:15 -0500
|
|
Subject: [PATCH] Sneak to bulk process composter
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
index 4c9ae6bdb2f0358798f84928271a2d783dcba7b4..47bf769a031ae39cc72d2191195d13787f1568d4 100644
|
|
--- a/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
+++ b/src/main/java/net/minecraft/world/level/block/ComposterBlock.java
|
|
@@ -218,16 +218,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
ItemStack itemstack = player.getItemInHand(hand);
|
|
|
|
if (i < 8 && ComposterBlock.COMPOSTABLES.containsKey(itemstack.getItem())) {
|
|
- if (i < 7 && !world.isClientSide) {
|
|
- BlockState iblockdata1 = ComposterBlock.addItem(state, (LevelAccessor) world, pos, itemstack);
|
|
-
|
|
- world.levelEvent(1500, pos, state != iblockdata1 ? 1 : 0);
|
|
- player.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
|
- if (!player.getAbilities().instabuild) {
|
|
- itemstack.shrink(1);
|
|
- }
|
|
+ // Purpur start
|
|
+ BlockState newState = process(i, state, world, itemstack, pos, player);
|
|
+ if (world.purpurConfig.composterBulkProcess && player.isShiftKeyDown()) {
|
|
+ BlockState oldState;
|
|
+ int oldCount, newCount, oldLevel, newLevel;
|
|
+ do {
|
|
+ oldState = newState;
|
|
+ oldCount = itemstack.getCount();
|
|
+ oldLevel = oldState.getValue(ComposterBlock.LEVEL);
|
|
+ newState = process(oldLevel, oldState, world, itemstack, pos, player);
|
|
+ newCount = itemstack.getCount();
|
|
+ newLevel = newState.getValue(ComposterBlock.LEVEL);
|
|
+ } while (newCount > 0 && (newCount != oldCount || newLevel != oldLevel || newState != oldState));
|
|
}
|
|
-
|
|
+ // Purpur end
|
|
return InteractionResult.sidedSuccess(world.isClientSide);
|
|
} else if (i == 8) {
|
|
ComposterBlock.d(state, world, pos, (Entity) null); // CraftBukkit - no event for players
|
|
@@ -237,6 +242,21 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder {
|
|
}
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ private static BlockState process(int level, BlockState state, Level world, ItemStack itemstack, BlockPos pos, Player player) {
|
|
+ if (level < 7) {
|
|
+ BlockState state1 = ComposterBlock.addItem(state, world, pos, itemstack);
|
|
+ world.levelEvent(1500, pos, state != state1 ? 1 : 0);
|
|
+ player.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
|
|
+ if (!player.getAbilities().instabuild) {
|
|
+ itemstack.shrink(1);
|
|
+ }
|
|
+ return state1;
|
|
+ }
|
|
+ return state;
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
public static BlockState a(BlockState iblockdata, ServerLevel worldserver, ItemStack itemstack, BlockPos blockposition, Entity entity) { // CraftBukkit
|
|
int i = (Integer) iblockdata.getValue(ComposterBlock.LEVEL);
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
index 256dd7999edbeb7f64509aea2f9bfad55564cf53..0bf00191954f1b08661677f88b0c1c43f483eb5d 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
|
@@ -471,6 +471,11 @@ public class PurpurWorldConfig {
|
|
chestOpenWithBlockOnTop = getBoolean("blocks.chest.open-with-solid-block-on-top", chestOpenWithBlockOnTop);
|
|
}
|
|
|
|
+ public boolean composterBulkProcess = false;
|
|
+ private void composterSettings() {
|
|
+ composterBulkProcess = getBoolean("blocks.composter.sneak-to-bulk-process", composterBulkProcess);
|
|
+ }
|
|
+
|
|
public boolean dispenserApplyCursedArmor = true;
|
|
public boolean dispenserPlaceAnvils = false;
|
|
private void dispenserSettings() {
|