mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 16:58:34 +01:00
parent
ded8ceb529
commit
377973fc9c
5 changed files with 37 additions and 9 deletions
|
@ -26,6 +26,7 @@ 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;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
|
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses;
|
||||||
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
import de.ellpeck.actuallyadditions.mod.material.InitArmorMaterials;
|
||||||
|
@ -136,6 +137,7 @@ public class ActuallyAdditions{
|
||||||
TreasureChestHandler.init();
|
TreasureChestHandler.init();
|
||||||
LensRecipeHandler.init();
|
LensRecipeHandler.init();
|
||||||
EmpowererHandler.init();
|
EmpowererHandler.init();
|
||||||
|
LensMining.init();
|
||||||
|
|
||||||
InitBooklet.postInit();
|
InitBooklet.postInit();
|
||||||
proxy.postInit(event);
|
proxy.postInit(event);
|
||||||
|
|
|
@ -16,6 +16,8 @@ public enum ConfigStringListValues{
|
||||||
|
|
||||||
CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "Ingots, Dusts and Ores that will be blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
|
CRUSHER_RECIPE_EXCEPTIONS("Crusher Recipe Exceptions", ConfigCategories.OTHER, new String[]{"ingotBrick", "ingotBrickNether"}, "Ingots, Dusts and Ores that will be blacklisted from being auto-registered to be crushed by the Crusher. This list uses OreDictionary Names of the Inputs only."),
|
||||||
CRUSHER_OUTPUT_BLACKLIST("Crusher Output Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as outputs from OreDict Crusher recipes. Use this in case a mod, for example, adds a dust variant that can't be smelted into an ingot. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_item@3"),
|
CRUSHER_OUTPUT_BLACKLIST("Crusher Output Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as outputs from OreDict Crusher recipes. Use this in case a mod, for example, adds a dust variant that can't be smelted into an ingot. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_item@3"),
|
||||||
|
MINING_LENS_BLACKLIST("Mining Lens Blacklist", ConfigCategories.OTHER, new String[0], "The items that aren't allowed as being generated by the Lens of the Miner. Use REGISTRY NAMES, and if metadata is needed, add it like so: somemod:some_block@3"),
|
||||||
|
MINING_LENS_EXTRA_WHITELIST("Mining lens Extra Whitelist", ConfigCategories.OTHER, new String[0], "By default, the mining lens has a set number of ores it can generate. If there is an ore that it should be able to generate, add its OreDictionary name followed by an @ and the weight that it should have (the higher, the more often it will generate), followed by another @ and then an s for it to generate in stone and an n for it to generate in netherrack. For instance: oreCheese@100@s would add cheese ore with a weight of 100 that generates in stone."),
|
||||||
MASHED_FOOD_CRAFTING_EXCEPTIONS("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
MASHED_FOOD_CRAFTING_EXCEPTIONS("Mashed Food Crafting Exceptions", ConfigCategories.ITEMS_CRAFTING, new String[]{"ActuallyAdditions:itemCoffee"}, "The ItemFood, IGrowable and IPlantable Items that can not be used to craft Mashed Food. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
||||||
PAXEL_EXTRA_MINING_WHITELIST("AIOT Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
PAXEL_EXTRA_MINING_WHITELIST("AIOT Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the AIOT can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
||||||
DRILL_EXTRA_MINING_WHITELIST("Drill Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
DRILL_EXTRA_MINING_WHITELIST("Drill Extra Whitelist", ConfigCategories.TOOL_VALUES, new String[]{"TConstruct:GravelOre"}, "By default, the Drill can mine certain blocks. If there is one that it can't mine, but should be able to, put its REGISTRY NAME here. These are the actual registered Item Names, the ones you use, for example, when using the /give Command."),
|
||||||
|
|
|
@ -14,6 +14,9 @@ import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor;
|
||||||
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
import de.ellpeck.actuallyadditions.api.lens.Lens;
|
||||||
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
import de.ellpeck.actuallyadditions.api.recipe.WeightedOre;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockNetherrack;
|
import net.minecraft.block.BlockNetherrack;
|
||||||
|
@ -31,8 +34,7 @@ public class LensMining extends Lens{
|
||||||
|
|
||||||
public static final int ENERGY_USE = 60000;
|
public static final int ENERGY_USE = 60000;
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
static{
|
|
||||||
ActuallyAdditionsAPI.addMiningLensStoneOre("oreCoal", 5000);
|
ActuallyAdditionsAPI.addMiningLensStoneOre("oreCoal", 5000);
|
||||||
ActuallyAdditionsAPI.addMiningLensNetherOre("oreNetherCoal", 5000);
|
ActuallyAdditionsAPI.addMiningLensNetherOre("oreNetherCoal", 5000);
|
||||||
ActuallyAdditionsAPI.addMiningLensStoneOre("oreIron", 3000);
|
ActuallyAdditionsAPI.addMiningLensStoneOre("oreIron", 3000);
|
||||||
|
@ -92,6 +94,28 @@ public class LensMining extends Lens{
|
||||||
|
|
||||||
ActuallyAdditionsAPI.addMiningLensNetherOre("oreCobalt", 50);
|
ActuallyAdditionsAPI.addMiningLensNetherOre("oreCobalt", 50);
|
||||||
ActuallyAdditionsAPI.addMiningLensNetherOre("oreArdite", 50);
|
ActuallyAdditionsAPI.addMiningLensNetherOre("oreArdite", 50);
|
||||||
|
|
||||||
|
for(String conf : ConfigStringListValues.MINING_LENS_EXTRA_WHITELIST.getValue()){
|
||||||
|
if(conf.contains("@")){
|
||||||
|
try{
|
||||||
|
String[] split = conf.split("@");
|
||||||
|
|
||||||
|
String ore = split[0];
|
||||||
|
int weight = Integer.parseInt(split[1]);
|
||||||
|
String dim = split[2];
|
||||||
|
|
||||||
|
if("n".equals(dim)){
|
||||||
|
ActuallyAdditionsAPI.addMiningLensNetherOre(ore, weight);
|
||||||
|
}
|
||||||
|
else if("s".equals(dim)){
|
||||||
|
ActuallyAdditionsAPI.addMiningLensStoneOre(ore, weight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
ModUtil.LOGGER.warn("A config option appears to be incorrect: The entry "+conf+" can't be parsed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,7 +145,7 @@ public class LensMining extends Lens{
|
||||||
List<ItemStack> stacks = OreDictionary.getOres(ore.name, false);
|
List<ItemStack> stacks = OreDictionary.getOres(ore.name, false);
|
||||||
if(stacks != null && !stacks.isEmpty()){
|
if(stacks != null && !stacks.isEmpty()){
|
||||||
for(ItemStack aStack : stacks){
|
for(ItemStack aStack : stacks){
|
||||||
if(StackUtil.isValid(aStack) && aStack.getItem() instanceof ItemBlock){
|
if(StackUtil.isValid(aStack) && !CrusherRecipeRegistry.hasBlacklistedOutput(aStack, ConfigStringListValues.MINING_LENS_BLACKLIST.getValue()) && aStack.getItem() instanceof ItemBlock){
|
||||||
adaptedUse += (totalWeight-ore.itemWeight)%40000;
|
adaptedUse += (totalWeight-ore.itemWeight)%40000;
|
||||||
|
|
||||||
stack = aStack;
|
stack = aStack;
|
||||||
|
@ -163,5 +187,4 @@ public class LensMining extends Lens{
|
||||||
public int getDistance(){
|
public int getDistance(){
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import de.ellpeck.actuallyadditions.mod.booklet.page.PageCrafting;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace;
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PageFurnace;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture;
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PagePicture;
|
||||||
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTextOnly;
|
import de.ellpeck.actuallyadditions.mod.booklet.page.PageTextOnly;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.config.values.ConfigStringListValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
import de.ellpeck.actuallyadditions.mod.items.lens.LensRecipeHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
|
@ -219,7 +220,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
for(ItemStack input : inputs){
|
for(ItemStack input : inputs){
|
||||||
if(StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null){
|
if(StackUtil.isValid(input) && CrusherRecipeRegistry.getRecipeFromInput(input) == null){
|
||||||
for(ItemStack outputOne : outputOnes){
|
for(ItemStack outputOne : outputOnes){
|
||||||
if(StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne)){
|
if(StackUtil.isValid(outputOne) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputOne, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){
|
||||||
ItemStack outputOneCopy = outputOne.copy();
|
ItemStack outputOneCopy = outputOne.copy();
|
||||||
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmounts);
|
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmounts);
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ public class MethodHandler implements IMethodHandler{
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
for(ItemStack outputTwo : outputTwos){
|
for(ItemStack outputTwo : outputTwos){
|
||||||
if(StackUtil.isValid(outputTwo) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputTwo)){
|
if(StackUtil.isValid(outputTwo) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputTwo, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){
|
||||||
ItemStack outputTwoCopy = outputTwo.copy();
|
ItemStack outputTwoCopy = outputTwo.copy();
|
||||||
outputTwoCopy = StackUtil.setStackSize(outputTwoCopy, outputTwoAmounts);
|
outputTwoCopy = StackUtil.setStackSize(outputTwoCopy, outputTwoAmounts);
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,13 @@ public final class CrusherRecipeRegistry{
|
||||||
ModUtil.LOGGER.warn("Couldn't add "+oresNoResult.size()+" Crusher Recipes automatically, either because the inputs were missing outputs, or because they exist already: "+oresNoResult);
|
ModUtil.LOGGER.warn("Couldn't add "+oresNoResult.size()+" Crusher Recipes automatically, either because the inputs were missing outputs, or because they exist already: "+oresNoResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasBlacklistedOutput(ItemStack output){
|
public static boolean hasBlacklistedOutput(ItemStack output, String[] config){
|
||||||
if(StackUtil.isValid(output)){
|
if(StackUtil.isValid(output)){
|
||||||
Item item = output.getItem();
|
Item item = output.getItem();
|
||||||
if(item != null){
|
if(item != null){
|
||||||
String reg = item.getRegistryName().toString();
|
String reg = item.getRegistryName().toString();
|
||||||
|
|
||||||
for(String conf : ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue()){
|
for(String conf : config){
|
||||||
String confReg = conf;
|
String confReg = conf;
|
||||||
int meta = 0;
|
int meta = 0;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ public final class CrusherRecipeRegistry{
|
||||||
meta = Integer.parseInt(split[1]);
|
meta = Integer.parseInt(split[1]);
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
ModUtil.LOGGER.warn("A config option appears to be incorrect: The Crusher Output Blacklist entry "+conf+" can't be parsed!");
|
ModUtil.LOGGER.warn("A config option appears to be incorrect: The entry "+conf+" can't be parsed!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue