mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
updateBuildScript & spotlessApply
This commit is contained in:
1 parent
21ce111286
commit
9bf784e82c
927 files changed
+67478
-62885
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -2,21 +2,20 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:09:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.entity.boss.IBossDisplayData;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* An extension of IBossDisplayData. This counts as a botania boss and as a normal
|
||||
@@ -28,35 +27,35 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface IBotaniaBoss extends IBossDisplayData {
|
||||
|
||||
/**
|
||||
* The ResourceLocation to bind for this boss's boss bar.
|
||||
* You can use BotaniaAPI.internalMethodHandler.getDefaultBossBarTexture() to get
|
||||
* the one used by botania bosses.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getBossBarTexture();
|
||||
/**
|
||||
* The ResourceLocation to bind for this boss's boss bar.
|
||||
* You can use BotaniaAPI.internalMethodHandler.getDefaultBossBarTexture() to get
|
||||
* the one used by botania bosses.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getBossBarTexture();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar texture. This is for the background, not the bar that shows
|
||||
* the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarTextureRect();
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar texture. This is for the background, not the bar that shows
|
||||
* the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarTextureRect();
|
||||
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar HP texture. This is for the foreground that shows how much
|
||||
* HP the boss has. The width of the rectangle will be multiplied by the
|
||||
* faction of the boss's current HP by max HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarHPTextureRect();
|
||||
/**
|
||||
* A Rectangle instance delimiting the uv, width and height of this boss's
|
||||
* boss bar HP texture. This is for the foreground that shows how much
|
||||
* HP the boss has. The width of the rectangle will be multiplied by the
|
||||
* faction of the boss's current HP by max HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Rectangle getBossBarHPTextureRect();
|
||||
|
||||
/**
|
||||
* A callback for when this boss's boss bar renders, you can do aditional rendering
|
||||
* here if needed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void bossBarRenderCallback(ScaledResolution res, int x, int y);
|
||||
/**
|
||||
* A callback for when this boss's boss bar renders, you can do aditional rendering
|
||||
* here if needed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void bossBarRenderCallback(ScaledResolution res, int x, int y);
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:13:21 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.internal.ShaderCallback;
|
||||
|
||||
/**
|
||||
* A Botania boss whose HP bar makes use of shaders. Shaders
|
||||
@@ -23,20 +23,19 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface IBotaniaBossWithShader extends IBotaniaBoss {
|
||||
|
||||
/**
|
||||
* The Shader Program to use for this boss bar. Return 0 case
|
||||
* you don't want a shader to be used. You can use separate shaders
|
||||
* for the background and foreground.
|
||||
* @param background True if rendering the background of the boss bar,
|
||||
* false if rendering the bar itself that shows the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background);
|
||||
|
||||
/**
|
||||
* A callback for the shader, used to pass in uniforms. Return null for no callback.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
|
||||
/**
|
||||
* The Shader Program to use for this boss bar. Return 0 case
|
||||
* you don't want a shader to be used. You can use separate shaders
|
||||
* for the background and foreground.
|
||||
* @param background True if rendering the background of the boss bar,
|
||||
* false if rendering the bar itself that shows the HP.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBossBarShaderProgram(boolean background);
|
||||
|
||||
/**
|
||||
* A callback for the shader, used to pass in uniforms. Return null for no callback.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ShaderCallback getBossBarShaderCallback(boolean background, int shader);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:22:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
@@ -13,7 +13,6 @@ package vazkii.botania.api.brew;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
@@ -22,105 +21,104 @@ import net.minecraft.potion.PotionEffect;
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
String key;
|
||||
String name;
|
||||
int color;
|
||||
int cost;
|
||||
List<PotionEffect> effects;
|
||||
boolean canInfuseBloodPendant = true;
|
||||
boolean canInfuseIncense = true;
|
||||
String key;
|
||||
String name;
|
||||
int color;
|
||||
int cost;
|
||||
List<PotionEffect> effects;
|
||||
boolean canInfuseBloodPendant = true;
|
||||
boolean canInfuseIncense = true;
|
||||
|
||||
/**
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.cost = cost;
|
||||
this.effects = new ArrayList(Arrays.asList(effects));
|
||||
}
|
||||
/**
|
||||
* @param name The unlocalized name of this potion.
|
||||
* @param color The color for the potion to be rendered in the bottle, note that it will get
|
||||
* changed a bit when it renders (for more or less brightness) to give a fancy effect.
|
||||
* @param cost The cost, in Mana for this brew.
|
||||
* @param effects A list of effects to apply to the player when they drink it.
|
||||
*/
|
||||
public Brew(String key, String name, int color, int cost, PotionEffect... effects) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.cost = cost;
|
||||
this.effects = new ArrayList(Arrays.asList(effects));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto the Tainted Blood Pendant.
|
||||
*/
|
||||
public Brew setNotBloodPendantInfusable() {
|
||||
canInfuseBloodPendant = false;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto the Tainted Blood Pendant.
|
||||
*/
|
||||
public Brew setNotBloodPendantInfusable() {
|
||||
canInfuseBloodPendant = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto Incense Sticks.
|
||||
*/
|
||||
public Brew setNotIncenseInfusable() {
|
||||
canInfuseIncense = false;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets this brew to not be able to be infused onto Incense Sticks.
|
||||
*/
|
||||
public Brew setNotIncenseInfusable() {
|
||||
canInfuseIncense = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean canInfuseBloodPendant() {
|
||||
return canInfuseBloodPendant;
|
||||
}
|
||||
public boolean canInfuseBloodPendant() {
|
||||
return canInfuseBloodPendant;
|
||||
}
|
||||
|
||||
public boolean canInfuseIncense() {
|
||||
return canInfuseIncense;
|
||||
}
|
||||
public boolean canInfuseIncense() {
|
||||
return canInfuseIncense;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the key for this brew, for it to be found in the map in the API.
|
||||
* This should ALWAYS return the same result.
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
/**
|
||||
* Returns the key for this brew, for it to be found in the map in the API.
|
||||
* This should ALWAYS return the same result.
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized name. This is used for the lexicon.
|
||||
*/
|
||||
public String getUnlocalizedName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Gets the insensitive unlocalized name. This is used for the lexicon.
|
||||
*/
|
||||
public String getUnlocalizedName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the unlocalized name for the ItemStack passed in.
|
||||
*/
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
/**
|
||||
* Gets the unlocalized name for the ItemStack passed in.
|
||||
*/
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display color for the ItemStack passed in. Note that for
|
||||
* the lexicon, this passes in a botania Managlass Vial or an
|
||||
* Alfglass Flask at all times.
|
||||
*/
|
||||
public int getColor(ItemStack stack) {
|
||||
return color;
|
||||
}
|
||||
/**
|
||||
* Gets the display color for the ItemStack passed in. Note that for
|
||||
* the lexicon, this passes in a botania Managlass Vial or an
|
||||
* Alfglass Flask at all times.
|
||||
*/
|
||||
public int getColor(ItemStack stack) {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
/**
|
||||
* Gets the insensitive unlocalized mana cost. This is used for the lexicon.
|
||||
*/
|
||||
public int getManaCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of potion effects for the ItemStack passed in.
|
||||
* Note that for the lexicon, this passes in a botania Managlass
|
||||
* Vial or an Alfglass Flask at all times.
|
||||
*/
|
||||
public List<PotionEffect> getPotionEffects(ItemStack stack) {
|
||||
return effects;
|
||||
}
|
||||
/**
|
||||
* Gets the mana cost for the ItemStack passed in.
|
||||
*/
|
||||
public int getManaCost(ItemStack stack) {
|
||||
return getManaCost();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of potion effects for the ItemStack passed in.
|
||||
* Note that for the lexicon, this passes in a botania Managlass
|
||||
* Vial or an Alfglass Flask at all times.
|
||||
*/
|
||||
public List<PotionEffect> getPotionEffects(ItemStack stack) {
|
||||
return effects;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:26:40 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
@@ -19,17 +19,16 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IBrewContainer {
|
||||
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
/**
|
||||
* Returs an ItemStack that should be an item that has the brew
|
||||
* passed in.
|
||||
*/
|
||||
public ItemStack getItemForBrew(Brew brew, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the cost to add this brew onto this container. Return -1
|
||||
* to not allow for the brew to be added. Normally you'd
|
||||
* use brew.getManaCost(stack);
|
||||
*/
|
||||
public int getManaCost(Brew brew, ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 9:20:33 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
@@ -19,6 +19,5 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
}
|
||||
@@ -2,13 +2,14 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 14, 2015, 3:28:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@@ -16,7 +17,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -29,293 +29,293 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class CorporeaHelper {
|
||||
|
||||
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
|
||||
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
|
||||
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers = new ArrayList<ICorporeaAutoCompleteController>();
|
||||
private static final List<IInventory> empty = Collections.unmodifiableList(new ArrayList());
|
||||
private static final WeakHashMap<List<ICorporeaSpark>, List<IInventory>> cachedNetworks = new WeakHashMap();
|
||||
private static final List<ICorporeaAutoCompleteController> autoCompleteControllers =
|
||||
new ArrayList<ICorporeaAutoCompleteController>();
|
||||
|
||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||
private static final Pattern patternControlCode = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
|
||||
|
||||
public static final String[] WILDCARD_STRINGS = new String[] {
|
||||
"...", "~", "+", "?" , "*"
|
||||
};
|
||||
public static final String[] WILDCARD_STRINGS = new String[] {"...", "~", "+", "?", "*"};
|
||||
|
||||
/**
|
||||
* How many items were matched in the last request. If java had "out" params like C# this wouldn't be needed :V
|
||||
*/
|
||||
public static int lastRequestMatches = 0;
|
||||
/**
|
||||
* How many items were extracted in the last request.
|
||||
*/
|
||||
public static int lastRequestExtractions = 0;
|
||||
/**
|
||||
* How many items were matched in the last request. If java had "out" params like C# this wouldn't be needed :V
|
||||
*/
|
||||
public static int lastRequestMatches = 0;
|
||||
/**
|
||||
* How many items were extracted in the last request.
|
||||
*/
|
||||
public static int lastRequestExtractions = 0;
|
||||
|
||||
/**
|
||||
* Gets a list of all the inventories on this spark network. This list is cached for use once every tick,
|
||||
* and if something changes during that tick it'll still have the first result.
|
||||
*/
|
||||
public static List<IInventory> getInventoriesOnNetwork(ICorporeaSpark spark) {
|
||||
ICorporeaSpark master = spark.getMaster();
|
||||
if(master == null)
|
||||
return empty;
|
||||
List<ICorporeaSpark> network = master.getConnections();
|
||||
/**
|
||||
* Gets a list of all the inventories on this spark network. This list is cached for use once every tick,
|
||||
* and if something changes during that tick it'll still have the first result.
|
||||
*/
|
||||
public static List<IInventory> getInventoriesOnNetwork(ICorporeaSpark spark) {
|
||||
ICorporeaSpark master = spark.getMaster();
|
||||
if (master == null) return empty;
|
||||
List<ICorporeaSpark> network = master.getConnections();
|
||||
|
||||
if(cachedNetworks.containsKey(network)) {
|
||||
List<IInventory> cache = cachedNetworks.get(network);
|
||||
if(cache != null)
|
||||
return cache;
|
||||
}
|
||||
if (cachedNetworks.containsKey(network)) {
|
||||
List<IInventory> cache = cachedNetworks.get(network);
|
||||
if (cache != null) return cache;
|
||||
}
|
||||
|
||||
List<IInventory> inventories = new ArrayList();
|
||||
if(network != null)
|
||||
for(ICorporeaSpark otherSpark : network)
|
||||
if(otherSpark != null) {
|
||||
IInventory inv = otherSpark.getInventory();
|
||||
if(inv != null)
|
||||
inventories.add(inv);
|
||||
}
|
||||
List<IInventory> inventories = new ArrayList();
|
||||
if (network != null)
|
||||
for (ICorporeaSpark otherSpark : network)
|
||||
if (otherSpark != null) {
|
||||
IInventory inv = otherSpark.getInventory();
|
||||
if (inv != null) inventories.add(inv);
|
||||
}
|
||||
|
||||
cachedNetworks.put(network, inventories);
|
||||
return inventories;
|
||||
}
|
||||
cachedNetworks.put(network, inventories);
|
||||
return inventories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level functions that use a List< IInventory > or a Map< IInventory, Integer > should be
|
||||
* called instead if the context for those exists to avoid having to get the values again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getCountInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level functions that use a List< IInventory > or a Map< IInventory, Integer > should be
|
||||
* called instead if the context for those exists to avoid having to get the values again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getCountInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level function that use a Map< IInventory, Integer > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> map = getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
return getCountInNetwork(stack, map, checkNBT);
|
||||
}
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
* The higher level function that use a Map< IInventory, Integer > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> map = getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
return getCountInNetwork(stack, map, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, Map<IInventory, Integer> inventories, boolean checkNBT) {
|
||||
int count = 0;
|
||||
/**
|
||||
* Gets the amount of available items in the network of the type passed in, checking NBT or not.
|
||||
*/
|
||||
public static int getCountInNetwork(ItemStack stack, Map<IInventory, Integer> inventories, boolean checkNBT) {
|
||||
int count = 0;
|
||||
|
||||
for(IInventory inv : inventories.keySet())
|
||||
count += inventories.get(inv);
|
||||
for (IInventory inv : inventories.keySet()) count += inventories.get(inv);
|
||||
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The higher level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The higher level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(
|
||||
ItemStack stack, ICorporeaSpark spark, boolean checkNBT) {
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
return getInventoriesWithItemInNetwork(stack, inventories, checkNBT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The deeper level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(ItemStack stack,List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> countMap = new HashMap<IInventory, Integer>();
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
for (IWrappedInventory inv : wrappedInventories) {
|
||||
CorporeaRequest request = new CorporeaRequest(stack, checkNBT, -1);
|
||||
inv.countItems(request);
|
||||
if (request.foundItems > 0) {
|
||||
countMap.put(inv.getWrappedObject(), request.foundItems);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets a Map mapping IInventories to the amount of items of the type passed in that exist
|
||||
* The deeper level function that use a List< IInventory > should be
|
||||
* called instead if the context for this exists to avoid having to get the value again.
|
||||
*/
|
||||
public static Map<IInventory, Integer> getInventoriesWithItemInNetwork(
|
||||
ItemStack stack, List<IInventory> inventories, boolean checkNBT) {
|
||||
Map<IInventory, Integer> countMap = new HashMap<IInventory, Integer>();
|
||||
List<IWrappedInventory> wrappedInventories = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
for (IWrappedInventory inv : wrappedInventories) {
|
||||
CorporeaRequest request = new CorporeaRequest(stack, checkNBT, -1);
|
||||
inv.countItems(request);
|
||||
if (request.foundItems > 0) {
|
||||
countMap.put(inv.getWrappedObject(), request.foundItems);
|
||||
}
|
||||
}
|
||||
|
||||
return countMap;
|
||||
}
|
||||
return countMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bridge for requestItem() using an ItemStack.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
return requestItem(stack, stack.stackSize, spark, checkNBT, doit);
|
||||
}
|
||||
/**
|
||||
* Bridge for requestItem() using an ItemStack.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
return requestItem(stack, stack.stackSize, spark, checkNBT, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bridge for requestItem() using a String and an item count.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(String name, int count, ICorporeaSpark spark, boolean doit) {
|
||||
return requestItem(name, count, spark, false, doit);
|
||||
}
|
||||
/**
|
||||
* Bridge for requestItem() using a String and an item count.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(String name, int count, ICorporeaSpark spark, boolean doit) {
|
||||
return requestItem(name, count, spark, false, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests list of ItemStacks of the type passed in from the network, or tries to, checking NBT or not.
|
||||
* This will remove the items from the adequate inventories unless the "doit" parameter is false.
|
||||
* Returns a new list of ItemStacks of the items acquired or an empty list if none was found.
|
||||
* Case itemCount is -1 it'll find EVERY item it can.
|
||||
* <br><br>
|
||||
* The "matcher" parameter has to be an ItemStack or a String, if the first it'll check if the
|
||||
* two stacks are similar using the "checkNBT" parameter, else it'll check if the name of the item
|
||||
* equals or matches (case a regex is passed in) the matcher string.
|
||||
* <br><br>
|
||||
* When requesting counting of items, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(Object matcher, int itemCount, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(matcher, itemCount, spark, checkNBT, doit);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
return stacks;
|
||||
/**
|
||||
* Requests list of ItemStacks of the type passed in from the network, or tries to, checking NBT or not.
|
||||
* This will remove the items from the adequate inventories unless the "doit" parameter is false.
|
||||
* Returns a new list of ItemStacks of the items acquired or an empty list if none was found.
|
||||
* Case itemCount is -1 it'll find EVERY item it can.
|
||||
* <br><br>
|
||||
* The "matcher" parameter has to be an ItemStack or a String, if the first it'll check if the
|
||||
* two stacks are similar using the "checkNBT" parameter, else it'll check if the name of the item
|
||||
* equals or matches (case a regex is passed in) the matcher string.
|
||||
* <br><br>
|
||||
* When requesting counting of items, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(
|
||||
Object matcher, int itemCount, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
List<ItemStack> stacks = new ArrayList<ItemStack>();
|
||||
CorporeaRequestEvent event = new CorporeaRequestEvent(matcher, itemCount, spark, checkNBT, doit);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return stacks;
|
||||
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
List<IInventory> inventories = getInventoriesOnNetwork(spark);
|
||||
List<IWrappedInventory> inventoriesW = BotaniaAPI.internalHandler.wrapInventory(inventories);
|
||||
Map<ICorporeaInterceptor, ICorporeaSpark> interceptors = new HashMap<ICorporeaInterceptor, ICorporeaSpark>();
|
||||
|
||||
CorporeaRequest request = new CorporeaRequest(matcher, checkNBT, itemCount);
|
||||
for(IWrappedInventory inv : inventoriesW) {
|
||||
ICorporeaSpark invSpark = inv.getSpark();
|
||||
CorporeaRequest request = new CorporeaRequest(matcher, checkNBT, itemCount);
|
||||
for (IWrappedInventory inv : inventoriesW) {
|
||||
ICorporeaSpark invSpark = inv.getSpark();
|
||||
|
||||
Object originalInventory = inv.getWrappedObject();
|
||||
if(originalInventory instanceof ICorporeaInterceptor) {
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
|
||||
interceptor.interceptRequest(matcher, itemCount, invSpark, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, invSpark);
|
||||
}
|
||||
Object originalInventory = inv.getWrappedObject();
|
||||
if (originalInventory instanceof ICorporeaInterceptor) {
|
||||
ICorporeaInterceptor interceptor = (ICorporeaInterceptor) originalInventory;
|
||||
interceptor.interceptRequest(matcher, itemCount, invSpark, spark, stacks, inventories, doit);
|
||||
interceptors.put(interceptor, invSpark);
|
||||
}
|
||||
|
||||
if(doit) {
|
||||
stacks.addAll(inv.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(inv.countItems(request));
|
||||
}
|
||||
}
|
||||
if (doit) {
|
||||
stacks.addAll(inv.extractItems(request));
|
||||
} else {
|
||||
stacks.addAll(inv.countItems(request));
|
||||
}
|
||||
}
|
||||
|
||||
lastRequestMatches = request.foundItems;
|
||||
lastRequestExtractions = request.extractedItems;
|
||||
lastRequestMatches = request.foundItems;
|
||||
lastRequestExtractions = request.extractedItems;
|
||||
|
||||
for(ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(matcher, itemCount, interceptors.get(interceptor), spark, stacks, inventories, doit);
|
||||
for (ICorporeaInterceptor interceptor : interceptors.keySet())
|
||||
interceptor.interceptRequestLast(
|
||||
matcher, itemCount, interceptors.get(interceptor), spark, stacks, inventories, doit);
|
||||
|
||||
return stacks;
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spark attached to the inventory passed case it's a TileEntity.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForInventory(IInventory inv) {
|
||||
if(!(inv instanceof TileEntity))
|
||||
return null;
|
||||
/**
|
||||
* Gets the spark attached to the inventory passed case it's a TileEntity.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForInventory(IInventory inv) {
|
||||
if (!(inv instanceof TileEntity)) return null;
|
||||
|
||||
TileEntity tile = (TileEntity) inv;
|
||||
return getSparkForBlock(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
TileEntity tile = (TileEntity) inv;
|
||||
return getSparkForBlock(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the spark attached to the block in the coords passed in. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForBlock(World world, int x, int y, int z) {
|
||||
List<ICorporeaSpark> sparks = world.getEntitiesWithinAABB(ICorporeaSpark.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
return sparks.isEmpty() ? null : sparks.get(0);
|
||||
}
|
||||
/**
|
||||
* Gets the spark attached to the block in the coords passed in. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static ICorporeaSpark getSparkForBlock(World world, int x, int y, int z) {
|
||||
List<ICorporeaSpark> sparks = world.getEntitiesWithinAABB(
|
||||
ICorporeaSpark.class, AxisAlignedBB.getBoundingBox(x, y + 1, z, x + 1, y + 2, z + 1));
|
||||
return sparks.isEmpty() ? null : sparks.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the block in the coords passed in has a spark attached. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static boolean doesBlockHaveSpark(World world, int x, int y, int z) {
|
||||
return getSparkForBlock(world, x, y, z) != null;
|
||||
}
|
||||
/**
|
||||
* Gets if the block in the coords passed in has a spark attached. Note that the coords passed
|
||||
* in are for the block that the spark will be on, not the coords of the spark itself.
|
||||
*/
|
||||
public static boolean doesBlockHaveSpark(World world, int x, int y, int z) {
|
||||
return getSparkForBlock(world, x, y, z) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the slot passed in can be extracted from by a spark.
|
||||
*/
|
||||
public static boolean isValidSlot(IInventory inv, int slot) {
|
||||
return !(inv instanceof ISidedInventory) || arrayHas(((ISidedInventory) inv).getAccessibleSlotsFromSide(ForgeDirection.UP.ordinal()), slot) && ((ISidedInventory) inv).canExtractItem(slot, inv.getStackInSlot(slot), ForgeDirection.UP.ordinal());
|
||||
}
|
||||
/**
|
||||
* Gets if the slot passed in can be extracted from by a spark.
|
||||
*/
|
||||
public static boolean isValidSlot(IInventory inv, int slot) {
|
||||
return !(inv instanceof ISidedInventory)
|
||||
|| arrayHas(((ISidedInventory) inv).getAccessibleSlotsFromSide(ForgeDirection.UP.ordinal()), slot)
|
||||
&& ((ISidedInventory) inv)
|
||||
.canExtractItem(slot, inv.getStackInSlot(slot), ForgeDirection.UP.ordinal());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if two stacks match.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack1, ItemStack stack2, boolean checkNBT) {
|
||||
return stack1 != null && stack2 != null && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
|
||||
}
|
||||
/**
|
||||
* Gets if two stacks match.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack1, ItemStack stack2, boolean checkNBT) {
|
||||
return stack1 != null
|
||||
&& stack2 != null
|
||||
&& stack1.isItemEqual(stack2)
|
||||
&& (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the name of a stack matches the string passed in.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack, String s) {
|
||||
if(stack == null)
|
||||
return false;
|
||||
/**
|
||||
* Gets if the name of a stack matches the string passed in.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack, String s) {
|
||||
if (stack == null) return false;
|
||||
|
||||
boolean contains = false;
|
||||
for(String wc : WILDCARD_STRINGS) {
|
||||
if(s.endsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(0, s.length() - wc.length());
|
||||
}
|
||||
else if(s.startsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(wc.length());
|
||||
}
|
||||
boolean contains = false;
|
||||
for (String wc : WILDCARD_STRINGS) {
|
||||
if (s.endsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(0, s.length() - wc.length());
|
||||
} else if (s.startsWith(wc)) {
|
||||
contains = true;
|
||||
s = s.substring(wc.length());
|
||||
}
|
||||
|
||||
if(contains)
|
||||
break;
|
||||
}
|
||||
if (contains) break;
|
||||
}
|
||||
|
||||
String name = stripControlCodes(stack.getDisplayName().toLowerCase().trim());
|
||||
return equalOrContain(name, s, contains)
|
||||
|| equalOrContain(name + "s", s, contains)
|
||||
|| equalOrContain(name + "es", s, contains)
|
||||
|| name.endsWith("y") && equalOrContain(name.substring(0, name.length() - 1) + "ies", s, contains);
|
||||
}
|
||||
|
||||
String name = stripControlCodes(stack.getDisplayName().toLowerCase().trim());
|
||||
return equalOrContain(name, s, contains) || equalOrContain(name + "s", s, contains) || equalOrContain(name + "es", s, contains) || name.endsWith("y") && equalOrContain(name.substring(0, name.length() - 1) + "ies", s, contains);
|
||||
}
|
||||
/**
|
||||
* Clears the cached networks, called once per tick, should not be called outside
|
||||
* of the botania code.
|
||||
*/
|
||||
public static void clearCache() {
|
||||
cachedNetworks.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the cached networks, called once per tick, should not be called outside
|
||||
* of the botania code.
|
||||
*/
|
||||
public static void clearCache() {
|
||||
cachedNetworks.clear();
|
||||
}
|
||||
/**
|
||||
* Helper method to check if an int array contains an int.
|
||||
*/
|
||||
public static boolean arrayHas(int[] arr, int val) {
|
||||
for (int element : arr) if (element == val) return true;
|
||||
|
||||
/**
|
||||
* Helper method to check if an int array contains an int.
|
||||
*/
|
||||
public static boolean arrayHas(int[] arr, int val) {
|
||||
for (int element : arr)
|
||||
if(element == val)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Helper method to make stacksMatch() less messy.
|
||||
*/
|
||||
public static boolean equalOrContain(String s1, String s2, boolean contain) {
|
||||
return contain ? s1.contains(s2) : s1.equals(s2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to make stacksMatch() less messy.
|
||||
*/
|
||||
public static boolean equalOrContain(String s1, String s2, boolean contain) {
|
||||
return contain ? s1.contains(s2) : s1.equals(s2);
|
||||
}
|
||||
/**
|
||||
* Registers a ICorporeaAutoCompleteController
|
||||
*/
|
||||
public static void registerAutoCompleteController(ICorporeaAutoCompleteController controller) {
|
||||
autoCompleteControllers.add(controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a ICorporeaAutoCompleteController
|
||||
*/
|
||||
public static void registerAutoCompleteController(ICorporeaAutoCompleteController controller) {
|
||||
autoCompleteControllers.add(controller);
|
||||
}
|
||||
/**
|
||||
* Returns if the auto complete helper should run
|
||||
*/
|
||||
public static boolean shouldAutoComplete() {
|
||||
for (ICorporeaAutoCompleteController controller : autoCompleteControllers)
|
||||
if (controller.shouldAutoComplete()) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the auto complete helper should run
|
||||
*/
|
||||
public static boolean shouldAutoComplete() {
|
||||
for(ICorporeaAutoCompleteController controller : autoCompleteControllers)
|
||||
if(controller.shouldAutoComplete())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Copy from StringUtils
|
||||
public static String stripControlCodes(String str) {
|
||||
return patternControlCode.matcher(str).replaceAll("");
|
||||
}
|
||||
// Copy from StringUtils
|
||||
public static String stripControlCodes(String str) {
|
||||
return patternControlCode.matcher(str).replaceAll("");
|
||||
}
|
||||
}
|
||||
@@ -2,25 +2,24 @@
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
public class CorporeaRequest {
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
|
||||
super();
|
||||
this.matcher = matcher;
|
||||
this.checkNBT = checkNBT;
|
||||
this.count = count;
|
||||
}
|
||||
public Object matcher;
|
||||
public boolean checkNBT;
|
||||
public int count;
|
||||
public int foundItems = 0;
|
||||
public int extractedItems = 0;
|
||||
|
||||
public CorporeaRequest(Object matcher, boolean checkNBT, int count) {
|
||||
super();
|
||||
this.matcher = matcher;
|
||||
this.checkNBT = checkNBT;
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 30, 2015, 2:55:57 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
@@ -19,22 +19,20 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
@Cancelable
|
||||
public class CorporeaRequestEvent extends Event {
|
||||
|
||||
public final Object request;
|
||||
public final int count;
|
||||
public final ICorporeaSpark spark;
|
||||
public final boolean checkNBT;
|
||||
/**
|
||||
* If false then items won't be pulled.
|
||||
*/
|
||||
public final boolean realRequest;
|
||||
|
||||
public CorporeaRequestEvent(Object request, int count, ICorporeaSpark spark, boolean nbt, boolean real) {
|
||||
this.request = request;
|
||||
this.count = count;
|
||||
this.spark = spark;
|
||||
checkNBT = nbt;
|
||||
realRequest = real;
|
||||
}
|
||||
|
||||
public final Object request;
|
||||
public final int count;
|
||||
public final ICorporeaSpark spark;
|
||||
public final boolean checkNBT;
|
||||
/**
|
||||
* If false then items won't be pulled.
|
||||
*/
|
||||
public final boolean realRequest;
|
||||
|
||||
public CorporeaRequestEvent(Object request, int count, ICorporeaSpark spark, boolean nbt, boolean real) {
|
||||
this.request = request;
|
||||
this.count = count;
|
||||
this.spark = spark;
|
||||
checkNBT = nbt;
|
||||
realRequest = real;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <SoundLogic>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [June 8, 2015, 1:04:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
@@ -18,10 +18,9 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface ICorporeaAutoCompleteController {
|
||||
|
||||
/**
|
||||
* Return true if auto completion should be enabled.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldAutoComplete();
|
||||
|
||||
/**
|
||||
* Return true if auto completion should be enabled.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldAutoComplete();
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 19, 2015, 6:23:31 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -21,18 +20,31 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICorporeaInterceptor {
|
||||
|
||||
/**
|
||||
* Intercepts a request as it goes. The list of inventories has all the inventories
|
||||
* at this point, but the list of stacks is not complete. The request parameter can
|
||||
* be either a String or ItemStack.
|
||||
*/
|
||||
public void interceptRequest(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source, List<ItemStack> stacks, List<IInventory> inventories, boolean doit);
|
||||
|
||||
/**
|
||||
* Intercepts a request after all the stacks have been found and processed. Both the
|
||||
* list of inventories and stacks is complete at this point. The request parameter can
|
||||
* be either a String or ItemStack.
|
||||
*/
|
||||
public void interceptRequestLast(Object request, int count, ICorporeaSpark spark, ICorporeaSpark source, List<ItemStack> stacks, List<IInventory> inventories, boolean doit);
|
||||
/**
|
||||
* Intercepts a request as it goes. The list of inventories has all the inventories
|
||||
* at this point, but the list of stacks is not complete. The request parameter can
|
||||
* be either a String or ItemStack.
|
||||
*/
|
||||
public void interceptRequest(
|
||||
Object request,
|
||||
int count,
|
||||
ICorporeaSpark spark,
|
||||
ICorporeaSpark source,
|
||||
List<ItemStack> stacks,
|
||||
List<IInventory> inventories,
|
||||
boolean doit);
|
||||
|
||||
/**
|
||||
* Intercepts a request after all the stacks have been found and processed. Both the
|
||||
* list of inventories and stacks is complete at this point. The request parameter can
|
||||
* be either a String or ItemStack.
|
||||
*/
|
||||
public void interceptRequestLast(
|
||||
Object request,
|
||||
int count,
|
||||
ICorporeaSpark spark,
|
||||
ICorporeaSpark source,
|
||||
List<ItemStack> stacks,
|
||||
List<IInventory> inventories,
|
||||
boolean doit);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Sep 28, 2015, 11:25:48 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
@@ -17,9 +17,8 @@ package vazkii.botania.api.corporea;
|
||||
*/
|
||||
public interface ICorporeaRequestor {
|
||||
|
||||
/*
|
||||
* Executes the passed in request.
|
||||
*/
|
||||
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark);
|
||||
|
||||
/*
|
||||
* Executes the passed in request.
|
||||
*/
|
||||
public void doCorporeaRequest(Object request, int count, ICorporeaSpark spark);
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 13, 2015, 10:53:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -21,67 +20,66 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICorporeaSpark {
|
||||
|
||||
/**
|
||||
* Called to register the connections for the spark network passed in. Parameters include the master spark,
|
||||
* which is the one that initiated the chain call, the referrer which passed the call to this instance
|
||||
* and the List of sparks connected. Normal behavior should be to find any sparks around that are not
|
||||
* already present in the list of connections and add them to it, passing the function call to them.
|
||||
* <br><br>
|
||||
* The connections List and the master Spark should be kept in this instance as pointers for use in
|
||||
* getConnections() and getMaster() and passed in to any subsequent registerConnections calls on sparks
|
||||
* found nearby. This is only called whenever a new spark is added or removed from and to the network,
|
||||
* at that point the connection list in the master spark would be cleared out, also clearing out the one
|
||||
* in this instance, as it should be a pointer.
|
||||
*/
|
||||
public void registerConnections(ICorporeaSpark master, ICorporeaSpark referrer, List<ICorporeaSpark> connections);
|
||||
/**
|
||||
* Called to register the connections for the spark network passed in. Parameters include the master spark,
|
||||
* which is the one that initiated the chain call, the referrer which passed the call to this instance
|
||||
* and the List of sparks connected. Normal behavior should be to find any sparks around that are not
|
||||
* already present in the list of connections and add them to it, passing the function call to them.
|
||||
* <br><br>
|
||||
* The connections List and the master Spark should be kept in this instance as pointers for use in
|
||||
* getConnections() and getMaster() and passed in to any subsequent registerConnections calls on sparks
|
||||
* found nearby. This is only called whenever a new spark is added or removed from and to the network,
|
||||
* at that point the connection list in the master spark would be cleared out, also clearing out the one
|
||||
* in this instance, as it should be a pointer.
|
||||
*/
|
||||
public void registerConnections(ICorporeaSpark master, ICorporeaSpark referrer, List<ICorporeaSpark> connections);
|
||||
|
||||
/**
|
||||
* Gets the inventory this spark is bound to, generally the one right below it.
|
||||
*/
|
||||
public IInventory getInventory();
|
||||
/**
|
||||
* Gets the inventory this spark is bound to, generally the one right below it.
|
||||
*/
|
||||
public IInventory getInventory();
|
||||
|
||||
/**
|
||||
* Gets the list of sparks this spark is connected to, see registerConnections(). This list
|
||||
* should also include itself. This list must be checked against on a regular basis to verify
|
||||
* that the spark is still in the network, if that's not the case, the pointer should be
|
||||
* eliminated.
|
||||
*/
|
||||
public List<ICorporeaSpark> getConnections();
|
||||
/**
|
||||
* Gets the list of sparks this spark is connected to, see registerConnections(). This list
|
||||
* should also include itself. This list must be checked against on a regular basis to verify
|
||||
* that the spark is still in the network, if that's not the case, the pointer should be
|
||||
* eliminated.
|
||||
*/
|
||||
public List<ICorporeaSpark> getConnections();
|
||||
|
||||
/**
|
||||
* Gets the list of sparks that this spark added to the list of connections during registerConnections(), this
|
||||
* is mainly used to create a non messy chain of particles to display the network when a spark is right
|
||||
* clicked with a wand.
|
||||
*/
|
||||
public List<ICorporeaSpark> getRelatives();
|
||||
/**
|
||||
* Gets the list of sparks that this spark added to the list of connections during registerConnections(), this
|
||||
* is mainly used to create a non messy chain of particles to display the network when a spark is right
|
||||
* clicked with a wand.
|
||||
*/
|
||||
public List<ICorporeaSpark> getRelatives();
|
||||
|
||||
/**
|
||||
* Gets the master spark in this network, see registerConnections(). The value this returns
|
||||
* should be null and the pointer should be eliminated if the spark is no longer present
|
||||
* in the network.
|
||||
*/
|
||||
public ICorporeaSpark getMaster();
|
||||
/**
|
||||
* Gets the master spark in this network, see registerConnections(). The value this returns
|
||||
* should be null and the pointer should be eliminated if the spark is no longer present
|
||||
* in the network.
|
||||
*/
|
||||
public ICorporeaSpark getMaster();
|
||||
|
||||
/**
|
||||
* Called when an item is extracted from the inventory this spark is attached to through this
|
||||
* spark.
|
||||
*/
|
||||
public void onItemExtracted(ItemStack stack);
|
||||
/**
|
||||
* Called when an item is extracted from the inventory this spark is attached to through this
|
||||
* spark.
|
||||
*/
|
||||
public void onItemExtracted(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Called when this spark requests items, passes in the result of the request and not the actual requested stack(s).
|
||||
*/
|
||||
public void onItemsRequested(List<ItemStack> stacks);
|
||||
/**
|
||||
* Called when this spark requests items, passes in the result of the request and not the actual requested stack(s).
|
||||
*/
|
||||
public void onItemsRequested(List<ItemStack> stacks);
|
||||
|
||||
/**
|
||||
* Gets if this spark is considered a master spark.
|
||||
*/
|
||||
public boolean isMaster();
|
||||
|
||||
/**
|
||||
* Gets the network that this spark is on, or the color it's displaying. Sparks may only connect to others
|
||||
* of the same network, and on changing network should trigger a re-cache of the previous network.
|
||||
*/
|
||||
public int getNetwork();
|
||||
/**
|
||||
* Gets if this spark is considered a master spark.
|
||||
*/
|
||||
public boolean isMaster();
|
||||
|
||||
/**
|
||||
* Gets the network that this spark is on, or the color it's displaying. Sparks may only connect to others
|
||||
* of the same network, and on changing network should trigger a re-cache of the previous network.
|
||||
*/
|
||||
public int getNetwork();
|
||||
}
|
||||
@@ -2,15 +2,14 @@
|
||||
* This class was created by <Vindex>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
*/
|
||||
package vazkii.botania.api.corporea;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -21,37 +20,37 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IWrappedInventory {
|
||||
|
||||
/**
|
||||
* Break encapsulation and exposes original inventory.
|
||||
*/
|
||||
IInventory getWrappedObject();
|
||||
/**
|
||||
* Break encapsulation and exposes original inventory.
|
||||
*/
|
||||
IInventory getWrappedObject();
|
||||
|
||||
/**
|
||||
* Counts items in the inventory matching the request
|
||||
*
|
||||
* @param request
|
||||
* - specifies what should be found
|
||||
* @return List of ItemStack, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts. To get final count requestor
|
||||
* should sum stackSize of all stacks.
|
||||
*/
|
||||
List<ItemStack> countItems(CorporeaRequest request);
|
||||
/**
|
||||
* Counts items in the inventory matching the request
|
||||
*
|
||||
* @param request
|
||||
* - specifies what should be found
|
||||
* @return List of ItemStack, individual stacks may exceed maxStackSize for
|
||||
* purposes of counting huge amounts. To get final count requestor
|
||||
* should sum stackSize of all stacks.
|
||||
*/
|
||||
List<ItemStack> countItems(CorporeaRequest request);
|
||||
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
/**
|
||||
* Convenience method for accessing spark over inventory
|
||||
*/
|
||||
ICorporeaSpark getSpark();
|
||||
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@link CorporeaRequest#foundItems} and
|
||||
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
|
||||
* items were found and extracted.
|
||||
*
|
||||
* @param request
|
||||
* @return List of ItemStacks to be delivered to the destination.
|
||||
*/
|
||||
List<ItemStack> extractItems(CorporeaRequest request);
|
||||
/**
|
||||
* Extracts items matching request from the inventory.<br/>
|
||||
* {@link CorporeaRequest#count} is updated to reflect how many items are
|
||||
* yet to be extracted.<br/>
|
||||
* {@link CorporeaRequest#foundItems} and
|
||||
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
|
||||
* items were found and extracted.
|
||||
*
|
||||
* @param request
|
||||
* @return List of ItemStacks to be delivered to the destination.
|
||||
*/
|
||||
List<ItemStack> extractItems(CorporeaRequest request);
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 7, 2014, 3:47:43 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
@@ -20,31 +19,30 @@ import vazkii.botania.api.mana.TileSignature;
|
||||
|
||||
public class DummyManaNetwork implements IManaNetwork {
|
||||
|
||||
public static final DummyManaNetwork instance = new DummyManaNetwork();
|
||||
public static final DummyManaNetwork instance = new DummyManaNetwork();
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void clear() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllCollectorsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllPoolsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
@Override
|
||||
public List<TileSignature> getAllCollectorsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllPoolsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:43:03 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -38,198 +37,204 @@ import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@Override
|
||||
public LexiconPage textPage(String key) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage textPage(String key) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage elfPaperTextPage(String key) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage elfPaperTextPage(String key) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage imagePage(String key, String resource) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage imagePage(String key, String resource) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage craftingRecipePage(String key, IRecipe recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage craftingRecipePage(String key, IRecipe recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage petalRecipePage(String key, RecipePetals recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage petalRecipePage(String key, RecipePetals recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LexiconPage multiblockPage(String key, MultiblockSet mb) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
@Override
|
||||
public LexiconPage multiblockPage(String key, MultiblockSet mb) {
|
||||
return dummyPage(key);
|
||||
}
|
||||
|
||||
private LexiconPage dummyPage(String key) {
|
||||
return new DummyPage(key);
|
||||
}
|
||||
private LexiconPage dummyPage(String key) {
|
||||
return new DummyPage(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSubTileAsStack(String subTile) {
|
||||
return new ItemStack(Blocks.stone, 0, 0);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getSubTileAsStack(String subTile) {
|
||||
return new ItemStack(Blocks.stone, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getSubTileAsFloatingFlowerStack(String subTile) {
|
||||
return getSubTileAsStack(subTile);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getSubTileAsFloatingFlowerStack(String subTile) {
|
||||
return getSubTileAsStack(subTile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStackSubTileKey(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public String getStackSubTileKey(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getSubTileIconForName(String name) {
|
||||
return Blocks.red_flower.getIcon(0, 0);
|
||||
}
|
||||
@Override
|
||||
public IIcon getSubTileIconForName(String name) {
|
||||
return Blocks.red_flower.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return DummyManaNetwork.instance;
|
||||
}
|
||||
@Override
|
||||
public IManaNetwork getManaNetworkInstance() {
|
||||
return DummyManaNetwork.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void drawComplexManaHUD(
|
||||
int color,
|
||||
int mana,
|
||||
int maxMana,
|
||||
String name,
|
||||
ScaledResolution res,
|
||||
ItemStack bindDisplay,
|
||||
boolean properlyBound) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
return new ItemStack(Blocks.stone, 0, 0);
|
||||
}
|
||||
@Override
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e) {
|
||||
return new ItemStack(Blocks.stone, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getBaublesInventory(EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public IInventory getBaublesInventory(EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassiveFlowerDecay() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getPassiveFlowerDecay() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultBossBarTexture() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public ResourceLocation getDefaultBossBarTexture() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBossStatus(IBotaniaBoss status) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void setBossStatus(IBotaniaBoss status) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuildcraftPipe(TileEntity tile) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isBuildcraftPipe(TileEntity tile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side) {
|
||||
// NO-OP
|
||||
}
|
||||
@Override
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean hasSolegnoliaAround(Entity e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getWorldElapsedTicks() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public long getWorldElapsedTicks() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBotaniaFlower(World world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isBotaniaFlower(World world, int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<IInventory> inventories) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWrappedInventory> wrapInventory(List<IInventory> inventories) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,17 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:41:23 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
|
||||
/**
|
||||
* A dummy page. It does absolutely nothing and is only
|
||||
@@ -21,14 +21,13 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public class DummyPage extends LexiconPage {
|
||||
|
||||
public DummyPage(String unlocalizedName) {
|
||||
super(unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {
|
||||
// NO-OP
|
||||
}
|
||||
public DummyPage(String unlocalizedName) {
|
||||
super(unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderScreen(IGuiLexiconEntry gui, int x, int y) {
|
||||
// NO-OP
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,14 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 24, 2014, 4:17:33 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
|
||||
public class DummySubTile extends SubTileEntity {
|
||||
|
||||
}
|
||||
public class DummySubTile extends SubTileEntity {}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:48:41 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
|
||||
@@ -22,60 +21,60 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
*/
|
||||
public interface IGuiLexiconEntry {
|
||||
|
||||
/**
|
||||
* Gets the entry currently portrayed in this gui.
|
||||
*/
|
||||
public LexiconEntry getEntry();
|
||||
/**
|
||||
* Gets the entry currently portrayed in this gui.
|
||||
*/
|
||||
public LexiconEntry getEntry();
|
||||
|
||||
/**
|
||||
* Gets the current page the lexicon GUI is browsing.
|
||||
*/
|
||||
public int getPageOn();
|
||||
/**
|
||||
* Gets the current page the lexicon GUI is browsing.
|
||||
*/
|
||||
public int getPageOn();
|
||||
|
||||
/**
|
||||
* Gets the leftmost part of the GUI.
|
||||
*/
|
||||
public int getLeft();
|
||||
/**
|
||||
* Gets the leftmost part of the GUI.
|
||||
*/
|
||||
public int getLeft();
|
||||
|
||||
/**
|
||||
* Gets the topmost part of the GUI.
|
||||
*/
|
||||
public int getTop();
|
||||
/**
|
||||
* Gets the topmost part of the GUI.
|
||||
*/
|
||||
public int getTop();
|
||||
|
||||
/**
|
||||
* Gets the GUI's width.
|
||||
*/
|
||||
public int getWidth();
|
||||
/**
|
||||
* Gets the GUI's width.
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
/**
|
||||
* Gets the GUI's height
|
||||
*/
|
||||
public int getHeight();
|
||||
/**
|
||||
* Gets the GUI's height
|
||||
*/
|
||||
public int getHeight();
|
||||
|
||||
/**
|
||||
* Gets the GUI's Z level for rendering.
|
||||
*/
|
||||
public float getZLevel();
|
||||
/**
|
||||
* Gets the GUI's Z level for rendering.
|
||||
*/
|
||||
public float getZLevel();
|
||||
|
||||
/**
|
||||
* Gets the list of buttons in this gui.
|
||||
*/
|
||||
public List<GuiButton> getButtonList();
|
||||
/**
|
||||
* Gets the list of buttons in this gui.
|
||||
*/
|
||||
public List<GuiButton> getButtonList();
|
||||
|
||||
/**
|
||||
* Gets the total amount of ticks (+ partial ticks) the player
|
||||
* has been in this gui.
|
||||
*/
|
||||
public float getElapsedTicks();
|
||||
/**
|
||||
* Gets the total amount of ticks (+ partial ticks) the player
|
||||
* has been in this gui.
|
||||
*/
|
||||
public float getElapsedTicks();
|
||||
|
||||
/**
|
||||
* Gets the current partial ticks.
|
||||
*/
|
||||
public float getPartialTicks();
|
||||
/**
|
||||
* Gets the current partial ticks.
|
||||
*/
|
||||
public float getPartialTicks();
|
||||
|
||||
/**
|
||||
* Gets the delta (1F = 1 tick) between this render call
|
||||
* and the last one.
|
||||
*/
|
||||
public float getTickDelta();
|
||||
/**
|
||||
* Gets the delta (1F = 1 tick) between this render call
|
||||
* and the last one.
|
||||
*/
|
||||
public float getTickDelta();
|
||||
}
|
||||
@@ -2,16 +2,17 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:34:34 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -34,8 +35,6 @@ import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Any methods that refer to internal methods in Botania are here.
|
||||
@@ -46,89 +45,95 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface IInternalMethodHandler {
|
||||
|
||||
public LexiconPage textPage(String key);
|
||||
public LexiconPage textPage(String key);
|
||||
|
||||
public LexiconPage elfPaperTextPage(String key);
|
||||
public LexiconPage elfPaperTextPage(String key);
|
||||
|
||||
public LexiconPage imagePage(String key, String resource);
|
||||
public LexiconPage imagePage(String key, String resource);
|
||||
|
||||
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes);
|
||||
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes);
|
||||
|
||||
public LexiconPage craftingRecipePage(String key, IRecipe recipe);
|
||||
public LexiconPage craftingRecipePage(String key, IRecipe recipe);
|
||||
|
||||
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes);
|
||||
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes);
|
||||
|
||||
public LexiconPage petalRecipePage(String key, RecipePetals recipe);
|
||||
public LexiconPage petalRecipePage(String key, RecipePetals recipe);
|
||||
|
||||
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes);
|
||||
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes);
|
||||
|
||||
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe);
|
||||
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe);
|
||||
|
||||
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes);
|
||||
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes);
|
||||
|
||||
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe);
|
||||
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe);
|
||||
|
||||
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes);
|
||||
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes);
|
||||
|
||||
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe);
|
||||
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe);
|
||||
|
||||
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe);
|
||||
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe);
|
||||
|
||||
public LexiconPage multiblockPage(String key, MultiblockSet mb);
|
||||
public LexiconPage multiblockPage(String key, MultiblockSet mb);
|
||||
|
||||
public IManaNetwork getManaNetworkInstance();
|
||||
public IManaNetwork getManaNetworkInstance();
|
||||
|
||||
public ItemStack getSubTileAsStack(String subTile);
|
||||
public ItemStack getSubTileAsStack(String subTile);
|
||||
|
||||
public ItemStack getSubTileAsFloatingFlowerStack(String subTile);
|
||||
public ItemStack getSubTileAsFloatingFlowerStack(String subTile);
|
||||
|
||||
public String getStackSubTileKey(ItemStack stack);
|
||||
public String getStackSubTileKey(ItemStack stack);
|
||||
|
||||
public IIcon getSubTileIconForName(String name);
|
||||
public IIcon getSubTileIconForName(String name);
|
||||
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register);
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register);
|
||||
|
||||
public boolean shouldForceCheck();
|
||||
public boolean shouldForceCheck();
|
||||
|
||||
public int getPassiveFlowerDecay();
|
||||
public int getPassiveFlowerDecay();
|
||||
|
||||
public IInventory getBaublesInventory(EntityPlayer player);
|
||||
public IInventory getBaublesInventory(EntityPlayer player);
|
||||
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side);
|
||||
public void breakOnAllCursors(EntityPlayer player, Item item, ItemStack stack, int x, int y, int z, int side);
|
||||
|
||||
public boolean hasSolegnoliaAround(Entity e);
|
||||
public boolean hasSolegnoliaAround(Entity e);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawComplexManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res, ItemStack bindDisplay, boolean properlyBound);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawComplexManaHUD(
|
||||
int color,
|
||||
int mana,
|
||||
int maxMana,
|
||||
String name,
|
||||
ScaledResolution res,
|
||||
ItemStack bindDisplay,
|
||||
boolean properlyBound);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getBindDisplayForFlowerType(SubTileEntity e);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderLexiconText(int x, int y, int width, int height, String unlocalizedText);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getDefaultBossBarTexture();
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getDefaultBossBarTexture();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setBossStatus(IBotaniaBoss status);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setBossStatus(IBotaniaBoss status);
|
||||
|
||||
public boolean isBuildcraftPipe(TileEntity tile);
|
||||
public boolean isBuildcraftPipe(TileEntity tile);
|
||||
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
|
||||
public void sparkleFX(World world, double x, double y, double z, float r, float g, float b, float size, int m);
|
||||
|
||||
public long getWorldElapsedTicks();
|
||||
public long getWorldElapsedTicks();
|
||||
|
||||
public boolean isBotaniaFlower(World world, int x, int y, int z);
|
||||
public boolean isBotaniaFlower(World world, int x, int y, int z);
|
||||
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot);
|
||||
|
||||
/**
|
||||
* Wrap inventories in the network into wrappers providing compatibility for storage mods.
|
||||
*/
|
||||
List<IWrappedInventory> wrapInventory(List<IInventory> inventories);
|
||||
public void sendBaubleUpdatePacket(EntityPlayer player, int slot);
|
||||
|
||||
/**
|
||||
* Wrap inventories in the network into wrappers providing compatibility for storage mods.
|
||||
*/
|
||||
List<IWrappedInventory> wrapInventory(List<IInventory> inventories);
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 31, 2014, 4:36:13 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
@@ -20,54 +19,53 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
*/
|
||||
public interface IManaBurst {
|
||||
|
||||
public boolean isFake();
|
||||
public boolean isFake();
|
||||
|
||||
public void setMotion(double x, double y, double z);
|
||||
public void setMotion(double x, double y, double z);
|
||||
|
||||
public int getColor();
|
||||
public int getColor();
|
||||
|
||||
public void setColor(int color);
|
||||
public void setColor(int color);
|
||||
|
||||
public int getMana();
|
||||
public int getMana();
|
||||
|
||||
public void setMana(int mana);
|
||||
public void setMana(int mana);
|
||||
|
||||
public int getStartingMana();
|
||||
public int getStartingMana();
|
||||
|
||||
public void setStartingMana(int mana);
|
||||
public void setStartingMana(int mana);
|
||||
|
||||
public int getMinManaLoss();
|
||||
public int getMinManaLoss();
|
||||
|
||||
public void setMinManaLoss(int minManaLoss);
|
||||
public void setMinManaLoss(int minManaLoss);
|
||||
|
||||
public float getManaLossPerTick();
|
||||
public float getManaLossPerTick();
|
||||
|
||||
public void setManaLossPerTick(float mana);
|
||||
public void setManaLossPerTick(float mana);
|
||||
|
||||
public float getGravity();
|
||||
public float getGravity();
|
||||
|
||||
public void setGravity(float gravity);
|
||||
public void setGravity(float gravity);
|
||||
|
||||
public ChunkCoordinates getBurstSourceChunkCoordinates();
|
||||
public ChunkCoordinates getBurstSourceChunkCoordinates();
|
||||
|
||||
public void setBurstSourceCoords(int x, int y, int z);
|
||||
public void setBurstSourceCoords(int x, int y, int z);
|
||||
|
||||
public ItemStack getSourceLens();
|
||||
public ItemStack getSourceLens();
|
||||
|
||||
public void setSourceLens(ItemStack lens);
|
||||
public void setSourceLens(ItemStack lens);
|
||||
|
||||
public boolean hasAlreadyCollidedAt(int x, int y, int z);
|
||||
public boolean hasAlreadyCollidedAt(int x, int y, int z);
|
||||
|
||||
public void setCollidedAt(int x, int y, int z);
|
||||
public void setCollidedAt(int x, int y, int z);
|
||||
|
||||
public int getTicksExisted();
|
||||
public int getTicksExisted();
|
||||
|
||||
public void setFake(boolean fake);
|
||||
public void setFake(boolean fake);
|
||||
|
||||
public void setShooterUUID(UUID uuid);
|
||||
public void setShooterUUID(UUID uuid);
|
||||
|
||||
public UUID getShooterUIID();
|
||||
|
||||
public void ping();
|
||||
public UUID getShooterUIID();
|
||||
|
||||
public void ping();
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 7, 2014, 3:39:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
@@ -23,45 +22,45 @@ import vazkii.botania.api.mana.TileSignature;
|
||||
*/
|
||||
public interface IManaNetwork {
|
||||
|
||||
/**
|
||||
* Clears the entire Mana Network of all it's contents, you probably
|
||||
* don't want to call this unless you have a very good reason.
|
||||
*/
|
||||
public void clear();
|
||||
/**
|
||||
* Clears the entire Mana Network of all it's contents, you probably
|
||||
* don't want to call this unless you have a very good reason.
|
||||
*/
|
||||
public void clear();
|
||||
|
||||
/**
|
||||
* Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk
|
||||
* Coordinates passed in, in the given dimension.<br>
|
||||
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
|
||||
* Note that this function *can* get performance intensive, it's reccomended you
|
||||
* call it sparingly and take cache of the value returned.
|
||||
* @param limit The maximum distance the closest block can be, if the closest block
|
||||
* is farther away than that, null will be returned instead.
|
||||
*/
|
||||
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit);
|
||||
/**
|
||||
* Gets the closest Mana Collector (eg. Mana Spreader) in the network to the Chunk
|
||||
* Coordinates passed in, in the given dimension.<br>
|
||||
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
|
||||
* Note that this function *can* get performance intensive, it's reccomended you
|
||||
* call it sparingly and take cache of the value returned.
|
||||
* @param limit The maximum distance the closest block can be, if the closest block
|
||||
* is farther away than that, null will be returned instead.
|
||||
*/
|
||||
public TileEntity getClosestCollector(ChunkCoordinates pos, World world, int limit);
|
||||
|
||||
/**
|
||||
* Gets the closest Mana Pool in the network to the Chunk Coordinates passed in,
|
||||
* in the given dimension.<br>
|
||||
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
|
||||
* Note that this function *can* get performance intensive, it's reccomended you
|
||||
* call it sparingly and take cache of the value returned.
|
||||
* @param limit The maximum distance the closest block can be, if the closest block
|
||||
* is farther away than that, null will be returned instead.
|
||||
*/
|
||||
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit);
|
||||
/**
|
||||
* Gets the closest Mana Pool in the network to the Chunk Coordinates passed in,
|
||||
* in the given dimension.<br>
|
||||
* A way of getting the dimension is via worldObj.provider.dimensionId<br>
|
||||
* Note that this function *can* get performance intensive, it's reccomended you
|
||||
* call it sparingly and take cache of the value returned.
|
||||
* @param limit The maximum distance the closest block can be, if the closest block
|
||||
* is farther away than that, null will be returned instead.
|
||||
*/
|
||||
public TileEntity getClosestPool(ChunkCoordinates pos, World world, int limit);
|
||||
|
||||
/**
|
||||
* Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension
|
||||
* passed in. Note that this is the actual list and not a copy, make sure to
|
||||
* clone the list if you intend to change it in any way.
|
||||
*/
|
||||
public List<TileSignature> getAllCollectorsInWorld(World world);
|
||||
/**
|
||||
* Gets the list of all Mana Collectors (eg. Mana Spreader) in the dimension
|
||||
* passed in. Note that this is the actual list and not a copy, make sure to
|
||||
* clone the list if you intend to change it in any way.
|
||||
*/
|
||||
public List<TileSignature> getAllCollectorsInWorld(World world);
|
||||
|
||||
/**
|
||||
* Gets the list of all Mana Pools in the dimension passed in. Note that this
|
||||
* is the actual list and not a copy, make sure to clone the list if you intend
|
||||
* to change it in any way.
|
||||
*/
|
||||
public List<TileSignature> getAllPoolsInWorld(World world);
|
||||
/**
|
||||
* Gets the list of all Mana Pools in the dimension passed in. Note that this
|
||||
* is the actual list and not a copy, make sure to clone the list if you intend
|
||||
* to change it in any way.
|
||||
*/
|
||||
public List<TileSignature> getAllPoolsInWorld(World world);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:31:35 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
@@ -15,6 +15,5 @@ package vazkii.botania.api.internal;
|
||||
*/
|
||||
public abstract class ShaderCallback {
|
||||
|
||||
public abstract void call(int shader);
|
||||
|
||||
public abstract void call(int shader);
|
||||
}
|
||||
@@ -2,41 +2,38 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 9, 2015, 9:38:44 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
World world = tile.getWorldObj();
|
||||
List players = world.playerEntities;
|
||||
for(Object player : players)
|
||||
if(player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP mp = (EntityPlayerMP) player;
|
||||
if(pointDistancePlane(mp.posX, mp.posZ, tile.xCoord + 0.5, tile.zCoord + 0.5) < 64)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(tile.getDescriptionPacket());
|
||||
}
|
||||
}
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
World world = tile.getWorldObj();
|
||||
List players = world.playerEntities;
|
||||
for (Object player : players)
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP mp = (EntityPlayerMP) player;
|
||||
if (pointDistancePlane(mp.posX, mp.posZ, tile.xCoord + 0.5, tile.zCoord + 0.5) < 64)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(tile.getDescriptionPacket());
|
||||
}
|
||||
}
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if(tile != null)
|
||||
dispatchTEToNearbyPlayers(tile);
|
||||
}
|
||||
|
||||
public static float pointDistancePlane(double x1, double y1, double x2, double y2) {
|
||||
return (float) Math.hypot(x1 - x2, y1 - y2);
|
||||
}
|
||||
public static void dispatchTEToNearbyPlayers(World world, int x, int y, int z) {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
if (tile != null) dispatchTEToNearbyPlayers(tile);
|
||||
}
|
||||
|
||||
public static float pointDistancePlane(double x1, double y1, double x2, double y2) {
|
||||
return (float) Math.hypot(x1 - x2, y1 - y2);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 30, 2015, 11:24:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -18,8 +18,7 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IAncientWillContainer {
|
||||
|
||||
public void addAncientWill(ItemStack stack, int will);
|
||||
|
||||
public boolean hasAncientWill(ItemStack stack, int will);
|
||||
public void addAncientWill(ItemStack stack, int will);
|
||||
|
||||
public boolean hasAncientWill(ItemStack stack, int will);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 24, 2015, 7:00:21 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -18,15 +18,14 @@ import vazkii.botania.api.mana.IManaReceiver;
|
||||
*/
|
||||
public interface IAvatarTile extends IInventory, IManaReceiver {
|
||||
|
||||
/**
|
||||
* Gets the amount of ticks that have elapsed on this avatar while it's functional
|
||||
* (has redstone signal).
|
||||
*/
|
||||
public int getElapsedFunctionalTicks();
|
||||
|
||||
/**
|
||||
* Gets if this avatar is enabled (isn't powered by a redstone signal).
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
/**
|
||||
* Gets the amount of ticks that have elapsed on this avatar while it's functional
|
||||
* (has redstone signal).
|
||||
*/
|
||||
public int getElapsedFunctionalTicks();
|
||||
|
||||
/**
|
||||
* Gets if this avatar is enabled (isn't powered by a redstone signal).
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 24, 2015, 6:45:50 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -18,14 +18,13 @@ import net.minecraft.util.ResourceLocation;
|
||||
*/
|
||||
public interface IAvatarWieldable {
|
||||
|
||||
/**
|
||||
* Called on update of the avatar tile.
|
||||
*/
|
||||
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the overlay resource to render on top of the avatar tile.
|
||||
*/
|
||||
public ResourceLocation getOverlayResource(IAvatarTile tile, ItemStack stack);
|
||||
/**
|
||||
* Called on update of the avatar tile.
|
||||
*/
|
||||
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the overlay resource to render on top of the avatar tile.
|
||||
*/
|
||||
public ResourceLocation getOverlayResource(IAvatarTile tile, ItemStack stack);
|
||||
}
|
||||
@@ -2,24 +2,22 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Dec 4, 2014, 3:28:43 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A Bauble Item that implements this will be have hooks to render something on
|
||||
* the player while its equipped.
|
||||
@@ -28,50 +26,52 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface IBaubleRender {
|
||||
|
||||
/**
|
||||
* Called for the rendering of the bauble on the player. The player instance can be
|
||||
* acquired through the event parameter. Transformations are already applied for
|
||||
* the RenderType passed in. Make sure to check against the type parameter for
|
||||
* rendering. Will not be called if the item is a ICosmeticAttachable and
|
||||
* has a cosmetic bauble attached to it.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type);
|
||||
/**
|
||||
* Called for the rendering of the bauble on the player. The player instance can be
|
||||
* acquired through the event parameter. Transformations are already applied for
|
||||
* the RenderType passed in. Make sure to check against the type parameter for
|
||||
* rendering. Will not be called if the item is a ICosmeticAttachable and
|
||||
* has a cosmetic bauble attached to it.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerBaubleRender(ItemStack stack, RenderPlayerEvent event, RenderType type);
|
||||
|
||||
/**
|
||||
* A few helper methods for the render.
|
||||
*/
|
||||
public static class Helper {
|
||||
/**
|
||||
* A few helper methods for the render.
|
||||
*/
|
||||
public static class Helper {
|
||||
|
||||
public static void rotateIfSneaking(EntityPlayer player) {
|
||||
if(player.isSneaking())
|
||||
applySneakingRotation();
|
||||
}
|
||||
public static void rotateIfSneaking(EntityPlayer player) {
|
||||
if (player.isSneaking()) applySneakingRotation();
|
||||
}
|
||||
|
||||
public static void applySneakingRotation() {
|
||||
GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
public static void applySneakingRotation() {
|
||||
GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
|
||||
}
|
||||
|
||||
public static void translateToHeadLevel(EntityPlayer player) {
|
||||
GL11.glTranslated(0, (player != Minecraft.getMinecraft().thePlayer ? 1.68F : 0F) - player.getDefaultEyeHeight() + (player.isSneaking() ? 0.0625 : 0), 0);
|
||||
}
|
||||
public static void translateToHeadLevel(EntityPlayer player) {
|
||||
GL11.glTranslated(
|
||||
0,
|
||||
(player != Minecraft.getMinecraft().thePlayer ? 1.68F : 0F)
|
||||
- player.getDefaultEyeHeight()
|
||||
+ (player.isSneaking() ? 0.0625 : 0),
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static enum RenderType {
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's rotation.
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
BODY,
|
||||
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's head rotations.
|
||||
* Sneaking is not handled and should be done during the render.~
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
HEAD;
|
||||
}
|
||||
public static enum RenderType {
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's rotation.
|
||||
* Sneaking is not handled and should be done during the render.
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
BODY,
|
||||
|
||||
/**
|
||||
* Render Type for the player's body, translations apply on the player's head rotations.
|
||||
* Sneaking is not handled and should be done during the render.~
|
||||
* @see IBaubleRender.Helper
|
||||
*/
|
||||
HEAD;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 20, 2015, 10:31:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -21,20 +21,20 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IBlockProvider {
|
||||
|
||||
/**
|
||||
* Provides the requested item. The doit paremeter specifies whether this is
|
||||
* just a test (false) or if the item should actually be removed (true).
|
||||
* If you need to use calls to ManaItemHandler.requestMana[Exact], use
|
||||
* the requestor as the ItemStack passed in.
|
||||
*/
|
||||
public boolean provideBlock(EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta, boolean doit);
|
||||
|
||||
/**
|
||||
* Gets the amount of blocks of the type passed stored in this item. You must
|
||||
* check for the block passed in to not give the counter for a wrong block. Returning
|
||||
* -1 states that the item can provide infinite of the item passed in (for example,
|
||||
* the Rod of the Lands would return -1 if the block is dirt).
|
||||
*/
|
||||
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta);
|
||||
/**
|
||||
* Provides the requested item. The doit paremeter specifies whether this is
|
||||
* just a test (false) or if the item should actually be removed (true).
|
||||
* If you need to use calls to ManaItemHandler.requestMana[Exact], use
|
||||
* the requestor as the ItemStack passed in.
|
||||
*/
|
||||
public boolean provideBlock(
|
||||
EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta, boolean doit);
|
||||
|
||||
/**
|
||||
* Gets the amount of blocks of the type passed stored in this item. You must
|
||||
* check for the block passed in to not give the counter for a wrong block. Returning
|
||||
* -1 states that the item can provide infinite of the item passed in (for example,
|
||||
* the Rod of the Lands would return -1 if the block is dirt).
|
||||
*/
|
||||
public int getBlockCount(EntityPlayer player, ItemStack requestor, ItemStack stack, Block block, int meta);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 24, 2015, 3:08:40 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -15,6 +15,4 @@ package vazkii.botania.api.item;
|
||||
* Having a IBauble of this type equipped on the 0th slot (amulet)
|
||||
* will draw bursts without depth testing and to see sub tile radiuses.
|
||||
*/
|
||||
public interface IBurstViewerBauble {
|
||||
|
||||
}
|
||||
public interface IBurstViewerBauble {}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 22, 2015, 8:31:39 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,14 +20,13 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICosmeticAttachable {
|
||||
|
||||
/**
|
||||
* Gets the cosmetic item stored in the stack passed in.
|
||||
*/
|
||||
public ItemStack getCosmeticItem(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the stack's cosmetic item to the one passed in.
|
||||
*/
|
||||
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic);
|
||||
/**
|
||||
* Gets the cosmetic item stored in the stack passed in.
|
||||
*/
|
||||
public ItemStack getCosmeticItem(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the stack's cosmetic item to the one passed in.
|
||||
*/
|
||||
public void setCosmeticItem(ItemStack stack, ItemStack cosmetic);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 22, 2015, 2:02:02 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -15,6 +15,4 @@ package vazkii.botania.api.item;
|
||||
* other baubles to add the render to them. Other cosmetic baubles
|
||||
* can't be stacked on this.
|
||||
*/
|
||||
public interface ICosmeticBauble extends IBaubleRender {
|
||||
|
||||
}
|
||||
public interface ICosmeticBauble extends IBaubleRender {}
|
||||
@@ -2,23 +2,20 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 18, 2015, 12:20:44 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
|
||||
/**
|
||||
* Used to define a Mana Pool that can be dyed through floral powder.
|
||||
*/
|
||||
public interface IDyablePool {
|
||||
|
||||
public int getColor();
|
||||
|
||||
public void setColor(int color);
|
||||
|
||||
public int getColor();
|
||||
|
||||
public void setColor(int color);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 30, 2014, 4:28:29 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -15,29 +15,28 @@ package vazkii.botania.api.item;
|
||||
*/
|
||||
public interface IExoflameHeatable {
|
||||
|
||||
/**
|
||||
* Can this TileEntity smelt its contents. If true, the Exoflame is allowed
|
||||
* to fuel it.
|
||||
*/
|
||||
public boolean canSmelt();
|
||||
/**
|
||||
* Can this TileEntity smelt its contents. If true, the Exoflame is allowed
|
||||
* to fuel it.
|
||||
*/
|
||||
public boolean canSmelt();
|
||||
|
||||
/**
|
||||
* Gets the amount of ticks left for the fuel. If below 2, the exoflame
|
||||
* will call boostBurnTime.
|
||||
*/
|
||||
public int getBurnTime();
|
||||
/**
|
||||
* Gets the amount of ticks left for the fuel. If below 2, the exoflame
|
||||
* will call boostBurnTime.
|
||||
*/
|
||||
public int getBurnTime();
|
||||
|
||||
/**
|
||||
* Called to increase the amount of time this furnace should be burning
|
||||
* the fuel for. Even if it doesn't have any fuel.
|
||||
*/
|
||||
public void boostBurnTime();
|
||||
|
||||
/**
|
||||
* Called once every two ticks to increase the speed of the furnace. Feel
|
||||
* free to not do anything if all you want is to allow the exoflame to feed
|
||||
* it, not make it faster.
|
||||
*/
|
||||
public void boostCookTime();
|
||||
/**
|
||||
* Called to increase the amount of time this furnace should be burning
|
||||
* the fuel for. Even if it doesn't have any fuel.
|
||||
*/
|
||||
public void boostBurnTime();
|
||||
|
||||
/**
|
||||
* Called once every two ticks to increase the speed of the furnace. Feel
|
||||
* free to not do anything if all you want is to allow the exoflame to feed
|
||||
* it, not make it faster.
|
||||
*/
|
||||
public void boostCookTime();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 6, 2014, 6:02:29 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -16,13 +16,13 @@ package vazkii.botania.api.item;
|
||||
*/
|
||||
public interface IExtendedPlayerController {
|
||||
|
||||
/**
|
||||
* Sets the extra reach the player should have.
|
||||
*/
|
||||
public void setReachDistanceExtension(float f);
|
||||
/**
|
||||
* Sets the extra reach the player should have.
|
||||
*/
|
||||
public void setReachDistanceExtension(float f);
|
||||
|
||||
/**
|
||||
* Gets the current reach extension.
|
||||
*/
|
||||
public float getReachDistanceExtension();
|
||||
/**
|
||||
* Gets the current reach extension.
|
||||
*/
|
||||
public float getReachDistanceExtension();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 30, 2015, 1:43:17 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,9 +20,8 @@ import net.minecraft.util.ChunkCoordinates;
|
||||
*/
|
||||
public interface IExtendedWireframeCoordinateListProvider extends IWireframeCoordinateListProvider {
|
||||
|
||||
/**
|
||||
* Gets the source wireframe to draw, this one will be drawn thicker.
|
||||
*/
|
||||
public ChunkCoordinates getSourceWireframe(EntityPlayer player, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the source wireframe to draw, this one will be drawn thicker.
|
||||
*/
|
||||
public ChunkCoordinates getSourceWireframe(EntityPlayer player, ItemStack stack);
|
||||
}
|
||||
@@ -2,13 +2,14 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [17/11/2015, 20:10:53 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.subtile.SubTileEntity;
|
||||
@@ -18,10 +19,10 @@ import vazkii.botania.api.subtile.SubTileEntity;
|
||||
*/
|
||||
public interface IFlowerPlaceable {
|
||||
|
||||
/**
|
||||
* Gets the block to be placed, return null to not place anything.
|
||||
*/
|
||||
public Block getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
/**
|
||||
* Gets the block to be placed, return null to not place anything.
|
||||
*/
|
||||
public Block getBlockToPlaceByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
|
||||
public void onBlockPlacedByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
public void onBlockPlacedByFlower(ItemStack stack, SubTileEntity flower, int x, int y, int z);
|
||||
}
|
||||
@@ -9,13 +9,15 @@
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A BiomeGenBase that implements this will not have Botania flowers generated.
|
||||
*/
|
||||
public interface IFlowerlessBiome {
|
||||
/**
|
||||
* @return Should this world be allowed to generate flowers?
|
||||
*/
|
||||
public boolean canGenerateFlowers(World world, int x, int z);
|
||||
}
|
||||
/**
|
||||
* @return Should this world be allowed to generate flowers?
|
||||
*/
|
||||
public boolean canGenerateFlowers(World world, int x, int z);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <TheLoneDevil>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -17,8 +17,8 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IFlowerlessWorld {
|
||||
|
||||
/**
|
||||
* @return Should this world be allowed to generate flowers?
|
||||
*/
|
||||
public boolean generateFlowers(World world);
|
||||
/**
|
||||
* @return Should this world be allowed to generate flowers?
|
||||
*/
|
||||
public boolean generateFlowers(World world);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 4:52:04 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,6 +20,5 @@ import net.minecraft.world.World;
|
||||
@Deprecated
|
||||
public interface IGrassHornExcempt {
|
||||
|
||||
public boolean canUproot(World world, int x, int y, int z);
|
||||
|
||||
public boolean canUproot(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 24, 2015, 11:16:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -18,47 +18,45 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IHornHarvestable {
|
||||
|
||||
/**
|
||||
* Returns true if this block can be uprooted.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public boolean canHornHarvest(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
/**
|
||||
* Returns true if this block can be uprooted.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public boolean canHornHarvest(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
|
||||
/**
|
||||
* Returns true if harvestByHorn() should be called. If false it just uses the normal
|
||||
* block breaking method.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public boolean hasSpecialHornHarvest(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
/**
|
||||
* Returns true if harvestByHorn() should be called. If false it just uses the normal
|
||||
* block breaking method.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public boolean hasSpecialHornHarvest(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
|
||||
/**
|
||||
* Called to harvest by a horn.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public void harvestByHorn(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
/**
|
||||
* Called to harvest by a horn.
|
||||
* Note that the stack param can be null if it's a drum breaking it.
|
||||
*/
|
||||
public void harvestByHorn(World world, int x, int y, int z, ItemStack stack, EnumHornType hornType);
|
||||
|
||||
public static enum EnumHornType {
|
||||
public static enum EnumHornType {
|
||||
|
||||
/**
|
||||
* Horn of the Wild, for grass and crops
|
||||
*/
|
||||
WILD,
|
||||
/**
|
||||
* Horn of the Wild, for grass and crops
|
||||
*/
|
||||
WILD,
|
||||
|
||||
/**
|
||||
* Horn of the Canopy, for leaves
|
||||
*/
|
||||
CANOPY,
|
||||
/**
|
||||
* Horn of the Canopy, for leaves
|
||||
*/
|
||||
CANOPY,
|
||||
|
||||
/**
|
||||
* Horn of the Covering, for snow
|
||||
*/
|
||||
COVERING;
|
||||
|
||||
public static EnumHornType getTypeForMeta(int meta) {
|
||||
EnumHornType[] values = EnumHornType.values();
|
||||
return values[Math.min(values.length - 1, meta)];
|
||||
}
|
||||
|
||||
};
|
||||
/**
|
||||
* Horn of the Covering, for snow
|
||||
*/
|
||||
COVERING;
|
||||
|
||||
public static EnumHornType getTypeForMeta(int meta) {
|
||||
EnumHornType[] values = EnumHornType.values();
|
||||
return values[Math.min(values.length - 1, meta)];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 18, 2015, 12:10:00 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,10 +20,9 @@ import vazkii.botania.api.mana.IManaPool;
|
||||
*/
|
||||
public interface IManaDissolvable {
|
||||
|
||||
/**
|
||||
* Called for every tick the item is on a mana pool. If the stack has stack
|
||||
* size 0 the item is killed. This is called in both the server and client.
|
||||
*/
|
||||
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
|
||||
|
||||
/**
|
||||
* Called for every tick the item is on a mana pool. If the stack has stack
|
||||
* size 0 the item is killed. This is called in both the server and client.
|
||||
*/
|
||||
public void onDissolveTick(IManaPool pool, ItemStack stack, EntityItem item);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 28, 2015, 9:04:53 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -23,22 +23,20 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IManaProficiencyArmor {
|
||||
|
||||
public boolean shouldGiveProficiency(ItemStack stack, int slot, EntityPlayer player);
|
||||
public boolean shouldGiveProficiency(ItemStack stack, int slot, EntityPlayer player);
|
||||
|
||||
public final static class Helper {
|
||||
|
||||
public static boolean hasProficiency(EntityPlayer player) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
ItemStack armor = player.getCurrentArmor(i);
|
||||
if(armor != null) {
|
||||
Item item = armor.getItem();
|
||||
if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, i, player))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
public static final class Helper {
|
||||
|
||||
public static boolean hasProficiency(EntityPlayer player) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
ItemStack armor = player.getCurrentArmor(i);
|
||||
if (armor != null) {
|
||||
Item item = armor.getItem();
|
||||
if (item instanceof IManaProficiencyArmor
|
||||
&& ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, i, player)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 30, 2014, 4:22:15 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -16,14 +16,13 @@ package vazkii.botania.api.item;
|
||||
*/
|
||||
public interface IPetalApothecary {
|
||||
|
||||
/**
|
||||
* Sets if the the apothecary has water or not.
|
||||
*/
|
||||
public void setWater(boolean water);
|
||||
|
||||
/**
|
||||
* Does the apothecary have water in it?
|
||||
*/
|
||||
public boolean hasWater();
|
||||
/**
|
||||
* Sets if the the apothecary has water or not.
|
||||
*/
|
||||
public void setWater(boolean water);
|
||||
|
||||
/**
|
||||
* Does the apothecary have water in it?
|
||||
*/
|
||||
public boolean hasWater();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 17, 2015, 4:57:44 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -17,8 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IPhantomInkable {
|
||||
|
||||
public boolean hasPhantomInk(ItemStack stack);
|
||||
|
||||
public void setPhantomInk(ItemStack stack, boolean ink);
|
||||
public boolean hasPhantomInk(ItemStack stack);
|
||||
|
||||
public void setPhantomInk(ItemStack stack, boolean ink);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Aug 6, 2014, 6:06:27 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,10 +20,9 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IPixieSpawner {
|
||||
|
||||
/**
|
||||
* The chance this item adds for pixies to be spawned. From 0.0 to 1.0. All values
|
||||
* are put together when calculating.
|
||||
*/
|
||||
public float getPixieChance(ItemStack stack);
|
||||
|
||||
}
|
||||
/**
|
||||
* The chance this item adds for pixies to be spawned. From 0.0 to 1.0. All values
|
||||
* are put together when calculating.
|
||||
*/
|
||||
public float getPixieChance(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 29, 2015, 7:17:41 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -19,24 +19,23 @@ import net.minecraft.stats.Achievement;
|
||||
*/
|
||||
public interface IRelic {
|
||||
|
||||
/**
|
||||
* Binds to the player name passed in.
|
||||
*/
|
||||
public void bindToUsername(String playerName, ItemStack stack);
|
||||
/**
|
||||
* Binds to the player name passed in.
|
||||
*/
|
||||
public void bindToUsername(String playerName, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the username of the person this relic is bound to.
|
||||
*/
|
||||
public String getSoulbindUsername(ItemStack stack);
|
||||
/**
|
||||
* Gets the username of the person this relic is bound to.
|
||||
*/
|
||||
public String getSoulbindUsername(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the achievement that this relic binds to.
|
||||
*/
|
||||
public void setBindAchievement(Achievement achievement);
|
||||
|
||||
/**
|
||||
* Gets the achievement that this relic binds to.
|
||||
*/
|
||||
public Achievement getBindAchievement();
|
||||
/**
|
||||
* Sets the achievement that this relic binds to.
|
||||
*/
|
||||
public void setBindAchievement(Achievement achievement);
|
||||
|
||||
/**
|
||||
* Gets the achievement that this relic binds to.
|
||||
*/
|
||||
public Achievement getBindAchievement();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 30, 2015, 2:46:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -20,8 +20,8 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ISequentialBreaker {
|
||||
|
||||
public void breakOtherBlock(EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side);
|
||||
|
||||
public boolean disposeOfTrashBlocks(ItemStack stack);
|
||||
public void breakOtherBlock(
|
||||
EntityPlayer player, ItemStack stack, int x, int y, int z, int originX, int originY, int originZ, int side);
|
||||
|
||||
public boolean disposeOfTrashBlocks(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Feb 23, 2015, 7:03:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
@@ -18,30 +18,31 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ISortableTool {
|
||||
|
||||
/**
|
||||
* Gets the type of tool that this is. A pick, axe or shovel.
|
||||
*/
|
||||
public ToolType getSortingType(ItemStack stack);
|
||||
/**
|
||||
* Gets the type of tool that this is. A pick, axe or shovel.
|
||||
*/
|
||||
public ToolType getSortingType(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the priority that this tool should have when being sorted. The
|
||||
* tool with the highest priority will be picked. The way this is specified
|
||||
* should be (tool-level) * 100 + (tool-modifier) * 10 + (efficiency-level).
|
||||
* <br><br>
|
||||
* For example, a <b>Manasteel Pickaxe</b> is tool-level 10 and it doesn't have
|
||||
* modifiers. Assuming Efficiency 4, the priority should be 10 * 100 + 4 = <b>1004</b>.
|
||||
* This will rate higher than a similar pickaxe with Efficiency 3.<br>
|
||||
* A <b>Terra Shatterer</b> has a modifier, its rank and is tool-level 20. With Efficiency
|
||||
* 5 and rank B (2) the priority should be 20 * 100 + 2 * 10 + 5 = <b>2025</b>.
|
||||
* <br><br>
|
||||
* All intermediate tool levels are there for other mod tools that wish to occupy the spots inbetween.
|
||||
* Of course, you don't have to always adhere to this. Tools like the <b>Vitreous Pickaxe</b> don't,
|
||||
* that one in particular is priority 0 so it's never picked.
|
||||
*/
|
||||
public int getSortingPriority(ItemStack stack);
|
||||
/**
|
||||
* Gets the priority that this tool should have when being sorted. The
|
||||
* tool with the highest priority will be picked. The way this is specified
|
||||
* should be (tool-level) * 100 + (tool-modifier) * 10 + (efficiency-level).
|
||||
* <br><br>
|
||||
* For example, a <b>Manasteel Pickaxe</b> is tool-level 10 and it doesn't have
|
||||
* modifiers. Assuming Efficiency 4, the priority should be 10 * 100 + 4 = <b>1004</b>.
|
||||
* This will rate higher than a similar pickaxe with Efficiency 3.<br>
|
||||
* A <b>Terra Shatterer</b> has a modifier, its rank and is tool-level 20. With Efficiency
|
||||
* 5 and rank B (2) the priority should be 20 * 100 + 2 * 10 + 5 = <b>2025</b>.
|
||||
* <br><br>
|
||||
* All intermediate tool levels are there for other mod tools that wish to occupy the spots inbetween.
|
||||
* Of course, you don't have to always adhere to this. Tools like the <b>Vitreous Pickaxe</b> don't,
|
||||
* that one in particular is priority 0 so it's never picked.
|
||||
*/
|
||||
public int getSortingPriority(ItemStack stack);
|
||||
|
||||
public static enum ToolType {
|
||||
PICK, AXE, SHOVEL
|
||||
}
|
||||
|
||||
}
|
||||
public static enum ToolType {
|
||||
PICK,
|
||||
AXE,
|
||||
SHOVEL
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,20 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 29, 2015, 11:30:41 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* An item that implements this will allow for various wireframes to be drawn
|
||||
@@ -25,11 +24,10 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public interface IWireframeCoordinateListProvider {
|
||||
|
||||
/**
|
||||
* Returns a list of ChunkCoordinates for the wireframes to draw.
|
||||
* Can be null.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<ChunkCoordinates> getWireframesToDraw(EntityPlayer player, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns a list of ChunkCoordinates for the wireframes to draw.
|
||||
* Can be null.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public List<ChunkCoordinates> getWireframesToDraw(EntityPlayer player, ItemStack stack);
|
||||
}
|
||||
@@ -2,18 +2,18 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 25, 2015, 8:02:41 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* Why would you ever want this ._.
|
||||
@@ -21,18 +21,17 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TinyPotatoRenderEvent extends Event {
|
||||
|
||||
public final TileEntity tile;
|
||||
public final String name;
|
||||
public final double x, y, z;
|
||||
public final float partTicks;
|
||||
|
||||
public TinyPotatoRenderEvent(TileEntity tile, String name, double x, double y, double z, float partTicks) {
|
||||
this.tile = tile;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.partTicks = partTicks;
|
||||
}
|
||||
public final TileEntity tile;
|
||||
public final String name;
|
||||
public final double x, y, z;
|
||||
public final float partTicks;
|
||||
|
||||
public TinyPotatoRenderEvent(TileEntity tile, String name, double x, double y, double z, float partTicks) {
|
||||
this.tile = tile;
|
||||
this.name = name;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.partTicks = partTicks;
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [04/12/2015, 18:29:56 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import java.util.Queue;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import java.util.Queue;
|
||||
|
||||
/**
|
||||
* Fired when the Lexica Botania's tutorial is started. You can add your
|
||||
@@ -20,10 +19,9 @@ import cpw.mods.fml.common.eventhandler.Event;
|
||||
*/
|
||||
public class BotaniaTutorialStartEvent extends Event {
|
||||
|
||||
public final Queue<LexiconEntry> tutorial;
|
||||
|
||||
public BotaniaTutorialStartEvent(Queue<LexiconEntry> tutorial) {
|
||||
this.tutorial = tutorial;
|
||||
}
|
||||
public final Queue<LexiconEntry> tutorial;
|
||||
|
||||
public BotaniaTutorialStartEvent(Queue<LexiconEntry> tutorial) {
|
||||
this.tutorial = tutorial;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 8, 2014, 7:02:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
@@ -19,10 +19,9 @@ package vazkii.botania.api.lexicon;
|
||||
*/
|
||||
public interface IAddonEntry {
|
||||
|
||||
/**
|
||||
* Returns the <b>unlocalized</b> subtitle to show below the title. Here you'd
|
||||
* return something like "(This Entry is provided by the Botanic Tinkerer addon)".
|
||||
*/
|
||||
public String getSubtitle();
|
||||
|
||||
/**
|
||||
* Returns the <b>unlocalized</b> subtitle to show below the title. Here you'd
|
||||
* return something like "(This Entry is provided by the Botanic Tinkerer addon)".
|
||||
*/
|
||||
public String getSubtitle();
|
||||
}
|
||||
@@ -7,15 +7,14 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ILexicon {
|
||||
|
||||
/**
|
||||
* Gets if a specific knowledge is unlocked. Check the knowledge types in
|
||||
* BotaniaAPI.
|
||||
*/
|
||||
public boolean isKnowledgeUnlocked(ItemStack stack, KnowledgeType knowledge);
|
||||
|
||||
/**
|
||||
* Unlocks a specfic type of knowledge.
|
||||
*/
|
||||
public void unlockKnowledge(ItemStack stack, KnowledgeType knowledge);
|
||||
/**
|
||||
* Gets if a specific knowledge is unlocked. Check the knowledge types in
|
||||
* BotaniaAPI.
|
||||
*/
|
||||
public boolean isKnowledgeUnlocked(ItemStack stack, KnowledgeType knowledge);
|
||||
|
||||
/**
|
||||
* Unlocks a specfic type of knowledge.
|
||||
*/
|
||||
public void unlockKnowledge(ItemStack stack, KnowledgeType knowledge);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 20, 2014, 7:05:44 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
@@ -20,9 +20,8 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface ILexiconable {
|
||||
|
||||
/**
|
||||
* Gets the lexicon entry to open at this location. null works too.
|
||||
*/
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon);
|
||||
|
||||
/**
|
||||
* Gets the lexicon entry to open at this location. null works too.
|
||||
*/
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 20, 2014, 6:08:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
@@ -18,6 +18,5 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IRecipeKeyProvider {
|
||||
|
||||
public String getKey(ItemStack stack);
|
||||
|
||||
public String getKey(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Nov 3, 2014, 2:59:55 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
@@ -16,8 +16,7 @@ package vazkii.botania.api.lexicon;
|
||||
*/
|
||||
public interface ITwoNamedPage {
|
||||
|
||||
public void setSecondUnlocalizedName(String name);
|
||||
|
||||
public String getSecondUnlocalizedName();
|
||||
public void setSecondUnlocalizedName(String name);
|
||||
|
||||
public String getSecondUnlocalizedName();
|
||||
}
|
||||
@@ -4,17 +4,17 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class KnowledgeType {
|
||||
|
||||
public final String id;
|
||||
public final EnumChatFormatting color;
|
||||
public final boolean autoUnlock;
|
||||
public final String id;
|
||||
public final EnumChatFormatting color;
|
||||
public final boolean autoUnlock;
|
||||
|
||||
public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
|
||||
this.id = id;
|
||||
this.color = color;
|
||||
this.autoUnlock = autoUnlock;
|
||||
}
|
||||
public KnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
|
||||
this.id = id;
|
||||
this.color = color;
|
||||
this.autoUnlock = autoUnlock;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return "botania.knowledge." + id;
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return "botania.knowledge." + id;
|
||||
}
|
||||
}
|
||||
@@ -2,75 +2,74 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:23:47 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class LexiconCategory implements Comparable<LexiconCategory> {
|
||||
|
||||
private static int count = 0;
|
||||
private static int count = 0;
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
|
||||
private final int sortingId;
|
||||
private ResourceLocation icon;
|
||||
private int priority = 5;
|
||||
public final String unlocalizedName;
|
||||
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
|
||||
private final int sortingId;
|
||||
private ResourceLocation icon;
|
||||
private int priority = 5;
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this category. This will be localized by the client display.
|
||||
*/
|
||||
public LexiconCategory(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
sortingId = count;
|
||||
count++;
|
||||
}
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this category. This will be localized by the client display.
|
||||
*/
|
||||
public LexiconCategory(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
sortingId = count;
|
||||
count++;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the priority for this category for sorting. Higher numbers
|
||||
* means they'll appear first in the book. The basics category
|
||||
* is 9, the miscellaneous category is 0, other vanilla botania categories
|
||||
* are 5. Using 9 and 0 is <b>not</b> recommended, since having your
|
||||
* categories before basics or after miscellaneous is a bad idea.
|
||||
* If two categories have the same priority they'll be sorted
|
||||
* by insertion order.
|
||||
*/
|
||||
public LexiconCategory setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets the priority for this category for sorting. Higher numbers
|
||||
* means they'll appear first in the book. The basics category
|
||||
* is 9, the miscellaneous category is 0, other vanilla botania categories
|
||||
* are 5. Using 9 and 0 is <b>not</b> recommended, since having your
|
||||
* categories before basics or after miscellaneous is a bad idea.
|
||||
* If two categories have the same priority they'll be sorted
|
||||
* by insertion order.
|
||||
*/
|
||||
public LexiconCategory setPriority(int priority) {
|
||||
this.priority = priority;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getSortingPriority() {
|
||||
return priority;
|
||||
}
|
||||
public int getSortingPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public final int getSortingId() {
|
||||
return sortingId;
|
||||
}
|
||||
public final int getSortingId() {
|
||||
return sortingId;
|
||||
}
|
||||
|
||||
public LexiconCategory setIcon(ResourceLocation icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
public LexiconCategory setIcon(ResourceLocation icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResourceLocation getIcon() {
|
||||
return icon;
|
||||
}
|
||||
public ResourceLocation getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LexiconCategory category) {
|
||||
return priority == category.priority ? sortingId - category.sortingId : category.priority - priority;
|
||||
}
|
||||
@Override
|
||||
public int compareTo(LexiconCategory category) {
|
||||
return priority == category.priority ? sortingId - category.sortingId : category.priority - priority;
|
||||
}
|
||||
}
|
||||
@@ -2,165 +2,160 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:17:06 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final LexiconCategory category;
|
||||
public final String unlocalizedName;
|
||||
public final LexiconCategory category;
|
||||
|
||||
private KnowledgeType type = BotaniaAPI.basicKnowledge;
|
||||
private KnowledgeType type = BotaniaAPI.basicKnowledge;
|
||||
|
||||
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
|
||||
private boolean priority = false;
|
||||
private ItemStack icon = null;
|
||||
|
||||
private List<ItemStack> extraDisplayedRecipes = new ArrayList();
|
||||
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
|
||||
private boolean priority = false;
|
||||
private ItemStack icon = null;
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
|
||||
*/
|
||||
public LexiconEntry(String unlocalizedName, LexiconCategory category) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.category = category;
|
||||
}
|
||||
private List<ItemStack> extraDisplayedRecipes = new ArrayList();
|
||||
|
||||
/**
|
||||
* Sets this page as prioritized, as in, will appear before others in the lexicon.
|
||||
*/
|
||||
public LexiconEntry setPriority() {
|
||||
priority = true;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this entry. This will be localized by the client display.
|
||||
*/
|
||||
public LexiconEntry(String unlocalizedName, LexiconCategory category) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Knowledge type of this entry.
|
||||
*/
|
||||
public LexiconEntry setKnowledgeType(KnowledgeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Sets this page as prioritized, as in, will appear before others in the lexicon.
|
||||
*/
|
||||
public LexiconEntry setPriority() {
|
||||
priority = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KnowledgeType getKnowledgeType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* Sets the Knowledge type of this entry.
|
||||
*/
|
||||
public LexiconEntry setKnowledgeType(KnowledgeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display icon for this entry. Overriding the one already there. When adding recipe pages to the
|
||||
* entry, this will be called once for the result of the first found recipe.
|
||||
*/
|
||||
public void setIcon(ItemStack stack) {
|
||||
icon = stack;
|
||||
}
|
||||
public KnowledgeType getKnowledgeType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ItemStack getIcon() {
|
||||
return icon;
|
||||
}
|
||||
/**
|
||||
* Sets the display icon for this entry. Overriding the one already there. When adding recipe pages to the
|
||||
* entry, this will be called once for the result of the first found recipe.
|
||||
*/
|
||||
public void setIcon(ItemStack stack) {
|
||||
icon = stack;
|
||||
}
|
||||
|
||||
public boolean isPriority() {
|
||||
return priority;
|
||||
}
|
||||
public ItemStack getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
public boolean isPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public String getTagline() {
|
||||
return null; // Override this if you want a tagline. You probably do
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isVisible() {
|
||||
return true;
|
||||
}
|
||||
public String getTagline() {
|
||||
return null; // Override this if you want a tagline. You probably do
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets what pages you want this entry to have.
|
||||
*/
|
||||
public LexiconEntry setLexiconPages(LexiconPage... pages) {
|
||||
this.pages.addAll(Arrays.asList(pages));
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean isVisible() {
|
||||
return true;
|
||||
}
|
||||
|
||||
for(int i = 0; i < this.pages.size(); i++) {
|
||||
LexiconPage page = this.pages.get(i);
|
||||
if(!page.skipRegistry)
|
||||
page.onPageAdded(this, i);
|
||||
}
|
||||
/**
|
||||
* Sets what pages you want this entry to have.
|
||||
*/
|
||||
public LexiconEntry setLexiconPages(LexiconPage... pages) {
|
||||
this.pages.addAll(Arrays.asList(pages));
|
||||
|
||||
return this;
|
||||
}
|
||||
for (int i = 0; i < this.pages.size(); i++) {
|
||||
LexiconPage page = this.pages.get(i);
|
||||
if (!page.skipRegistry) page.onPageAdded(this, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the web link for this entry. If this isn't null, looking at this entry will
|
||||
* show a "View Online" button in the book. The String returned should be the URL to
|
||||
* open when the button is clicked.
|
||||
*/
|
||||
public String getWebLink() {
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a page to the list of pages.
|
||||
*/
|
||||
public void addPage(LexiconPage page) {
|
||||
pages.add(page);
|
||||
}
|
||||
/**
|
||||
* Returns the web link for this entry. If this isn't null, looking at this entry will
|
||||
* show a "View Online" button in the book. The String returned should be the URL to
|
||||
* open when the button is clicked.
|
||||
*/
|
||||
public String getWebLink() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final String getNameForSorting() {
|
||||
return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName());
|
||||
}
|
||||
/**
|
||||
* Adds a page to the list of pages.
|
||||
*/
|
||||
public void addPage(LexiconPage page) {
|
||||
pages.add(page);
|
||||
}
|
||||
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
for(LexiconPage page : pages) {
|
||||
List<ItemStack> l = page.getDisplayedRecipes();
|
||||
public final String getNameForSorting() {
|
||||
return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName());
|
||||
}
|
||||
|
||||
if(l != null) {
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList();
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList();
|
||||
for (LexiconPage page : pages) {
|
||||
List<ItemStack> l = page.getDisplayedRecipes();
|
||||
|
||||
for(ItemStack s : l) {
|
||||
addItem: {
|
||||
for(ItemStack s1 : itemsAddedThisPage)
|
||||
if(s1.getItem() == s.getItem())
|
||||
break addItem;
|
||||
for(ItemStack s1 : list)
|
||||
if(s1.isItemEqual(s) && ItemStack.areItemStackTagsEqual(s1, s))
|
||||
break addItem;
|
||||
if (l != null) {
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList();
|
||||
|
||||
itemsAddedThisPage.add(s);
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list.addAll(extraDisplayedRecipes);
|
||||
for (ItemStack s : l) {
|
||||
addItem:
|
||||
{
|
||||
for (ItemStack s1 : itemsAddedThisPage) if (s1.getItem() == s.getItem()) break addItem;
|
||||
for (ItemStack s1 : list)
|
||||
if (s1.isItemEqual(s) && ItemStack.areItemStackTagsEqual(s1, s)) break addItem;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public void addExtraDisplayedRecipe(ItemStack stack) {
|
||||
extraDisplayedRecipes.add(stack);
|
||||
}
|
||||
itemsAddedThisPage.add(s);
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LexiconEntry o) {
|
||||
return getNameForSorting().compareTo(o.getNameForSorting());
|
||||
}
|
||||
list.addAll(extraDisplayedRecipes);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void addExtraDisplayedRecipe(ItemStack stack) {
|
||||
extraDisplayedRecipes.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LexiconEntry o) {
|
||||
return getNameForSorting().compareTo(o.getNameForSorting());
|
||||
}
|
||||
}
|
||||
@@ -2,112 +2,111 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:17:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.internal.IGuiLexiconEntry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class LexiconPage {
|
||||
|
||||
public String unlocalizedName;
|
||||
public boolean skipRegistry;
|
||||
public String unlocalizedName;
|
||||
public boolean skipRegistry;
|
||||
|
||||
public LexiconPage(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
public LexiconPage(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the rendering for this page.
|
||||
* @param gui The active GuiScreen
|
||||
* @param mx The mouse's relative X position.
|
||||
* @param my The mouse's relative Y position.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my);
|
||||
/**
|
||||
* Does the rendering for this page.
|
||||
* @param gui The active GuiScreen
|
||||
* @param mx The mouse's relative X position.
|
||||
* @param my The mouse's relative Y position.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract void renderScreen(IGuiLexiconEntry gui, int mx, int my);
|
||||
|
||||
/**
|
||||
* Called per update tick. Non gui-sensitive version, kept for backwards compatibility only.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called per update tick. Non gui-sensitive version, kept for backwards compatibility only.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called per update tick. Feel free to override fully, the
|
||||
* call to updateScreen() is for backwards compatibility.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen(IGuiLexiconEntry gui) {
|
||||
updateScreen();
|
||||
}
|
||||
/**
|
||||
* Called per update tick. Feel free to override fully, the
|
||||
* call to updateScreen() is for backwards compatibility.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void updateScreen(IGuiLexiconEntry gui) {
|
||||
updateScreen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this page is opened, be it via initGui() or when the player changes page.
|
||||
* You can add buttons and whatever you'd do on initGui() here.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onOpened(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called when this page is opened, be it via initGui() or when the player changes page.
|
||||
* You can add buttons and whatever you'd do on initGui() here.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onOpened(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when this page is opened, be it via closing the gui or when the player changes page.
|
||||
* Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onClosed(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called when this page is opened, be it via closing the gui or when the player changes page.
|
||||
* Make sure to dispose of anything you don't use any more, such as buttons in the gui's buttonList.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onClosed(IGuiLexiconEntry gui) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a button is pressed, equivalent to GuiScreen.actionPerformed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called when a button is pressed, equivalent to GuiScreen.actionPerformed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onActionPerformed(IGuiLexiconEntry gui, GuiButton button) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a key is pressed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onKeyPressed(char c, int key) {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called when a key is pressed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onKeyPressed(char c, int key) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called.
|
||||
*/
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
// NO-OP
|
||||
}
|
||||
/**
|
||||
* Called when {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called.
|
||||
*/
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the list of recipes present in this page for display in the category
|
||||
* page. Can return null for an entry with no recipes.
|
||||
*/
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Shows the list of recipes present in this page for display in the category
|
||||
* page. Can return null for an entry with no recipes.
|
||||
*/
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
public LexiconPage setSkipRegistry() {
|
||||
skipRegistry = true;
|
||||
return this;
|
||||
}
|
||||
public LexiconPage setSkipRegistry() {
|
||||
skipRegistry = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 6, 2014, 3:54:12 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import vazkii.botania.api.mana.IManaItem;
|
||||
|
||||
@@ -23,56 +22,52 @@ import vazkii.botania.api.mana.IManaItem;
|
||||
*/
|
||||
public final class LexiconRecipeMappings {
|
||||
|
||||
private static Map<String, EntryData> mappings = new HashMap();
|
||||
private static Map<String, EntryData> mappings = new HashMap();
|
||||
|
||||
/**
|
||||
* Maps the given stack to the given page of the entry.
|
||||
*/
|
||||
public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) {
|
||||
EntryData data = new EntryData(entry, page);
|
||||
String str = stackToString(stack);
|
||||
/**
|
||||
* Maps the given stack to the given page of the entry.
|
||||
*/
|
||||
public static void map(ItemStack stack, LexiconEntry entry, int page, boolean force) {
|
||||
EntryData data = new EntryData(entry, page);
|
||||
String str = stackToString(stack);
|
||||
|
||||
if(force || !mappings.containsKey(str))
|
||||
mappings.put(str, data);
|
||||
if(entry.getIcon() == null)
|
||||
entry.setIcon(stack.copy());
|
||||
}
|
||||
if (force || !mappings.containsKey(str)) mappings.put(str, data);
|
||||
if (entry.getIcon() == null) entry.setIcon(stack.copy());
|
||||
}
|
||||
|
||||
public static void map(ItemStack stack, LexiconEntry entry, int page) {
|
||||
map(stack, entry, page, false);
|
||||
}
|
||||
public static void map(ItemStack stack, LexiconEntry entry, int page) {
|
||||
map(stack, entry, page, false);
|
||||
}
|
||||
|
||||
public static void remove(ItemStack stack) {
|
||||
mappings.remove(stackToString(stack));
|
||||
}
|
||||
public static void remove(ItemStack stack) {
|
||||
mappings.remove(stackToString(stack));
|
||||
}
|
||||
|
||||
public static EntryData getDataForStack(ItemStack stack) {
|
||||
return mappings.get(stackToString(stack));
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
return "NULL";
|
||||
|
||||
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
|
||||
public static EntryData getDataForStack(ItemStack stack) {
|
||||
return mappings.get(stackToString(stack));
|
||||
}
|
||||
|
||||
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
}
|
||||
public static String stackToString(ItemStack stack) {
|
||||
if (stack == null || stack.getItem() == null) return "NULL";
|
||||
|
||||
public static boolean ignoreMeta(ItemStack stack) {
|
||||
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
|
||||
}
|
||||
if (stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
|
||||
|
||||
public static class EntryData {
|
||||
return stack.getUnlocalizedName() + (ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
|
||||
}
|
||||
|
||||
public final LexiconEntry entry;
|
||||
public final int page;
|
||||
public static boolean ignoreMeta(ItemStack stack) {
|
||||
return stack.isItemStackDamageable() || stack.getItem() instanceof IManaItem;
|
||||
}
|
||||
|
||||
public EntryData(LexiconEntry entry, int page) {
|
||||
this.entry = entry;
|
||||
this.page = page;
|
||||
}
|
||||
public static class EntryData {
|
||||
|
||||
}
|
||||
public final LexiconEntry entry;
|
||||
public final int page;
|
||||
|
||||
public EntryData(LexiconEntry entry, int page) {
|
||||
this.entry = entry;
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,16 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 27, 2015, 7:48:47 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -23,10 +22,16 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
*/
|
||||
public interface IMultiblockRenderHook {
|
||||
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap();
|
||||
public static Map<Block, IMultiblockRenderHook> renderHooks = new HashMap();
|
||||
|
||||
public void renderBlockForMultiblock(IBlockAccess world, Multiblock mb, Block block, int meta, RenderBlocks renderBlocks, MultiblockComponent comp, float alpha);
|
||||
|
||||
public boolean needsTranslate(Block block);
|
||||
public void renderBlockForMultiblock(
|
||||
IBlockAccess world,
|
||||
Multiblock mb,
|
||||
Block block,
|
||||
int meta,
|
||||
RenderBlocks renderBlocks,
|
||||
MultiblockComponent comp,
|
||||
float alpha);
|
||||
|
||||
public boolean needsTranslate(Block block);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 27, 2015, 2:37:22 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock;
|
||||
@@ -14,7 +14,6 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
@@ -27,162 +26,147 @@ import vazkii.botania.api.lexicon.multiblock.component.MultiblockComponent;
|
||||
*/
|
||||
public class Multiblock {
|
||||
|
||||
public List<MultiblockComponent> components = new ArrayList();
|
||||
public List<ItemStack> materials = new ArrayList();
|
||||
public List<MultiblockComponent> components = new ArrayList();
|
||||
public List<ItemStack> materials = new ArrayList();
|
||||
|
||||
public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ;
|
||||
public int minX, minY, minZ, maxX, maxY, maxZ, offX, offY, offZ;
|
||||
|
||||
public HashMap<List<Integer>, MultiblockComponent> locationCache = new HashMap<List<Integer>, MultiblockComponent>();
|
||||
public HashMap<List<Integer>, MultiblockComponent> locationCache =
|
||||
new HashMap<List<Integer>, MultiblockComponent>();
|
||||
|
||||
/**
|
||||
* Adds a multiblock component to this multiblock. The component's x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(MultiblockComponent component) {
|
||||
if(getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ) != null)
|
||||
throw new IllegalArgumentException("Location in multiblock already occupied");
|
||||
components.add(component);
|
||||
changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ);
|
||||
calculateCostForNewComponent(component);
|
||||
addComponentToLocationCache(component);
|
||||
}
|
||||
/**
|
||||
* Adds a multiblock component to this multiblock. The component's x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(MultiblockComponent component) {
|
||||
if (getComponentForLocation(component.relPos.posX, component.relPos.posY, component.relPos.posZ) != null)
|
||||
throw new IllegalArgumentException("Location in multiblock already occupied");
|
||||
components.add(component);
|
||||
changeAxisForNewComponent(component.relPos.posX, component.relPos.posY, component.relPos.posZ);
|
||||
calculateCostForNewComponent(component);
|
||||
addComponentToLocationCache(component);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs and adds a multiblock component to this multiblock. The x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(int x, int y, int z, Block block, int meta) {
|
||||
addComponent(new MultiblockComponent(new ChunkCoordinates(x, y, z), block, meta));
|
||||
}
|
||||
/**
|
||||
* Constructs and adds a multiblock component to this multiblock. The x y z
|
||||
* coords should be pivoted to the center of the structure.
|
||||
*/
|
||||
public void addComponent(int x, int y, int z, Block block, int meta) {
|
||||
addComponent(new MultiblockComponent(new ChunkCoordinates(x, y, z), block, meta));
|
||||
}
|
||||
|
||||
private void changeAxisForNewComponent(int x, int y, int z) {
|
||||
if(x < minX)
|
||||
minX = x;
|
||||
else if(x > maxX)
|
||||
maxX = x;
|
||||
private void changeAxisForNewComponent(int x, int y, int z) {
|
||||
if (x < minX) minX = x;
|
||||
else if (x > maxX) maxX = x;
|
||||
|
||||
if(y < minY)
|
||||
minY = y;
|
||||
else if(y > maxY)
|
||||
maxY = y;
|
||||
if (y < minY) minY = y;
|
||||
else if (y > maxY) maxY = y;
|
||||
|
||||
if(z < minZ)
|
||||
minZ = z;
|
||||
else if(z > maxZ)
|
||||
maxZ = z;
|
||||
}
|
||||
if (z < minZ) minZ = z;
|
||||
else if (z > maxZ) maxZ = z;
|
||||
}
|
||||
|
||||
private void calculateCostForNewComponent(MultiblockComponent comp) {
|
||||
ItemStack[] materials = comp.getMaterials();
|
||||
if(materials != null)
|
||||
for(ItemStack stack : materials)
|
||||
addStack(stack);
|
||||
}
|
||||
private void calculateCostForNewComponent(MultiblockComponent comp) {
|
||||
ItemStack[] materials = comp.getMaterials();
|
||||
if (materials != null) for (ItemStack stack : materials) addStack(stack);
|
||||
}
|
||||
|
||||
private void addStack(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return;
|
||||
private void addStack(ItemStack stack) {
|
||||
if (stack == null) return;
|
||||
|
||||
for(ItemStack oStack : materials)
|
||||
if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
|
||||
oStack.stackSize += stack.stackSize;
|
||||
return;
|
||||
}
|
||||
for (ItemStack oStack : materials)
|
||||
if (oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
|
||||
oStack.stackSize += stack.stackSize;
|
||||
return;
|
||||
}
|
||||
|
||||
materials.add(stack);
|
||||
}
|
||||
materials.add(stack);
|
||||
}
|
||||
|
||||
public void setRenderOffset(int x, int y, int z) {
|
||||
offX = x;
|
||||
offY = y;
|
||||
offZ = z;
|
||||
}
|
||||
public void setRenderOffset(int x, int y, int z) {
|
||||
offX = x;
|
||||
offY = y;
|
||||
offZ = z;
|
||||
}
|
||||
|
||||
public List<MultiblockComponent> getComponents() {
|
||||
return components;
|
||||
}
|
||||
public List<MultiblockComponent> getComponents() {
|
||||
return components;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates this multiblock by the angle passed in. For the best results, use
|
||||
* only multiples of pi/2.
|
||||
*/
|
||||
public void rotate(double angle) {
|
||||
for(MultiblockComponent comp : getComponents())
|
||||
comp.rotate(angle);
|
||||
updateLocationCache();
|
||||
}
|
||||
/**
|
||||
* Rotates this multiblock by the angle passed in. For the best results, use
|
||||
* only multiples of pi/2.
|
||||
*/
|
||||
public void rotate(double angle) {
|
||||
for (MultiblockComponent comp : getComponents()) comp.rotate(angle);
|
||||
updateLocationCache();
|
||||
}
|
||||
|
||||
public Multiblock copy() {
|
||||
Multiblock mb = new Multiblock();
|
||||
for(MultiblockComponent comp : getComponents())
|
||||
mb.addComponent(comp.copy());
|
||||
public Multiblock copy() {
|
||||
Multiblock mb = new Multiblock();
|
||||
for (MultiblockComponent comp : getComponents()) mb.addComponent(comp.copy());
|
||||
|
||||
return mb;
|
||||
}
|
||||
return mb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a length 4 array of all the rotations multiple of pi/2 required
|
||||
* to render this multiblock in the world relevant to the 4 cardinal
|
||||
* orientations.
|
||||
*/
|
||||
public Multiblock[] createRotations() {
|
||||
Multiblock[] blocks = new Multiblock[4];
|
||||
blocks[0] = this;
|
||||
blocks[1] = blocks[0].copy();
|
||||
blocks[1].rotate(Math.PI / 2);
|
||||
blocks[2] = blocks[1].copy();
|
||||
blocks[2].rotate(Math.PI / 2);
|
||||
blocks[3] = blocks[2].copy();
|
||||
blocks[3].rotate(Math.PI / 2);
|
||||
/**
|
||||
* Creates a length 4 array of all the rotations multiple of pi/2 required
|
||||
* to render this multiblock in the world relevant to the 4 cardinal
|
||||
* orientations.
|
||||
*/
|
||||
public Multiblock[] createRotations() {
|
||||
Multiblock[] blocks = new Multiblock[4];
|
||||
blocks[0] = this;
|
||||
blocks[1] = blocks[0].copy();
|
||||
blocks[1].rotate(Math.PI / 2);
|
||||
blocks[2] = blocks[1].copy();
|
||||
blocks[2].rotate(Math.PI / 2);
|
||||
blocks[3] = blocks[2].copy();
|
||||
blocks[3].rotate(Math.PI / 2);
|
||||
|
||||
return blocks;
|
||||
}
|
||||
return blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a MultiblockSet from this Multiblock and its rotations using
|
||||
* createRotations().
|
||||
*/
|
||||
public MultiblockSet makeSet() {
|
||||
return new MultiblockSet(this);
|
||||
}
|
||||
/**
|
||||
* Makes a MultiblockSet from this Multiblock and its rotations using
|
||||
* createRotations().
|
||||
*/
|
||||
public MultiblockSet makeSet() {
|
||||
return new MultiblockSet(this);
|
||||
}
|
||||
|
||||
public int getXSize() {
|
||||
return Math.abs(minX) + Math.abs(maxX) + 1;
|
||||
}
|
||||
public int getXSize() {
|
||||
return Math.abs(minX) + Math.abs(maxX) + 1;
|
||||
}
|
||||
|
||||
public int getYSize() {
|
||||
return Math.abs(minY) + Math.abs(maxY) + 1;
|
||||
}
|
||||
public int getYSize() {
|
||||
return Math.abs(minY) + Math.abs(maxY) + 1;
|
||||
}
|
||||
|
||||
public int getZSize() {
|
||||
return Math.abs(minZ) + Math.abs(maxZ) + 1;
|
||||
}
|
||||
public int getZSize() {
|
||||
return Math.abs(minZ) + Math.abs(maxZ) + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuilds the location cache
|
||||
*/
|
||||
public void updateLocationCache() {
|
||||
locationCache.clear();
|
||||
for(MultiblockComponent comp : components)
|
||||
addComponentToLocationCache(comp);
|
||||
}
|
||||
/**
|
||||
* Rebuilds the location cache
|
||||
*/
|
||||
public void updateLocationCache() {
|
||||
locationCache.clear();
|
||||
for (MultiblockComponent comp : components) addComponentToLocationCache(comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a single component to the location cache
|
||||
*/
|
||||
private void addComponentToLocationCache(MultiblockComponent comp) {
|
||||
ChunkCoordinates pos = comp.getRelativePosition();
|
||||
locationCache.put(Arrays.asList(
|
||||
pos.posX,
|
||||
pos.posY,
|
||||
pos.posZ
|
||||
), comp);
|
||||
}
|
||||
/**
|
||||
* Adds a single component to the location cache
|
||||
*/
|
||||
private void addComponentToLocationCache(MultiblockComponent comp) {
|
||||
ChunkCoordinates pos = comp.getRelativePosition();
|
||||
locationCache.put(Arrays.asList(pos.posX, pos.posY, pos.posZ), comp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the component for a given location
|
||||
*/
|
||||
public MultiblockComponent getComponentForLocation(int x, int y, int z) {
|
||||
return locationCache.get(Arrays.asList(x, y, z));
|
||||
}
|
||||
/**
|
||||
* Gets the component for a given location
|
||||
*/
|
||||
public MultiblockComponent getComponentForLocation(int x, int y, int z) {
|
||||
return locationCache.get(Arrays.asList(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 27, 2015, 7:31:58 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock;
|
||||
@@ -18,26 +18,26 @@ import net.minecraft.util.MathHelper;
|
||||
*/
|
||||
public class MultiblockSet {
|
||||
|
||||
private final Multiblock[] mbs;
|
||||
private final Multiblock[] mbs;
|
||||
|
||||
public MultiblockSet(Multiblock[] mbs) {
|
||||
this.mbs = mbs;
|
||||
}
|
||||
public MultiblockSet(Multiblock[] mbs) {
|
||||
this.mbs = mbs;
|
||||
}
|
||||
|
||||
public MultiblockSet(Multiblock mb) {
|
||||
this(mb.createRotations());
|
||||
}
|
||||
public MultiblockSet(Multiblock mb) {
|
||||
this(mb.createRotations());
|
||||
}
|
||||
|
||||
public Multiblock getForEntity(Entity e) {
|
||||
return getForRotation(e.rotationYaw);
|
||||
}
|
||||
public Multiblock getForEntity(Entity e) {
|
||||
return getForRotation(e.rotationYaw);
|
||||
}
|
||||
|
||||
public Multiblock getForRotation(double rotation) {
|
||||
int facing = MathHelper.floor_double(rotation * 4.0 / 360.0 + 0.5) & 3;
|
||||
return getForIndex(facing);
|
||||
}
|
||||
public Multiblock getForRotation(double rotation) {
|
||||
int facing = MathHelper.floor_double(rotation * 4.0 / 360.0 + 0.5) & 3;
|
||||
return getForIndex(facing);
|
||||
}
|
||||
|
||||
public Multiblock getForIndex(int index) {
|
||||
return mbs[Math.min(mbs.length - 1, index)];
|
||||
}
|
||||
public Multiblock getForIndex(int index) {
|
||||
return mbs[Math.min(mbs.length - 1, index)];
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [01/11/2015, 19:05:57 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock.component;
|
||||
@@ -19,14 +19,13 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public class AnyComponent extends MultiblockComponent {
|
||||
|
||||
public AnyComponent(ChunkCoordinates relPos, Block block, int meta) {
|
||||
super(relPos, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return !block.isAir(world, x, y, z) && block.getCollisionBoundingBoxFromPool(world, x, y, z) != null;
|
||||
}
|
||||
public AnyComponent(ChunkCoordinates relPos, Block block, int meta) {
|
||||
super(relPos, block, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
return !block.isAir(world, x, y, z) && block.getCollisionBoundingBoxFromPool(world, x, y, z) != null;
|
||||
}
|
||||
}
|
||||
+17
-18
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 27, 2015, 7:20:09 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock.component;
|
||||
@@ -21,23 +21,22 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
*/
|
||||
public class ColorSwitchingComponent extends MultiblockComponent {
|
||||
|
||||
public ColorSwitchingComponent(ChunkCoordinates relPos, Block block) {
|
||||
super(relPos, block, -1);
|
||||
}
|
||||
public ColorSwitchingComponent(ChunkCoordinates relPos, Block block) {
|
||||
super(relPos, block, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return (int) (BotaniaAPI.internalHandler.getWorldElapsedTicks() / 20) % 16;
|
||||
}
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return (int) (BotaniaAPI.internalHandler.getWorldElapsedTicks() / 20) % 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiblockComponent copy() {
|
||||
return new ColorSwitchingComponent(relPos, block);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiblockComponent copy() {
|
||||
return new ColorSwitchingComponent(relPos, block);
|
||||
}
|
||||
}
|
||||
+13
-14
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 28, 2015, 3:23:15 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock.component;
|
||||
@@ -20,18 +20,17 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
*/
|
||||
public class FlowerComponent extends ColorSwitchingComponent {
|
||||
|
||||
public FlowerComponent(ChunkCoordinates relPos, Block block) {
|
||||
super(relPos, block);
|
||||
}
|
||||
public FlowerComponent(ChunkCoordinates relPos, Block block) {
|
||||
super(relPos, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return BotaniaAPI.internalHandler.isBotaniaFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiblockComponent copy() {
|
||||
return new FlowerComponent(relPos, block);
|
||||
}
|
||||
@Override
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return BotaniaAPI.internalHandler.isBotaniaFlower(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiblockComponent copy() {
|
||||
return new FlowerComponent(relPos, block);
|
||||
}
|
||||
}
|
||||
+60
-59
@@ -2,21 +2,21 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 27, 2015, 2:42:32 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon.multiblock.component;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* A component of a multiblock, the normal one
|
||||
@@ -24,73 +24,74 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
*/
|
||||
public class MultiblockComponent {
|
||||
|
||||
public ChunkCoordinates relPos;
|
||||
public final Block block;
|
||||
public final int meta;
|
||||
public final TileEntity tileEntity;
|
||||
public boolean doFancyRender;
|
||||
public ChunkCoordinates relPos;
|
||||
public final Block block;
|
||||
public final int meta;
|
||||
public final TileEntity tileEntity;
|
||||
public boolean doFancyRender;
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta) {
|
||||
this(relPos, block, meta, null);
|
||||
}
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta) {
|
||||
this(relPos, block, meta, null);
|
||||
}
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, boolean doFancyRender) {
|
||||
this(relPos, block, meta, doFancyRender, null);
|
||||
}
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, boolean doFancyRender) {
|
||||
this(relPos, block, meta, doFancyRender, null);
|
||||
}
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, TileEntity tileEntity) {
|
||||
this(relPos, block, meta, block.hasTileEntity() == (tileEntity != null), tileEntity);
|
||||
}
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, TileEntity tileEntity) {
|
||||
this(relPos, block, meta, block.hasTileEntity() == (tileEntity != null), tileEntity);
|
||||
}
|
||||
|
||||
public MultiblockComponent(ChunkCoordinates relPos, Block block, int meta, boolean doFancyRender, TileEntity tileEntity) {
|
||||
this.relPos = relPos;
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.tileEntity = tileEntity;
|
||||
this.doFancyRender = doFancyRender;
|
||||
}
|
||||
public MultiblockComponent(
|
||||
ChunkCoordinates relPos, Block block, int meta, boolean doFancyRender, TileEntity tileEntity) {
|
||||
this.relPos = relPos;
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
this.tileEntity = tileEntity;
|
||||
this.doFancyRender = doFancyRender;
|
||||
}
|
||||
|
||||
public ChunkCoordinates getRelativePosition() {
|
||||
return relPos;
|
||||
}
|
||||
public ChunkCoordinates getRelativePosition() {
|
||||
return relPos;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
public Block getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta);
|
||||
}
|
||||
public boolean matches(World world, int x, int y, int z) {
|
||||
return world.getBlock(x, y, z) == getBlock() && (meta == -1 || world.getBlockMetadata(x, y, z) == meta);
|
||||
}
|
||||
|
||||
public ItemStack[] getMaterials() {
|
||||
return new ItemStack[] { new ItemStack(block, 1, meta) };
|
||||
}
|
||||
public ItemStack[] getMaterials() {
|
||||
return new ItemStack[] {new ItemStack(block, 1, meta)};
|
||||
}
|
||||
|
||||
public void rotate(double angle) {
|
||||
double x = relPos.posX;
|
||||
double z = relPos.posZ;
|
||||
double sin = Math.sin(angle);
|
||||
double cos = Math.cos(angle);
|
||||
public void rotate(double angle) {
|
||||
double x = relPos.posX;
|
||||
double z = relPos.posZ;
|
||||
double sin = Math.sin(angle);
|
||||
double cos = Math.cos(angle);
|
||||
|
||||
double xn = x * cos - z * sin;
|
||||
double zn = x * sin + z * cos;
|
||||
relPos = new ChunkCoordinates((int) Math.round(xn), relPos.posY, (int) Math.round(zn));
|
||||
}
|
||||
double xn = x * cos - z * sin;
|
||||
double zn = x * sin + z * cos;
|
||||
relPos = new ChunkCoordinates((int) Math.round(xn), relPos.posY, (int) Math.round(zn));
|
||||
}
|
||||
|
||||
public MultiblockComponent copy() {
|
||||
return new MultiblockComponent(relPos, block, meta, tileEntity);
|
||||
}
|
||||
public MultiblockComponent copy() {
|
||||
return new MultiblockComponent(relPos, block, meta, tileEntity);
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity() {
|
||||
return tileEntity;
|
||||
}
|
||||
public TileEntity getTileEntity() {
|
||||
return tileEntity;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldDoFancyRender() {
|
||||
return doFancyRender;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldDoFancyRender() {
|
||||
return doFancyRender;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 31, 2014, 3:49:30 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -16,21 +16,26 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public final class BurstProperties {
|
||||
|
||||
public int maxMana;
|
||||
public int ticksBeforeManaLoss;
|
||||
public float manaLossPerTick;
|
||||
public float gravity;
|
||||
public float motionModifier;
|
||||
public int maxMana;
|
||||
public int ticksBeforeManaLoss;
|
||||
public float manaLossPerTick;
|
||||
public float gravity;
|
||||
public float motionModifier;
|
||||
|
||||
public int color;
|
||||
|
||||
public BurstProperties(int maxMana, int ticksBeforeManaLoss, float manaLossPerTick, float gravity, float motionModifier, int color) {
|
||||
this.maxMana = maxMana;
|
||||
this.ticksBeforeManaLoss = ticksBeforeManaLoss;
|
||||
this.manaLossPerTick = manaLossPerTick;
|
||||
this.gravity = gravity;
|
||||
this.motionModifier = motionModifier;
|
||||
this.color = color;
|
||||
}
|
||||
public int color;
|
||||
|
||||
public BurstProperties(
|
||||
int maxMana,
|
||||
int ticksBeforeManaLoss,
|
||||
float manaLossPerTick,
|
||||
float gravity,
|
||||
float motionModifier,
|
||||
int color) {
|
||||
this.maxMana = maxMana;
|
||||
this.ticksBeforeManaLoss = ticksBeforeManaLoss;
|
||||
this.manaLossPerTick = manaLossPerTick;
|
||||
this.gravity = gravity;
|
||||
this.motionModifier = motionModifier;
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 2, 2014, 5:26:02 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -15,6 +15,4 @@ package vazkii.botania.api.mana;
|
||||
* called on both client and server. If this is not implemented
|
||||
* the call will only occur on the server.
|
||||
*/
|
||||
public interface IClientManaHandler extends IManaReceiver {
|
||||
|
||||
}
|
||||
public interface IClientManaHandler extends IManaReceiver {}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <WireSegal>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Nov 23, 2015, 10:30:34 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,16 +17,13 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICompositableLens extends ILens {
|
||||
|
||||
/**
|
||||
* Returns the properties of the itemstack, used to check if two lenses can combine.
|
||||
*/
|
||||
public int getProps(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Checks if the lens is combinable.
|
||||
*/
|
||||
public boolean isCombinable(ItemStack stack);
|
||||
/**
|
||||
* Returns the properties of the itemstack, used to check if two lenses can combine.
|
||||
*/
|
||||
public int getProps(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Checks if the lens is combinable.
|
||||
*/
|
||||
public boolean isCombinable(ItemStack stack);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [May 25, 2014, 7:34:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -19,7 +19,5 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ICreativeManaProvider {
|
||||
|
||||
public boolean isCreative(ItemStack stack);
|
||||
|
||||
public boolean isCreative(ItemStack stack);
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [15/11/2015, 19:27:07 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,8 +17,7 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IDirectioned {
|
||||
|
||||
public float getRotationX();
|
||||
|
||||
public float getRotationY();
|
||||
public float getRotationX();
|
||||
|
||||
public float getRotationY();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 19, 2015, 10:05:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -18,6 +18,5 @@ import java.util.UUID;
|
||||
*/
|
||||
public interface IIdentifiable {
|
||||
|
||||
public UUID getIdentifier();
|
||||
|
||||
public UUID getIdentifier();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 11, 2014, 4:29:32 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -13,17 +13,16 @@ package vazkii.botania.api.mana;
|
||||
/**
|
||||
* A TileEntity that implements this interface has an IO key lock. This
|
||||
* interface defines an input and output key.<br><br>
|
||||
*
|
||||
*
|
||||
* A Spreader can only shoot mana into a IKeyLocked interfaced TE if the Input
|
||||
* key of the TE is equal to the Output key of the Spreader.<br><br>
|
||||
*
|
||||
*
|
||||
* A Spreader can only pull mana from a IKeyLocked interfaced IManaPool TE if the
|
||||
* Output key of the IManaPool is equal to the Input key of the Spreader.
|
||||
*/
|
||||
public interface IKeyLocked {
|
||||
|
||||
public String getInputKey();
|
||||
|
||||
public String getOutputKey();
|
||||
public String getInputKey();
|
||||
|
||||
public String getOutputKey();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 26, 2014, 9:51:58 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,6 +17,5 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface ILaputaImmobile {
|
||||
|
||||
public boolean canMove(World world, int x, int y, int z);
|
||||
|
||||
public boolean canMove(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -2,41 +2,40 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 31, 2014, 3:03:04 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Have an Item implement this to be counted as a lens for the mana spreader.
|
||||
*/
|
||||
public interface ILens extends ILensEffect {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLensColor(ItemStack stack);
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getLensColor(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Can the source lens be combined with the composite lens? This is called
|
||||
* for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens.
|
||||
*/
|
||||
public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens);
|
||||
/**
|
||||
* Can the source lens be combined with the composite lens? This is called
|
||||
* for both the ILens instance of ItemStack.getItem() of sourceLens and compositeLens.
|
||||
*/
|
||||
public boolean canCombineLenses(ItemStack sourceLens, ItemStack compositeLens);
|
||||
|
||||
/**
|
||||
* Gets the composite lens in the stack passed in, return null for none.
|
||||
*/
|
||||
public ItemStack getCompositeLens(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the composite lens for the sourceLens as the compositeLens, returns
|
||||
* the ItemStack with the combination.
|
||||
*/
|
||||
public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens);
|
||||
/**
|
||||
* Gets the composite lens in the stack passed in, return null for none.
|
||||
*/
|
||||
public ItemStack getCompositeLens(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Sets the composite lens for the sourceLens as the compositeLens, returns
|
||||
* the ItemStack with the combination.
|
||||
*/
|
||||
public ItemStack setCompositeLens(ItemStack sourceLens, ItemStack compositeLens);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [15/11/2015, 21:00:32 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -18,18 +18,17 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ILensControl extends ILens {
|
||||
|
||||
public boolean isControlLens(ItemStack stack);
|
||||
public boolean isControlLens(ItemStack stack);
|
||||
|
||||
public boolean allowBurstShooting(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
public boolean allowBurstShooting(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
|
||||
/**
|
||||
* Used for the tick of a non-redstone spreader.
|
||||
*/
|
||||
public void onControlledSpreaderTick(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
|
||||
/**
|
||||
* Used for when a redstone spreader gets a pulse.
|
||||
*/
|
||||
public void onControlledSpreaderPulse(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
/**
|
||||
* Used for the tick of a non-redstone spreader.
|
||||
*/
|
||||
public void onControlledSpreaderTick(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
|
||||
/**
|
||||
* Used for when a redstone spreader gets a pulse.
|
||||
*/
|
||||
public void onControlledSpreaderPulse(ItemStack stack, IManaSpreader spreader, boolean redstone);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 14, 2014, 7:30:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -20,29 +20,29 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
*/
|
||||
public interface ILensEffect {
|
||||
|
||||
/**
|
||||
* Called when a mana spreader that has this focus shoots a burst. This is where
|
||||
* you change the properties of the burst.
|
||||
*/
|
||||
public void apply(ItemStack stack, BurstProperties props);
|
||||
/**
|
||||
* Called when a mana spreader that has this focus shoots a burst. This is where
|
||||
* you change the properties of the burst.
|
||||
*/
|
||||
public void apply(ItemStack stack, BurstProperties props);
|
||||
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus collides against
|
||||
* any block. This is called after the collision is handled.
|
||||
* @return True to kill the burst. False to keep it alive.
|
||||
*/
|
||||
public boolean collideBurst(IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack);
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus collides against
|
||||
* any block. This is called after the collision is handled.
|
||||
* @return True to kill the burst. False to keep it alive.
|
||||
*/
|
||||
public boolean collideBurst(
|
||||
IManaBurst burst, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus is updated.
|
||||
* This is called before the update is handled.
|
||||
*/
|
||||
public void updateBurst(IManaBurst burst, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Called when the mana burst should do it's particles. Return false to not
|
||||
* do any particles.
|
||||
*/
|
||||
public boolean doParticles(IManaBurst burst, ItemStack stack);
|
||||
/**
|
||||
* Called when a mana burst fired from a mana spreader with this focus is updated.
|
||||
* This is called before the update is handled.
|
||||
*/
|
||||
public void updateBurst(IManaBurst burst, ItemStack stack);
|
||||
|
||||
/**
|
||||
* Called when the mana burst should do it's particles. Return false to not
|
||||
* do any particles.
|
||||
*/
|
||||
public boolean doParticles(IManaBurst burst, ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 4:59:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,9 +17,8 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IManaBlock {
|
||||
|
||||
/**
|
||||
* Gets the amount of mana currently in this block.
|
||||
*/
|
||||
public int getCurrentMana();
|
||||
|
||||
/**
|
||||
* Gets the amount of mana currently in this block.
|
||||
*/
|
||||
public int getCurrentMana();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 5:01:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -15,28 +15,27 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
/**
|
||||
* Any TileEntity that implements this is considered a mana collector, by
|
||||
* which nearby generating flowers will pump mana into it.<br><br>
|
||||
*
|
||||
*
|
||||
* <b>Implementation Instructions:</b><br>
|
||||
* - Override invalidate() and onChunkUnload(), calling <i>ManaNetworkEvent.removeCollector(this);</i> on both.<br>
|
||||
* - On the first tick of onUpdate(), call </i>ManaNetworkEvent.addCollector(this);<i>
|
||||
*/
|
||||
public interface IManaCollector extends IManaReceiver {
|
||||
|
||||
/**
|
||||
* Called every tick on the client case the player is holding a Wand of the Forest.
|
||||
*/
|
||||
public void onClientDisplayTick();
|
||||
/**
|
||||
* Called every tick on the client case the player is holding a Wand of the Forest.
|
||||
*/
|
||||
public void onClientDisplayTick();
|
||||
|
||||
/**
|
||||
* Get the multiplier of mana to input into the block, 1.0 is the original amount of mana
|
||||
* in the burst. 0.9, for example, is 90%, so 10% of the mana in the burst will get
|
||||
* dissipated.
|
||||
*/
|
||||
public float getManaYieldMultiplier(IManaBurst burst);
|
||||
|
||||
/**
|
||||
* Gets the maximum amount of mana this collector can have.
|
||||
*/
|
||||
public int getMaxMana();
|
||||
/**
|
||||
* Get the multiplier of mana to input into the block, 1.0 is the original amount of mana
|
||||
* in the burst. 0.9, for example, is 90%, so 10% of the mana in the burst will get
|
||||
* dissipated.
|
||||
*/
|
||||
public float getManaYieldMultiplier(IManaBurst burst);
|
||||
|
||||
/**
|
||||
* Gets the maximum amount of mana this collector can have.
|
||||
*/
|
||||
public int getMaxMana();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 10, 2014, 7:49:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -16,6 +16,5 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IManaCollisionGhost {
|
||||
|
||||
public boolean isGhost();
|
||||
|
||||
public boolean isGhost();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 28, 2015, 9:22:53 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -20,12 +20,11 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IManaDiscountArmor {
|
||||
|
||||
/**
|
||||
* Gets the mana discount that this piece of armor provides. This is added
|
||||
* together to create the full discount.
|
||||
* Value is to be from 0.0 to 1.0. 0.1 is 10% discount, as an example.
|
||||
* You can also return negative values to make tools cost more.
|
||||
*/
|
||||
public float getDiscount(ItemStack stack, int slot, EntityPlayer player);
|
||||
|
||||
/**
|
||||
* Gets the mana discount that this piece of armor provides. This is added
|
||||
* together to create the full discount.
|
||||
* Value is to be from 0.0 to 1.0. 0.1 is 10% discount, as an example.
|
||||
* You can also return negative values to make tools cost more.
|
||||
*/
|
||||
public float getDiscount(ItemStack stack, int slot, EntityPlayer player);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [08/12/2015, 18:10:29 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -15,6 +15,4 @@ package vazkii.botania.api.mana;
|
||||
* This is used in botania for the terra shatterer to not be constantly
|
||||
* receiving mana from these items..
|
||||
*/
|
||||
public interface IManaGivingItem {
|
||||
|
||||
}
|
||||
public interface IManaGivingItem {}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 6, 2014, 9:07:40 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -19,50 +19,49 @@ import net.minecraft.tileentity.TileEntity;
|
||||
*/
|
||||
public interface IManaItem {
|
||||
|
||||
/**
|
||||
* Gets the amount of mana this item contains
|
||||
*/
|
||||
public int getMana(ItemStack stack);
|
||||
/**
|
||||
* Gets the amount of mana this item contains
|
||||
*/
|
||||
public int getMana(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Gets the max amount of mana this item can hold.
|
||||
*/
|
||||
public int getMaxMana(ItemStack stack);
|
||||
/**
|
||||
* Gets the max amount of mana this item can hold.
|
||||
*/
|
||||
public int getMaxMana(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Adds mana to this item.
|
||||
*/
|
||||
public void addMana(ItemStack stack, int mana);
|
||||
/**
|
||||
* Adds mana to this item.
|
||||
*/
|
||||
public void addMana(ItemStack stack, int mana);
|
||||
|
||||
/**
|
||||
* Can this item receive mana from a mana Pool?
|
||||
* @param pool The pool it's receiving mana from, can be casted to IManaPool.
|
||||
* @see IManaPool#isOutputtingPower()
|
||||
*/
|
||||
public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool);
|
||||
/**
|
||||
* Can this item receive mana from a mana Pool?
|
||||
* @param pool The pool it's receiving mana from, can be casted to IManaPool.
|
||||
* @see IManaPool#isOutputtingPower()
|
||||
*/
|
||||
public boolean canReceiveManaFromPool(ItemStack stack, TileEntity pool);
|
||||
|
||||
/**
|
||||
* Can this item recieve mana from another item?
|
||||
*/
|
||||
public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack);
|
||||
/**
|
||||
* Can this item recieve mana from another item?
|
||||
*/
|
||||
public boolean canReceiveManaFromItem(ItemStack stack, ItemStack otherStack);
|
||||
|
||||
/**
|
||||
* Can this item export mana to a mana Pool?
|
||||
* @param pool The pool it's exporting mana to, can be casted to IManaPool.
|
||||
* @see IManaPool#isOutputtingPower()
|
||||
*/
|
||||
public boolean canExportManaToPool(ItemStack stack,TileEntity pool);
|
||||
/**
|
||||
* Can this item export mana to a mana Pool?
|
||||
* @param pool The pool it's exporting mana to, can be casted to IManaPool.
|
||||
* @see IManaPool#isOutputtingPower()
|
||||
*/
|
||||
public boolean canExportManaToPool(ItemStack stack, TileEntity pool);
|
||||
|
||||
/**
|
||||
* Can this item export mana to another item?
|
||||
*/
|
||||
public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack);
|
||||
|
||||
/**
|
||||
* If this item simply does not export mana at all, set this to true. This is
|
||||
* used to skip items that contain mana but can't export it when drawing the
|
||||
* mana bar above the XP bar.
|
||||
*/
|
||||
public boolean isNoExport(ItemStack stack);
|
||||
/**
|
||||
* Can this item export mana to another item?
|
||||
*/
|
||||
public boolean canExportManaToItem(ItemStack stack, ItemStack otherStack);
|
||||
|
||||
/**
|
||||
* If this item simply does not export mana at all, set this to true. This is
|
||||
* used to skip items that contain mana but can't export it when drawing the
|
||||
* mana bar above the XP bar.
|
||||
*/
|
||||
public boolean isNoExport(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 5:03:09 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -14,17 +14,16 @@ package vazkii.botania.api.mana;
|
||||
* Any TileEntity that implements this is considered a Mana Pool,
|
||||
* by which nearby functional flowers will pull mana from it.<br>
|
||||
* Mana Distributors will also accept it as valid output.<br><br>
|
||||
*
|
||||
*
|
||||
* <b>Implementation Instructions:</b><br>
|
||||
* - Override invalidate() and onChunkUnload(), calling <i>ManaNetworkEvent.removePool(this);</i> on both.<br>
|
||||
* - On the first tick of onUpdate(), call <i>ManaNetworkEvent.addPool(this);</i>
|
||||
*/
|
||||
public interface IManaPool extends IManaReceiver {
|
||||
|
||||
/**
|
||||
* Returns false if the mana pool is accepting power from other power items,
|
||||
* true if it's sending power into them.
|
||||
*/
|
||||
public boolean isOutputtingPower();
|
||||
|
||||
/**
|
||||
* Returns false if the mana pool is accepting power from other power items,
|
||||
* true if it's sending power into them.
|
||||
*/
|
||||
public boolean isOutputtingPower();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 4:55:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -15,20 +15,19 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IManaReceiver extends IManaBlock {
|
||||
|
||||
/**
|
||||
* Is this Mana Receiver is full? Being full means no mana bursts will be sent.
|
||||
*/
|
||||
public boolean isFull();
|
||||
/**
|
||||
* Is this Mana Receiver is full? Being full means no mana bursts will be sent.
|
||||
*/
|
||||
public boolean isFull();
|
||||
|
||||
/**
|
||||
* Called when this receiver receives mana.
|
||||
*/
|
||||
public void recieveMana(int mana);
|
||||
|
||||
/**
|
||||
* Can this tile receive mana from bursts? Generally set to false for
|
||||
* implementations of IManaCollector.
|
||||
*/
|
||||
public boolean canRecieveManaFromBursts();
|
||||
/**
|
||||
* Called when this receiver receives mana.
|
||||
*/
|
||||
public void recieveMana(int mana);
|
||||
|
||||
/**
|
||||
* Can this tile receive mana from bursts? Generally set to false for
|
||||
* implementations of IManaCollector.
|
||||
*/
|
||||
public boolean canRecieveManaFromBursts();
|
||||
}
|
||||
@@ -2,29 +2,27 @@
|
||||
* This class was created by <SoundLogic>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 18, 2015, 7:30:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
|
||||
/**
|
||||
* Any TileEntity that implements this is considered a Mana Spreader,
|
||||
* by which can fire mana bursts as a spreader.
|
||||
*/
|
||||
public interface IManaSpreader extends IManaBlock, IPingable, IDirectioned {
|
||||
|
||||
public void setCanShoot(boolean canShoot);
|
||||
public void setCanShoot(boolean canShoot);
|
||||
|
||||
public int getBurstParticleTick();
|
||||
public int getBurstParticleTick();
|
||||
|
||||
public void setBurstParticleTick(int i);
|
||||
public void setBurstParticleTick(int i);
|
||||
|
||||
public int getLastBurstDeathTick();
|
||||
|
||||
public void setLastBurstDeathTick(int ticksExisted);
|
||||
public int getLastBurstDeathTick();
|
||||
|
||||
public void setLastBurstDeathTick(int ticksExisted);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Oct 23, 2015, 3:54:03 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -18,9 +18,8 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IManaTooltipDisplay {
|
||||
|
||||
/**
|
||||
* Returns the fraction of mana in this item for display. From 0 to 1 (exclusive).
|
||||
*/
|
||||
public float getManaFractionForDisplay(ItemStack stack);
|
||||
|
||||
/**
|
||||
* Returns the fraction of mana in this item for display. From 0 to 1 (exclusive).
|
||||
*/
|
||||
public float getManaFractionForDisplay(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [May 16, 2014, 7:52:53 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -18,6 +18,5 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
*/
|
||||
public interface IManaTrigger {
|
||||
|
||||
public void onBurstCollision(IManaBurst burst, World world, int x, int y, int z);
|
||||
|
||||
public void onBurstCollision(IManaBurst burst, World world, int x, int y, int z);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [May 25, 2014, 7:32:10 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -20,6 +20,5 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface IManaUsingItem {
|
||||
|
||||
public boolean usesMana(ItemStack stack);
|
||||
|
||||
public boolean usesMana(ItemStack stack);
|
||||
}
|
||||
@@ -2,16 +2,15 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jun 19, 2015, 9:52:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
|
||||
/**
|
||||
@@ -20,12 +19,11 @@ import vazkii.botania.api.internal.IManaBurst;
|
||||
*/
|
||||
public interface IPingable extends IIdentifiable {
|
||||
|
||||
/**
|
||||
* Pings this object back, telling it that the burst passed in is still alive
|
||||
* in the world. The UUID parameter should be the UUID with which the burst
|
||||
* was created, this is used to let the object handle the check for if it's the
|
||||
* correct ID internally. IManaBurst implementations should do this every tick.
|
||||
*/
|
||||
public void pingback(IManaBurst burst, UUID expectedIdentity);
|
||||
|
||||
/**
|
||||
* Pings this object back, telling it that the burst passed in is still alive
|
||||
* in the world. The UUID parameter should be the UUID with which the burst
|
||||
* was created, this is used to let the object handle the check for if it's the
|
||||
* correct ID internally. IManaBurst implementations should do this every tick.
|
||||
*/
|
||||
public void pingback(IManaBurst burst, UUID expectedIdentity);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 2, 2014, 6:36:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -20,6 +20,5 @@ import net.minecraft.world.World;
|
||||
*/
|
||||
public interface IPoolOverlayProvider {
|
||||
|
||||
public IIcon getIcon(World world, int x, int y, int z);
|
||||
|
||||
public IIcon getIcon(World world, int x, int y, int z);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [15/11/2015, 19:28:18 (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,13 +17,13 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IRedirectable extends IDirectioned {
|
||||
|
||||
public void setRotationX(float rot);
|
||||
public void setRotationX(float rot);
|
||||
|
||||
public void setRotationY(float rot);
|
||||
public void setRotationY(float rot);
|
||||
|
||||
/**
|
||||
* This should be called after rotation setting is done to allow
|
||||
* for the block to re-calculate.
|
||||
*/
|
||||
public void commitRedirection();
|
||||
/**
|
||||
* This should be called after rotation setting is done to allow
|
||||
* for the block to re-calculate.
|
||||
*/
|
||||
public void commitRedirection();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Apr 12, 2015, 3:08:09 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,6 +17,5 @@ package vazkii.botania.api.mana;
|
||||
*/
|
||||
public interface IThrottledPacket {
|
||||
|
||||
public void markDispatchable();
|
||||
|
||||
public void markDispatchable();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jul 22, 2014, 2:26:14 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -18,6 +18,5 @@ import net.minecraft.item.ItemStack;
|
||||
*/
|
||||
public interface ITinyPlanetExcempt {
|
||||
|
||||
public boolean shouldPull(ItemStack stack);
|
||||
|
||||
public boolean shouldPull(ItemStack stack);
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Mar 13, 2014, 5:32:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
@@ -17,239 +17,224 @@ import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
|
||||
/**
|
||||
* Requests mana from items in a given player's inventory.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* the amount of mana existent will be returned instead, if you want exact values use requestManaExact.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return The amount of mana received from the request.
|
||||
*/
|
||||
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if(stack == null)
|
||||
return 0;
|
||||
/**
|
||||
* Requests mana from items in a given player's inventory.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* the amount of mana existent will be returned instead, if you want exact values use requestManaExact.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return The amount of mana received from the request.
|
||||
*/
|
||||
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if (stack == null) return 0;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if (baublesInv != null) size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
for (int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if (stackInSlot == stack) continue;
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItem = (IManaItem) stackInSlot.getItem();
|
||||
if(manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) {
|
||||
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
|
||||
continue;
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItem = (IManaItem) stackInSlot.getItem();
|
||||
if (manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) {
|
||||
if (stack.getItem() instanceof IManaItem
|
||||
&& !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) continue;
|
||||
|
||||
int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot));
|
||||
int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot));
|
||||
|
||||
if(remove)
|
||||
manaItem.addMana(stackInSlot, -mana);
|
||||
if(useBaubles)
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
if (remove) manaItem.addMana(stackInSlot, -mana);
|
||||
if (useBaubles) BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
|
||||
return mana;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mana;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests an exact amount of mana from items in a given player's inventory.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* false will be returned instead, and nothing will happen.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return If the request was succesful.
|
||||
*/
|
||||
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if(stack == null)
|
||||
return false;
|
||||
/**
|
||||
* Requests an exact amount of mana from items in a given player's inventory.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* false will be returned instead, and nothing will happen.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return If the request was succesful.
|
||||
*/
|
||||
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if (stack == null) return false;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if (baublesInv != null) size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
for (int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if (stackInSlot == stack) continue;
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
if(manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) {
|
||||
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
|
||||
continue;
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
if (manaItemSlot.canExportManaToItem(stackInSlot, stack)
|
||||
&& manaItemSlot.getMana(stackInSlot) > manaToGet) {
|
||||
if (stack.getItem() instanceof IManaItem
|
||||
&& !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot)) continue;
|
||||
|
||||
if(remove)
|
||||
manaItemSlot.addMana(stackInSlot, -manaToGet);
|
||||
if(useBaubles)
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
if (remove) manaItemSlot.addMana(stackInSlot, -manaToGet);
|
||||
if (useBaubles) BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches mana to items in a given player's inventory. Note that this method
|
||||
* does not automatically remove mana from the item which is exporting.
|
||||
* @param manaToSend How much mana is to be sent.
|
||||
* @param remove If true, the mana will be added from the target item. Set to false to just check.
|
||||
* @return The amount of mana actually sent.
|
||||
*/
|
||||
public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if(stack == null)
|
||||
return 0;
|
||||
/**
|
||||
* Dispatches mana to items in a given player's inventory. Note that this method
|
||||
* does not automatically remove mana from the item which is exporting.
|
||||
* @param manaToSend How much mana is to be sent.
|
||||
* @param remove If true, the mana will be added from the target item. Set to false to just check.
|
||||
* @return The amount of mana actually sent.
|
||||
*/
|
||||
public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if (stack == null) return 0;
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if (baublesInv != null) size += baublesInv.getSizeInventory();
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
for (int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if (stackInSlot == stack) continue;
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
|
||||
if(manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) {
|
||||
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot))
|
||||
continue;
|
||||
if (manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) {
|
||||
if (stack.getItem() instanceof IManaItem
|
||||
&& !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot)) continue;
|
||||
|
||||
int received = 0;
|
||||
if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot))
|
||||
received = manaToSend;
|
||||
else received = manaToSend - (manaItemSlot.getMana(stackInSlot) + manaToSend - manaItemSlot.getMaxMana(stackInSlot));
|
||||
int received = 0;
|
||||
if (manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot))
|
||||
received = manaToSend;
|
||||
else
|
||||
received = manaToSend
|
||||
- (manaItemSlot.getMana(stackInSlot)
|
||||
+ manaToSend
|
||||
- manaItemSlot.getMaxMana(stackInSlot));
|
||||
|
||||
if (add) manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
if (useBaubles) BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
|
||||
if(add)
|
||||
manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
if(useBaubles)
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
return received;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return received;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Dispatches an exact amount of mana to items in a given player's inventory. Note that this method
|
||||
* does not automatically remove mana from the item which is exporting.
|
||||
* @param manaToSend How much mana is to be sent.
|
||||
* @param remove If true, the mana will be added from the target item. Set to false to just check.
|
||||
* @return If an item received the mana sent.
|
||||
*/
|
||||
public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if (stack == null) return false;
|
||||
|
||||
/**
|
||||
* Dispatches an exact amount of mana to items in a given player's inventory. Note that this method
|
||||
* does not automatically remove mana from the item which is exporting.
|
||||
* @param manaToSend How much mana is to be sent.
|
||||
* @param remove If true, the mana will be added from the target item. Set to false to just check.
|
||||
* @return If an item received the mana sent.
|
||||
*/
|
||||
public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if(stack == null)
|
||||
return false;
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if (baublesInv != null) size += baublesInv.getSizeInventory();
|
||||
|
||||
int invSize = mainInv.getSizeInventory();
|
||||
int size = invSize;
|
||||
if(baublesInv != null)
|
||||
size += baublesInv.getSizeInventory();
|
||||
for (int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if (stackInSlot == stack) continue;
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
boolean useBaubles = i >= invSize;
|
||||
IInventory inv = useBaubles ? baublesInv : mainInv;
|
||||
int slot = i - (useBaubles ? invSize : 0);
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot);
|
||||
if(stackInSlot == stack)
|
||||
continue;
|
||||
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
if (manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot)
|
||||
&& manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) {
|
||||
if (stack.getItem() instanceof IManaItem
|
||||
&& !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot)) continue;
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
|
||||
if(manaItemSlot.getMana(stackInSlot) + manaToSend <= manaItemSlot.getMaxMana(stackInSlot) && manaItemSlot.canReceiveManaFromItem(stackInSlot, stack)) {
|
||||
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canExportManaToItem(stack, stackInSlot))
|
||||
continue;
|
||||
if (add) manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
if (useBaubles) BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
|
||||
if(add)
|
||||
manaItemSlot.addMana(stackInSlot, manaToSend);
|
||||
if(useBaubles)
|
||||
BotaniaAPI.internalHandler.sendBaubleUpdatePacket(player, slot);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Requests mana from items in a given player's inventory. This version also
|
||||
* checks for IManaDiscountArmor items equipped to lower the cost.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* the amount of mana existent will be returned instead, if you want exact values use requestManaExact.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return The amount of mana received from the request.
|
||||
*/
|
||||
public static int requestManaForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
|
||||
int cost = (int) (manaToGet * multiplier);
|
||||
return (int) (requestMana(stack, player, cost, remove) / multiplier);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests mana from items in a given player's inventory. This version also
|
||||
* checks for IManaDiscountArmor items equipped to lower the cost.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* the amount of mana existent will be returned instead, if you want exact values use requestManaExact.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return The amount of mana received from the request.
|
||||
*/
|
||||
public static int requestManaForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
|
||||
int cost = (int) (manaToGet * multiplier);
|
||||
return (int) (requestMana(stack, player, cost, remove) / multiplier);
|
||||
}
|
||||
/**
|
||||
* Requests an exact amount of mana from items in a given player's inventory. This version also
|
||||
* checks for IManaDiscountArmor items equipped to lower the cost.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* false will be returned instead, and nothing will happen.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return If the request was succesful.
|
||||
*/
|
||||
public static boolean requestManaExactForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
|
||||
int cost = (int) (manaToGet * multiplier);
|
||||
return requestManaExact(stack, player, cost, remove);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests an exact amount of mana from items in a given player's inventory. This version also
|
||||
* checks for IManaDiscountArmor items equipped to lower the cost.
|
||||
* @param manaToGet How much mana is to be requested, if less mana exists than this amount,
|
||||
* false will be returned instead, and nothing will happen.
|
||||
* @param remove If true, the mana will be removed from the target item. Set to false to just check.
|
||||
* @return If the request was succesful.
|
||||
*/
|
||||
public static boolean requestManaExactForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
|
||||
int cost = (int) (manaToGet * multiplier);
|
||||
return requestManaExact(stack, player, cost, remove);
|
||||
}
|
||||
/**
|
||||
* Gets the sum of all the discounts on IManaDiscountArmor items equipped
|
||||
* on the player passed in.
|
||||
*/
|
||||
public static float getFullDiscountForTools(EntityPlayer player) {
|
||||
float discount = 0F;
|
||||
for (int i = 0; i < player.inventory.armorInventory.length; i++) {
|
||||
ItemStack armor = player.inventory.armorInventory[i];
|
||||
if (armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sum of all the discounts on IManaDiscountArmor items equipped
|
||||
* on the player passed in.
|
||||
*/
|
||||
public static float getFullDiscountForTools(EntityPlayer player) {
|
||||
float discount = 0F;
|
||||
for(int i = 0; i < player.inventory.armorInventory.length; i++) {
|
||||
ItemStack armor = player.inventory.armorInventory[i];
|
||||
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player);
|
||||
}
|
||||
|
||||
return discount;
|
||||
}
|
||||
return discount;
|
||||
}
|
||||
}
|
||||
@@ -2,55 +2,57 @@
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 5:04:30 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
|
||||
public class ManaNetworkEvent extends Event {
|
||||
|
||||
public final TileEntity tile;
|
||||
public final ManaBlockType type;
|
||||
public final Action action;
|
||||
public final TileEntity tile;
|
||||
public final ManaBlockType type;
|
||||
public final Action action;
|
||||
|
||||
public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) {
|
||||
this.tile = tile;
|
||||
this.type = type;
|
||||
this.action = action;
|
||||
}
|
||||
public ManaNetworkEvent(TileEntity tile, ManaBlockType type, Action action) {
|
||||
this.tile = tile;
|
||||
this.type = type;
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public static void addCollector(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
public static void addCollector(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void removeCollector(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
public static void removeCollector(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.COLLECTOR, Action.REMOVE);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void addPool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
public static void addPool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.ADD);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public static void removePool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.REMOVE);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
public static void removePool(TileEntity tile) {
|
||||
ManaNetworkEvent event = new ManaNetworkEvent(tile, ManaBlockType.POOL, Action.REMOVE);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
}
|
||||
|
||||
public enum ManaBlockType {
|
||||
POOL, COLLECTOR
|
||||
}
|
||||
public enum ManaBlockType {
|
||||
POOL,
|
||||
COLLECTOR
|
||||
}
|
||||
|
||||
public enum Action {
|
||||
REMOVE, ADD
|
||||
}
|
||||
public enum Action {
|
||||
REMOVE,
|
||||
ADD
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,11 @@ import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileSignature {
|
||||
|
||||
public final TileEntity tile;
|
||||
public final boolean remoteWorld;
|
||||
|
||||
public TileSignature(TileEntity tile, boolean remoteWorld) {
|
||||
this.tile = tile;
|
||||
this.remoteWorld = remoteWorld;
|
||||
}
|
||||
public final TileEntity tile;
|
||||
public final boolean remoteWorld;
|
||||
|
||||
public TileSignature(TileEntity tile, boolean remoteWorld) {
|
||||
this.tile = tile;
|
||||
this.remoteWorld = remoteWorld;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 927 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user