Compare commits

..
5 Commits
Author SHA1 Message Date
Martin Robertz 72492ff8c8 update 2024-05-19 13:07:01 +02:00
Lyfts bc7972031b Cehrry pick: a7d6f8e59b [a7d6f8e]
* update deps

* fix teleposer unable to teleport to the end
2024-05-19 12:54:19 +02:00
LyftsGitHub GTNH Actionsgithub-actions[bot]
8b0726c5ae Cerry Pick: fcddb56254 [fcddb56]
Fix client-side crash on servers (#52)

* update deps

* fix client crash on servers

* spotlessApply (#53)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-05-19 12:53:34 +02:00
Martin Robertz 6a3b0e1a70 update 2024-05-03 23:15:46 +02:00
Guillaume Mercier 232148ac42 Add new rune to reduce the delay between crafts (#51)
* add layout.json to gitignore

* Add quickness rune

This rune reduces the delay between consecutive crafts. This is done by essentially scheduling a recipe check every time a recipe completes. Using something like a world accelerator will have no effect on the frequency and the runes themselves do not increase the frequency at which the altar naturally checks for updates.

This commit also addresses a couple other issues with the altar.
- since the altar was using the world time and not the world age, some mechanics were impossible to trigger if you set doDaylightCycle to false.
- For example it was impossible to start a craft if the time wasn't set to a multiple of 100.

(cherry picked from commit e14b1f23c9)
2024-05-03 23:14:44 +02:00
61 changed files with 723 additions and 1298 deletions

No files matched your search

+1 -1
View File
@@ -27,4 +27,4 @@ whitelist.json
*.iws
src/main/resources/mixins.*.json
*.bat
layout.json
/layout.json
+11 -11
View File
@@ -23,19 +23,19 @@
*/
dependencies {
api("com.github.GTNewHorizons:waila:1.8.4:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.7.40-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.266:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.12.6-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.7:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.6.2:dev") {transitive = false }
api("com.github.GTNewHorizons:waila:1.7.3:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.5.27-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.45.166:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.10.12-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.8.9:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.4.8:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.14.1-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.16.2-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false }
compileOnly("com.github.GTNewHorizons:CraftTweaker:3.4.1: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("curse.maven:guide-api-228832:2287185") {transitive = false }
+2 -13
View File
@@ -14,7 +14,7 @@ modId = AWWayofTime
modGroup = WayofTime.alchemicalWizardry
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -85,11 +85,6 @@ accessTransformersFile = NEI_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
@@ -122,15 +117,9 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+3 -5
View File
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -57,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -86,7 +84,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -205,7 +203,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
Vendored
-2
View File
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
}
@@ -250,8 +250,7 @@ import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWateryGrave;
import WayofTime.alchemicalWizardry.common.spell.simple.SpellWindGust;
import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorReagentRegistry;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
@@ -308,8 +307,6 @@ public class AlchemicalWizardry {
public static boolean parseTextFiles = false;
public static int defaultMeteorCost = 1000000;
public static String defaultMeteorBlock;
public static boolean doMeteorsDestroyBlocks = true;
public static String[] allowedCrushedOresArray;
@@ -493,7 +490,6 @@ public class AlchemicalWizardry {
public static boolean causeHungerWithRegen;
public static boolean causeHungerChatMessage = true;
public static boolean disableBoundToolsRightClick;
public static boolean allowPotionRepair;
public static BlockStack[] secondTierRunes = new BlockStack[10];
public static BlockStack[] thirdTierRunes = new BlockStack[10];
@@ -624,12 +620,35 @@ public class AlchemicalWizardry {
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
File bmDirectory = new File("config/BloodMagic/schematics");
generateDefaultConfig(
"config/BloodMagic/schematics",
"/assets/alchemicalwizardry/schematics/building/buildings.zip");
generateDefaultConfig("config/BloodMagic/meteors", "/assets/alchemicalwizardry/meteors/meteors.zip");
generateDefaultConfig("config/BloodMagic/meteors/reagents", "/assets/alchemicalwizardry/meteors/reagents.zip");
if (!bmDirectory.exists() && bmDirectory.mkdirs()) {
try {
InputStream in = AlchemicalWizardry.class
.getResourceAsStream("/assets/alchemicalwizardry/schematics/building/buildings.zip");
logger.info("none yet!");
if (in != null) {
logger.info("I have found a zip!");
ZipInputStream zipStream = new ZipInputStream(in);
ZipEntry entry;
while ((entry = zipStream.getNextEntry()) != null) {
File file = new File(bmDirectory, entry.getName());
if (file.exists() && file.length() > 3L) {
continue;
}
FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[8192];
int len;
while ((len = zipStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
}
}
} catch (Exception e) {}
}
TEDemonPortal.loadBuildingList();
@@ -688,42 +707,6 @@ public class AlchemicalWizardry {
ModAchievements.init();
}
/**
* Attempt to generate default configs at the given destination using a zip located at the given source.
*
* @param destination The destination path for the config, starting inside .minecraft.
* @param source The source path for the config's zip, starting in src/main/resources/
*/
private static void generateDefaultConfig(String destination, String source) {
File destinationDirectory = new File(destination);
if (!destinationDirectory.exists() && destinationDirectory.mkdirs()) {
try {
InputStream in = AlchemicalWizardry.class.getResourceAsStream(source);
logger.info("Attempting to load default config for {}", destinationDirectory);
if (in != null) {
logger.info("Unpacking zip found at {}", source);
ZipInputStream zipStream = new ZipInputStream(in);
ZipEntry entry;
while ((entry = zipStream.getNextEntry()) != null) {
File file = new File(destinationDirectory, entry.getName());
if (file.exists() && file.length() > 3L) {
continue;
}
FileOutputStream out = new FileOutputStream(file);
byte[] buffer = new byte[8192];
int len;
while ((len = zipStream.read(buffer)) != -1) {
out.write(buffer, 0, len);
}
out.close();
}
}
} catch (Exception e) {}
}
}
@EventHandler
public void load(FMLInitializationEvent event) {
int craftingConstant = OreDictionary.WILDCARD_VALUE;
@@ -735,9 +718,8 @@ public class AlchemicalWizardry {
proxy.registerEntities();
proxy.registerEntityTrackers();
proxy.registerEvents();
if (Loader.isModLoaded("Waila")) {
BloodMagicWailaPlugin.init();
}
BloodMagicWailaPlugin.init();
// ItemStacks used for crafting go here
ItemStack lapisStack = new ItemStack(Items.dye, 1, 4);
ItemStack lavaBucketStack = new ItemStack(Items.lava_bucket);
@@ -3337,9 +3319,7 @@ public class AlchemicalWizardry {
BloodMagicConfiguration.loadCustomLPValues();
DemonVillageLootRegistry.init();
MeteorRegistry.loadConfig();
MeteorReagentRegistry.loadConfig();
Meteor.loadConfig();
this.initCompressionHandlers();
}
@@ -4523,7 +4503,7 @@ public class AlchemicalWizardry {
return strings;
}
@EventHandler
@Mod.EventHandler
public void initCommands(FMLServerStartingEvent event) {
event.registerServerCommand(new CommandBloodMagic());
}
@@ -29,7 +29,6 @@ import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks;
import WayofTime.alchemicalWizardry.common.demonVillage.DemonVillagePath;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
@@ -103,23 +102,6 @@ public class BloodMagicConfiguration {
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true)
.getBoolean(true);
AlchemicalWizardry.defaultMeteorCost = config.getInt(
"defaultMeteorCost",
"meteor",
1000000,
0,
Integer.MAX_VALUE,
"The default LP cost to use for meteors if the \"cost\" property is not present in its config file.\n");
AlchemicalWizardry.defaultMeteorBlock = config.getString(
"defaultMeteorBlock",
"meteor",
"",
"The block to use for filler in meteors if none is provided in the meteor's config file and "
+ "that\nmeteor's fillerChance is greater than 0. Also used as a fallback for empty ore "
+ "lists in meteor configs.\nSpecify the block with the "
+ "format:\n\"modId:itemName:meta\"\nDefaults to minecraft:stone:0 if no block is provided or "
+ "the provided block cannot be found.");
MeteorComponent.setDefaultMeteorBlock();
AlchemicalWizardry.allowedCrushedOresArray = config.get(
"oreCrushing",
"allowedOres",
@@ -131,7 +113,6 @@ public class BloodMagicConfiguration {
.getBoolean();
AlchemicalWizardry.causeHungerChatMessage = config.get("WimpySettings", "causeHungerChatMessage", true)
.getBoolean();
AlchemicalWizardry.allowPotionRepair = config.get("WimpySettings", "allowPotionRepair", true).getBoolean();
// AlchemicalWizardry.lockdownAltar = config.get("WimpySettings", "LockdownAltarWithRegen", true).getBoolean();
AlchemicalWizardry.lockdownAltar = false;
AlchemicalWizardry.disableBoundToolsRightClick = config
@@ -666,19 +647,10 @@ public class BloodMagicConfiguration {
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier(
"specialBlocks",
new BlockStack[] { new BlockStack(Blocks.air, 0), new BlockStack(Blocks.glowstone, 0),
new BlockStack(Blocks.air, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0),
new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.air, 0),
new BlockStack(ModBlocks.blockCrystal, 0) },
"Set the special blocks for the altar with the format mod:block(:meta) in the following order:\n"
+ "Tier 3 pillar\n"
+ "Tier 3 cap\n"
+ "Tier 4 pillar\n"
+ "Tier 4 cap\n"
+ "Tier 5 beacon\n"
+ "Tier 6 pillar\n"
+ "Tier 6 cap\n"
+ "Set any of these to minecraft:air to allow for that component to be any block EXCEPT air (e.g., let any block be used for a pillar).");
new BlockStack[] { new BlockStack(Blocks.stonebrick, 0), new BlockStack(Blocks.glowstone, 0),
new BlockStack(Blocks.stonebrick, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0),
new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.stonebrick, 0),
new BlockStack(ModBlocks.blockCrystal, 0) });
config.save();
}
@@ -818,16 +790,12 @@ public class BloodMagicConfiguration {
}
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) {
return getAltarRunesForTier(tierName, defaultValues, "");
}
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues, String comment) {
String[] defaultNames = new String[defaultValues.length];
for (int i = 0; i < defaultValues.length; i++) {
defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":"
+ defaultValues[i].getMeta();
}
Property property = config.get("rune overrides", tierName, defaultNames, comment);
Property property = config.get("rune overrides", tierName, defaultNames);
String[] names = property.getStringList();
if (names.length != defaultNames.length) {
property.set(defaultNames);
@@ -280,7 +280,7 @@ public class SoulNetworkHandler {
return 0;
}
int newEss = (int) Math.min(Integer.MAX_VALUE, Math.min(event.maximum, (long) currEss + event.addedAmount));
int newEss = Math.min(event.maximum, currEss + event.addedAmount);
if (event.getResult() != Event.Result.DENY) {
data.currentEssence = newEss;
}
@@ -13,15 +13,11 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import com.google.common.base.Joiner;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigmComponent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.NEIServerUtils;
@@ -39,95 +35,40 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
private final int radius;
private Point focus;
public CachedMeteorRecipe(Meteor meteor, ItemStack focusStack) {
this.input.add(new PositionedStack(meteor.focusItem, 74, 4));
public CachedMeteorRecipe(MeteorParadigm meteor, ItemStack focusStack) {
this.input.add(new PositionedStack(meteor.focusStack, 74, 4));
int row = 0;
int col = 0;
float totalComponentWeight = MeteorComponent.getTotalListWeight(meteor.ores);
float fillerChance = meteor.fillerChance;
List<MeteorComponent> sortedComponents = new ArrayList<>(meteor.ores);
sortedComponents.sort(Comparator.comparingInt(c -> -c.getWeight()));
float totalMeteorWeight = meteor.getTotalMeteorWeight();
List<MeteorParadigmComponent> sortedComponents = new ArrayList<>(meteor.componentList);
sortedComponents.sort(Comparator.comparingInt(c -> -c.getChance()));
float fillerRatio = (float) (fillerChance / 100.0);
float componentRatio = 1 - fillerRatio;
for (MeteorParadigmComponent component : sortedComponents) {
ItemStack stack = component.getValidBlockParadigm();
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
if (fillerChance < 100) {
for (MeteorComponent component : sortedComponents) {
ItemStack stack = component.getBlock();
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>();
float chance = component.getChance() / totalMeteorWeight;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
List<String> tooltips = new ArrayList<>();
float chance = component.getWeight() / totalComponentWeight * componentRatio;
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
if (!component.getRequiredReagents().isEmpty()) {
tooltips.add(I18n.format("nei.recipe.meteor.reagent", getReagentStrings(component)));
}
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0;
row++;
}
if (matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
}
}
if (fillerChance > 0) {
if (col != 0) {
col++;
if (col > 8) {
col = 0;
row++;
}
List<MeteorComponent> sortedFiller = new ArrayList<>(meteor.filler);
sortedFiller.sort(Comparator.comparingInt(c -> -c.getWeight()));
float totalFillerWeight = MeteorComponent.getTotalListWeight(meteor.filler);
for (MeteorComponent filler : sortedFiller) {
ItemStack stack = filler.getBlock();
int xPos = 3 + 18 * col;
int yPos = 37 + 18 * row;
List<String> tooltips = new ArrayList<>();
float chance = filler.getWeight() / totalFillerWeight * fillerRatio;
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.filler"));
if (!filler.getRequiredReagents().isEmpty()) {
tooltips.add(I18n.format("nei.recipe.meteor.reagent", getReagentStrings(filler)));
}
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
col++;
if (col > 8) {
col = 0;
row++;
}
if (matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
if (focusStack != null && matchItem(focusStack, stack)) {
this.focus = new Point(xPos - 1, yPos - 1);
}
}
this.radius = meteor.radius;
this.cost = meteor.cost;
}
private String getReagentStrings(MeteorComponent component) {
ArrayList<Reagent> reagents = component.getRequiredReagents();
ArrayList<String> reagentNames = new ArrayList<>();
for (Reagent r : reagents) {
reagentNames.add(r.name);
}
return Joiner.on(", ").join(reagentNames);
}
@Override
public List<PositionedStack> getIngredients() {
return this.input;
@@ -160,7 +101,7 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if (outputId.equals(getOverlayIdentifier()) && getClass() == NEIMeteorRecipeHandler.class) {
for (Meteor meteor : getSortedMeteors()) {
for (MeteorParadigm meteor : getSortedMeteors()) {
arecipes.add(new CachedMeteorRecipe(meteor, null));
}
} else {
@@ -170,11 +111,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadCraftingRecipes(ItemStack result) {
for (Meteor meteor : getSortedMeteors()) {
if (meteor.ores.stream().anyMatch(m -> matchItem(result, m.getBlock()))) {
arecipes.add(new CachedMeteorRecipe(meteor, result));
}
if (meteor.fillerChance > 0 && meteor.filler.stream().anyMatch(m -> matchItem(result, m.getBlock()))) {
for (MeteorParadigm meteor : getSortedMeteors()) {
if (meteor.componentList.stream().anyMatch(m -> matchItem(result, m.getValidBlockParadigm()))) {
arecipes.add(new CachedMeteorRecipe(meteor, result));
}
}
@@ -182,8 +120,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (Meteor meteor : getSortedMeteors()) {
if (matchItem(ingredient, meteor.focusItem)) {
for (MeteorParadigm meteor : getSortedMeteors()) {
if (matchItem(ingredient, meteor.focusStack)) {
arecipes.add(new CachedMeteorRecipe(meteor, null));
}
}
@@ -194,34 +132,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
if (NEIServerUtils.areStacksSameTypeCrafting(compared, compareTo)) {
return true;
}
// Ignore GregTech ore variants (like basalt ore)
// ignore 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
// (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).
String[] prefixes = { "crushed", "rawOre", "raw" };
for (int i : OreDictionary.getOreIDs(compareTo)) {
String s1 = OreDictionary.getOreName(i);
if (s1.startsWith("ore")) {
for (int j : OreDictionary.getOreIDs(compared)) {
if (i == j) {
return true;
}
String s2 = OreDictionary.getOreName(j);
for (String prefix : prefixes) {
if (i == OreDictionary.getOreID(s2.replaceFirst("^" + prefix, "ore"))) {
return true;
}
}
}
}
}
return false;
}
@@ -280,8 +195,8 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
return I18n.format("nei.recipe.meteor.category");
}
private List<Meteor> getSortedMeteors() {
return MeteorRegistry.meteorList.stream().sorted(Comparator.comparing(m -> m.cost))
private List<MeteorParadigm> getSortedMeteors() {
return MeteorRegistry.paradigmList.stream().sorted(Comparator.comparing(m -> m.cost))
.collect(Collectors.toList());
}
@@ -290,6 +205,6 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
}
private int getEstimatedAmount(float chance, int radius) {
return (int) Math.ceil(4f / 3 * Math.PI * Math.pow(radius + 0.5, 3) * chance);
return (int) Math.ceil(4f / 3 * Math.PI * Math.pow(radius, 3) * chance);
}
}
@@ -106,24 +106,26 @@ public class RenderHelper {
GL11.glPushMatrix();
int xSize = 32;
int ySize = 32;
int amount = Math.max((int) (256 * ((double) (maxAmount - lpAmount) / maxAmount)), 0);
int x = (lpBarX - xSize / 2) * 8;
int y = (lpBarY - ySize / 2) * 8;
ResourceLocation test2 = new ResourceLocation("alchemicalwizardry", "textures/gui/container1.png");
GL11.glColor4f(1, 0, 0, 1.0F);
GL11.glEnable(GL11.GL_BLEND);
mc.renderEngine.bindTexture(test2);
mc.getTextureManager().bindTexture(test2);
GL11.glScalef(1f / 8f, 1f / 8f, 1f / 8f);
GL11.glPushMatrix();
drawTexturedModalRect(x, y + amount, 0, amount, 256, 256 - amount);
GL11.glPopMatrix();
ResourceLocation test = new ResourceLocation("alchemicalwizardry", "textures/gui/lpVial.png");
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.renderEngine.bindTexture(test);
GL11.glPushMatrix();
mc.getTextureManager().bindTexture(test);
drawTexturedModalRect(x, y, 0, 0, 256, 256);
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -5,7 +5,6 @@ import java.util.Arrays;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@@ -66,14 +65,9 @@ public class UpgradedAltars {
private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z,
int altarTier) {
int compX = x + altarComponent.getX();
int compY = y + altarComponent.getY();
int compZ = z + altarComponent.getZ();
if (altarComponent.getBlock() == Blocks.air) {
return !world.isAirBlock(compX, compY, compZ);
}
Block block = world.getBlock(compX, compY, compZ);
int metadata = world.getBlockMetadata(compX, compY, compZ);
Block block = world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
int metadata = world
.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
if (altarComponent.isBloodRune()) {
boolean result = false;
BlockStack[] runes = getRuneOverrides(altarTier);
@@ -1,22 +1,22 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import java.util.ArrayList;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
public class EntityMeteor extends EnergyBlastProjectile {
private int meteorID;
public ArrayList<Reagent> reagentList = new ArrayList<>();
public boolean hasTerrae;
public boolean hasOrbisTerrae;
public boolean hasCrystallos;
public boolean hasIncendium;
public boolean hasTennebrae;
public EntityMeteor(World par1World) {
super(par1World);
@@ -33,11 +33,11 @@ public class EntityMeteor extends EnergyBlastProjectile {
super.writeEntityToNBT(par1NBTTagCompound);
par1NBTTagCompound.setInteger("meteorID", meteorID);
for (Reagent r : reagentList) {
par1NBTTagCompound.setBoolean("reagent." + r.name, true);
}
par1NBTTagCompound.setBoolean("hasTerrae", hasTerrae);
par1NBTTagCompound.setBoolean("hasOrbisTerrae", hasOrbisTerrae);
par1NBTTagCompound.setBoolean("hasCrystallos", hasCrystallos);
par1NBTTagCompound.setBoolean("hasIncendium", hasIncendium);
par1NBTTagCompound.setBoolean("hasTennebrae", hasTennebrae);
}
@Override
@@ -45,11 +45,11 @@ public class EntityMeteor extends EnergyBlastProjectile {
super.readEntityFromNBT(par1NBTTagCompound);
meteorID = par1NBTTagCompound.getInteger("meteorID");
for (Reagent r : ReagentRegistry.reagentList.values()) {
if (par1NBTTagCompound.getBoolean("reagent." + r.name)) {
reagentList.add(r);
}
}
hasTerrae = par1NBTTagCompound.getBoolean("hasTerrae");
hasOrbisTerrae = par1NBTTagCompound.getBoolean("hasOrbisTerrae");
hasIncendium = par1NBTTagCompound.getBoolean("hasIncendium");
hasCrystallos = par1NBTTagCompound.getBoolean("hasCrystallos");
hasTennebrae = par1NBTTagCompound.getBoolean("hasTennebrae");
}
@Override
@@ -66,7 +66,13 @@ public class EntityMeteor extends EnergyBlastProjectile {
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) {
this.onImpact(mop.entityHit);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
MeteorRegistry.createMeteorImpact(worldObj, mop.blockX, mop.blockY, mop.blockZ, this.meteorID, reagentList);
MeteorRegistry.createMeteorImpact(
worldObj,
mop.blockX,
mop.blockY,
mop.blockZ,
this.meteorID,
new boolean[] { hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae });
}
this.setDead();
@@ -74,8 +80,13 @@ public class EntityMeteor extends EnergyBlastProjectile {
@Override
public void onImpact(Entity mop) {
MeteorRegistry
.createMeteorImpact(worldObj, (int) this.posX, (int) this.posY, (int) this.posZ, meteorID, reagentList);
MeteorRegistry.createMeteorImpact(
worldObj,
(int) this.posX,
(int) this.posY,
(int) this.posZ,
meteorID,
new boolean[] { hasTerrae, hasOrbisTerrae, hasCrystallos, hasIncendium, hasTennebrae });
this.setDead();
}
@@ -1,7 +1,5 @@
package WayofTime.alchemicalWizardry.common.items.potion;
import static WayofTime.alchemicalWizardry.AlchemicalWizardry.allowPotionRepair;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -349,10 +347,4 @@ public class AlchemyFlask extends Item {
potionStack.getTagCompound().setTag("CustomPotionEffects", nbttaglist);
return new EntityPotion(worldObj, entityLivingBase, potionStack);
}
@Override
public boolean isRepairable() {
if (allowPotionRepair) return super.isRepairable();
return false;
}
}
@@ -77,7 +77,12 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false);
if (movingobjectposition == null) {
tellEssence(par3EntityPlayer, ownerName);
par3EntityPlayer.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.currentessence") + " "
+ SoulNetworkHandler.getCurrentEssence(ownerName)
+ "LP"));
return par1ItemStack;
} else {
if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
@@ -88,7 +93,12 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
TileEntity tile = par2World.getTileEntity(x, y, z);
if (!(tile instanceof IReagentHandler)) {
tellEssence(par3EntityPlayer, ownerName);
par3EntityPlayer.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.currentessence") + " "
+ SoulNetworkHandler.getCurrentEssence(ownerName)
+ "LP"));
return par1ItemStack;
}
@@ -98,7 +108,14 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
if (infoList != null) {
for (ReagentContainerInfo info : infoList) {
if (info != null && info.reagent != null && info.reagent.reagent != null) {
tellReagent(par3EntityPlayer, info);
par3EntityPlayer.addChatComponentMessage(
new ChatComponentText(
StatCollector.translateToLocal("message.divinationsigil.reagent") + " "
+ ReagentRegistry.getKeyForReagent(info.reagent.reagent)
+ ","
+ StatCollector.translateToLocal("message.divinationsigil.amount")
+ " "
+ info.reagent.amount));
}
}
}
@@ -108,26 +125,6 @@ public class SigilDivination extends Item implements ArmourUpgrade, IReagentMani
return par1ItemStack;
}
private static void tellReagent(EntityPlayer par3EntityPlayer, ReagentContainerInfo info) {
par3EntityPlayer.addChatComponentMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.divinationsigil.reagent",
ReagentRegistry.getKeyForReagent(info.reagent.reagent))));
par3EntityPlayer.addChatComponentMessage(
new ChatComponentText(
StatCollector
.translateToLocalFormatted("message.divinationsigil.amount", info.reagent.amount)));
}
private static void tellEssence(EntityPlayer par3EntityPlayer, String ownerName) {
par3EntityPlayer.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.divinationsigil.currentessence",
SoulNetworkHandler.getCurrentEssence(ownerName))));
}
@Override
public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack) {}
@@ -31,7 +31,7 @@ public class RitualEffectAlphaPact extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) {
if (world.getWorldTime() % 20 != 0) {
return;
}
@@ -34,7 +34,7 @@ public class RitualEffectAnimalGrowth extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) {
if (world.getWorldTime() % 20 != 0) {
return;
}
@@ -208,7 +208,7 @@ public class RitualEffectAutoAlchemy extends RitualEffect {
}
}
if (world.getTotalWorldTime() % 10 == 0) {
if (world.getWorldTime() % 10 == 0) {
if (flag == 0 && inputInv1 != null) {
for (int i = 0; i < recipe.length; i++) {
ItemStack recItem = recipe[i];
@@ -90,7 +90,7 @@ public class RitualEffectContainment extends RitualEffect {
}
}
if (world.getTotalWorldTime() % 2 == 0 && flag) {
if (world.getWorldTime() % 2 == 0 && flag) {
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
@@ -48,7 +48,7 @@ public class RitualEffectCrafting extends RitualEffect {
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
if (world.getTotalWorldTime() % (hasPotentia ? 1 : 4) != 0) {
if (world.getWorldTime() % (hasPotentia ? 1 : 4) != 0) {
return;
}
@@ -38,7 +38,7 @@ public class RitualEffectCrushing extends RitualEffect {
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
if (world.getTotalWorldTime() % 10 != 5) {
if (world.getWorldTime() % 10 != 5) {
return;
}
@@ -69,7 +69,7 @@ public class RitualEffectFeatheredEarth extends RitualEffect // Nullifies all fa
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * entityCount);
if (flag && world.getTotalWorldTime() % costCooldown == 0) {
if (flag && world.getWorldTime() % costCooldown == 0) {
if (hasTerrae) {
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
@@ -38,7 +38,7 @@ public class RitualEffectFeatheredKnife extends RitualEffect {
int timeDelay = hasPotentia ? 10 : 20;
if (world.getTotalWorldTime() % timeDelay != 0) {
if (world.getWorldTime() % timeDelay != 0) {
return;
}
@@ -62,7 +62,7 @@ public class RitualEffectFlight extends RitualEffect {
entityCount++;
}
if (entityCount > 0 && world.getTotalWorldTime() % reagentCooldown == 0) {
if (entityCount > 0 && world.getWorldTime() % reagentCooldown == 0) {
if (hasAether) {
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
@@ -31,7 +31,7 @@ public class RitualEffectFullStomach extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) {
if (world.getWorldTime() % 20 != 0) {
return;
}
@@ -42,7 +42,7 @@ public class RitualEffectGrowth extends RitualEffect {
boolean hasVirtus = this.canDrainReagent(ritualStone, ReagentRegistry.virtusReagent, virtusDrain, false);
int speed = this.getSpeedForReagents(hasTerrae, hasOrbisTerrae);
if (world.getTotalWorldTime() % speed != 0) {
if (world.getWorldTime() % speed != 0) {
return;
}
@@ -40,7 +40,7 @@ public class RitualEffectHarvest extends RitualEffect {
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else {
if (world.getTotalWorldTime() % 5 != 0) {
if (world.getWorldTime() % 5 != 0) {
return;
}
@@ -35,7 +35,7 @@ public class RitualEffectHealing extends RitualEffect {
int timeDelay = 50;
if (world.getTotalWorldTime() % timeDelay != 0) {
if (world.getWorldTime() % timeDelay != 0) {
return;
}
@@ -100,14 +100,14 @@ public class RitualEffectInterdiction extends RitualEffect {
if (itemFlag) {
flag = true;
if (world.getTotalWorldTime() % aetherDrainRate == 0) {
if (world.getWorldTime() % aetherDrainRate == 0) {
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
}
}
}
if (world.getTotalWorldTime() % 2 == 0 && flag) {
if (world.getWorldTime() % 2 == 0 && flag) {
SoulNetworkHandler.syphonFromNetwork(owner, getCostPerRefresh());
}
}
@@ -39,7 +39,7 @@ public class RitualEffectItemRouting extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) {
if (world.getWorldTime() % 20 != 0) {
return;
}
@@ -46,7 +46,7 @@ public class RitualEffectLava extends RitualEffect {
&& SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, fireFuseCost)) {
boolean hasReductus = this
.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getTotalWorldTime() % 100 == 0;
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 5;
List<EntityLivingBase> entityList = SpellHelper
@@ -18,15 +18,10 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class RitualEffectLeap extends RitualEffect {
// Throws mobs with twice the horizontal speed
public static final int aetherDrain = 10;
// Throws mobs with half the vertical speed
public static final int terraeDrain = 10;
// Grants 3 seconds of fall immunity
public static final int reductusDrain = 10;
// Only throws adults (and non-sneaking players)
public static final int tenebraeDrain = 10;
// Only throws babies (and non-sneaking players)
public static final int sanctusDrain = 10;
@Override
@@ -44,107 +39,152 @@ public class RitualEffectLeap extends RitualEffect {
List<EntityLivingBase> livingList = SpellHelper
.getLivingEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
if (livingList == null || livingList.isEmpty()) {
if (livingList == null) {
return;
}
if (currentEssence < this.getCostPerRefresh() * livingList.size()) {
SoulNetworkHandler.causeNauseaToPlayer(owner);
return;
}
} else {
boolean hasAether = this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
boolean hasTerrae = this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
boolean hasReductus = this
.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean hasTenebrae = this
.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
boolean hasSanctus = this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
boolean hasAether = true;
boolean hasTerrae = true;
boolean hasReductus = true;
boolean hasTenebrae = true;
boolean hasSanctus = true;
int direction = ritualStone.getDirection();
int direction = ritualStone.getDirection();
int flag = 0;
int count = 0;
for (EntityLivingBase livingEntity : livingList) {
if (livingEntity.isSneaking()) {
continue;
}
hasReductus = hasReductus
&& this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
hasTenebrae = hasTenebrae
&& this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
hasSanctus = hasSanctus
&& this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
// Sanctus only makes it work on children and tenebrae only with adults.
// Both being present prevents the ritual from working for any NPCs.
if (((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild()))
&& !(livingEntity instanceof EntityPlayer)) {
continue;
}
hasAether = hasAether
&& this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
hasTerrae = hasTerrae
&& this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
double motionY = hasTerrae ? 0.6 : 1.2;
double speed = hasAether ? 6.0 : 3.0;
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
count++;
if (livingEntity instanceof EntityPlayer) {
switch (direction) {
case 1:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, -speed);
break;
case 2:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, speed, motionY, 0);
break;
case 3:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, speed);
break;
case 4:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, -speed, motionY, 0);
break;
}
} else {
switch (direction) {
case 1:
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 2:
livingEntity.motionX = speed;
livingEntity.motionZ = 0.0;
break;
case 3:
livingEntity.motionX = 0.0;
livingEntity.motionZ = speed;
break;
case 4:
livingEntity.motionX = -speed;
livingEntity.motionZ = 0.0;
break;
for (EntityLivingBase livingEntity : livingList) {
if (livingEntity.isSneaking()) {
continue;
}
if (hasTenebrae) {
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
} else if (hasSanctus) {
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
hasAether = hasAether
&& this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, false);
hasTerrae = hasTerrae
&& this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, false);
hasReductus = hasReductus
&& this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
hasTenebrae = hasTenebrae
&& this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, false);
hasSanctus = hasSanctus
&& this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, false);
double motionY = hasTerrae ? 0.6 : 1.2;
double speed = hasAether ? 6.0 : 3.0;
if (!(hasTenebrae || hasSanctus) || livingEntity instanceof EntityPlayer) {
livingEntity.motionY = motionY;
livingEntity.fallDistance = 0;
if (livingEntity instanceof EntityPlayer) {
switch (direction) {
case 1:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, -speed);
break;
case 2:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, speed, motionY, 0);
break;
case 3:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, 0, motionY, speed);
break;
case 4:
SpellHelper.setPlayerSpeedFromServer((EntityPlayer) livingEntity, -speed, motionY, 0);
break;
}
} else {
livingEntity.motionY = motionY;
switch (direction) {
case 1:
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 2:
livingEntity.motionX = speed;
livingEntity.motionZ = 0.0;
break;
case 3:
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 4:
livingEntity.motionX = -speed;
livingEntity.motionZ = 0.0;
break;
}
}
flag++;
} else {
if ((hasSanctus && !livingEntity.isChild()) || (hasTenebrae && livingEntity.isChild())) {
continue;
}
livingEntity.motionY = motionY;
switch (direction) {
case 1:
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 2:
livingEntity.motionX = speed;
livingEntity.motionZ = 0.0;
break;
case 3:
livingEntity.motionX = 0.0;
livingEntity.motionZ = -speed;
break;
case 4:
livingEntity.motionX = -speed;
livingEntity.motionZ = 0.0;
break;
}
if (hasTenebrae) {
this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tenebraeDrain, true);
}
if (hasSanctus) {
this.canDrainReagent(ritualStone, ReagentRegistry.sanctusReagent, sanctusDrain, true);
}
livingEntity.fallDistance = 0;
flag++;
}
if (hasAether) {
this.canDrainReagent(ritualStone, ReagentRegistry.aetherReagent, aetherDrain, true);
}
if (hasTerrae) {
this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, terraeDrain, true);
}
if (hasReductus) {
if (!livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) {
livingEntity.addPotionEffect(
new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
}
}
}
if (hasReductus && !livingEntity.isPotionActive(AlchemicalWizardry.customPotionFeatherFall)) {
livingEntity
.addPotionEffect(new PotionEffect(AlchemicalWizardry.customPotionFeatherFall.id, 3 * 20, 0));
this.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, true);
if (flag > 0) {
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * flag);
}
}
if (count > 0) {
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * count);
}
}
@Override
@@ -154,7 +194,7 @@ public class RitualEffectLeap extends RitualEffect {
@Override
public List<RitualComponent> getRitualComponentList() {
ArrayList<RitualComponent> leapingRitual = new ArrayList<>();
ArrayList<RitualComponent> leapingRitual = new ArrayList();
leapingRitual.add(new RitualComponent(0, 0, -2, RitualComponent.DUSK));
leapingRitual.add(new RitualComponent(1, 0, -1, RitualComponent.AIR));
leapingRitual.add(new RitualComponent(-1, 0, -1, RitualComponent.AIR));
@@ -68,7 +68,7 @@ public class RitualEffectMagnetic extends RitualEffect {
boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent, potentiaDrain, false);
if (world.getTotalWorldTime() % (hasPotentia ? 10 : 40) != 0) {
if (world.getWorldTime() % (hasPotentia ? 10 : 40) != 0) {
return;
}
@@ -31,7 +31,7 @@ public class RitualEffectOmegaStalling extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 20 != 0) {
if (world.getWorldTime() % 20 != 0) {
return;
}
@@ -46,7 +46,7 @@ public class RitualEffectOmegaTest extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % 200 != 0) {
if (world.getWorldTime() % 200 != 0) {
return;
}
@@ -40,7 +40,7 @@ public class RitualEffectSphereCreator extends RitualEffect {
// boolean hasPotentia = this.canDrainReagent(ritualStone, ReagentRegistry.potentiaReagent,
// potentiaDrain, false);
if (world.getTotalWorldTime() % 1 != 0) {
if (world.getWorldTime() % 1 != 0) {
return;
}
@@ -5,14 +5,12 @@ import java.util.List;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
@@ -45,12 +43,9 @@ public class RitualEffectSummonMeteor extends RitualEffect {
if (entities == null) return;
for (EntityItem entityItem : entities) {
if (entityItem != null && MeteorRegistry.isValidMeteorFocusItem(entityItem.getEntityItem())) {
ItemStack stack = entityItem.getEntityItem();
if (stack == null || stack.stackSize <= 0) continue;
int meteorID = MeteorRegistry.getMeteorIDForItem(stack);
int cost = MeteorRegistry.meteorList.get(meteorID).cost;
if (entityItem != null && MeteorRegistry.isValidParadigmItem(entityItem.getEntityItem())) {
int meteorID = MeteorRegistry.getParadigmIDForItem(entityItem.getEntityItem());
int cost = MeteorRegistry.paradigmList.get(meteorID).cost;
if (currentEssence < cost) {
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
@@ -61,20 +56,23 @@ public class RitualEffectSummonMeteor extends RitualEffect {
EntityMeteor meteor = new EntityMeteor(world, x + 0.5f, 257, z + 0.5f, meteorID);
meteor.motionY = -1.0f;
for (Reagent r : ReagentRegistry.reagentList.values()) {
if (this.canDrainReagent(ritualStone, r, 1000, true)) {
meteor.reagentList.add(r);
}
}
stack.stackSize--;
if (stack.stackSize <= 0) {
world.removeEntity(entityItem);
} else {
entityItem.setEntityItemStack(stack);
if (this.canDrainReagent(ritualStone, ReagentRegistry.terraeReagent, 1000, true)) {
meteor.hasTerrae = true;
}
if (this.canDrainReagent(ritualStone, ReagentRegistry.orbisTerraeReagent, 1000, true)) {
meteor.hasOrbisTerrae = true;
}
if (this.canDrainReagent(ritualStone, ReagentRegistry.crystallosReagent, 1000, true)) {
meteor.hasCrystallos = true;
}
if (this.canDrainReagent(ritualStone, ReagentRegistry.incendiumReagent, 1000, true)) {
meteor.hasIncendium = true;
}
if (this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, 1000, true)) {
meteor.hasTennebrae = true;
}
entityItem.setDead();
world.spawnEntityInWorld(meteor);
ritualStone.setActive(false);
SoulNetworkHandler.syphonFromNetwork(owner, cost);
@@ -44,7 +44,7 @@ public class RitualEffectSupression extends RitualEffect {
int radius = this.getRadiusForReagents(hasAether, hasAquasalus);
int masterRadius = radius;
int yIndex = (int) (world.getTotalWorldTime() % (2 * radius + 1)) - radius;
int yIndex = (int) (world.getWorldTime() % (2 * radius + 1)) - radius;
boolean expansion = false;
if (ritualStone.getVar1() < (radius + 1)) {
@@ -86,7 +86,7 @@ public class RitualEffectSupression extends RitualEffect {
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh() * costMod);
if (world.getTotalWorldTime() % 100 == 0) {
if (world.getWorldTime() % 100 == 0) {
if (hasAquasalus) {
this.canDrainReagent(ritualStone, ReagentRegistry.aquasalusReagent, aquasalusDrain, true);
}
@@ -66,7 +66,7 @@ public class RitualEffectWater extends RitualEffect {
if (hasOffensa) {
boolean hasReductus = this
.canDrainReagent(ritualStone, ReagentRegistry.reductusReagent, reductusDrain, false);
boolean drainReductus = world.getTotalWorldTime() % 100 == 0;
boolean drainReductus = world.getWorldTime() % 100 == 0;
int range = 10;
List<Entity> list = SpellHelper.getEntitiesInRange(world, x + 0.5, y + 0.5, z + 0.5, range, range);
@@ -21,9 +21,10 @@ public class RitualEffectWellOfSuffering extends RitualEffect {
public static final int timeDelay = 25;
public static final int amount = AlchemicalWizardry.lpPerSacrificeWellOfSuffering;
public static final int tennebraeDrain = 5;
public static final int potentiaDrain = 10;
public static final int offensaDrain = 3;
private static final int tennebraeDrain = 5;
private static final int potentiaDrain = 10;
private static final int offensaDrain = 3;
@Override
public void performEffect(IMasterRitualStone ritualStone) {
@@ -35,7 +36,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect {
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getTotalWorldTime() % timeDelay != 0) {
if (world.getWorldTime() % this.timeDelay != 0) {
return;
}
@@ -61,8 +62,13 @@ public class RitualEffectWellOfSuffering extends RitualEffect {
int d0 = 10;
int vertRange = hasPotentia ? 20 : 10;
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(x, y, z, (x + 1), (y + 1), (z + 1))
.expand(d0, vertRange, d0);
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(
(double) x,
(double) y,
(double) z,
(double) (x + 1),
(double) (y + 1),
(double) (z + 1)).expand(d0, vertRange, d0);
List<EntityLivingBase> list = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
int entityCount = 0;
@@ -87,7 +93,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect {
&& this.canDrainReagent(ritualStone, ReagentRegistry.tenebraeReagent, tennebraeDrain, true);
entityCount++;
tileAltar.sacrificialDaggerCall(amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true);
tileAltar.sacrificialDaggerCall(this.amount * (hasTennebrae ? 2 : 1) * (hasOffensa ? 2 : 1), true);
}
}
@@ -106,7 +112,7 @@ public class RitualEffectWellOfSuffering extends RitualEffect {
@Override
public List<RitualComponent> getRitualComponentList() {
ArrayList<RitualComponent> wellOfSufferingRitual = new ArrayList<>();
ArrayList<RitualComponent> wellOfSufferingRitual = new ArrayList();
wellOfSufferingRitual.add(new RitualComponent(1, 0, 1, RitualComponent.FIRE));
wellOfSufferingRitual.add(new RitualComponent(-1, 0, 1, RitualComponent.FIRE));
wellOfSufferingRitual.add(new RitualComponent(1, 0, -1, RitualComponent.FIRE));
@@ -1,46 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.io.IOException;
import net.minecraft.item.ItemStack;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.common.registry.GameRegistry;
class ItemStackAdapter extends TypeAdapter<ItemStack> {
@Override
public ItemStack read(JsonReader reader) throws IOException {
String str = reader.nextString();
String[] input = str.split(":");
if (input.length < 2) {
AlchemicalWizardry.logger
.warn("Unable to read item stack \"{}\". Valid format is \"modid:name(:meta optional)\"", str);
return null;
}
ItemStack itemStack = GameRegistry.findItemStack(input[0], input[1], 1);
if (itemStack == null) {
AlchemicalWizardry.logger.warn("Unable to find item stack \"{}\".", str);
return null;
}
if (input.length < 3) {
return itemStack;
}
try {
itemStack.setItemDamage(Integer.parseInt(input[2]));
} catch (NumberFormatException e) {
AlchemicalWizardry.logger
.warn("Invalid metadata value {} for item stack {}:{}", input[2], input[0], input[1]);
}
return itemStack;
}
@Override
public void write(JsonWriter writer, ItemStack mpc) throws IOException {
// Not implemented because it is not needed.
}
}
@@ -1,238 +1,52 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import static WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent.defaultMeteorBlock;
import static WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent.getTotalListWeight;
import static WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorReagentRegistry.getFillerList;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.item.ItemBlock;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import cpw.mods.fml.common.Optional;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.common.blocks.TileEntityOres;
public class Meteor {
public List<MeteorComponent> ores;
public List<MeteorComponent> filler;
public String[] ores;
public int radius;
public int cost;
public float fillerChance; // Out of 100.0
public ItemStack focusItem;
private String focusModId;
private String focusName;
private int focusMeta;
private int maxWeight;
public String focusModId;
public String focusName;
public int focusMeta;
public static Random rand = new Random();
public Meteor() {
this.radius = 1;
this.cost = AlchemicalWizardry.defaultMeteorCost;
this.fillerChance = 0;
this.maxWeight = 0;
this.preventNullLists();
}
public Meteor(ItemStack focusStack, int radius, int cost, int fillerChance, List<MeteorComponent> oreList,
List<MeteorComponent> fillerList) {
this.focusItem = focusStack;
this.radius = radius;
this.cost = cost;
this.fillerChance = fillerChance;
this.ores = oreList;
this.filler = fillerList;
}
public void createMeteorImpact(World world, int x, int y, int z, List<Reagent> reagents) {
int radius = getNewRadius(this.radius, reagents);
float fillerChance = getNewFillerChance(this.fillerChance, reagents);
if (MeteorReagentRegistry.doExplosions(reagents)) {
world.createExplosion(null, x, y, z, radius * 4, MeteorReagentRegistry.doMeteorsDestroyBlocks(reagents));
}
List<MeteorComponent> oreList = removeBlocksMissingRequiredReagents(this.ores, reagents);
List<MeteorComponent> fillerList = getNewFillerList(this.filler, reagents);
int totalComponentWeight = MeteorComponent.getTotalListWeight(oreList);
int totalFillerWeight = MeteorComponent.getTotalListWeight(fillerList);
for (int i = -radius; i <= radius; i++) {
for (int j = -radius; j <= radius; j++) {
for (int k = -radius; k <= radius; k++) {
if (i * i + j * j + k * k >= (radius + 0.50f) * (radius + 0.50f)) {
continue;
}
if (!world.isAirBlock(x + i, y + j, z + k)) {
continue;
}
if (fillerChance < 100 && (fillerChance <= 0 || world.rand.nextFloat() * 100 >= fillerChance)) {
setMeteorBlock(x + i, y + j, z + k, world, oreList, totalComponentWeight);
} else {
setMeteorBlock(x + i, y + j, z + k, world, fillerList, totalFillerWeight);
}
public static void loadConfig() {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
File file = new File("config/BloodMagic/meteors");
File[] files = file.listFiles();
if (files != null) {
try {
for (File f : files) {
BufferedReader br = new BufferedReader(new FileReader(f));
Meteor m = gson.fromJson(br, Meteor.class);
MeteorRegistry.registerMeteorParadigm(
findItemStack(m.focusModId, m.focusName, m.focusMeta),
m.ores,
m.radius,
m.cost);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
private int getNewRadius(int radius, List<Reagent> reagents) {
radius += MeteorReagentRegistry.getLargestRadiusIncrease(reagents);
radius += MeteorReagentRegistry.getLargestRadiusDecrease(reagents);
return Math.max(radius, 1);
}
private float getNewFillerChance(float fillerChance, List<Reagent> reagents) {
// Don't add filler to meteors that have none
if (fillerChance <= 0) {
return 0;
}
float increase = MeteorReagentRegistry.getLargestFillerChanceIncrease(reagents);
float decrease = MeteorReagentRegistry.getLargestFillerChanceDecrease(reagents);
// Avoid division by zero
if (decrease == -100) {
return 0;
}
fillerChance += MeteorReagentRegistry.getLargestRawFillerChanceIncrease(reagents);
fillerChance += MeteorReagentRegistry.getLargestRawFillerChanceDecrease(reagents);
if (increase > 0) {
fillerChance = 100 * (fillerChance + increase) / (100 + increase);
} else if (decrease < 0) {
fillerChance = 100 * (fillerChance + decrease) / (100 + decrease);
}
return Math.max(0, Math.min(fillerChance, 100));
}
/**
* @return a new filler list. The original list is entirely replaced if any of the supplied reagents have a filler
* config.
*/
private List<MeteorComponent> getNewFillerList(List<MeteorComponent> fillerList, List<Reagent> reagents) {
List<MeteorComponent> reagentFillers = getFillerList(reagents);
reagentFillers = removeBlocksMissingRequiredReagents(reagentFillers, reagents);
if (!reagentFillers.isEmpty() && reagentFillers.get(0) != defaultMeteorBlock) {
return reagentFillers;
}
return removeBlocksMissingRequiredReagents(fillerList, reagents);
}
private List<MeteorComponent> removeBlocksMissingRequiredReagents(List<MeteorComponent> blockList,
List<Reagent> reagents) {
ArrayList<MeteorComponent> newList = new ArrayList<>();
for (MeteorComponent component : blockList) {
if (component.checkForReagent(reagents)) {
newList.add(component);
}
}
if (newList.isEmpty()) { // Use the default if every filler requires a reagent
newList.add(defaultMeteorBlock);
}
return newList;
}
/**
* Sets a randomly chosen block from blocklist according to the MeteorComponent weights at position x, y, z in the
* provided world.
*/
private void setMeteorBlock(int x, int y, int z, World world, List<MeteorComponent> blockList,
int totalListWeight) {
int randNum = world.rand.nextInt(totalListWeight);
for (MeteorComponent component : blockList) {
randNum -= component.getWeight();
if (randNum < 0) {
ItemStack blockStack = component.getBlock();
if (blockStack != null && blockStack.getItem() instanceof ItemBlock) {
((ItemBlock) blockStack.getItem())
.placeBlockAt(blockStack, null, world, x, y, z, 0, 0, 0, 0, blockStack.getItemDamage());
if (AlchemicalWizardry.isGregTechLoaded) setGTOresNaturalIfNeeded(world, x, y, z);
world.markBlockForUpdate(x, y, z);
break;
}
}
}
}
public void validate() {
this.preventNullLists();
this.clampNumericalValues();
this.buildFocusItem();
this.maxWeightToFillerChance();
}
private void preventNullLists() {
if (ores == null || ores.isEmpty()) {
ores = new ArrayList<>();
ores.add(defaultMeteorBlock);
}
while (ores.contains(null)) {
ores.remove(null);
}
if (filler == null || filler.isEmpty()) {
filler = new ArrayList<>();
filler.add(defaultMeteorBlock);
}
while (filler.contains(null)) {
filler.remove(null);
}
}
/**
* Clamps all numerical values to their minimum/maximum values.
*/
private void clampNumericalValues() {
radius = Math.max(1, radius);
cost = Math.max(0, cost);
fillerChance = Math.max(0f, Math.min(fillerChance, 100.0f));
focusMeta = Math.max(0, focusMeta);
maxWeight = Math.max(0, maxWeight);
}
/**
* Construct the focus item for this meteor from its modid, name, and metadata if using the old config format.
*/
private void buildFocusItem() {
if (this.focusItem != null) return;
this.focusItem = GameRegistry.findItemStack(this.focusModId, this.focusName, 1);
if (this.focusItem == null) return;
this.focusItem.setItemDamage(this.focusMeta);
AlchemicalWizardry.logger.warn(
"Setting focusModId, focusName, and focusMeta individually in meteor"
+ "configs has been deprecated. Set \"focusItem\" with format \"modId:name(:meta optional)\""
+ " instead.");
}
/**
* Turn the maximum weight into an equivalent filler chance based on the provided block list. Does NOT restrict
* blocks over the max weight like the old weight system! Specify required reagents for the blocks you want to
* restrict in the ores tag for the meteor's config instead! This is used for the default meteors which include
* certain ores which may not be present in all environments.
*/
private void maxWeightToFillerChance() {
if (maxWeight <= 0 || fillerChance > 0) {
return;
}
this.fillerChance = Math.max(0f, Math.min(100f * (1 - ((float) getTotalListWeight(ores) / maxWeight)), 100.0f));
}
@Optional.Method(modid = "gregtech")
private static void setGTOresNaturalIfNeeded(World world, int x, int y, int z) {
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityOres) {
((TileEntityOres) tileEntity).mNatural = true;
}
private static ItemStack findItemStack(String modid, String name, int meta) {
ItemStack is = GameRegistry.findItemStack(modid, name, 1);
if (is == null) return null;
Items.feather.setDamage(is, meta);
return is;
}
}
@@ -1,140 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import cpw.mods.fml.common.registry.GameRegistry;
public class MeteorComponent {
private final int weight;
private final ItemStack itemStack;
private final ArrayList<Reagent> reagent;
public static MeteorComponent defaultMeteorBlock;
public static void setDefaultMeteorBlock() {
String string = AlchemicalWizardry.defaultMeteorBlock;
String[] split = string.split(":");
ItemStack stack = null;
if (!string.isEmpty() && split.length >= 3) {
stack = GameRegistry.findItemStack(split[0], split[1], 1);
}
if (stack != null) {
Items.feather.setDamage(stack, Integer.parseInt(split[2]));
} else {
stack = new ItemStack(Blocks.stone);
}
defaultMeteorBlock = new MeteorComponent(stack, 1);
}
public MeteorComponent(ItemStack stack, int weight) {
this(stack, weight, new ArrayList<>());
}
public MeteorComponent(ItemStack stack, int weight, ArrayList<Reagent> reagent) {
this.itemStack = stack;
this.weight = weight;
this.reagent = reagent;
}
public static List<MeteorComponent> parseStringArray(String[] blockArray) {
List<MeteorComponent> addList = new ArrayList<>();
if (blockArray == null) {
return addList;
}
for (String blockName : blockArray) {
MeteorComponent component = parseString(blockName);
if (component != null) {
addList.add(component);
}
}
return addList;
}
// modId:itemName:meta:weight(:reagent1, reagent2, ... optional)
private static final Pattern itemNamePattern = Pattern.compile("(.*):(.*):(\\d+):(\\d+)(:.*)?");
// OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional)
private static final Pattern oredictPattern = Pattern.compile("OREDICT:(.*):(\\d+)(:.*)?");
public static MeteorComponent parseString(String blockName) {
Matcher matcher = itemNamePattern.matcher(blockName);
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));
String reagent = matcher.group(5);
ArrayList<Reagent> reagentList = MeteorReagent.parseReagents(reagent, blockName);
ItemStack stack = GameRegistry.findItemStack(modID, itemName, 1);
if (stack != null && stack.getItem() instanceof ItemBlock) {
stack.setItemDamage(meta);
return new MeteorComponent(stack, weight, reagentList);
}
} else if ((matcher = oredictPattern.matcher(blockName)).matches()) {
String oreDict = matcher.group(1);
int weight = Integer.parseInt(matcher.group(2));
String reagent = matcher.group(3);
ArrayList<Reagent> reagentList = MeteorReagent.parseReagents(reagent, blockName);
List<ItemStack> list = OreDictionary.getOres(oreDict);
for (ItemStack stack : list) {
if (stack != null && stack.getItem() instanceof ItemBlock) {
return new MeteorComponent(stack, weight, reagentList);
}
}
}
AlchemicalWizardry.logger.warn("Unable to add Meteor Component \"{}\"", blockName);
AlchemicalWizardry.logger.warn(
"Valid formats are \"modId:itemName:meta:weight(:reagent1, reagent2, ... optional)\" and \"OREDICT:oreDictName:weight(:reagent1, reagent2, ... optional)\".");
return null;
}
public int getWeight() {
return this.weight;
}
public static int getTotalListWeight(List<MeteorComponent> blockList) {
int totalWeight = 0;
for (MeteorComponent component : blockList) {
totalWeight += component.getWeight();
}
return totalWeight;
}
public ItemStack getBlock() {
return itemStack;
}
public ArrayList<Reagent> getRequiredReagents() {
return reagent;
}
public boolean checkForReagent(List<Reagent> reagentList) {
if (reagent.isEmpty()) {
return true;
}
for (Reagent r1 : reagentList) {
for (Reagent r2 : reagent) {
if (r1.equals(r2)) {
return true;
}
}
}
return false;
}
}
@@ -1,20 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.io.IOException;
import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
class MeteorComponentAdapter extends TypeAdapter<MeteorComponent> {
@Override
public MeteorComponent read(JsonReader reader) throws IOException {
return MeteorComponent.parseString(reader.nextString());
}
@Override
public void write(JsonWriter writer, MeteorComponent component) throws IOException {
// Not implemented because it is not needed.
}
}
@@ -0,0 +1,227 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.common.blocks.GT_TileEntity_Ores;
public class MeteorParadigm {
public List<MeteorParadigmComponent> componentList = new ArrayList<>();
public ItemStack focusStack;
public int radius;
public int cost;
public static Random rand = new Random();
public MeteorParadigm(ItemStack focusStack, int radius, int cost) {
this.focusStack = focusStack;
this.radius = radius;
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) {
for (int i = 0; i < oreArray.length; ++i) {
String oreName = oreArray[i];
boolean success = false;
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() {
int totalMeteorWeight = 0;
for (MeteorParadigmComponent mpc : componentList) {
totalMeteorWeight += mpc.getChance();
}
return totalMeteorWeight;
}
public void createMeteorImpact(World world, int x, int y, int z, boolean[] flags) {
boolean hasTerrae = false;
boolean hasOrbisTerrae = false;
boolean hasCrystallos = false;
boolean hasIncendium = false;
boolean hasTennebrae = false;
if (flags != null && flags.length >= 5) {
hasTerrae = flags[0];
hasOrbisTerrae = flags[1];
hasCrystallos = flags[2];
hasIncendium = flags[3];
hasTennebrae = flags[4];
}
int newRadius = radius;
if (hasOrbisTerrae) {
newRadius += 2;
} else if (hasTerrae) {
newRadius += 1;
}
world.createExplosion(null, x, y, z, newRadius * 4, AlchemicalWizardry.doMeteorsDestroyBlocks);
float iceChance = hasCrystallos ? 1 : 0;
float soulChance = hasIncendium ? 1 : 0;
float obsidChance = hasTennebrae ? 1 : 0;
float totalChance = iceChance + soulChance + obsidChance;
int totalMeteorWeight = getTotalMeteorWeight();
for (int i = -newRadius; i <= newRadius; i++) {
for (int j = -newRadius; j <= newRadius; j++) {
for (int k = -newRadius; k <= newRadius; k++) {
if (i * i + j * j + k * k >= (newRadius + 0.50f) * (newRadius + 0.50f)) {
continue;
}
if (!world.isAirBlock(x + i, y + j, z + k)) {
continue;
}
int randNum = world.rand.nextInt(totalMeteorWeight);
boolean hasPlacedBlock = false;
for (MeteorParadigmComponent mpc : componentList) {
randNum -= mpc.getChance();
if (randNum < 0) {
ItemStack blockStack = mpc.getValidBlockParadigm();
if (blockStack != null && blockStack.getItem() instanceof ItemBlock) {
((ItemBlock) blockStack.getItem()).placeBlockAt(
blockStack,
null,
world,
x + i,
y + j,
z + k,
0,
0,
0,
0,
blockStack.getItemDamage());
if (AlchemicalWizardry.isGregTechLoaded)
setGTOresNaturalIfNeeded(world, x + i, y + j, z + k);
world.markBlockForUpdate(x + i, y + j, z + k);
hasPlacedBlock = true;
break;
}
// world.setBlock(x + i, y + j, z + k,
// Block.getBlockById(Item.getIdFromItem(blockStack.getItem())), blockStack.getItemDamage(),
// 3);
// hasPlacedBlock = true;
// break;
}
}
if (!hasPlacedBlock) {
float randChance = rand.nextFloat() * totalChance;
if (randChance < iceChance) {
world.setBlock(x + i, y + j, z + k, Blocks.ice, 0, 3);
} else {
randChance -= iceChance;
if (randChance < soulChance) {
switch (rand.nextInt(3)) {
case 0:
world.setBlock(x + i, y + j, z + k, Blocks.soul_sand, 0, 3);
break;
case 1:
world.setBlock(x + i, y + j, z + k, Blocks.glowstone, 0, 3);
break;
case 2:
world.setBlock(x + i, y + j, z + k, Blocks.netherrack, 0, 3);
break;
}
} else {
randChance -= soulChance;
if (randChance < obsidChance) {
world.setBlock(x + i, y + j, z + k, Blocks.obsidian, 0, 3);
} else {
randChance -= obsidChance;
world.setBlock(x + i, y + j, z + k, Blocks.stone, 0, 3);
}
}
}
}
}
}
}
}
@Optional.Method(modid = "gregtech")
private static void setGTOresNaturalIfNeeded(World world, int x, int y, int z) {
final TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof GT_TileEntity_Ores) {
((GT_TileEntity_Ores) tileEntity).mNatural = true;
}
}
}
@@ -0,0 +1,22 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import net.minecraft.item.ItemStack;
public class MeteorParadigmComponent {
protected int chance;
protected ItemStack itemStack;
public MeteorParadigmComponent(ItemStack stack, int chance) {
this.itemStack = stack;
this.chance = chance;
}
public int getChance() {
return this.chance;
}
public ItemStack getValidBlockParadigm() {
return itemStack;
}
}
@@ -1,34 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
public class MeteorReagent {
public boolean disableExplosions = false;
public boolean invertExplosionBlockDamage = false;
public int radiusChange = 0;
public int fillerChanceChange = 0;
public float rawFillerChanceChange = 0;
public List<MeteorComponent> filler = new ArrayList<>();
public static ArrayList<Reagent> parseReagents(String reagent, String blockName) {
ArrayList<Reagent> reagentList = new ArrayList<>();
if (reagent != null) {
String[] reagents = reagent.substring(1).split(", ?");
for (String str : reagents) {
Reagent r = ReagentRegistry.getReagentForKey(str);
if (r == null) {
AlchemicalWizardry.logger.warn("Unable to add reagent \"{}\" for {}.", str, blockName);
continue;
}
reagentList.add(r);
}
}
return reagentList;
}
}
@@ -1,202 +0,0 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import static WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry.reagentList;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
public class MeteorReagentRegistry {
public static Map<Reagent, MeteorReagent> reagents = new HashMap<>();
public static void loadConfig() {
Gson gson = new GsonBuilder().setPrettyPrinting()
.registerTypeAdapter(MeteorComponent.class, new MeteorComponentAdapter()).create();
File file = new File("config/BloodMagic/meteors/reagents/");
File[] files = file.listFiles();
if (files != null) {
for (String reagent : reagentList.keySet()) {
try {
File f = new File("config/BloodMagic/meteors/reagents/" + reagent + ".json");
if (!f.isFile()) {
continue;
}
BufferedReader br = new BufferedReader(new FileReader(f));
MeteorReagent r = gson.fromJson(br, MeteorReagent.class);
if (r == null) {
continue;
}
reagents.put(ReagentRegistry.getReagentForKey(reagent), r);
} catch (FileNotFoundException | JsonSyntaxException e) {
AlchemicalWizardry.logger.warn("Error adding reagent {}", reagent);
e.printStackTrace();
}
}
}
}
/**
* @return the one largest radius increase from all given reagents (positive value in config).
*/
public static int getLargestRadiusIncrease(List<Reagent> reagentList) {
int increase = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
int change = reagents.get(r).radiusChange;
if (change > increase) {
increase = change;
}
}
return increase;
}
/**
* @return the one largest radius decrease from all given reagents (negative value in config).
*/
public static int getLargestRadiusDecrease(List<Reagent> reagentList) {
int decrease = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
int change = reagents.get(r).radiusChange;
if (change < decrease) {
decrease = change;
}
}
return decrease;
}
/**
* @return the one largest filler chance increase from all given reagents (positive value in config).
*/
public static int getLargestFillerChanceIncrease(List<Reagent> reagentList) {
int increase = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
int change = reagents.get(r).fillerChanceChange;
if (change > increase) {
increase = change;
}
}
return increase;
}
/**
* @return the one largest filler chance decrease from all given reagents (negative value in config).
*/
public static int getLargestFillerChanceDecrease(List<Reagent> reagentList) {
int decrease = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
int change = reagents.get(r).fillerChanceChange;
if (change < decrease) {
decrease = change;
}
}
return decrease;
}
/**
* @return the one largest raw filler chance increase from all given reagents (positive value in config).
*/
public static float getLargestRawFillerChanceIncrease(List<Reagent> reagentList) {
float increase = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
float change = reagents.get(r).rawFillerChanceChange;
if (change > increase) {
increase = change;
}
}
return increase;
}
/**
* @return the one largest raw filler chance decrease from all given reagents (negative value in config).
*/
public static float getLargestRawFillerChanceDecrease(List<Reagent> reagentList) {
float decrease = 0;
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
float change = reagents.get(r).rawFillerChanceChange;
if (change < decrease) {
decrease = change;
}
}
return decrease;
}
/**
* @return a list of the MeteorComponents that the given reagents will use to replace filler.
*/
public static List<MeteorComponent> getFillerList(List<Reagent> reagentList) {
List<MeteorComponent> fillerList = new ArrayList<>();
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
List<MeteorComponent> filler = reagents.get(r).filler;
if (filler != null && !filler.isEmpty()) {
fillerList.addAll(filler);
}
}
return fillerList;
}
/**
* @return false if any of the given reagents disable explosions, otherwise true
*/
public static boolean doExplosions(List<Reagent> reagentList) {
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
if (reagents.get(r).disableExplosions) {
return false;
}
}
return true;
}
/**
* @return the value of the config AlchemicalWizardry.doMeteorsDestroyBlocks if no reagent inverts explosion block
* damage. If any reagent inverts explosion block damage, the inverse of the config
* AlchemicalWizardry.doMeteorsDestroyBlocks is returned.
*/
public static boolean doMeteorsDestroyBlocks(List<Reagent> reagentList) {
for (Reagent r : reagentList) {
if (!reagents.containsKey(r)) {
continue;
}
if (reagents.get(r).invertExplosionBlockDamage) {
return !AlchemicalWizardry.doMeteorsDestroyBlocks;
}
}
return AlchemicalWizardry.doMeteorsDestroyBlocks;
}
}
@@ -1,9 +1,5 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
@@ -11,71 +7,35 @@ import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
public class MeteorRegistry {
public static List<Meteor> meteorList = new ArrayList<>();
public static List<MeteorParadigm> paradigmList = new ArrayList<>();
public static void loadConfig() {
Gson gson = new GsonBuilder().setPrettyPrinting()
.registerTypeAdapter(MeteorComponent.class, new MeteorComponentAdapter())
.registerTypeAdapter(ItemStack.class, new ItemStackAdapter()).create();
File file = new File("config/BloodMagic/meteors");
File[] files = file.listFiles();
if (files != null) {
for (File f : files) {
try {
if (f.isDirectory() || !f.getName().endsWith(".json")) {
continue;
}
BufferedReader br = new BufferedReader(new FileReader(f));
Meteor m = gson.fromJson(br, Meteor.class);
MeteorRegistry.registerMeteor(m);
} catch (FileNotFoundException | JsonSyntaxException e) {
AlchemicalWizardry.logger.warn("Error adding meteor {}", f.getName());
e.printStackTrace();
}
}
public static void registerMeteorParadigm(MeteorParadigm paradigm) {
paradigmList.add(paradigm);
}
public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius, int cost) {
if (stack != null && oreList != null) {
MeteorParadigm meteor = new MeteorParadigm(stack, radius, cost);
meteor.parseStringArray(oreList);
paradigmList.add(meteor);
}
}
public static void registerMeteor(Meteor meteor) {
meteor.validate();
meteorList.add(meteor);
}
public static void registerMeteor(ItemStack stack, String[] componentList, int radius, int cost) {
registerMeteor(stack, MeteorComponent.parseStringArray(componentList), radius, cost, null, 0);
}
public static void registerMeteor(ItemStack stack, List<MeteorComponent> componentList, int radius, int cost,
List<MeteorComponent> fillerList, int fillerChance) {
if (stack != null && componentList != null) {
Meteor meteor = new Meteor(stack, radius, cost, fillerChance, componentList, fillerList);
meteor.validate();
meteorList.add(meteor);
public static void createMeteorImpact(World world, int x, int y, int z, int paradigmID, boolean[] flags) {
if (paradigmID < paradigmList.size()) {
paradigmList.get(paradigmID).createMeteorImpact(world, x, y, z, flags);
}
}
public static void createMeteorImpact(World world, int x, int y, int z, int meteorID, List<Reagent> reagents) {
if (meteorID < meteorList.size()) {
meteorList.get(meteorID).createMeteorImpact(world, x, y, z, reagents);
}
}
public static int getMeteorIDForItem(ItemStack stack) {
public static int getParadigmIDForItem(ItemStack stack) {
if (stack == null) {
return -1;
}
for (int i = 0; i < meteorList.size(); i++) {
ItemStack focusStack = meteorList.get(i).focusItem;
for (int i = 0; i < paradigmList.size(); i++) {
ItemStack focusStack = paradigmList.get(i).focusStack;
if (focusStack != null && focusStack.getItem() == stack.getItem()
&& (focusStack.getItemDamage() == OreDictionary.WILDCARD_VALUE
@@ -87,7 +47,7 @@ public class MeteorRegistry {
return -1;
}
public static boolean isValidMeteorFocusItem(ItemStack stack) {
return getMeteorIDForItem(stack) != -1;
public static boolean isValidParadigmItem(ItemStack stack) {
return getParadigmIDForItem(stack) != -1;
}
}
@@ -1,5 +1,6 @@
package WayofTime.alchemicalWizardry.common.tileEntity;
import java.text.NumberFormat;
import java.util.List;
import net.minecraft.block.Block;
@@ -940,16 +941,13 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
public void sendChatInfoToPlayer(EntityPlayer player) {
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted("message.altar.currentessence", this.fluid.amount)));
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.altar.currenttier",
UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord))));
new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount));
player.addChatMessage(
new ChatComponentTranslation(
StatCollector.translateToLocalFormatted("message.altar.capacity", this.getCapacity())));
String.format("message.altar.currenttier"),
UpgradedAltars.isAltarValid(worldObj, xCoord, yCoord, zCoord)));
player.addChatMessage(
new ChatComponentTranslation(String.format("message.altar.capacity"), this.getCapacity()));
}
public void sendMoreChatInfoToPlayer(EntityPlayer player) {
@@ -957,25 +955,23 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
int stackSize = getStackInSlot(0).stackSize;
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.altar.progress",
progress,
liquidRequired * stackSize)));
StatCollector.translateToLocal("message.altar.progress") + " "
+ progress
+ "LP/"
+ liquidRequired * stackSize
+ "LP"));
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted(
"message.altar.consumptionrate",
(int) (consumptionRate * (1 + consumptionMultiplier)))));
StatCollector.translateToLocal("message.altar.consumptionrate") + " "
+ (int) (consumptionRate * (1 + consumptionMultiplier))
+ "LP/t"));
}
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted("message.altar.currentessence", this.fluid.amount)));
new ChatComponentTranslation(String.format("message.altar.currentessence"), this.fluid.amount));
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted("message.altar.inputtank", this.fluidInput.amount)));
new ChatComponentTranslation(String.format("message.altar.inputtank"), this.fluidInput.amount));
player.addChatMessage(
new ChatComponentText(
StatCollector.translateToLocalFormatted("message.altar.outputtank", this.fluidOutput.amount)));
new ChatComponentTranslation(String.format("message.altar.outputtank"), this.fluidOutput.amount));
}
@Override
@@ -992,27 +988,26 @@ public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, I
return;
final NBTTagCompound altarData = accessor.getNBTData().getCompoundTag("altar");
final NumberFormat numberFormat = NumberFormat.getIntegerInstance();
if (altarData.hasKey("stored")) {
currenttip.add(
StatCollector
.translateToLocalFormatted("tooltip.waila.currentFluid", altarData.getInteger("stored")));
StatCollector.translateToLocal("tooltip.waila.currentFluid")
+ numberFormat.format(altarData.getInteger("stored")));
} else {
currenttip.add(StatCollector.translateToLocal("tooltip.waila.noFluid"));
}
currenttip.add(
StatCollector
.translateToLocalFormatted("tooltip.waila.altarCapacity", altarData.getInteger("capacity")));
currenttip.add(StatCollector.translateToLocalFormatted("tooltip.waila.tier", altarData.getInteger("tier")));
StatCollector.translateToLocal("tooltip.waila.altarCapacity")
+ numberFormat.format(altarData.getInteger("capacity")));
currenttip.add(StatCollector.translateToLocal("tooltip.waila.tier") + altarData.getInteger("tier"));
if (altarData.hasKey("progress")) {
currenttip.add(
StatCollector.translateToLocalFormatted(
"tooltip.waila.altarProgress",
altarData.getInteger("progress")));
currenttip.add(
StatCollector.translateToLocalFormatted("tooltip.waila.crafting", altarData.getString("crafting")));
StatCollector.translateToLocal("tooltip.waila.altarProgress") + altarData.getInteger("progress")
+ "%");
currenttip.add(StatCollector.translateToLocal("tooltip.waila.crafting") + altarData.getString("crafting"));
}
}
@@ -733,11 +733,10 @@ public class TEWritingTable extends TEInventory implements ISidedInventory, IBlo
final NBTTagCompound tag = accessor.getNBTData();
final int curProgress = tag.getInteger("progress");
if (curProgress > 0) {
currenttip.add(StatCollector.translateToLocalFormatted("tooltip.waila.chemistrySetProgress", curProgress));
currenttip.add(StatCollector.translateToLocal("tooltip.waila.altarProgress") + curProgress + "%");
}
if (tag.hasKey("crafting")) {
currenttip
.add(StatCollector.translateToLocalFormatted("tooltip.waila.crafting", tag.getString("crafting")));
currenttip.add(StatCollector.translateToLocal("tooltip.waila.crafting") + tag.getString("crafting"));
}
}
@@ -7,8 +7,7 @@ import java.util.Iterator;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorComponent;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorParadigm;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
@@ -42,19 +41,6 @@ public class FallingTower {
MineTweakerAPI.apply(new Add(toStack(stack), radius, cost, components.split("\\s*,\\s*")));
}
@ZenMethod
public static void addFocus(IItemStack stack, int radius, int cost, String components, String filler,
int fillerChance) {
MineTweakerAPI.apply(
new Add(
toStack(stack),
radius,
cost,
components.split("\\s*,\\s*"),
filler.split("\\s*,\\s*"),
fillerChance));
}
@ZenMethod
public static void removeFocus(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
@@ -62,46 +48,36 @@ public class FallingTower {
private static class Add implements IUndoableAction {
private Meteor meteor;
private MeteorParadigm paradigm;
public Add(ItemStack stack, int radius, int cost, String[] components) {
new Add(stack, radius, cost, components, null, 0);
}
public Add(ItemStack stack, int radius, int cost, String[] components, String[] filler, int fillerChance) {
meteor = new Meteor(
stack,
radius,
cost,
fillerChance,
MeteorComponent.parseStringArray(components),
MeteorComponent.parseStringArray(filler));
meteor.validate();
paradigm = new MeteorParadigm(stack, radius, cost);
paradigm.parseStringArray(components);
}
@Override
public void apply() {
MeteorRegistry.registerMeteor(meteor);
MeteorRegistry.registerMeteorParadigm(paradigm);
}
@Override
public boolean canUndo() {
return MeteorRegistry.meteorList != null;
return MeteorRegistry.paradigmList != null;
}
@Override
public void undo() {
MeteorRegistry.meteorList.remove(meteor);
MeteorRegistry.paradigmList.remove(paradigm);
}
@Override
public String describe() {
return "Adding Falling Tower Focus for " + meteor.focusItem.getDisplayName();
return "Adding Falling Tower Focus for " + paradigm.focusStack.getDisplayName();
}
@Override
public String describeUndo() {
return "Removing Falling Tower Focus for " + meteor.focusItem.getDisplayName();
return "Removing Falling Tower Focus for " + paradigm.focusStack.getDisplayName();
}
@Override
@@ -113,7 +89,7 @@ public class FallingTower {
private static class Remove implements IUndoableAction {
private final ItemStack focus;
private Meteor paradigm;
private MeteorParadigm paradigm;
public Remove(ItemStack focus) {
this.focus = focus;
@@ -121,9 +97,9 @@ public class FallingTower {
@Override
public void apply() {
for (Iterator<Meteor> itr = MeteorRegistry.meteorList.iterator(); itr.hasNext();) {
Meteor paradigm = itr.next();
if (OreDictionary.itemMatches(paradigm.focusItem, focus, false)) {
for (Iterator<MeteorParadigm> itr = MeteorRegistry.paradigmList.iterator(); itr.hasNext();) {
MeteorParadigm paradigm = itr.next();
if (OreDictionary.itemMatches(paradigm.focusStack, focus, false)) {
this.paradigm = paradigm;
itr.remove();
break;
@@ -133,12 +109,12 @@ public class FallingTower {
@Override
public boolean canUndo() {
return MeteorRegistry.meteorList != null && paradigm != null;
return MeteorRegistry.paradigmList != null && paradigm != null;
}
@Override
public void undo() {
MeteorRegistry.meteorList.add(paradigm);
MeteorRegistry.paradigmList.add(paradigm);
}
@Override
@@ -1,6 +1,5 @@
#Block Localization
tile.bloodAltar.name=Blood Altar
tile.bloodRune.name=Blood Rune
tile.bloodRune.blank.name=Blood Rune
tile.bloodRune.fill.name=Rune of Augmented Capacity
tile.bloodRune.empty.name=Rune of Dislocation
@@ -26,12 +25,10 @@ tile.bloodPedestal.name=Arcane Pedestal
tile.bloodPlinth.name=Arcane Plinth
tile.bloodTeleposer.name=Teleposer
tile.blockConduit.name=Spell Conduit
tile.blockSpellParadigm.name=Paradigm
tile.blockSpellParadigm.projectile.name=Particle Generator
tile.blockSpellParadigm.self.name=Self Augmentator
tile.blockSpellParadigm.melee.name=Melee Aggregator
tile.blockSpellParadigm.tool.name=Tool Forger
tile.blockSpellEnhancement.name=Enhancement Spell
tile.blockSpellEnhancement.power1.name=Unstable Spell Empowerer
tile.blockSpellEnhancement.power2.name=Standard Spell Empowerer
tile.blockSpellEnhancement.power3.name=Reinforced Spell Empowerer
@@ -47,12 +44,10 @@ tile.blockSpellEnhancement.potency2.name=Standard Spell Augmentor
tile.blockSpellEnhancement.potency3.name=Reinforced Spell Augmentor
tile.blockSpellEnhancement.potency4.name=Imbued Spell Augmentor
tile.blockSpellEnhancement.potency5.name=Demonic Spell Augmentor
tile.blockSpellModifier.name=Modifier Spell
tile.blockSpellModifier.default.name=Default Spell Modifier
tile.blockSpellModifier.offensive.name=Offensive Spell Modifier
tile.blockSpellModifier.defensive.name=Defensive Spell Modifier
tile.blockSpellModifier.environmental.name=Environmental Spell Modifier
tile.blockSpellEffect.name=Effect Spell
tile.blockSpellEffect.fire.name=Crucible of Fire
tile.blockSpellEffect.ice.name=Ice Maker
tile.blockSpellEffect.wind.name=Wind Generator
@@ -61,15 +56,12 @@ tile.alchemicCalcinator.name=Alchemic Calcinator
tile.crystalBelljar.name=Crystal Belljar
tile.blockReagentConduit.name=Alchemy Relay
tile.lifeEssenceFluidBlock.name=Life Essence
tile.crystalBlock.name=Crystal Cluster
tile.crystalBlock.fullCrystal.name=Crystal Cluster
tile.crystalBlock.crystalBrick.name=Crystal Cluster Brick
tile.demonPortal.name=Demon Portal
tile.demonChest.name=Demon's Chest
tile.enchantmentGlyph.name=Enchantment Glyph
tile.enchantmentGlyph.enchantability.name=Glyph of the Adept Enchanter
tile.enchantmentGlyph.enchantmentLevel.name=Glyph of Arcane Potential
tile.stabilityGlyph.name=Glyph of Rigid Stability
tile.stabilityGlyph.stability1.name=Glyph of Rigid Stability
tile.schematicSaver.name=Schematic Saver
tile.blockMimic.name=Mimic Block
@@ -165,7 +157,6 @@ item.itemComplexSpellCrystal.name=Complex Spell Crystal
item.itemSigilOfSupression.name=Sigil of Supression
item.itemSigilOfEnderSeverance.name=Sigil of Ender Severance
item.bucketLife.name=Bucket of Life
item.baseItems.name=Base Item
item.bloodMagicBaseItem.QuartzRod.name=Quartz Rod
item.bloodMagicBaseItem.EmptyCore.name=Empty Core
item.bloodMagicBaseItem.MagicalesCable.name=Magicales Cable
@@ -198,7 +189,6 @@ item.bloodMagicBaseItem.LifeShard.name=Life Shard
item.bloodMagicBaseItem.SoulShard.name=Soul Shard
item.bloodMagicBaseItem.LifeBrace.name=Living Brace
item.bloodMagicBaseItem.SoulRunicPlate.name=Soul Runic Plate
item.baseAlchemyItems.name=Base Alchemy Item
item.bloodMagicAlchemyItem.Offensa.name=Offensa
item.bloodMagicAlchemyItem.Praesidium.name=Praesidium
item.bloodMagicAlchemyItem.OrbisTerrae.name=Orbis Terrae
@@ -229,7 +219,6 @@ item.transcendentBloodOrb.name=Transcendent Blood Orb
item.itemMailCatalogue.name=Mail Order Catalogue
item.inputRoutingFocus.name=Input Routing Focus
item.bloodMagicBaseItem.EnderShard.name=Ender Shard
item.outputRoutingFocus.name=Output Routing Focus
item.outputRoutingFocus.default.name=Default Output Routing Focus
item.outputRoutingFocus.modItem.name=Output Routing Focus (ModItem)
item.outputRoutingFocus.ignMeta.name=Output Routing Focus (Ignore Meta)
@@ -253,7 +242,6 @@ item.boundPlateWater.name=Water Omega Plate
item.boundLeggingsWater.name=Water Omega Leggings
item.boundBootsWater.name=Water Omega Boots
item.bloodMagicIncenseItem.name=Incense Item
item.bloodMagicIncenseItem.Woodash.name=Wood Ash
item.bloodMagicIncenseItem.Byrrus.name=Byrrus
item.bloodMagicIncenseItem.Livens.name=Livens
@@ -279,8 +267,6 @@ nei.recipe.meteor.cost=Cost: %s LP
nei.recipe.meteor.radius=Radius: %s
nei.recipe.meteor.chance=Chance: %s%%
nei.recipe.meteor.amount=Estimated amount: %s
nei.recipe.meteor.filler=§7Filler block
nei.recipe.meteor.reagent=§nRequired reagent§r: %s
#Rituals
ritual.AW001Water.name=Ritual of the Full Spring
@@ -525,13 +511,13 @@ tooltip.routingFocus.desc=A focus used to route items
tooltip.alchemy.usedinincense=Purifying incense used in a crucible
#Messages
message.altar.capacity=Capacity: %,d LP
message.altar.consumptionrate=Consumption Rate: %,d LP/t
message.altar.currentessence=Altar's Current Essence: %,d LP
message.altar.capacity=Capacity: %s LP
message.altar.consumptionrate=Consumption Rate:
message.altar.currentessence=Altar's Current Essence: %s LP
message.altar.currenttier=Altar's Current Tier: %s
message.altar.progress=Altar's Progress: %,d LP / %,d LP
message.altar.inputtank= Input Tank: %,d LP
message.altar.outputtank= Output Tank: %,d LP
message.altar.progress=Altar's Progress:
message.altar.inputtank= Input Tank: %s LP
message.altar.outputtank= Output Tank: %s LP
message.altar.hunger=[BM] Your high regeneration rate has caused you to become hungry...
message.attunedcrystal.clearing=Clearing saved container...
message.attunedcrystal.error.cannotfind=Can no longer find linked container.
@@ -543,9 +529,9 @@ message.attunedcrystal.setto=Attuned Crystal now set to:
message.demon.shallfollow=I shall follow and protect you!
message.demon.willstay=I will stay here for now, Master.
message.destinationclearer.cleared=Destination list now cleared.
message.divinationsigil.amount=Amount: %,d AR
message.divinationsigil.currentessence=Current Essence: %,d LP
message.divinationsigil.reagent=Reagent: %s
message.divinationsigil.amount=Amount:
message.divinationsigil.currentessence=Current Essence:
message.divinationsigil.reagent=Reagent:
message.orb.currenttier=Current Tier: %d
message.masterstone.crystalvibrates=Your crystal vibrates pathetically.
message.masterstone.energyflows=A rush of energy flows through the ritual!
@@ -624,13 +610,13 @@ bm.versioning.downloadingAlready=It's downloading! Be patient!
bm.versioning.disabled=This feature is disabled.
# Waila localizations
tooltip.waila.currentFluid=Life Essence: %,d
tooltip.waila.currentFluid=Life Essence:
tooltip.waila.noFluid=There is no Life Essence in the altar
tooltip.waila.tier=Altar Tier: %d
tooltip.waila.altarProgress=Altar Progress: %d%%
tooltip.waila.crafting=Crafting: %s
tooltip.waila.altarCapacity=Altar Capacity: %,d
tooltip.waila.chemistrySetProgress=Item Progress: %d%%
tooltip.waila.tier=Altar Tier:
tooltip.waila.altarProgress=Altar Progress:
tooltip.waila.crafting=Crafting:
tooltip.waila.altarCapacity=Altar Capacity:
tooltip.waila.chemistrySetProgress=Item Progress:
tooltip.waila.owner=Owner:
tooltip.waila.ritualString=Current Ritual:
tooltip.waila.active=Ritual Active
@@ -639,4 +625,4 @@ tooltip.waila.notActive=Ritual Not Active
option.bm.bloodAltar=Blood Altar
option.bm.ritualController=Ritual Stones
option.bm.teleposer=Teleposer
option.bm.chemistrySet=Alchemical Chemistry Set
option.bm.chemistrySet=Alchemical Chemistry Set
@@ -416,13 +416,13 @@ tooltip.routingFocus.limit=Лимит:
tooltip.routingFocus.desc=Фокус, используемый для направления предметов
#Messages
message.altar.capacity=Ёмкость: %,d LP
message.altar.consumptionrate=Скорость потребления: %,d LP/тик
message.altar.currentessence=Текущая эссенция алтаря: %,d LP
message.altar.capacity=Ёмкость: %s LP
message.altar.consumptionrate=Скорость потребления:
message.altar.currentessence=Текущая эссенция алтаря: %s LP
message.altar.currenttier=Текущий уровень алтаря: %s
message.altar.progress=Прогресс алтаря: %,d LP / %,d LP
message.altar.inputtank= Резервуар для входа: %,d LP
message.altar.outputtank= Резервуар для выхода: %,d LP
message.altar.progress=Прогресс алтаря:
message.altar.inputtank= Резервуар для входа: %s LP
message.altar.outputtank= Резервуар для выхода: %s LP
message.altar.hunger=[BM] Из-за Вашего высокого уровня регенерации Вы проголодались...
message.attunedcrystal.clearing=Очистка сохранённого контейнера...
message.attunedcrystal.error.cannotfind=Не удалось найти соединённый контейнер.
@@ -434,9 +434,9 @@ message.attunedcrystal.setto=Алхимический маршрутизатор
message.demon.shallfollow=Я обещаю следовать за Вами и защищать!
message.demon.willstay=Я буду стоять здесь, Хозяин.
message.destinationclearer.cleared=Список назначения очищен.
message.divinationsigil.amount=Количество: %,d AR
message.divinationsigil.currentessence=Текущая эссенция: %,d LP
message.divinationsigil.reagent=Реагент: %s
message.divinationsigil.amount=Количество:
message.divinationsigil.currentessence=Текущая эссенция:
message.divinationsigil.reagent=Реагент:
message.masterstone.crystalvibrates=Ваш кристалл жалобно вибрирует.
message.masterstone.energyflows=Порыв потоков энергии проходит через ритуал!
message.masterstone.nothinghappened=Ничего не происходит...
@@ -510,13 +510,13 @@ tooltip.routingFocus.desc=一个传送物件的核心
tooltip.alchemy.usedinincense=用于香炉的精炼熏香粉末
#Messages
message.altar.capacity=容量: %,d LP
message.altar.consumptionrate=消耗率: %,d LP/t
message.altar.currentessence=祭坛目前的生命本质: %,d LP
message.altar.capacity=容量: %s LP
message.altar.consumptionrate=消耗率:
message.altar.currentessence=祭坛目前的生命本质: %s LP
message.altar.currenttier=祭坛目前的层数: %s
message.altar.progress=祭坛的进展: %,d LP / %,d LP
message.altar.inputtank= 输入槽: %,d LP
message.altar.outputtank= 输出槽: %,d LP
message.altar.progress=祭坛的进展:
message.altar.inputtank= 输入槽: %s LP
message.altar.outputtank= 输出槽: %s LP
message.altar.hunger=[BM] 你的高级再生效果使你变得饥饿...
message.attunedcrystal.clearing=清除已保存的容器...
message.attunedcrystal.error.cannotfind=无法找到连接的容器.
@@ -528,9 +528,9 @@ message.attunedcrystal.setto=调整水晶设置为:
message.demon.shallfollow=我将会跟随并且保护你!
message.demon.willstay=我会在这待着的,主人.
message.destinationclearer.cleared=目标列表已清除.
message.divinationsigil.amount=数额: %,d AR
message.divinationsigil.currentessence=目前的生命本质: %,d LP
message.divinationsigil.reagent=炼金试剂: %s
message.divinationsigil.amount=数额:
message.divinationsigil.currentessence=目前的生命本质:
message.divinationsigil.reagent=炼金试剂:
message.orb.currenttier=当前等级: %d
message.masterstone.crystalvibrates=你的水晶弱弱的振动着.
message.masterstone.energyflows=一股能量流经这个仪式!
@@ -424,13 +424,13 @@ tooltip.routingFocus.desc=A focus used to route items
tooltip.alchemy.usedinincense=Purifying incense used in a crucible
#Messages
message.altar.capacity=Capacity: %,d LP
message.altar.consumptionrate=Consumption Rate: %,d LP/t
message.altar.currentessence=Altar's Current Essence: %,d LP
message.altar.capacity=Capacity: %s LP
message.altar.consumptionrate=Consumption Rate:
message.altar.currentessence=Altar's Current Essence: %s LP
message.altar.currenttier=Altar's Current Tier: %s
message.altar.progress=Altar's Progress: %,d LP / %,d LP
message.altar.inputtank= Input Tank: %,d LP
message.altar.outputtank= Output Tank: %,d LP
message.altar.progress=Altar's Progress:
message.altar.inputtank= Input Tank: %s LP
message.altar.outputtank= Output Tank: %s LP
message.altar.hunger=[BM] Your high regeneration rate has caused you to become hungry...
message.attunedcrystal.clearing=Clearing saved container...
message.attunedcrystal.error.cannotfind=Can no longer find linked container.
@@ -442,9 +442,9 @@ message.attunedcrystal.setto=Attuned Crystal now set to:
message.demon.shallfollow=I shall follow and protect you!
message.demon.willstay=I will stay here for now, Master.
message.destinationclearer.cleared=Destination list now cleared.
message.divinationsigil.amount=Amount: %,d AR
message.divinationsigil.currentessence=Current Essence: %,d LP
message.divinationsigil.reagent=Reagent: %s
message.divinationsigil.amount=Amount:
message.divinationsigil.currentessence=Current Essence:
message.divinationsigil.reagent=Reagent:
message.masterstone.crystalvibrates=Your crystal vibrates pathetically.
message.masterstone.energyflows=A rush of energy flows through the ritual!
message.masterstone.nothinghappened=Nothing appears to have happened...
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 720 B