Merge branch 'main' into suggest-attributes-to-enhance
This commit is contained in:
@@ -28,7 +28,6 @@ import net.minecraftforge.event.entity.living.LivingDamageEvent;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.animal.IronGolem;
|
||||
import net.minecraft.world.entity.animal.SnowGolem;
|
||||
import net.minecraft.world.entity.npc.GossipType;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.inventory.MerchantMenu;
|
||||
import net.minecraft.world.item.trading.MerchantOffer;
|
||||
import net.minecraft.world.entity.npc.Villager;
|
||||
import net.minecraft.world.entity.npc.GossipType;
|
||||
import net.minecraftforge.event.entity.player.PlayerContainerEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -26,6 +28,13 @@ public class CharismaTradeEvents {
|
||||
int cha = stats.getAttributeLevel("charisma");
|
||||
if (cha <= 0) return;
|
||||
|
||||
if (merchantMenu.getTrader() instanceof Villager villager) {
|
||||
int reputationBonus = StatEffects.getCharismaVillagerReputationBonus(cha);
|
||||
if (reputationBonus > 0) {
|
||||
villager.getGossips().add(player.getUUID(), GossipType.MINOR_POSITIVE, reputationBonus);
|
||||
}
|
||||
}
|
||||
|
||||
double discountFraction = StatEffects.getCharismaTradeDiscount(cha);
|
||||
if (discountFraction <= 0.0d) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user