use of net.minecraft.village.MerchantRecipeList in project PneumaticCraft by MineMaarten.
the class CraftingRegistrator method registerAmadronOffers.
private static void registerAmadronOffers() {
PneumaticRecipeRegistry registry = PneumaticRecipeRegistry.getInstance();
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.PCBBlueprint));
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.assemblyProgram, 1, 0));
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 8), new ItemStack(Itemss.assemblyProgram, 1, 1));
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 14), new ItemStack(Itemss.assemblyProgram, 1, 2));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.oil, 5000), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.diesel, 4000), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.lubricant, 2500), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.kerosene, 3000), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.gasoline, 2000), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new FluidStack(Fluids.lpg, 1000), new ItemStack(Items.emerald, 1));
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald), new FluidStack(Fluids.oil, 1000));
registry.registerDefaultStaticAmadronOffer(new ItemStack(Items.emerald, 5), new FluidStack(Fluids.lubricant, 1000));
for (int i = 0; i < 256; i++) {
try {
for (int j = 0; j < 10; j++) {
EntityVillager villager = new EntityVillager(null, i);
MerchantRecipeList list = villager.getRecipes(null);
for (MerchantRecipe recipe : (List<MerchantRecipe>) list) {
if (recipe.getSecondItemToBuy() == null && recipe.getItemToBuy() != null && recipe.getItemToBuy().getItem() != null && recipe.getItemToSell() != null && recipe.getItemToSell().getItem() != null) {
registry.registerDefaultPeriodicAmadronOffer(recipe.getItemToBuy(), recipe.getItemToSell());
}
}
}
} catch (Throwable e) {
}
}
}
use of net.minecraft.village.MerchantRecipeList in project NetherEx by LogicTechCorp.
the class EntityPigtificate method readEntityFromNBT.
@Override
public void readEntityFromNBT(NBTTagCompound compound) {
super.readEntityFromNBT(compound);
setProfession(compound.getInteger("Profession"));
setCareer(compound.getInteger("Career"));
setCareerLevel(compound.getInteger("CareerLevel"));
setWillingToMate(compound.getBoolean("Willing"));
if (compound.hasKey("Trades", 10)) {
NBTTagCompound trades = compound.getCompoundTag("Trades");
tradeList = new MerchantRecipeList(trades);
}
NBTTagList list = compound.getTagList("Inventory", 10);
for (int i = 0; i < list.tagCount(); ++i) {
ItemStack stack = new ItemStack(list.getCompoundTagAt(i));
if (!stack.isEmpty()) {
inventory.addItem(stack);
}
}
setCanPickUpLoot(true);
setAdditionalAITasks();
}
use of net.minecraft.village.MerchantRecipeList in project Railcraft by Railcraft.
the class TileTradeStation method attemptTrade.
private boolean attemptTrade(List<EntityVillager> villagers, int tradeSet) {
ItemStack buy1 = recipeSlots.getStackInSlot(tradeSet * 3 + 0);
ItemStack buy2 = recipeSlots.getStackInSlot(tradeSet * 3 + 1);
ItemStack sell = recipeSlots.getStackInSlot(tradeSet * 3 + 2);
for (EntityVillager villager : villagers) {
MerchantRecipeList recipes = villager.getRecipes(null);
for (MerchantRecipe recipe : recipes) {
if (recipe.isRecipeDisabled())
continue;
//noinspection ConstantConditions
if (recipe.getItemToBuy() != null && !InvTools.isItemLessThanOrEqualTo(recipe.getItemToBuy(), buy1))
continue;
//noinspection ConstantConditions
if (recipe.getSecondItemToBuy() != null && !InvTools.isItemLessThanOrEqualTo(recipe.getSecondItemToBuy(), buy2))
continue;
if (!InvTools.isItemGreaterOrEqualThan(recipe.getItemToSell(), sell))
continue;
// System.out.printf("Buying: %d %s Found: %d%n", recipe.getItemToBuy().stackSize, recipe.getItemToBuy().getDisplayName(), InvTools.countItems(invInput, recipe.getItemToBuy()));
if (canDoTrade(recipe)) {
// System.out.println("Can do trade");
doTrade(villager, recipe);
return true;
}
}
}
return false;
}
use of net.minecraft.village.MerchantRecipeList in project Railcraft by Railcraft.
the class TileTradeStation method nextTrade.
public void nextTrade(int tradeSet) {
EntityVillager villager = new EntityVillager(worldObj);
villager.setProfession(profession);
MerchantRecipeList recipes = villager.getRecipes(null);
MerchantRecipe recipe = recipes.get(MiscTools.RANDOM.nextInt(recipes.size()));
recipeSlots.setInventorySlotContents(tradeSet * 3 + 0, recipe.getItemToBuy());
recipeSlots.setInventorySlotContents(tradeSet * 3 + 1, recipe.getSecondItemToBuy());
recipeSlots.setInventorySlotContents(tradeSet * 3 + 2, recipe.getItemToSell());
}
Aggregations