Compare commits

..
12 Commits
Author SHA1 Message Date
DreamMasterXXL 0b8c17fb3c bump version 2021-05-16 13:17:43 +02:00
Martin Robertz 1fddcd5b40 Merge pull request #11 from GTNewHorizons/GTNH-Colen-bloodmagic-teleposer-fix
Fix teleposer costing no LP with interdim travel
2021-04-21 18:12:36 +02:00
GTNH-Colen ae654620bb Update TETeleposer.java 2021-04-21 11:08:09 +01:00
GTNH-Colen 00f9ac485b Update TETeleposer.java 2021-04-21 10:44:17 +01:00
GTNH-Colen 63289fe116 Fix teleposer costing no LP with interdim travel
The teleposer currently costs no LP if the x, y and z coordinates of your teleposers are the same between the dimensions you're teleporting between. This adds a base cost of 2000 making sure it will always drain some LP. This is a very simple PR but I don't program in java usually so appreciate scrutiny :p
2021-04-21 09:10:33 +01:00
Glease 67062474fa Fix race condition on NEIConfig#bloodOrbs initialization (#10) 2021-03-20 05:07:13 +08:00
Jason Mitchell b4db1b05c8 Update MineTweaker integration to handle delayed run of additions/removals to main recipe registry. 2020-11-29 18:01:26 -08:00
DreamMasterXXL 40d0b5e228 try to update BM to newest Craft tweaker version 2020-11-29 12:31:47 +01:00
Martin Robertz 88959889c0 Merge pull request #8 from repo-alt/1.7.10
- added a way to define meteors in json in config/BloodMagic/meteors/…
2020-10-29 19:09:58 +01:00
repo_alt bf576acc88 - added a way to define meteors in json in config/BloodMagic/meteors/ - added BM meteor 'cost' to MineTweaker API 2020-10-24 13:19:40 +03:00
DreamMasterXXL 5f49bd0cf5 add libs 2020-05-30 20:29:12 +02:00
DreamMasterXXL 40fef65857 update gradle 2020-05-30 20:27:01 +02:00
34 changed files with 220 additions and 177 deletions

No files matched your search

+12 -11
View File
@@ -40,30 +40,31 @@ repositories {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
name 'TehNut Repo'
url 'http://tehnut.info/maven/'
}
maven {
name 'tterrag Repo'
url 'http://maven.tterrag.com/'
}
ivy {
name "MineTweaker3"
artifactPattern "http://minetweaker3.powerofbytes.com/download/[module]-[revision].[ext]"
}
maven {
name = "gt"
url = "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
}
}
dependencies {
compile "codechicken:CodeChickenLib:" + config.mc_version + "-" + config.cclib_version + ":dev"
compile "codechicken:CodeChickenCore:" + config.mc_version + "-" + config.ccc_version + ":dev"
compile "codechicken:NotEnoughItems:" + config.mc_version + "-" + config.nei_version + ":dev"
compile name: 'MineTweaker3', version: config.minetweaker_version, ext: 'jar'
compile "codechicken:ForgeMultipart:1.7.10-1.1.0.314:dev"
compile "info.amerifrance.guideapi:Guide-API:" + config.mc_version + "-" + config.guideapi_version + ":deobf"
compile fileTree(dir: 'libs', include: 'CraftTweaker-Dev-1.7.10-3.2.2-GTNH.4-legacy.jar')
compile fileTree(dir: 'libs', include: 'Guide-API-1.7.10-1.0.1-20-deobf.jar')
compile "codechicken:ForgeMultipart:1.7.10-1.1.0.314:dev"
// compile "guideapi:Guide-API:" + config.mc_version + "-" + config.guideapi_version + ":deobf"
compile "team.chisel:Chisel:" + config.chisel_version + ":api"
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
minecraft {
version = config.mc_version + "-" + config.forge_version
runDir = "run"
+4 -4
View File
@@ -1,7 +1,7 @@
#
#Sun Jul 07 21:21:27 CEST 2019
#Sun Nov 29 17:51:49 PST 2020
mod_name=BloodMagic
forge_version=10.13.4.1492-1.7.10
forge_version=10.13.4.1614-1.7.10
ccc_version=1.0.7.47
cclib_version=1.1.3.138
nei_version=1.0.5.111
@@ -9,7 +9,7 @@ nei_version=1.0.5.111
package_group=com.wayoftime.bloodmagic
guideapi_version=1.0.1-20
mod_version=1.3.3
minetweaker_version=Dev-1.7.10-3.0.9B
minetweaker_version=Dev-1.7.10-3.2.2-GTNH
chisel_version=2.9.2.8
build_number=30
mc_version=1.7.10
build_number=44
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Sat Jul 06 23:18:00 EEST 2019
#Sat Jan 04 01:56:22 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,6 +13,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import WayofTime.alchemicalWizardry.api.BlockStack;
import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemicalPotionCreationHandler;
import WayofTime.alchemicalWizardry.api.alchemy.AlchemyRecipeRegistry;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
@@ -65,7 +66,6 @@ import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.*;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.*;
import WayofTime.alchemicalWizardry.common.spell.simple.*;
import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW;
import WayofTime.alchemicalWizardry.common.summoning.meteor.MeteorRegistry;
import WayofTime.alchemicalWizardry.common.thread.CommandDownloadGAPI;
import WayofTime.alchemicalWizardry.common.tileEntity.*;
import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler;
@@ -110,15 +110,6 @@ public class AlchemicalWizardry
public static boolean parseTextFiles = false;
public static boolean doMeteorsDestroyBlocks = true;
public static String[] diamondMeteorArray;
public static int diamondMeteorRadius;
public static String[] stoneMeteorArray;
public static int stoneMeteorRadius;
public static String[] ironBlockMeteorArray;
public static int ironBlockMeteorRadius;
public static String[] netherStarMeteorArray;
public static int netherStarMeteorRadius;
public static String[] allowedCrushedOresArray;
public static Potion customPotionDrowning;
@@ -889,10 +880,6 @@ public class AlchemicalWizardry
//Ore Dictionary Registration
OreDictionary.registerOre("oreCoal", Blocks.coal_ore);
MeteorRegistry.registerMeteorParadigm(diamondStack, diamondMeteorArray, diamondMeteorRadius);
MeteorRegistry.registerMeteorParadigm(stoneStack, stoneMeteorArray, stoneMeteorRadius);
MeteorRegistry.registerMeteorParadigm(ironBlockStack, ironBlockMeteorArray, ironBlockMeteorRadius);
MeteorRegistry.registerMeteorParadigm(new ItemStack(Items.nether_star), netherStarMeteorArray, netherStarMeteorRadius);
ItemStack stickStack = new ItemStack(Items.stick, 1, craftingConstant);
@@ -1191,6 +1178,7 @@ public class AlchemicalWizardry
BloodMagicConfiguration.loadCustomLPValues();
DemonVillageLootRegistry.init();
Meteor.loadConfig();
this.initCompressionHandlers();
@@ -103,15 +103,6 @@ public class BloodMagicConfiguration
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);
AlchemicalWizardry.diamondMeteorArray = config.get("meteor", "diamondMeteor", new String[]{"oreDiamond", "100", "oreEmerald", "75", "oreCinnabar", "200", "oreAmber", "200"}).getStringList();
AlchemicalWizardry.diamondMeteorRadius = config.get("meteor", "diamondMeteorRadius", 5).getInt();
AlchemicalWizardry.stoneMeteorArray = config.get("meteor", "stoneBlockMeteor", new String[]{"oreCoal", "150", "oreApatite", "50", "oreIron", "50"}).getStringList();
AlchemicalWizardry.stoneMeteorRadius = config.get("meteor", "stoneMeteorRadius", 16).getInt();
AlchemicalWizardry.ironBlockMeteorArray = config.get("meteor", "ironBlockMeteor", new String[]{"oreIron", "400", "oreGold", "30", "oreCopper", "200", "oreTin", "140", "oreSilver", "70", "oreLead", "80", "oreLapis", "60", "oreRedstone", "100"}).getStringList();
AlchemicalWizardry.ironBlockMeteorRadius = config.get("meteor", "ironBlockMeteorRadius", 7).getInt();
AlchemicalWizardry.netherStarMeteorArray = config.get("meteor", "netherStarMeteor", new String[]{"oreDiamond", "150", "oreEmerald", "100", "oreQuartz", "250", "oreSunstone", "5", "oreMoonstone", "50", "oreIridium", "5", "oreCertusQuartz", "150"}).getStringList();
AlchemicalWizardry.netherStarMeteorRadius = config.get("meteor", "netherStarMeteorRadius", 3).getInt();
AlchemicalWizardry.allowedCrushedOresArray = config.get("oreCrushing", "allowedOres", new String[]{"iron", "gold", "copper", "tin", "lead", "silver", "osmium"}).getStringList();
AlchemicalWizardry.wimpySettings = config.get("WimpySettings", "IDontLikeFun", false).getBoolean(false);
@@ -1,6 +1,6 @@
package WayofTime.alchemicalWizardry.client.nei;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
import java.awt.Rectangle;
import java.util.ArrayList;
@@ -57,7 +57,7 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
this.output = new PositionedStack(recipe.getResult(), 76, 25);
this.lp = recipe.getAmountNeeded() * 100;
this.orbs = new ArrayList<BloodOrbs>();
for (Item orb : bloodOrbs) {
for (Item orb : getBloodOrbs()) {
if (((IBloodOrb) orb).getOrbLevel() >= recipe.getOrbLevel()) {
orbs.add(new BloodOrbs(new ItemStack(orb)));
}
@@ -81,29 +81,6 @@ public class NEIAlchemyRecipeHandler extends TemplateRecipeHandler {
}
}
@Override
public TemplateRecipeHandler newInstance() {
// We need to populate available blood orbs,
// but don't try to do it more than once
if (bloodOrbs.isEmpty()) {
for (ItemStack item : ItemList.items) {
if (item != null && item.getItem() instanceof IBloodOrb) {
bloodOrbs.add(item.getItem());
}
}
if (bloodOrbs.isEmpty()) {
// If there is NEI no cache - go to item registry
for (Object anItemRegistry : Item.itemRegistry) {
Item item = (Item) anItemRegistry;
if (item != null && item instanceof IBloodOrb) {
bloodOrbs.add(item);
}
}
}
}
return super.newInstance();
}
@Override
public String getOverlayIdentifier() {
return "alchemicalwizardry.alchemy";
@@ -1,25 +1,23 @@
package WayofTime.alchemicalWizardry.client.nei;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.ItemList;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapedRecipeHandler;
import codechicken.nei.recipe.TemplateRecipeHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.StatCollector;
import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.ShapedRecipeHandler;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.bloodOrbs;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import static WayofTime.alchemicalWizardry.client.nei.NEIConfig.getBloodOrbs;
/**
* NEI Blood Orb Shaped Recipe Handler by joshie *
@@ -43,8 +41,8 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList();
for (Item item : bloodOrbs) {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
@@ -144,27 +142,4 @@ public class NEIBloodOrbShapedHandler extends ShapedRecipeHandler {
return StatCollector.translateToLocal("bm.string.crafting.orb.shaped");
}
@Override
public TemplateRecipeHandler newInstance() {
// We need to populate available blood orbs,
// but don't try to do it more than once
if (bloodOrbs.isEmpty()) {
for (ItemStack item : ItemList.items) {
if (item != null && item.getItem() instanceof IBloodOrb) {
bloodOrbs.add(item.getItem());
}
}
if (bloodOrbs.isEmpty()) {
// If there is NEI no cache - go to item registry
for (Object anItemRegistry : Item.itemRegistry) {
Item item = (Item) anItemRegistry;
if (item != null && item instanceof IBloodOrb) {
bloodOrbs.add(item);
}
}
}
}
return super.newInstance();
}
}
@@ -34,8 +34,8 @@ public class NEIBloodOrbShapelessHandler extends ShapelessRecipeHandler {
stack.setMaxSize(1);
ingredients.add(stack);
} else if (o instanceof Integer) {
ArrayList<ItemStack> orbs = new ArrayList();
for (Item item : NEIConfig.bloodOrbs) {
ArrayList<ItemStack> orbs = new ArrayList<>();
for (Item item : NEIConfig.getBloodOrbs()) {
if (((IBloodOrb) item).getOrbLevel() >= (Integer) o) {
orbs.add(new ItemStack(item));
}
@@ -2,13 +2,46 @@ package WayofTime.alchemicalWizardry.client.nei;
import java.util.ArrayList;
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb;
import codechicken.nei.ItemList;
import net.minecraft.item.Item;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import net.minecraft.item.ItemStack;
public class NEIConfig implements IConfigureNEI {
private static ArrayList<Item> bloodOrbs = null;
public static ArrayList<Item> getBloodOrbs() {
if (bloodOrbs == null) {
synchronized (NEIConfig.class) {
if (bloodOrbs == null) {
bloodOrbs = collectAllBloodOrbs();
}
}
}
return bloodOrbs;
}
private static ArrayList<Item> collectAllBloodOrbs() {
ArrayList<Item> bloodOrbsTemp = new ArrayList<>();
for (ItemStack item : ItemList.items) {
if (item != null && item.getItem() instanceof IBloodOrb) {
bloodOrbsTemp.add(item.getItem());
}
}
if (bloodOrbsTemp.isEmpty()) {
// If there is NEI no cache - go to item registry
for (Object anItemRegistry : Item.itemRegistry) {
Item item = (Item) anItemRegistry;
if (item instanceof IBloodOrb) {
bloodOrbsTemp.add(item);
}
}
}
return bloodOrbsTemp;
}
public class NEIConfig implements IConfigureNEI {
public static ArrayList<Item> bloodOrbs = new ArrayList<Item>();
@Override
public void loadConfig() {
API.registerRecipeHandler(new NEIAlchemyRecipeHandler());
@@ -32,67 +32,52 @@ public class RitualEffectSummonMeteor extends RitualEffect
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (ritualStone.getCooldown() > 0)
{
if (ritualStone.getCooldown() > 0) {
ritualStone.setCooldown(0);
}
if (currentEssence < this.getCostPerRefresh())
{
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
List<EntityItem> entities = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
if (entityOwner == null)
{
return;
}
if (entities == null)
return;
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
} else
{
List<EntityItem> entities = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
for (EntityItem entityItem : entities) {
if (entityItem != null && MeteorRegistry.isValidParadigmItem(entityItem.getEntityItem())) {
int meteorID = MeteorRegistry.getParadigmIDForItem(entityItem.getEntityItem());
int cost = MeteorRegistry.paradigmList.get(meteorID).cost;
if (entities == null)
{
return;
}
for (EntityItem entityItem : entities)
{
if (entityItem != null && MeteorRegistry.isValidParadigmItem(entityItem.getEntityItem()))
{
int meteorID = MeteorRegistry.getParadigmIDForItem(entityItem.getEntityItem());
EntityMeteor meteor = new EntityMeteor(world, x + 0.5f, 257, z + 0.5f, meteorID);
meteor.motionY = -1.0f;
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);
break;
if (currentEssence < cost) {
EntityPlayer entityOwner = SpellHelper.getPlayerForUsername(owner);
if (entityOwner != null)
entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80));
return;
}
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
EntityMeteor meteor = new EntityMeteor(world, x + 0.5f, 257, z + 0.5f, meteorID);
meteor.motionY = -1.0f;
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);
break;
}
}
}
@@ -0,0 +1,49 @@
package WayofTime.alchemicalWizardry.common.summoning.meteor;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
public class Meteor {
public String[] ores;
public int radius;
public int cost;
public String focusModId;
public String focusName;
public int focusMeta;
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 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;
}
}
@@ -12,17 +12,19 @@ import WayofTime.alchemicalWizardry.AlchemicalWizardry;
public class MeteorParadigm
{
public List<MeteorParadigmComponent> componentList = new ArrayList();
public List<MeteorParadigmComponent> componentList = new ArrayList<>();
public ItemStack focusStack;
public int radius;
public int cost;
public static int maxChance = 1000;
public static Random rand = new Random();
public MeteorParadigm(ItemStack focusStack, int radius)
public MeteorParadigm(ItemStack focusStack, int radius, int cost)
{
this.focusStack = focusStack;
this.radius = radius;
this.cost = cost;
}
public void parseStringArray(String[] oreArray)
@@ -9,18 +9,18 @@ import java.util.List;
public class MeteorRegistry
{
public static List<MeteorParadigm> paradigmList = new ArrayList();
public static List<MeteorParadigm> paradigmList = new ArrayList<>();
public static void registerMeteorParadigm(MeteorParadigm paradigm)
{
paradigmList.add(paradigm);
}
public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius)
public static void registerMeteorParadigm(ItemStack stack, String[] oreList, int radius, int cost)
{
if (stack != null && oreList != null)
{
MeteorParadigm meteor = new MeteorParadigm(stack, radius);
MeteorParadigm meteor = new MeteorParadigm(stack, radius, cost);
meteor.parseStringArray(oreList);
paradigmList.add(meteor);
}
@@ -146,10 +146,11 @@ public class TETeleposer extends TEInventory
{
entityCount = 0;
}
SoulNetworkHandler.syphonFromNetwork(focus, damage * transportCount + damage * entityCount);
//Teleport
//Teleport with minimum cost of 2000 LP.
int cost = Math.max(damage * transportCount + damage * entityCount, 2000);
SoulNetworkHandler.syphonFromNetwork(focus, cost);
if (worldF.equals(worldObj))
{
iterator1 = list1.iterator();
@@ -4,6 +4,7 @@ import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toObjects;
import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toShapedObjects;
import static WayofTime.alchemicalWizardry.common.tweaker.MTHelper.toStack;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.api.items.ShapelessBloodOrbRecipe;
@@ -24,16 +25,30 @@ import WayofTime.alchemicalWizardry.api.items.ShapedBloodOrbRecipe;
@ZenClass("mods.bloodmagic.BloodOrb")
public class BloodOrb
{
public static List<IUndoableAction> lateAdditions = new ArrayList<>();
public static List<IUndoableAction> lateRemovals = new ArrayList<>();
public static void applyAdditionsAndRemovals() {
for (IUndoableAction toRemove : lateRemovals) {
MineTweakerAPI.apply(toRemove);
}
for (IUndoableAction toAdd : lateAdditions) {
MineTweakerAPI.apply(toAdd);
}
lateAdditions.clear();
}
@ZenMethod
public static void addShaped(IItemStack output, IIngredient[][] ingredients)
{
MineTweakerAPI.apply(new Add(false, toStack(output), toShapedObjects(ingredients)));
lateAdditions.add(new Add(false, toStack(output), toShapedObjects(ingredients)));
}
@ZenMethod
public static void addShapeless(IItemStack output, IIngredient[] ingredients)
{
MineTweakerAPI.apply(new Add(true, toStack(output), toObjects(ingredients)));
lateAdditions.add((new Add(true, toStack(output), toObjects(ingredients))));
}
private static class Add implements IUndoableAction {
@@ -89,7 +104,7 @@ public class BloodOrb
@ZenMethod
public static void removeRecipe(IItemStack output) {
MineTweakerAPI.apply(new Remove(toStack(output)));
lateRemovals.add(new Remove(toStack(output)));
}
private static class Remove implements IUndoableAction {
@@ -111,7 +126,6 @@ public class BloodOrb
break;
}
}
CraftingManager.getInstance().getRecipeList().remove(iRecipe);
}
@@ -23,13 +23,25 @@ public class FallingTower
@ZenMethod
public static void addFocus(IItemStack stack, int radius, String[] components)
{
MineTweakerAPI.apply(new Add(toStack(stack),radius, components));
MineTweakerAPI.apply(new Add(toStack(stack),radius,10000, components));
}
@ZenMethod
public static void addFocus(IItemStack stack, int radius, String components)
{
MineTweakerAPI.apply(new Add(toStack(stack),radius, components.split("\\s*,\\s*")));
MineTweakerAPI.apply(new Add(toStack(stack), radius, 10000, components.split("\\s*,\\s*")));
}
@ZenMethod
public static void addFocus(IItemStack stack, int radius, int cost, String[] components)
{
MineTweakerAPI.apply(new Add(toStack(stack), radius, cost, components));
}
@ZenMethod
public static void addFocus(IItemStack stack, int radius, int cost, String components)
{
MineTweakerAPI.apply(new Add(toStack(stack),radius, cost, components.split("\\s*,\\s*")));
}
@ZenMethod
@@ -41,9 +53,9 @@ public class FallingTower
{
private MeteorParadigm paradigm;
public Add(ItemStack stack, int radius, String[] components)
public Add(ItemStack stack, int radius, int cost, String[] components)
{
paradigm = new MeteorParadigm(stack,radius);
paradigm = new MeteorParadigm(stack, radius, cost);
paradigm.parseStringArray(components);
}
@@ -1,6 +1,8 @@
package WayofTime.alchemicalWizardry.common.tweaker;
import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
import minetweaker.util.IEventHandler;
/**
* MineTweaker3 Integration by joshie *
@@ -15,5 +17,18 @@ public class MineTweakerIntegration
MineTweakerAPI.registerClass(BloodOrb.class);
MineTweakerAPI.registerClass(FallingTower.class);
MineTweakerAPI.registerClass(HarvestMoon.class);
MineTweakerImplementationAPI.onRollbackEvent(new HandleLateAdditionsAndRemovals());
MineTweakerImplementationAPI.onPostReload(new HandleLateAdditionsAndRemovals());
}
public static class HandleLateAdditionsAndRemovals implements IEventHandler<MineTweakerImplementationAPI.ReloadEvent>
{
@Override
public void handle(MineTweakerImplementationAPI.ReloadEvent event)
{
BloodOrb.applyAdditionsAndRemovals();
}
}
}