Added engineer and crystallizer villager

This commit is contained in:
Ellpeck 2016-11-21 17:50:33 +01:00
parent 0dc3dd7d1a
commit 9708a9a767
15 changed files with 193 additions and 79 deletions

View file

@ -23,7 +23,7 @@ if(hasProperty('buildnumber')){
} }
minecraft { minecraft {
version = "1.11-13.19.0.2153" version = "1.11-13.19.0.2154"
runDir = "idea" runDir = "idea"
mappings = "snapshot_20161111" mappings = "snapshot_20161111"
@ -44,8 +44,8 @@ repositories {
} }
dependencies { dependencies {
compile "net.darkhax.tesla:Tesla:1.10.2-1.2.1.49" compile "net.darkhax.tesla:Tesla:1.11-1.3.0.51"
deobfCompile "mezz.jei:jei_1.11:4.0.1.193" deobfCompile "mezz.jei:jei_1.11:4.0.2.194"
} }
processResources { processResources {

View file

@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.crafting.ItemCrafting;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.event.CommonEvents; import de.ellpeck.actuallyadditions.mod.event.CommonEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.InitVillager; import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.gen.OreGen; import de.ellpeck.actuallyadditions.mod.gen.OreGen;
import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;

View file

@ -1,61 +0,0 @@
/*
* This file ("InitVillager.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.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerCareer;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
public final class InitVillager{
public static VillagerProfession jamProfession;
public static void init(){
ModUtil.LOGGER.info("Initializing Village Addons...");
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
initJamVillagePart();
}
if(ConfigBoolValues.CROP_FIELD_EXISTS.isEnabled()){
initCustomCropFieldPart();
}
if(ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()){
initEngineerVillagePart();
}
}
private static void initEngineerVillagePart(){
VillagerRegistry.instance().registerVillageCreationHandler(new VillageEngineerHouseHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentEngineerHouse.class, ModUtil.MOD_ID+":engineerHouseStructure");
}
private static void initJamVillagePart(){
jamProfession = new VillagerProfession(ModUtil.MOD_ID+":jamGuy", ModUtil.MOD_ID+":textures/entity/villager/jam_villager.png", ModUtil.MOD_ID+":textures/entity/villager/jam_villager_zombie.png");
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());
}
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");
}
private static void initCustomCropFieldPart(){
VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID+":customCropFieldStructure");
}
}

View file

@ -0,0 +1,54 @@
/*
* This file ("BasicTradeList.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.util.StackUtil;
import net.minecraft.entity.IMerchant;
import net.minecraft.entity.passive.EntityVillager.ITradeList;
import net.minecraft.entity.passive.EntityVillager.PriceInfo;
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 BasicTradeList implements ITradeList{
private final ItemStack input;
private final PriceInfo inputAmount;
private final ItemStack output;
private final PriceInfo outputAmount;
public BasicTradeList(ItemStack input, PriceInfo inputAmount, ItemStack output, PriceInfo outputAmount){
this.input = input;
this.inputAmount = inputAmount;
this.output = output;
this.outputAmount = outputAmount;
}
public BasicTradeList(PriceInfo emeraldInput, ItemStack output, PriceInfo outputAmount){
this(new ItemStack(Items.EMERALD), emeraldInput, output, outputAmount);
}
public BasicTradeList(ItemStack input, PriceInfo inputAmount, PriceInfo emeraldOutput){
this(input, inputAmount, new ItemStack(Items.EMERALD), emeraldOutput);
}
@Override
public void func_190888_a(IMerchant merchant, MerchantRecipeList recipeList, Random random){
ItemStack in = this.input.copy();
in = StackUtil.setStackSize(in, this.inputAmount.getPrice(random));
ItemStack out = this.output.copy();
out = StackUtil.setStackSize(out, this.outputAmount.getPrice(random));
recipeList.add(new MerchantRecipe(in, out));
}
}

View file

@ -0,0 +1,112 @@
/*
* This file ("InitVillager.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.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentCustomCropField;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentEngineerHouse;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentJamHouse;
import de.ellpeck.actuallyadditions.mod.gen.village.component.handler.VillageCustomCropFieldHandler;
import de.ellpeck.actuallyadditions.mod.gen.village.component.handler.VillageEngineerHouseHandler;
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.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.entity.passive.EntityVillager.PriceInfo;
import net.minecraft.item.ItemStack;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerCareer;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
public final class InitVillager{
public static VillagerProfession jamProfession;
public static VillagerProfession engineerProfession;
public static void init(){
ModUtil.LOGGER.info("Initializing Village Addons...");
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
initJamVillagePart();
}
if(ConfigBoolValues.CROP_FIELD_EXISTS.isEnabled()){
initCustomCropFieldPart();
}
if(ConfigBoolValues.ENGINEER_VILLAGER_EXISTS.isEnabled()){
initEngineerVillagePart();
}
}
private static void initEngineerVillagePart(){
VillagerRegistry.instance().registerVillageCreationHandler(new VillageEngineerHouseHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentEngineerHouse.class, ModUtil.MOD_ID+":engineerHouseStructure");
engineerProfession = new VillagerProfession(ModUtil.MOD_ID+":engineer", ModUtil.MOD_ID+":textures/entity/villager/engineer_villager.png", ModUtil.MOD_ID+":textures/entity/villager/engineer_villager_zombie.png");
VillagerRegistry.instance().register(engineerProfession);
VillagerCareer crystallizer = new VillagerCareer(engineerProfession, ModUtil.MOD_ID+".crystallizer");
crystallizer.addTrade(1,
new BasicTradeList(new PriceInfo(1, 2), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), new PriceInfo(2, 8)),
new BasicTradeList(new PriceInfo(1, 3), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), new PriceInfo(2, 6)),
new BasicTradeList(new PriceInfo(1, 3), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), new PriceInfo(1, 4)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), new PriceInfo(10, 16), new PriceInfo(1, 1)));
crystallizer.addTrade(2,
new BasicTradeList(new PriceInfo(2, 3), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), new PriceInfo(2, 4)),
new BasicTradeList(new PriceInfo(1, 3), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), new PriceInfo(2, 6)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), new PriceInfo(8, 12), new PriceInfo(1, 1)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), new PriceInfo(8, 16), new PriceInfo(1, 2)));
crystallizer.addTrade(3,
new BasicTradeList(new PriceInfo(2, 4), new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), new PriceInfo(2, 3)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), new PriceInfo(6, 10), new PriceInfo(1, 1)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), new PriceInfo(4, 6), new PriceInfo(1, 1)),
new BasicTradeList(new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), new PriceInfo(6, 12), new PriceInfo(1, 2)));
VillagerCareer engineer = new VillagerCareer(engineerProfession, ModUtil.MOD_ID+".engineer");
engineer.addTrade(1,
new BasicTradeList(new PriceInfo(1, 2), new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), new PriceInfo(2, 3)),
new BasicTradeList(new PriceInfo(1, 2), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), new PriceInfo(6, 8)),
new BasicTradeList(new PriceInfo(1, 3), new ItemStack(InitItems.itemLaserWrench), new PriceInfo(1, 1)));
engineer.addTrade(2,
new BasicTradeList(new ItemStack(InitItems.itemCoffeeBean), new PriceInfo(20, 30), new PriceInfo(1, 2)),
new BasicTradeList(new PriceInfo(3, 5), new ItemStack(InitItems.itemPhantomConnector), new PriceInfo(1, 1)),
new BasicTradeList(new PriceInfo(10, 20), new ItemStack(InitBlocks.blockLaserRelay), new PriceInfo(1, 2)));
engineer.addTrade(3,
new BasicTradeList(new ItemStack(InitBlocks.blockTinyTorch), new PriceInfo(30, 40), new PriceInfo(1, 2)),
new BasicTradeList(new PriceInfo(1, 2), new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), new PriceInfo(1, 2)));
engineer.addTrade(4,
new BasicTradeList(new PriceInfo(3, 5), new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.IRON_CASING.ordinal()), new PriceInfo(1, 2)),
new BasicTradeList(new ItemStack(InitBlocks.blockEmpowerer), new PriceInfo(1, 1), new PriceInfo(15, 20)),
new BasicTradeList(new PriceInfo(30, 40), new ItemStack(InitBlocks.blockLaserRelayExtreme), new PriceInfo(1, 1)));
}
private static void initJamVillagePart(){
jamProfession = new VillagerProfession(ModUtil.MOD_ID+":jamGuy", ModUtil.MOD_ID+":textures/entity/villager/jam_villager.png", ModUtil.MOD_ID+":textures/entity/villager/jam_villager_zombie.png");
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());
}
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentJamHouse.class, ModUtil.MOD_ID+":jamHouseStructure");
}
private static void initCustomCropFieldPart(){
VillagerRegistry.instance().registerVillageCreationHandler(new VillageCustomCropFieldHandler());
MapGenStructureIO.registerStructureComponent(VillageComponentCustomCropField.class, ModUtil.MOD_ID+":customCropFieldStructure");
}
}

View file

@ -1,5 +1,5 @@
/* /*
* This file ("GenericTrade.java") is part of the Actually Additions mod for Minecraft. * This file ("JamVillagerTradeList.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed * It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at * under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense * http://ellpeck.de/actaddlicense
@ -8,7 +8,7 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams; import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams;

View file

@ -8,7 +8,7 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import net.minecraft.block.Block; import net.minecraft.block.Block;

View file

@ -8,18 +8,17 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI; import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.laser.LaserType; import de.ellpeck.actuallyadditions.api.laser.LaserType;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheColoredLampColors;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks; import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.data.WorldData;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems;
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.tile.*;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -42,6 +41,8 @@ import net.minecraft.world.gen.structure.template.Template;
import net.minecraft.world.gen.structure.template.TemplateManager; import net.minecraft.world.gen.structure.template.TemplateManager;
import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -91,7 +92,7 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
} }
} }
this.spawnVillagers(world, sbb, 3, 1, 3, 1); this.spawnVillagers(world, sbb, 7, 4, 6, 1);
return true; return true;
} }
@ -194,8 +195,8 @@ public class VillageComponentEngineerHouse extends StructureVillagePieces.House1
return world.getTileEntity(pos); return world.getTileEntity(pos);
} }
/*@Override @Override
protected VillagerProfession chooseForgeProfession(int count, VillagerProfession prof){ protected VillagerProfession chooseForgeProfession(int count, VillagerProfession prof){
return InitVillager.jamProfession; return InitVillager.engineerProfession;
}*/ }
} }

View file

@ -8,9 +8,10 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.gen.village.InitVillager;
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot; import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import net.minecraft.block.*; import net.minecraft.block.*;

View file

@ -8,8 +8,9 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component.handler;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentCustomCropField;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;

View file

@ -8,8 +8,9 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component.handler;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentEngineerHouse;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;

View file

@ -8,8 +8,9 @@
* © 2015-2016 Ellpeck * © 2015-2016 Ellpeck
*/ */
package de.ellpeck.actuallyadditions.mod.gen; package de.ellpeck.actuallyadditions.mod.gen.village.component.handler;
import de.ellpeck.actuallyadditions.mod.gen.village.component.VillageComponentJamHouse;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces; import net.minecraft.world.gen.structure.StructureVillagePieces;

View file

@ -80,4 +80,6 @@ public final class StackUtil{
public static NonNullList<ItemStack> createSlots(int size){ public static NonNullList<ItemStack> createSlots(int size){
return NonNullList.func_191197_a(size, getNull()); return NonNullList.func_191197_a(size, getNull());
} }
} }

View file

@ -11,6 +11,8 @@ fluid.actuallyadditions.empoweredoil=Empowered Oil
#Entities #Entities
entity.Villager.actuallyadditions.jammer=Jam Guy entity.Villager.actuallyadditions.jammer=Jam Guy
entity.Villager.actuallyadditions.crystallizer=Crystallizer
entity.Villager.actuallyadditions.engineer=Engineer
#Banners #Banners
item.banner.actuallyadditionsBook.black=Black Actually Additions Manual Pattern item.banner.actuallyadditionsBook.black=Black Actually Additions Manual Pattern