Search in sources :

Example 1 with EntityVillager

use of net.minecraft.entity.passive.EntityVillager 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) {
        }
    }
}
Also used : MerchantRecipeList(net.minecraft.village.MerchantRecipeList) MerchantRecipe(net.minecraft.village.MerchantRecipe) IPneumaticRecipeRegistry(pneumaticCraft.api.recipe.IPneumaticRecipeRegistry) FluidStack(net.minecraftforge.fluids.FluidStack) EntityVillager(net.minecraft.entity.passive.EntityVillager) ArrayList(java.util.ArrayList) MerchantRecipeList(net.minecraft.village.MerchantRecipeList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack)

Example 2 with EntityVillager

use of net.minecraft.entity.passive.EntityVillager in project PneumaticCraft by MineMaarten.

the class IntegratorPressureChamber method handleVillagers.

private void handleVillagers(int x, int y, List<IWidget> locatedTextures) {
    locatedTextures.add(new LocatedEntity(EntityVillager.class, x + 70, y + 95, 2F));
    LocatedEntity locatedEntity = new LocatedEntity(EntityVillager.class, x + 215, y + 125, 2F);
    EntityVillager villager = (EntityVillager) locatedEntity.entity;
    villager.setProfession(Config.villagerMechanicID);
    locatedTextures.add(locatedEntity);
}
Also used : EntityVillager(net.minecraft.entity.passive.EntityVillager) LocatedEntity(igwmod.gui.LocatedEntity)

Example 3 with EntityVillager

use of net.minecraft.entity.passive.EntityVillager in project VoodooCraft by Mod-DevCafeTeam.

the class TestItem method itemInteractionForEntity.

@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand) {
    World world = playerIn.world;
    BlockPos pos = target.getPosition();
    EntityVillager villager = new EntityVillager(world);
    EntityZombie zombie = new EntityZombie(world);
    if (!world.isRemote) {
        if (target instanceof EntityZombie) {
            villager.setPosition(pos.getX(), pos.getY(), pos.getZ());
            world.spawnEntity(villager);
            target.setDead();
            return true;
        } else if (target instanceof EntityVillager) {
            zombie.setPosition(pos.getX(), pos.getY(), pos.getZ());
            world.spawnEntity(zombie);
            target.setDead();
            return true;
        }
    }
    return false;
}
Also used : EntityZombie(net.minecraft.entity.monster.EntityZombie) EntityVillager(net.minecraft.entity.passive.EntityVillager) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World)

Example 4 with EntityVillager

use of net.minecraft.entity.passive.EntityVillager 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;
}
Also used : MerchantRecipeList(net.minecraft.village.MerchantRecipeList) MerchantRecipe(net.minecraft.village.MerchantRecipe) EntityVillager(net.minecraft.entity.passive.EntityVillager) ItemStack(net.minecraft.item.ItemStack)

Example 5 with EntityVillager

use of net.minecraft.entity.passive.EntityVillager in project Railcraft by Railcraft.

the class TileTradeStation method modifyNearbyAI.

private void modifyNearbyAI() {
    for (EntityVillager villager : findNearbyVillagers(20)) {
        AIPlugin.addAITask(villager, 9, new EntityAIWatchBlock(villager, getMachineType().getDefaultState(), 4, 0.08F));
        AIPlugin.addAITask(villager, 9, new EntityAIMoveToBlock(villager, getMachineType().getDefaultState(), 16, 0.002F));
    }
}
Also used : EntityAIMoveToBlock(mods.railcraft.common.util.ai.EntityAIMoveToBlock) EntityVillager(net.minecraft.entity.passive.EntityVillager) EntityAIWatchBlock(mods.railcraft.common.util.ai.EntityAIWatchBlock)

Aggregations

EntityVillager (net.minecraft.entity.passive.EntityVillager)12 EntityZombie (net.minecraft.entity.monster.EntityZombie)4 ItemStack (net.minecraft.item.ItemStack)3 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)3 MerchantRecipe (net.minecraft.village.MerchantRecipe)3 MerchantRecipeList (net.minecraft.village.MerchantRecipeList)3 EntityLiving (net.minecraft.entity.EntityLiving)2 EntityLivingBase (net.minecraft.entity.EntityLivingBase)2 EntityPigZombie (net.minecraft.entity.monster.EntityPigZombie)2 EntityPig (net.minecraft.entity.passive.EntityPig)2 BlockPos (net.minecraft.util.math.BlockPos)2 Pos (com.builtbroken.mc.imp.transform.vector.Pos)1 LocatedEntity (igwmod.gui.LocatedEntity)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Random (java.util.Random)1 EntityAIMoveToBlock (mods.railcraft.common.util.ai.EntityAIMoveToBlock)1 EntityAIWatchBlock (mods.railcraft.common.util.ai.EntityAIWatchBlock)1 Entity (net.minecraft.entity.Entity)1 EntityDragon (net.minecraft.entity.boss.EntityDragon)1