From 3bd107b3ccceb425bfd32871b864bd4cf35c5d1c Mon Sep 17 00:00:00 2001 From: chochem <40274384+chochem@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:57:20 +0000 Subject: [PATCH] priest trade improvements (#1111) --- .../NHTradeHandler/NHTradeHandler.java | 23 +++++++++++++++++++ .../com/dreammaster/main/MainRegistry.java | 3 +++ 2 files changed, 26 insertions(+) create mode 100644 src/main/java/com/dreammaster/NHTradeHandler/NHTradeHandler.java diff --git a/src/main/java/com/dreammaster/NHTradeHandler/NHTradeHandler.java b/src/main/java/com/dreammaster/NHTradeHandler/NHTradeHandler.java new file mode 100644 index 000000000..585380a42 --- /dev/null +++ b/src/main/java/com/dreammaster/NHTradeHandler/NHTradeHandler.java @@ -0,0 +1,23 @@ +package com.dreammaster.NHTradeHandler; + +import java.util.Random; + +import net.minecraft.entity.passive.EntityVillager; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.village.MerchantRecipe; +import net.minecraft.village.MerchantRecipeList; + +import cpw.mods.fml.common.registry.VillagerRegistry.IVillageTradeHandler; + +public class NHTradeHandler implements IVillageTradeHandler { + + @Override + public void manipulateTradesForVillager(final EntityVillager villager, final MerchantRecipeList recipeList, + final Random random) { + recipeList.addToListWithCheck( + new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(Items.ender_pearl, 1))); + recipeList.addToListWithCheck( + new MerchantRecipe(new ItemStack(Items.emerald, 1), new ItemStack(Items.dye, 1, 4))); + } +} diff --git a/src/main/java/com/dreammaster/main/MainRegistry.java b/src/main/java/com/dreammaster/main/MainRegistry.java index 918bc736b..8b1a30002 100644 --- a/src/main/java/com/dreammaster/main/MainRegistry.java +++ b/src/main/java/com/dreammaster/main/MainRegistry.java @@ -25,6 +25,7 @@ import net.minecraftforge.common.config.Configuration; import net.minecraftforge.fluids.FluidContainerRegistry; +import com.dreammaster.NHTradeHandler.NHTradeHandler; import com.dreammaster.TwilightForest.TF_Loot_Chests; import com.dreammaster.amazingtrophies.AchievementHandler; import com.dreammaster.bartworksHandler.BWGlassAdder; @@ -92,6 +93,7 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.VillagerRegistry; import cpw.mods.fml.relauncher.Side; import eu.usrv.yamcore.YAMCore; import eu.usrv.yamcore.auxiliary.IngameErrorLog; @@ -374,6 +376,7 @@ public void load(FMLInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new GTNHPauseScreen()); } + VillagerRegistry.instance().registerVillageTradeHandler(2, new NHTradeHandler()); } public static Block _mBlockBabyChest = new BlockBabyChest();