mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
@@ -5,10 +5,10 @@ Subject: [PATCH] Tool actionable options
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..22c8ef3d8d20c14d3b032d054827e074a4422ad6 100644
|
||||
index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..7738735c2d3847f048b9bdffaa2b3eff0b5b0940 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/AxeItem.java
|
||||
@@ -33,29 +33,31 @@ public class AxeItem extends DiggerItem {
|
||||
@@ -33,29 +33,32 @@ public class AxeItem extends DiggerItem {
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
Player player = context.getPlayer();
|
||||
BlockState blockState = level.getBlockState(blockPos);
|
||||
@@ -18,6 +18,7 @@ index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..22c8ef3d8d20c14d3b032d054827e074
|
||||
- return block.withPropertiesOf(blockState);
|
||||
- });
|
||||
+ // Purpur start
|
||||
+ Block clickedBlock = level.getBlockState(blockPos).getBlock();
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional = Optional.ofNullable(level.purpurConfig.axeStrippables.get(blockState.getBlock()));
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional2 = Optional.ofNullable(level.purpurConfig.axeWeatherables.get(blockState.getBlock()));
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional3 = Optional.ofNullable(level.purpurConfig.axeWaxables.get(blockState.getBlock()));
|
||||
@@ -27,16 +28,16 @@ index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..22c8ef3d8d20c14d3b032d054827e074
|
||||
+ Optional<org.purpurmc.purpur.tool.Actionable> optional4 = Optional.empty(); // Purpur
|
||||
if (optional.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
+ if (!STRIPPABLES.containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
optional4 = optional;
|
||||
} else if (optional2.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
+ if (!HoneycombItem.WAXABLES.get().containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
level.levelEvent(player, 3005, blockPos, 0);
|
||||
optional4 = optional2;
|
||||
} else if (optional3.isPresent()) {
|
||||
- level.playSound(player, blockPos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
+ if (!HoneycombItem.WAX_OFF_BY_BLOCK.get().containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
level.levelEvent(player, 3004, blockPos, 0);
|
||||
optional4 = optional3;
|
||||
}
|
||||
@@ -50,7 +51,7 @@ index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..22c8ef3d8d20c14d3b032d054827e074
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
// Paper end
|
||||
@@ -63,15 +65,22 @@ public class AxeItem extends DiggerItem {
|
||||
@@ -63,15 +66,22 @@ public class AxeItem extends DiggerItem {
|
||||
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger((ServerPlayer)player, blockPos, itemStack);
|
||||
}
|
||||
|
||||
@@ -77,10 +78,10 @@ index 9c49d8f696864d2aad23208422c4ab5b598a0cd9..22c8ef3d8d20c14d3b032d054827e074
|
||||
return InteractionResult.PASS;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/item/HoeItem.java b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
index 180aec596110309aade13d2080f8824d152b07cb..bf0e1f481b4c81f0663366bbe597b066f95a6200 100644
|
||||
index 180aec596110309aade13d2080f8824d152b07cb..c4aec1e5135a79837918b692e75a7b55d5cffeb0 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/HoeItem.java
|
||||
@@ -34,15 +34,22 @@ public class HoeItem extends DiggerItem {
|
||||
@@ -34,15 +34,23 @@ public class HoeItem extends DiggerItem {
|
||||
public InteractionResult useOn(UseOnContext context) {
|
||||
Level level = context.getLevel();
|
||||
BlockPos blockPos = context.getClickedPos();
|
||||
@@ -91,6 +92,7 @@ index 180aec596110309aade13d2080f8824d152b07cb..bf0e1f481b4c81f0663366bbe597b066
|
||||
- Predicate<UseOnContext> predicate = pair.getFirst();
|
||||
- Consumer<UseOnContext> consumer = pair.getSecond();
|
||||
+ // Purpur start
|
||||
+ Block clickedBlock = level.getBlockState(blockPos).getBlock();
|
||||
+ var tillable = level.purpurConfig.hoeTillables.get(level.getBlockState(blockPos).getBlock());
|
||||
+ if (tillable == null) { return InteractionResult.PASS; } else {
|
||||
+ Predicate<UseOnContext> predicate = tillable.condition().predicate();
|
||||
@@ -106,11 +108,11 @@ index 180aec596110309aade13d2080f8824d152b07cb..bf0e1f481b4c81f0663366bbe597b066
|
||||
if (predicate.test(context)) {
|
||||
Player player = context.getPlayer();
|
||||
- level.playSound(player, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F);
|
||||
+ level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
+ if (!TILLABLES.containsKey(clickedBlock)) level.playSound(null, blockPos, SoundEvents.HOE_TILL, SoundSource.BLOCKS, 1.0F, 1.0F); // Purpur - force sound
|
||||
if (!level.isClientSide) {
|
||||
consumer.accept(context);
|
||||
if (player != null) {
|
||||
@@ -52,7 +59,7 @@ public class HoeItem extends DiggerItem {
|
||||
@@ -52,7 +60,7 @@ public class HoeItem extends DiggerItem {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user