mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 08:27:43 +01:00
Anvil repair/damage options
This commit is contained in:
@@ -1,18 +1,10 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: 12emin34 <macanovic.emin@gmail.com>
|
|
||||||
Date: Sat, 12 Feb 2022 01:08:18 +0100
|
|
||||||
Subject: [PATCH] Anvil repair/damage options
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/level/block/AnvilBlock.java b/net/minecraft/world/level/block/AnvilBlock.java
|
|
||||||
index 50c907c962f936d2035bb7550750cdbd220b29c2..f9a2d2d4f798efa0d691996ec5ff7fe00260b36c 100644
|
|
||||||
--- a/net/minecraft/world/level/block/AnvilBlock.java
|
--- a/net/minecraft/world/level/block/AnvilBlock.java
|
||||||
+++ b/net/minecraft/world/level/block/AnvilBlock.java
|
+++ b/net/minecraft/world/level/block/AnvilBlock.java
|
||||||
@@ -59,6 +59,53 @@ public class AnvilBlock extends FallingBlock {
|
@@ -59,6 +_,53 @@
|
||||||
return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getClockWise());
|
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getClockWise());
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Purpur start - repairable/damageable anvils
|
+ // Purpur start - Anvil repair/damage options
|
||||||
+ @Override
|
+ @Override
|
||||||
+ protected net.minecraft.world.InteractionResult useItemOn(final net.minecraft.world.item.ItemStack stack, final BlockState state, final Level world, final BlockPos pos, final Player player, final net.minecraft.world.InteractionHand hand, final BlockHitResult hit) {
|
+ protected net.minecraft.world.InteractionResult useItemOn(final net.minecraft.world.item.ItemStack stack, final BlockState state, final Level world, final BlockPos pos, final Player player, final net.minecraft.world.InteractionHand hand, final BlockHitResult hit) {
|
||||||
+ if (world.purpurConfig.anvilRepairIngotsAmount > 0 && stack.is(net.minecraft.world.item.Items.IRON_INGOT)) {
|
+ if (world.purpurConfig.anvilRepairIngotsAmount > 0 && stack.is(net.minecraft.world.item.Items.IRON_INGOT)) {
|
||||||
@@ -57,26 +49,8 @@ index 50c907c962f936d2035bb7550750cdbd220b29c2..f9a2d2d4f798efa0d691996ec5ff7fe0
|
|||||||
+ }
|
+ }
|
||||||
+ return net.minecraft.world.InteractionResult.TRY_WITH_EMPTY_HAND;
|
+ return net.minecraft.world.InteractionResult.TRY_WITH_EMPTY_HAND;
|
||||||
+ }
|
+ }
|
||||||
+ // Purpur end
|
+ // Purpur end - Anvil repair/damage options
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
protected InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult hitResult) {
|
||||||
if (!world.isClientSide) {
|
if (!level.isClientSide) {
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
index 13791cc140fa7643991f5c958f48bf4693b20895..1290e73e4e741e7530481885994f16c2fd5db32c 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -797,9 +797,13 @@ public class PurpurWorldConfig {
|
|
||||||
|
|
||||||
public boolean anvilAllowColors = false;
|
|
||||||
public boolean anvilColorsUseMiniMessage;
|
|
||||||
+ public int anvilRepairIngotsAmount = 0;
|
|
||||||
+ public int anvilDamageObsidianAmount = 0;
|
|
||||||
private void anvilSettings() {
|
|
||||||
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
|
||||||
anvilColorsUseMiniMessage = getBoolean("blocks.anvil.use-mini-message", anvilColorsUseMiniMessage);
|
|
||||||
+ anvilRepairIngotsAmount = getInt("blocks.anvil.iron-ingots-used-for-repair", anvilRepairIngotsAmount);
|
|
||||||
+ anvilDamageObsidianAmount = getInt("blocks.anvil.obsidian-used-for-damage", anvilDamageObsidianAmount);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double azaleaGrowthChance = 0.0D;
|
|
||||||
@@ -796,9 +796,13 @@ public class PurpurWorldConfig {
|
|||||||
|
|
||||||
public boolean anvilAllowColors = false;
|
public boolean anvilAllowColors = false;
|
||||||
public boolean anvilColorsUseMiniMessage;
|
public boolean anvilColorsUseMiniMessage;
|
||||||
|
public int anvilRepairIngotsAmount = 0;
|
||||||
|
public int anvilDamageObsidianAmount = 0;
|
||||||
private void anvilSettings() {
|
private void anvilSettings() {
|
||||||
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors);
|
||||||
anvilColorsUseMiniMessage = getBoolean("blocks.anvil.use-mini-message", anvilColorsUseMiniMessage);
|
anvilColorsUseMiniMessage = getBoolean("blocks.anvil.use-mini-message", anvilColorsUseMiniMessage);
|
||||||
|
anvilRepairIngotsAmount = getInt("blocks.anvil.iron-ingots-used-for-repair", anvilRepairIngotsAmount);
|
||||||
|
anvilDamageObsidianAmount = getInt("blocks.anvil.obsidian-used-for-damage", anvilDamageObsidianAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double azaleaGrowthChance = 0.0D;
|
public double azaleaGrowthChance = 0.0D;
|
||||||
|
|||||||
Reference in New Issue
Block a user