mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
parent
b51824ecb8
commit
6d194879bf
2 changed files with 11 additions and 46 deletions
|
@ -21,6 +21,7 @@ import de.ellpeck.actuallyadditions.mod.gen.village.component.handler.VillageEng
|
|||
import de.ellpeck.actuallyadditions.mod.gen.village.component.handler.VillageJamHouseHandler;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.entity.passive.EntityVillager.PriceInfo;
|
||||
|
@ -96,9 +97,16 @@ public final class InitVillager{
|
|||
VillagerRegistry.instance().register(jamProfession);
|
||||
|
||||
VillagerCareer career = new VillagerCareer(jamProfession, ModUtil.MOD_ID+".jammer");
|
||||
for(int i = 0; i < 3; i++){
|
||||
career.addTrade(i+1, new JamVillagerTradeList());
|
||||
}
|
||||
career.addTrade(1,
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.CU_BA_RA.ordinal()), new PriceInfo(1, 3)),
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.GRA_KI_BA.ordinal()), new PriceInfo(1, 3)));
|
||||
career.addTrade(2,
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.PL_AP_LE.ordinal()), new PriceInfo(1, 3)),
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.CH_AP_CI.ordinal()), new PriceInfo(1, 3)),
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.HO_ME_KI.ordinal()), new PriceInfo(1, 3)));
|
||||
career.addTrade(3,
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.HO_ME_CO.ordinal()), new PriceInfo(1, 3)),
|
||||
new BasicTradeList(new PriceInfo(1, 4), new ItemStack(InitItems.itemJams, 1, TheJams.PI_CO.ordinal()), new PriceInfo(1, 3)));
|
||||
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
|
||||
MapGenStructureIO.registerStructureComponent(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* This file ("JamVillagerTradeList.java") is part of the Actually Additions mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015-2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.gen.village;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import net.minecraft.entity.IMerchant;
|
||||
import net.minecraft.entity.passive.EntityVillager.ITradeList;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.village.MerchantRecipe;
|
||||
import net.minecraft.village.MerchantRecipeList;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class JamVillagerTradeList implements ITradeList{
|
||||
|
||||
@Override
|
||||
public void addMerchantRecipe(IMerchant merchant, MerchantRecipeList recipeList, Random random){
|
||||
for(int i = 0; i < random.nextInt(3)+3; i++){
|
||||
ItemStack jam = new ItemStack(InitItems.itemJams, 1, random.nextInt(TheJams.values().length));
|
||||
ItemStack emerald = new ItemStack(Items.EMERALD);
|
||||
|
||||
if(random.nextFloat() >= 0.65F){
|
||||
//Jam as input
|
||||
recipeList.add(new MerchantRecipe(StackUtil.setStackSize(jam, random.nextInt(3)+1), StackUtil.setStackSize(emerald, random.nextInt(2)+1)));
|
||||
}
|
||||
else{
|
||||
//Emeralds as input
|
||||
recipeList.add(new MerchantRecipe(StackUtil.setStackSize(emerald, random.nextInt(6)+2), StackUtil.setStackSize(jam, random.nextInt(4)+2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue