mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-06-28 15:39:09 +02:00
44 lines
1.7 KiB
Java
44 lines
1.7 KiB
Java
/*
|
|
* This file ("GenericTrade.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;
|
|
|
|
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 func_190888_a(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)));
|
|
}
|
|
}
|
|
}
|
|
}
|