mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-10-26 14:24:11 +00:00
New formats for meteor config file. (#50)
This commit is contained in:
1 parent
3037e0f583
commit
1c8ceacb7f
6 files changed
+78
-61
No files matched your search
+8
-8
@@ -23,19 +23,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api("com.github.GTNewHorizons:waila:1.7.0:dev")
|
api("com.github.GTNewHorizons:waila:1.7.1:dev")
|
||||||
api("com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev")
|
api("com.github.GTNewHorizons:NotEnoughItems:2.5.25-GTNH:dev")
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.41:dev") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.126:dev") {transitive = false }
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:Botania:1.10.5-GTNH:api") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:Botania:1.10.12-GTNH:api") {transitive = false }
|
||||||
compileOnly("com.github.GTNewHorizons:ForestryMC:4.8.2:api") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:ForestryMC:4.8.7:api") {transitive = false }
|
||||||
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.4.7:dev") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev") {transitive = false }
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:Chisel:2.13.4-GTNH:api") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:Chisel:2.14.1-GTNH:api") {transitive = false }
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false }
|
||||||
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.3.0:dev") {transitive = false }
|
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.3.1:dev") {transitive = false }
|
||||||
|
|
||||||
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
|
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
|
||||||
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
|
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
|
||||||
|
|||||||
+6
-5
@@ -3,7 +3,7 @@
|
|||||||
gtnh.settings.blowdryerTag = 0.2.0
|
gtnh.settings.blowdryerTag = 0.2.0
|
||||||
|
|
||||||
# Human-readable mod name, available for mcmod.info population.
|
# Human-readable mod name, available for mcmod.info population.
|
||||||
modName = Blood Magic: Alchemical Wizardry
|
modName = Blood Magic\: Alchemical Wizardry
|
||||||
|
|
||||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||||
# Conventionally lowercase.
|
# Conventionally lowercase.
|
||||||
@@ -33,7 +33,7 @@ channel = stable
|
|||||||
mappingsVersion = 12
|
mappingsVersion = 12
|
||||||
|
|
||||||
# Defines other MCP mappings for dependency deobfuscation.
|
# Defines other MCP mappings for dependency deobfuscation.
|
||||||
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||||
|
|
||||||
# Select a default username for testing your mod. You can always override this per-run by running
|
# Select a default username for testing your mod. You can always override this per-run by running
|
||||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||||
@@ -61,6 +61,9 @@ gradleTokenModId =
|
|||||||
# [DEPRECATED] Mod name replacement token.
|
# [DEPRECATED] Mod name replacement token.
|
||||||
gradleTokenModName =
|
gradleTokenModName =
|
||||||
|
|
||||||
|
# [DEPRECATED] Mod Group replacement token.
|
||||||
|
gradleTokenGroupName =
|
||||||
|
|
||||||
# [DEPRECATED]
|
# [DEPRECATED]
|
||||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||||
@@ -123,7 +126,7 @@ includeWellKnownRepositories = true
|
|||||||
usesMavenPublishing = true
|
usesMavenPublishing = true
|
||||||
|
|
||||||
# Maven repository to publish the mod to.
|
# Maven repository to publish the mod to.
|
||||||
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
|
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||||
|
|
||||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||||
#
|
#
|
||||||
@@ -187,5 +190,3 @@ disableCheckstyle = true
|
|||||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||||
# ideaCheckSpotlessOnBuild = true
|
# ideaCheckSpotlessOnBuild = true
|
||||||
|
|
||||||
# Non-GTNH properties
|
|
||||||
gradleTokenGroupName =
|
|
||||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
|
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -11,7 +11,6 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.init.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
@@ -43,7 +42,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
|||||||
|
|
||||||
float totalMeteorWeight = meteor.getTotalMeteorWeight();
|
float totalMeteorWeight = meteor.getTotalMeteorWeight();
|
||||||
List<MeteorParadigmComponent> sortedComponents = new ArrayList<>(meteor.componentList);
|
List<MeteorParadigmComponent> sortedComponents = new ArrayList<>(meteor.componentList);
|
||||||
sortedComponents.sort(Comparator.comparingInt(c -> -c.chance));
|
sortedComponents.sort(Comparator.comparingInt(c -> -c.getChance()));
|
||||||
|
|
||||||
for (MeteorParadigmComponent component : sortedComponents) {
|
for (MeteorParadigmComponent component : sortedComponents) {
|
||||||
ItemStack stack = component.getValidBlockParadigm();
|
ItemStack stack = component.getValidBlockParadigm();
|
||||||
@@ -51,10 +50,6 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
|||||||
int yPos = 37 + 18 * row;
|
int yPos = 37 + 18 * row;
|
||||||
|
|
||||||
List<String> tooltips = new ArrayList<>();
|
List<String> tooltips = new ArrayList<>();
|
||||||
if (stack == null) {
|
|
||||||
stack = new ItemStack(Blocks.fire);
|
|
||||||
tooltips.add(String.format("no entries found for oredict \"%s\"", component.getOreDictName()));
|
|
||||||
}
|
|
||||||
float chance = component.getChance() / totalMeteorWeight;
|
float chance = component.getChance() / totalMeteorWeight;
|
||||||
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
|
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
|
||||||
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
|
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
|
||||||
|
|||||||
+57
-12
@@ -3,15 +3,19 @@ package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import gregtech.common.blocks.GT_TileEntity_Ores;
|
import gregtech.common.blocks.GT_TileEntity_Ores;
|
||||||
|
|
||||||
public class MeteorParadigm {
|
public class MeteorParadigm {
|
||||||
@@ -29,22 +33,67 @@ public class MeteorParadigm {
|
|||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// modId:itemName:meta:weight
|
||||||
|
private static final Pattern itemNamePattern = Pattern.compile("(.*):(.*):(\\d+):(\\d+)");
|
||||||
|
// OREDICT:oreDictName:weight
|
||||||
|
private static final Pattern oredictPattern = Pattern.compile("OREDICT:(.*):(\\d+)");
|
||||||
|
|
||||||
public void parseStringArray(String[] oreArray) {
|
public void parseStringArray(String[] oreArray) {
|
||||||
for (int i = 0; i + 1 < oreArray.length; i += 2) {
|
for (int i = 0; i < oreArray.length; ++i) {
|
||||||
String oreName = oreArray[i];
|
String oreName = oreArray[i];
|
||||||
int oreChance = Integer.parseInt(oreArray[i + 1]);
|
boolean success = false;
|
||||||
MeteorParadigmComponent mpc = new MeteorParadigmComponent(oreName, oreChance);
|
|
||||||
componentList.add(mpc);
|
Matcher matcher = itemNamePattern.matcher(oreName);
|
||||||
|
if (matcher.matches()) {
|
||||||
|
String modID = matcher.group(1);
|
||||||
|
String itemName = matcher.group(2);
|
||||||
|
int meta = Integer.parseInt(matcher.group(3));
|
||||||
|
int weight = Integer.parseInt(matcher.group(4));
|
||||||
|
|
||||||
|
ItemStack stack = GameRegistry.findItemStack(modID, itemName, 1);
|
||||||
|
if (stack != null && stack.getItem() instanceof ItemBlock) {
|
||||||
|
stack.setItemDamage(meta);
|
||||||
|
componentList.add(new MeteorParadigmComponent(stack, weight));
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if ((matcher = oredictPattern.matcher(oreName)).matches()) {
|
||||||
|
String oreDict = matcher.group(1);
|
||||||
|
int weight = Integer.parseInt(matcher.group(2));
|
||||||
|
|
||||||
|
List<ItemStack> list = OreDictionary.getOres(oreDict);
|
||||||
|
for (ItemStack stack : list) {
|
||||||
|
if (stack != null && stack.getItem() instanceof ItemBlock) {
|
||||||
|
componentList.add(new MeteorParadigmComponent(stack, weight));
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Legacy config
|
||||||
|
String oreDict = oreName;
|
||||||
|
int weight = Integer.parseInt(oreArray[++i]);
|
||||||
|
|
||||||
|
List<ItemStack> list = OreDictionary.getOres(oreDict);
|
||||||
|
for (ItemStack stack : list) {
|
||||||
|
if (stack != null && stack.getItem() instanceof ItemBlock) {
|
||||||
|
componentList.add(new MeteorParadigmComponent(stack, weight));
|
||||||
|
success = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
AlchemicalWizardry.logger.warn("Unable to add Meteor Paradigm \"" + oreName + "\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTotalMeteorWeight() {
|
public int getTotalMeteorWeight() {
|
||||||
int totalMeteorWeight = 0;
|
int totalMeteorWeight = 0;
|
||||||
for (MeteorParadigmComponent mpc : componentList) {
|
for (MeteorParadigmComponent mpc : componentList) {
|
||||||
if (mpc == null || !mpc.isValidBlockParadigm()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
totalMeteorWeight += mpc.getChance();
|
totalMeteorWeight += mpc.getChance();
|
||||||
}
|
}
|
||||||
return totalMeteorWeight;
|
return totalMeteorWeight;
|
||||||
@@ -99,10 +148,6 @@ public class MeteorParadigm {
|
|||||||
boolean hasPlacedBlock = false;
|
boolean hasPlacedBlock = false;
|
||||||
|
|
||||||
for (MeteorParadigmComponent mpc : componentList) {
|
for (MeteorParadigmComponent mpc : componentList) {
|
||||||
if (mpc == null || !mpc.isValidBlockParadigm()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
randNum -= mpc.getChance();
|
randNum -= mpc.getChance();
|
||||||
|
|
||||||
if (randNum < 0) {
|
if (randNum < 0) {
|
||||||
|
|||||||
+5
-29
@@ -1,46 +1,22 @@
|
|||||||
package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
package WayofTime.alchemicalWizardry.common.summoning.meteor;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
|
||||||
|
|
||||||
public class MeteorParadigmComponent {
|
public class MeteorParadigmComponent {
|
||||||
|
|
||||||
public String oreDictName;
|
protected int chance;
|
||||||
public int chance;
|
protected ItemStack itemStack;
|
||||||
|
|
||||||
public MeteorParadigmComponent(String dictName, int chance) {
|
public MeteorParadigmComponent(ItemStack stack, int chance) {
|
||||||
this.oreDictName = dictName;
|
this.itemStack = stack;
|
||||||
this.chance = chance;
|
this.chance = chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidBlockParadigm() {
|
|
||||||
if (this.getValidBlockParadigm() != null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOreDictName() {
|
|
||||||
return this.oreDictName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getChance() {
|
public int getChance() {
|
||||||
return this.chance;
|
return this.chance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getValidBlockParadigm() {
|
public ItemStack getValidBlockParadigm() {
|
||||||
List<ItemStack> list = OreDictionary.getOres(getOreDictName());
|
return itemStack;
|
||||||
|
|
||||||
for (ItemStack stack : list) {
|
|
||||||
if (stack != null && stack.getItem() instanceof ItemBlock) {
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user