Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add power display for Cauldron #12

Merged
merged 5 commits into from
Jul 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 299 additions & 89 deletions build.gradle

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Add your dependencies here

dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.12-GTNH:dev')

compile('curse.maven:witchery-69673:2234410')
compile('curse.maven:witchery-69673:2234410')
}
22 changes: 11 additions & 11 deletions repositories.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Add any additional repositories for your dependencies here

repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
url 'https://cursemaven.com'
}
maven {
url 'https://jitpack.io'
}
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
url 'https://cursemaven.com'
}
maven {
url 'https://jitpack.io'
}
}
806 changes: 416 additions & 390 deletions src/main/java/alkalus/main/api/RecipeManager.java

Large diffs are not rendered by default.

112 changes: 54 additions & 58 deletions src/main/java/alkalus/main/api/plugin/ExamplePlugin.java
Original file line number Diff line number Diff line change
@@ -1,74 +1,70 @@
package alkalus.main.api.plugin;


import alkalus.main.api.RecipeManager;
import alkalus.main.api.plugin.base.BasePluginWitchery;
import com.emoniph.witchery.Witchery;
import com.emoniph.witchery.predictions.Prediction;
import com.emoniph.witchery.util.Dye;

import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;

import alkalus.main.api.RecipeManager;
import alkalus.main.api.plugin.base.BasePluginWitchery;

public class ExamplePlugin extends BasePluginWitchery {

public ExamplePlugin() {
super(new LoadPhase[] {LoadPhase.INIT, LoadPhase.POSTINIT});
}

@Override
public String getPluginName() {
return "Example_Plugin";
}

@Override
public boolean preInit() {
return false;
}
public ExamplePlugin() {
super(new LoadPhase[] {LoadPhase.INIT, LoadPhase.POSTINIT});
}

@Override
public boolean init() {
//Add Recipes Here
RecipeManager.Kettle.addRecipe(
Witchery.Items.GENERIC.itemBrewOfThorns.createStack(3), //Output
1, //Witch Hat Bonus
0, //Familiar ID
0.0f, //Alter Power Required
-10027232, //Kettle Brew Colour
0, //Dimension ID Required (Best left 0)
true, //Does this show in the Kettle Recipes book?
new ItemStack[]{ //Inputs
Dye.CACTUS_GREEN.createStack(),
Witchery.Items.GENERIC.itemDiamondVapour.createStack(),
Witchery.Items.GENERIC.itemOdourOfPurity.createStack(),
Witchery.Items.GENERIC.itemMandrakeRoot.createStack()
});
@Override
public String getPluginName() {
return "Example_Plugin";
}

@Override
public boolean preInit() {
return false;
}

RecipeManager.Distillery.addRecipe(
new ItemStack(Items.diamond), //Input A
Witchery.Items.GENERIC.itemOilOfVitriol.createStack(), //Input B
3, //Required Empty Jar Count
Witchery.Items.GENERIC.itemMandrakeRoot.createStack(), //Output A
Witchery.Items.GENERIC.itemDiamondVapour.createStack(), //Output B
Witchery.Items.GENERIC.itemOdourOfPurity.createStack(), //Output C
(ItemStack) null); //Output D
return true;
}
@Override
public boolean init() {
// Add Recipes Here
RecipeManager.Kettle.addRecipe(
Witchery.Items.GENERIC.itemBrewOfThorns.createStack(3), // Output
1, // Witch Hat Bonus
0, // Familiar ID
0.0f, // Alter Power Required
-10027232, // Kettle Brew Colour
0, // Dimension ID Required (Best left 0)
true, // Does this show in the Kettle Recipes book?
new ItemStack[] { // Inputs
Dye.CACTUS_GREEN.createStack(),
Witchery.Items.GENERIC.itemDiamondVapour.createStack(),
Witchery.Items.GENERIC.itemOdourOfPurity.createStack(),
Witchery.Items.GENERIC.itemMandrakeRoot.createStack()
});

@Override
public boolean postInit() {
//Remove Recipes Here
RecipeManager.Kettle.removeRecipe(Witchery.Items.GENERIC.itemHappenstanceOil.createStack());
RecipeManager.Distillery.removeRecipe(RecipeManager.Distillery.findRecipeUsingIngredient(new ItemStack(Items.diamond)));
RecipeManager.RitesAndRituals.remove((byte) 1);
RecipeManager.Infusions.remove(RecipeManager.Infusions.getInfusion(3));
for (Prediction H : RecipeManager.Predictions.getPredictions().values()) {
RecipeManager.Predictions.remove(H);
}
RecipeManager.CreaturePowers.remove(RecipeManager.CreaturePowers.getCreaturePower(18));
return true;
}
RecipeManager.Distillery.addRecipe(
new ItemStack(Items.diamond), // Input A
Witchery.Items.GENERIC.itemOilOfVitriol.createStack(), // Input B
3, // Required Empty Jar Count
Witchery.Items.GENERIC.itemMandrakeRoot.createStack(), // Output A
Witchery.Items.GENERIC.itemDiamondVapour.createStack(), // Output B
Witchery.Items.GENERIC.itemOdourOfPurity.createStack(), // Output C
(ItemStack) null); // Output D
return true;
}

@Override
public boolean postInit() {
// Remove Recipes Here
RecipeManager.Kettle.removeRecipe(Witchery.Items.GENERIC.itemHappenstanceOil.createStack());
RecipeManager.Distillery.removeRecipe(
RecipeManager.Distillery.findRecipeUsingIngredient(new ItemStack(Items.diamond)));
RecipeManager.RitesAndRituals.remove((byte) 1);
RecipeManager.Infusions.remove(RecipeManager.Infusions.getInfusion(3));
for (Prediction H : RecipeManager.Predictions.getPredictions().values()) {
RecipeManager.Predictions.remove(H);
}
RecipeManager.CreaturePowers.remove(RecipeManager.CreaturePowers.getCreaturePower(18));
return true;
}
}
132 changes: 64 additions & 68 deletions src/main/java/alkalus/main/api/plugin/base/BasePluginWitchery.java
Original file line number Diff line number Diff line change
@@ -1,86 +1,82 @@
package alkalus.main.api.plugin.base;

import alkalus.main.api.RecipeManager;
import alkalus.main.api.plugin.interfaces.WitcheryPlugin;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

import alkalus.main.api.RecipeManager;
import alkalus.main.api.plugin.interfaces.WitcheryPlugin;

/**
* This class should be extended, then the three phase methods should be {@link Override}n as required.
* Constructor takes {@link LoadPhase}s, Feel free to leave {@link Override}n methods empty if they're not being use.
* @author Alkalus
*
*/
public abstract class BasePluginWitchery implements WitcheryPlugin {

/** Just a simple {@link Enum} containing the three main Forge load phases.
* @author Alkalus
*/
public static enum LoadPhase {
PREINIT,
INIT,
POSTINIT
}

/**
* Small Field used to maintain validation of the plugin.
*/
private volatile boolean isValid = true;

/** Dictates which stages your plugin will load in.
* @param initStage - Multiple {@link LoadPhase}s. Maximum 3.
*/
public BasePluginWitchery(Set<LoadPhase> phases) {
this(phases, true);
}

public abstract class BasePluginWitchery implements WitcheryPlugin {


/** Just a simple {@link Enum} containing the three main Forge load phases.
* @author Alkalus
*/
public static enum LoadPhase {
PREINIT, INIT, POSTINIT
}

/**
* Small Field used to maintain validation of the plugin.
*/
private volatile boolean isValid = true;
/** Dictates which stages your plugin will load in.
* @param initStage - Multiple {@link LoadPhase}s. Maximum 3.
*/
public BasePluginWitchery(LoadPhase[] phases) {
this(new HashSet<LoadPhase>(Arrays.asList(phases)), true);
}

/** Dictates which stages your plugin will load in.
* @param initStage - Multiple {@link LoadPhase}s. Maximum 3.
*/
public BasePluginWitchery(Set<LoadPhase> phases) {
this(phases, true);
}

/** Dictates which stages your plugin will load in.
* @param initStage - Multiple {@link LoadPhase}s. Maximum 3.
*/
public BasePluginWitchery(LoadPhase[] phases) {
this(new HashSet<LoadPhase>(Arrays.asList(phases)), true);
}

/**
* Internal Constructor for Plugins.
* @param phases - Multiple {@link LoadPhase}s. Maximum 3.
* @param internal - {@link boolean that dictates whether or not this was an internal call.
* Please use false if you reflectively call this, for future compatibility.}
*/
private BasePluginWitchery(Set<LoadPhase> phases, boolean internal) {
if (phases == null || phases.size() <= 0 || phases.size() >= 4) {
isValid = false;
}
if (isValid) {
for (LoadPhase p : phases) {
if (p == LoadPhase.PREINIT) {
RecipeManager.PluginManager.loadPluginForPreInit(this);
}
else if (p == LoadPhase.INIT) {
RecipeManager.PluginManager.loadPluginForInit(this);
}
else if (p == LoadPhase.POSTINIT) {
RecipeManager.PluginManager.loadPluginForPostInit(this);
}
}
}
}

/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean preInit();
/**
* Internal Constructor for Plugins.
* @param phases - Multiple {@link LoadPhase}s. Maximum 3.
* @param internal - {@link boolean that dictates whether or not this was an internal call.
* Please use false if you reflectively call this, for future compatibility.}
*/
private BasePluginWitchery(Set<LoadPhase> phases, boolean internal) {
if (phases == null || phases.size() <= 0 || phases.size() >= 4) {
isValid = false;
}
if (isValid) {
for (LoadPhase p : phases) {
if (p == LoadPhase.PREINIT) {
RecipeManager.PluginManager.loadPluginForPreInit(this);
} else if (p == LoadPhase.INIT) {
RecipeManager.PluginManager.loadPluginForInit(this);
} else if (p == LoadPhase.POSTINIT) {
RecipeManager.PluginManager.loadPluginForPostInit(this);
}
}
}
}

/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean init();
/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean preInit();

/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean postInit();
/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean init();

/** If you wish to utilize this phase, {@link Override} the behaviour. Be sure to enable this load phase during {@link WitcheryPlugin} construction.
* @return - You should return True/False depending upon if the code completes as expected or not.
*/
public abstract boolean postInit();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

public interface WitcheryPlugin {

public abstract String getPluginName();

public abstract boolean preInit();

public abstract boolean init();

public abstract boolean postInit();

public abstract String getPluginName();

public abstract boolean preInit();

public abstract boolean init();

public abstract boolean postInit();
}
Loading