Compare commits

..
1 Commits
15 changed files with 29 additions and 122 deletions

No files matched your search

-2
View File
@@ -41,6 +41,4 @@ dependencies {
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false } compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
compileOnly("curse.maven:endlessids-665730:7585931") {transitive = false } compileOnly("curse.maven:endlessids-665730:7585931") {transitive = false }
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.45:dev") compileOnly("com.github.GTNewHorizons:StructureLib:1.4.45:dev")
compileOnly("com.ruling_0:MaterialLib:0.24.0-mu:dev") {transitive = false }
} }
-1
View File
@@ -1,5 +1,4 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
mavenLocal()
} }
@@ -86,6 +86,7 @@ import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityM
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianWind; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianWind;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonChest; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonChest;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityAirElemental; import WayofTime.alchemicalWizardry.common.entity.mob.EntityAirElemental;
@@ -3343,9 +3344,10 @@ public class AlchemicalWizardry {
BloodMagicConfiguration.blacklistRituals(); BloodMagicConfiguration.blacklistRituals();
BloodMagicConfiguration.loadCustomLPValues(); BloodMagicConfiguration.loadCustomLPValues();
DemonVillageLootRegistry.init();
MeteorRegistry.loadConfig(); MeteorRegistry.loadConfig();
MeteorReagentRegistry.loadConfig(); MeteorReagentRegistry.loadConfig();
MeteorRegistry.logMaterialLibTally();
this.initCompressionHandlers(); this.initCompressionHandlers();
} }
@@ -114,7 +114,7 @@ public class BloodMagicConfiguration {
The block to use for filler in meteors if none is provided in the meteor's config file and that The block to use for filler in meteors if none is provided in the meteor's config file and that
meteor's fillerChance is greater than 0. Also used as a fallback for empty ore lists in meteor configs. meteor's fillerChance is greater than 0. Also used as a fallback for empty ore lists in meteor configs.
Specify the block with the format: Specify the block with the format:
"modId:itemName:meta", or "ml:material:shape" for a MaterialLib block. "modId:itemName:meta"
Defaults to minecraft:stone:0 if no block is provided or the provided block cannot be found."""); Defaults to minecraft:stone:0 if no block is provided or the provided block cannot be found.""");
MeteorComponent.setDefaultMeteorBlock(); MeteorComponent.setDefaultMeteorBlock();
AlchemicalWizardry.allowedCrushedOresArray = config.get( AlchemicalWizardry.allowedCrushedOresArray = config.get(
@@ -122,7 +122,7 @@ public class NEIBindingRitualHandler extends TemplateRecipeHandler {
@Override @Override
public String getRecipeName() { public String getRecipeName() {
return "Binding Ritual"; return StatCollector.translateToLocal("nei.recipe.bindingritual.category");
} }
@Override @Override
@@ -216,6 +216,6 @@ public class NEICalcinatorHandler extends TemplateRecipeHandler {
@Override @Override
public String getRecipeName() { public String getRecipeName() {
return "Alchemic Calcinator"; return StatCollector.translateToLocal("nei.recipe.calcinator.category");
} }
} }
@@ -214,6 +214,12 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
return true; return true;
} }
// Ignore GregTech ore variants (like basalt ore)
if (compared.getUnlocalizedName().startsWith("gt.blockores")
&& compareTo.getUnlocalizedName().startsWith("gt.blockores")) {
return compared.getItemDamage() % 1000 == compareTo.getItemDamage() % 1000;
}
// Check oredicts for ores. Checks for direct matches (oreIron with oreIron) as well as IC2/GT crushed ores // Check oredicts for ores. Checks for direct matches (oreIron with oreIron) as well as IC2/GT crushed ores
// (crushedGold with oreGold), EFR raw ores (rawCopper with oreCopper (although those all seem to have oreX // (crushedGold with oreGold), EFR raw ores (rawCopper with oreCopper (although those all seem to have oreX
// anyways)), and GT:NH raw ores (rawOreDiamond with oreDiamond). // anyways)), and GT:NH raw ores (rawOreDiamond with oreDiamond).
@@ -13,13 +13,8 @@ import WayofTime.alchemicalWizardry.ModItems;
public class DemonVillageLootRegistry { public class DemonVillageLootRegistry {
public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList<>(); public static ArrayList<WeightedRandomChestContent> list1 = new ArrayList<>();
private static boolean built = false;
/// Copies the dungeon and desert-pyramid loot on first use rather than while loading, so the copy carries every public static void init() {
/// change other mods make to those tables during loading.
private static void build() {
if (built) return;
built = true;
String[] tier1Strings = new String[] { ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST }; String[] tier1Strings = new String[] { ChestGenHooks.DUNGEON_CHEST, ChestGenHooks.PYRAMID_DESERT_CHEST };
for (String str : tier1Strings) { for (String str : tier1Strings) {
WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random()); WeightedRandomChestContent[] contents = ChestGenHooks.getItems(str, new Random());
@@ -35,7 +30,6 @@ public class DemonVillageLootRegistry {
} }
public static void populateChest(IInventory tile, int tier) { public static void populateChest(IInventory tile, int tier) {
build();
WeightedRandomChestContent WeightedRandomChestContent
.generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3); .generateChestContents(new Random(), toArray(list1), tile, tile.getSizeInventory() / 3);
} }
@@ -28,6 +28,7 @@ import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import gregtech.common.blocks.GTBlockOre;
public class BoundPickaxe extends ItemPickaxe implements IBindable { public class BoundPickaxe extends ItemPickaxe implements IBindable {
@@ -124,7 +125,13 @@ public class BoundPickaxe extends ItemPickaxe implements IBindable {
if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) { if (silkTouch && block.canSilkHarvest(world, player, x, y, z, meta)) {
dropMultiset.add(new ItemType(block, meta)); dropMultiset.add(new ItemType(block, meta));
} else { } else {
ArrayList<ItemStack> itemDropList = block.getDrops(world, x, y, z, meta, fortuneLvl); ArrayList<ItemStack> itemDropList;
if (AlchemicalWizardry.isGregTech5UnofficialNewHorizonsLoaded
&& block instanceof GTBlockOre ore) {
itemDropList = ore.getDropsForPlayer(world, x, y, z, meta, fortuneLvl, player);
} else {
itemDropList = block.getDrops(world, x, y, z, meta, fortuneLvl);
}
if (itemDropList != null) { if (itemDropList != null) {
for (ItemStack stack : itemDropList) for (ItemStack stack : itemDropList)
@@ -23,6 +23,7 @@ import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.ItemType; import WayofTime.alchemicalWizardry.common.ItemType;
import WayofTime.alchemicalWizardry.common.block.BlockTeleposer; import WayofTime.alchemicalWizardry.common.block.BlockTeleposer;
import gregtech.common.blocks.GTBlockOre;
public class RitualEffectMagnetic extends RitualEffect { public class RitualEffectMagnetic extends RitualEffect {
@@ -34,7 +35,8 @@ public class RitualEffectMagnetic extends RitualEffect {
public static boolean isBlockOre(Block block, int meta) { public static boolean isBlockOre(Block block, int meta) {
// Special case for lit redstone ore // Special case for lit redstone ore
if (block instanceof BlockOre || block instanceof BlockRedstoneOre) { if (block instanceof BlockOre || block instanceof BlockRedstoneOre
|| (AlchemicalWizardry.isGregTech5UnofficialNewHorizonsLoaded && block instanceof GTBlockOre)) {
return true; return true;
} }
@@ -22,19 +22,6 @@ class ItemStackAdapter extends TypeAdapter<ItemStack> {
.warn("Unable to read item stack \"{}\". Valid format is \"modid:name(:meta optional)\"", str); .warn("Unable to read item stack \"{}\". Valid format is \"modid:name(:meta optional)\"", str);
return null; return null;
} }
if (input[0].equals("ml")) {
if (input.length != 3) {
AlchemicalWizardry.logger.warn(
"Unable to read item stack \"{}\". Valid MaterialLib format is \"ml:material:shape\"",
str);
return null;
}
ItemStack resolved = MeteorRegistry.resolveMaterialLibStack(input[1], input[2]);
if (resolved == null) {
AlchemicalWizardry.logger.warn("Unable to find item stack \"{}\".", str);
}
return resolved;
}
ItemStack itemStack = GameRegistry.findItemStack(input[0], input[1], 1); ItemStack itemStack = GameRegistry.findItemStack(input[0], input[1], 1);
if (itemStack == null) { if (itemStack == null) {
AlchemicalWizardry.logger.warn("Unable to find item stack \"{}\".", str); AlchemicalWizardry.logger.warn("Unable to find item stack \"{}\".", str);
@@ -18,19 +18,13 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class MeteorComponent { public class MeteorComponent {
private final int weight; private final int weight;
private ItemStack itemStack; private final ItemStack itemStack;
private final String materialName;
private final String shapeToken;
private final ArrayList<Reagent> reagent; private final ArrayList<Reagent> reagent;
public static MeteorComponent defaultMeteorBlock; public static MeteorComponent defaultMeteorBlock;
public static void setDefaultMeteorBlock() { public static void setDefaultMeteorBlock() {
String string = AlchemicalWizardry.defaultMeteorBlock; String string = AlchemicalWizardry.defaultMeteorBlock;
String[] split = string.split(":"); String[] split = string.split(":");
if (split.length == 3 && split[0].equals("ml")) {
defaultMeteorBlock = new MeteorComponent(split[1], split[2]);
return;
}
ItemStack stack = null; ItemStack stack = null;
if (!string.isEmpty() && split.length >= 3) { if (!string.isEmpty() && split.length >= 3) {
stack = GameRegistry.findItemStack(split[0], split[1], 1); stack = GameRegistry.findItemStack(split[0], split[1], 1);
@@ -49,22 +43,10 @@ public class MeteorComponent {
public MeteorComponent(ItemStack stack, int weight, ArrayList<Reagent> reagent) { public MeteorComponent(ItemStack stack, int weight, ArrayList<Reagent> reagent) {
this.itemStack = stack; this.itemStack = stack;
this.materialName = null;
this.shapeToken = null;
this.weight = weight; this.weight = weight;
this.reagent = reagent; this.reagent = reagent;
} }
/// The default meteor block named as `ml:<Material>:<shape>`. Its stack is resolved on the first [#getBlock]
/// call -- the config is read at preInit, before MaterialLib resolves its shapes.
private MeteorComponent(String materialName, String shapeToken) {
this.itemStack = null;
this.materialName = materialName;
this.shapeToken = shapeToken;
this.weight = 1;
this.reagent = new ArrayList<>();
}
public static List<MeteorComponent> parseStringArray(String[] blockArray) { public static List<MeteorComponent> parseStringArray(String[] blockArray) {
List<MeteorComponent> addList = new ArrayList<>(); List<MeteorComponent> addList = new ArrayList<>();
if (blockArray == null) { if (blockArray == null) {
@@ -83,25 +65,10 @@ public class MeteorComponent {
private static final Pattern itemNamePattern = Pattern.compile("(.*):(.*):(\\d+):(\\d+)(:.*)?"); private static final Pattern itemNamePattern = Pattern.compile("(.*):(.*):(\\d+):(\\d+)(:.*)?");
// OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional) // OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional)
private static final Pattern oredictPattern = Pattern.compile("OREDICT:(.*):(\\d+)(:.*)?"); private static final Pattern oredictPattern = Pattern.compile("OREDICT:(.*):(\\d+)(:.*)?");
// ml:material:shape:weight(:reagent1, reagent2, ... optional)
private static final Pattern materialLibPattern = Pattern.compile("ml:([^:]+):([^:]+):(\\d+)(:.*)?");
public static MeteorComponent parseString(String blockName) { public static MeteorComponent parseString(String blockName) {
Matcher matcher = materialLibPattern.matcher(blockName); Matcher matcher = itemNamePattern.matcher(blockName);
if (matcher.matches()) { if (matcher.matches()) {
String materialName = matcher.group(1);
String shapeToken = matcher.group(2);
int weight = Integer.parseInt(matcher.group(3));
String reagent = matcher.group(4);
ArrayList<Reagent> reagentList = MeteorReagent.parseReagents(reagent, blockName);
ItemStack stack = MeteorRegistry.resolveMaterialLibStack(materialName, shapeToken);
if (stack != null && stack.getItem() instanceof ItemBlock) {
return new MeteorComponent(stack, weight, reagentList);
}
} else if ((matcher = itemNamePattern.matcher(blockName)).matches()) {
String modID = matcher.group(1); String modID = matcher.group(1);
String itemName = matcher.group(2); String itemName = matcher.group(2);
int meta = Integer.parseInt(matcher.group(3)); int meta = Integer.parseInt(matcher.group(3));
@@ -133,7 +100,7 @@ public class MeteorComponent {
} }
AlchemicalWizardry.logger.warn("Unable to add Meteor Component \"{}\"", blockName); AlchemicalWizardry.logger.warn("Unable to add Meteor Component \"{}\"", blockName);
AlchemicalWizardry.logger.warn( AlchemicalWizardry.logger.warn(
"Valid formats are \"modId:itemName:meta:weight(:reagent1, reagent2, ... optional)\", \"OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional)\" and \"ml:material:shape:weight(:reagent1, reagent2, ... optional)\"."); "Valid formats are \"modId:itemName:meta:weight(:reagent1, reagent2, ... optional)\" and \"OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional)\".");
return null; return null;
} }
@@ -150,16 +117,6 @@ public class MeteorComponent {
} }
public ItemStack getBlock() { public ItemStack getBlock() {
if (itemStack == null && materialName != null) {
itemStack = MeteorRegistry.resolveMaterialLibStack(materialName, shapeToken);
if (itemStack == null || !(itemStack.getItem() instanceof ItemBlock)) {
AlchemicalWizardry.logger.warn(
"Unable to use \"ml:{}:{}\" as the default meteor block, falling back to stone.",
materialName,
shapeToken);
itemStack = new ItemStack(Blocks.stone);
}
}
return itemStack; return itemStack;
} }
@@ -17,39 +17,11 @@ import com.google.gson.JsonSyntaxException;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.compat.materiallib.MaterialLibStacks;
import cpw.mods.fml.common.Loader;
public class MeteorRegistry { public class MeteorRegistry {
public static List<Meteor> meteorList = new ArrayList<>(); public static List<Meteor> meteorList = new ArrayList<>();
private static int materialLibResolved;
private static int materialLibInvalid;
/// The stack a `ml:<Material>:<shape>` entry names, or null when MaterialLib is absent or the entry resolves to
/// nothing. Counts the outcome into the tally [#logMaterialLibTally] reports.
static ItemStack resolveMaterialLibStack(String materialName, String shapeToken) {
ItemStack stack = Loader.isModLoaded("materiallib") ? MaterialLibStacks.getStack(materialName, shapeToken)
: null;
if (stack == null) {
materialLibInvalid++;
} else {
materialLibResolved++;
}
return stack;
}
/// Logs the `ml:` entry tally and clears it. Call once every config that can carry such entries is loaded.
public static void logMaterialLibTally() {
if (materialLibResolved + materialLibInvalid > 0) {
AlchemicalWizardry.logger
.info("Resolved {} MaterialLib entries ({} invalid)", materialLibResolved, materialLibInvalid);
}
materialLibResolved = 0;
materialLibInvalid = 0;
}
public static void loadConfig() { public static void loadConfig() {
Gson gson = new GsonBuilder().setPrettyPrinting() Gson gson = new GsonBuilder().setPrettyPrinting()
.registerTypeAdapter(MeteorComponent.class, new MeteorComponentAdapter()) .registerTypeAdapter(MeteorComponent.class, new MeteorComponentAdapter())
@@ -1,19 +0,0 @@
package WayofTime.alchemicalWizardry.compat.materiallib;
import net.minecraft.item.ItemStack;
import com.ruling_0.materiallib.api.StackResolver;
/// Resolves a MaterialLib item from a material name and a shape token.
///
/// MaterialLib types are named only in this class, so it loads only where `materiallib` is present.
public final class MaterialLibStacks {
private MaterialLibStacks() {}
/// A single item of the named material in the named shape; see [StackResolver#getStack] for the naming rules and
/// the null cases.
public static ItemStack getStack(String materialName, String shapeToken) {
return StackResolver.getStack(materialName, shapeToken, 1);
}
}
@@ -278,6 +278,8 @@ text.recipe.altar.tier=Tier: %s
text.recipe.altar.bloodRequired=LP: %s text.recipe.altar.bloodRequired=LP: %s
text.recipe.shapedOrb=Shaped Orb Recipe text.recipe.shapedOrb=Shaped Orb Recipe
text.recipe.alchemicCalcinator.reagent=%s AR text.recipe.alchemicCalcinator.reagent=%s AR
nei.recipe.bindingritual.category=Binding Ritual
nei.recipe.calcinator.category=Alchemic Calcinator
nei.recipe.meteor.category=Meteor Ritual nei.recipe.meteor.category=Meteor Ritual
nei.recipe.meteor.cost=LP cost to summon this meteor nei.recipe.meteor.cost=LP cost to summon this meteor
nei.recipe.meteor.tooExpensive=Insufficient LP in Soul Network nei.recipe.meteor.tooExpensive=Insufficient LP in Soul Network