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) {
}
}
}
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);
}
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;
}
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;
}
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));
}
}
Aggregations