-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8221103
commit 60340f4
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <58360096+s-yh-china@users.noreply.github.com> | ||
Date: Thu, 25 May 2023 16:37:06 +0800 | ||
Subject: [PATCH] No feather falling trample | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/level/block/FarmBlock.java b/src/main/java/net/minecraft/world/level/block/FarmBlock.java | ||
index 34d744837e599633a3c2c0b72f253bb0e157f226..1604a01c79caf98fafa83c0e7c6112f033c534ef 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/FarmBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/FarmBlock.java | ||
@@ -101,6 +101,13 @@ public class FarmBlock extends Block { | ||
public void fallOn(Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance) { | ||
super.fallOn(world, state, pos, entity, fallDistance); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. | ||
if (!world.isClientSide && world.random.nextFloat() < fallDistance - 0.5F && entity instanceof LivingEntity && (entity instanceof Player || world.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) && entity.getBbWidth() * entity.getBbWidth() * entity.getBbHeight() > 0.512F) { | ||
+ // Leaves start - noFeatherFallingTrample | ||
+ if (top.leavesmc.leaves.LeavesConfig.noFeatherFallingTrample) { | ||
+ if (net.minecraft.world.item.enchantment.EnchantmentHelper.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.FALL_PROTECTION, (LivingEntity) entity) > 0) { | ||
+ return; | ||
+ } | ||
+ } | ||
+ // Leaves end - noFeatherFallingTrample | ||
// CraftBukkit start - Interact soil | ||
org.bukkit.event.Cancellable cancellable; | ||
if (entity instanceof Player) { | ||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
index 0c852de41030dd0e2cab49790903de8097a0124d..dc763705f4e8982bd99a7cd5db5e8487574d2753 100644 | ||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
@@ -562,6 +562,11 @@ public final class LeavesConfig { | ||
} | ||
} | ||
|
||
+ public static boolean noFeatherFallingTrample = false; | ||
+ private static void noFeatherFallingTrample() { | ||
+ noFeatherFallingTrample = getBoolean("settings.modify.no-feather-falling-trample", noFeatherFallingTrample); | ||
+ } | ||
+ | ||
public static final class WorldConfig { | ||
|
||
public final String worldName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <58360096+s-yh-china@users.noreply.github.com> | ||
Date: Thu, 25 May 2023 17:15:22 +0800 | ||
Subject: [PATCH] Shared villager discounts | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java | ||
index 097007c1c25ba55d9916fc820dd1d1149d81f6f4..67c0a46b098d631b862df80511990c396934200b 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java | ||
+++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java | ||
@@ -120,6 +120,16 @@ public class GossipContainer { | ||
|
||
public int getReputation(UUID target, Predicate<GossipType> gossipTypeFilter) { | ||
GossipContainer.EntityGossips entityGossips = this.gossips.get(target); | ||
+ // Leaves start - sharedVillagerDiscounts | ||
+ if (top.leavesmc.leaves.LeavesConfig.sharedVillagerDiscounts && gossipTypeFilter.test(GossipType.MAJOR_POSITIVE)) { | ||
+ int otherRep = 0; | ||
+ if (entityGossips != null) { | ||
+ otherRep = entityGossips.weightedValue(v -> gossipTypeFilter.test(v) && !v.equals(GossipType.MAJOR_POSITIVE)); | ||
+ } | ||
+ int majorPositiveRep = this.gossips.values().stream().mapToInt(a -> a.weightedValue(v -> v.equals(GossipType.MAJOR_POSITIVE))).sum(); | ||
+ return otherRep + Math.min(majorPositiveRep, GossipType.MAJOR_POSITIVE.max * GossipType.MAJOR_POSITIVE.weight); | ||
+ } | ||
+ // Leaves end - sharedVillagerDiscounts | ||
return entityGossips != null ? entityGossips.weightedValue(gossipTypeFilter) : 0; | ||
} | ||
|
||
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
index dc763705f4e8982bd99a7cd5db5e8487574d2753..673b2608371b7e943d2214f78e39345c07ee8a36 100644 | ||
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java | ||
@@ -567,6 +567,11 @@ public final class LeavesConfig { | ||
noFeatherFallingTrample = getBoolean("settings.modify.no-feather-falling-trample", noFeatherFallingTrample); | ||
} | ||
|
||
+ public static boolean sharedVillagerDiscounts = false; | ||
+ private static void sharedVillagerDiscounts() { | ||
+ sharedVillagerDiscounts = getBoolean("settings.modify.shared-villager-discounts", sharedVillagerDiscounts); | ||
+ } | ||
+ | ||
public static final class WorldConfig { | ||
|
||
public final String worldName; |