mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 15:03:03 +00:00
Step 1: File Standardization
This commit is contained in:
1 parent
69c287f828
commit
3f6fa103dc
1177 files changed
+2
-2
No files matched your search
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public final class BCLog {
|
||||
|
||||
public static final Logger logger = LogManager.getLogger("BuildCraft");
|
||||
|
||||
/**
|
||||
* Deactivate constructor
|
||||
*/
|
||||
private BCLog() {
|
||||
}
|
||||
|
||||
public static void initLog() {
|
||||
|
||||
logger.info("Starting BuildCraft " + getVersion());
|
||||
logger.info("Copyright (c) SpaceToad, 2011-2014");
|
||||
logger.info("http://www.mod-buildcraft.com");
|
||||
}
|
||||
|
||||
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
|
||||
StringBuilder msg = new StringBuilder(mod);
|
||||
msg.append(" API error, please update your mods. Error: ").append(error);
|
||||
StackTraceElement[] stackTrace = error.getStackTrace();
|
||||
if (stackTrace.length > 0) {
|
||||
msg.append(", ").append(stackTrace[0]);
|
||||
}
|
||||
|
||||
logger.log(Level.ERROR, msg.toString());
|
||||
|
||||
if (classFile != null) {
|
||||
msg = new StringBuilder(mod);
|
||||
msg.append(" API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
|
||||
logger.log(Level.ERROR, msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static String getVersion() {
|
||||
try {
|
||||
Class<?> clazz = Class.forName("buildcraft.core.Version");
|
||||
Method method = clazz.getDeclaredMethod("getVersion");
|
||||
return String.valueOf(method.invoke(null));
|
||||
} catch (Exception e) {
|
||||
return "UNKNOWN VERSION";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is a comparable container for block positions. TODO: should this be merged with position?
|
||||
*/
|
||||
public class BlockIndex implements Comparable<BlockIndex> {
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
|
||||
public BlockIndex() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an index for a block located on x, y. z
|
||||
*/
|
||||
public BlockIndex(int x, int y, int z) {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public BlockIndex(NBTTagCompound c) {
|
||||
this.x = c.getInteger("i");
|
||||
this.y = c.getInteger("j");
|
||||
this.z = c.getInteger("k");
|
||||
}
|
||||
|
||||
public BlockIndex(Entity entity) {
|
||||
x = (int) Math.floor(entity.posX);
|
||||
y = (int) Math.floor(entity.posY);
|
||||
z = (int) Math.floor(entity.posZ);
|
||||
}
|
||||
|
||||
public BlockIndex(TileEntity entity) {
|
||||
this(entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a deterministic and complete ordering of block positions.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(BlockIndex o) {
|
||||
|
||||
if (o.x < x) {
|
||||
return 1;
|
||||
} else if (o.x > x) {
|
||||
return -1;
|
||||
} else if (o.z < z) {
|
||||
return 1;
|
||||
} else if (o.z > z) {
|
||||
return -1;
|
||||
} else if (o.y < y) {
|
||||
return 1;
|
||||
} else if (o.y > y) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void writeTo(NBTTagCompound c) {
|
||||
c.setInteger("i", x);
|
||||
c.setInteger("j", y);
|
||||
c.setInteger("k", z);
|
||||
}
|
||||
|
||||
public Block getBlock(World world) {
|
||||
return world.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof BlockIndex) {
|
||||
BlockIndex b = (BlockIndex) obj;
|
||||
|
||||
return b.x == x && b.y == y && b.z == z;
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (x * 37 + y) * 37 + z;
|
||||
}
|
||||
|
||||
public boolean nextTo(BlockIndex blockIndex) {
|
||||
return (Math.abs(blockIndex.x - x) <= 1 && blockIndex.y == y && blockIndex.z == z)
|
||||
|| (blockIndex.x == x && Math.abs(blockIndex.y - y) <= 1 && blockIndex.z == z)
|
||||
|| (blockIndex.x == x && blockIndex.y == y && Math.abs(blockIndex.z - z) <= 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class BlockMetaPair implements Comparable<BlockMetaPair> {
|
||||
private int id, meta;
|
||||
|
||||
public BlockMetaPair(Block block, int meta) {
|
||||
this.id = Block.getIdFromBlock(block);
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return Block.getBlockById(id);
|
||||
}
|
||||
|
||||
public int meta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 17 * meta + id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null || !(other instanceof BlockMetaPair)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((BlockMetaPair) other).id == id && ((BlockMetaPair) other).meta == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockMetaPair arg) {
|
||||
if (arg.id != id) {
|
||||
return (id - arg.id) * 16;
|
||||
} else {
|
||||
return meta - arg.meta;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.getBlock() == null) {
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
return Block.blockRegistry.getNameForObject(this.getBlock()) + ":" + (this.meta == OreDictionary.WILDCARD_VALUE ? "*" : this.meta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class BuildCraftAPI {
|
||||
|
||||
public static ICoreProxy proxy;
|
||||
|
||||
public static final Set<Block> softBlocks = new HashSet<Block>();
|
||||
|
||||
public static IWorldProperty isSoftProperty;
|
||||
public static IWorldProperty isWoodProperty;
|
||||
public static IWorldProperty isLeavesProperty;
|
||||
public static IWorldProperty[] isOreProperty;
|
||||
public static IWorldProperty isHarvestableProperty;
|
||||
public static IWorldProperty isFarmlandProperty;
|
||||
public static IWorldProperty isDirtProperty;
|
||||
public static IWorldProperty isShoveled;
|
||||
public static IWorldProperty isFluidSource;
|
||||
|
||||
/**
|
||||
* Deactivate constructor
|
||||
*/
|
||||
private BuildCraftAPI() {
|
||||
}
|
||||
|
||||
public static boolean isSoftBlock(World world, int x, int y, int z) {
|
||||
return isSoftProperty.get(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumColor {
|
||||
|
||||
BLACK,
|
||||
RED,
|
||||
GREEN,
|
||||
BROWN,
|
||||
BLUE,
|
||||
PURPLE,
|
||||
CYAN,
|
||||
LIGHT_GRAY,
|
||||
GRAY,
|
||||
PINK,
|
||||
LIME,
|
||||
YELLOW,
|
||||
LIGHT_BLUE,
|
||||
MAGENTA,
|
||||
ORANGE,
|
||||
WHITE;
|
||||
public static final EnumColor[] VALUES = values();
|
||||
public static final String[] DYES = {
|
||||
"dyeBlack",
|
||||
"dyeRed",
|
||||
"dyeGreen",
|
||||
"dyeBrown",
|
||||
"dyeBlue",
|
||||
"dyePurple",
|
||||
"dyeCyan",
|
||||
"dyeLightGray",
|
||||
"dyeGray",
|
||||
"dyePink",
|
||||
"dyeLime",
|
||||
"dyeYellow",
|
||||
"dyeLightBlue",
|
||||
"dyeMagenta",
|
||||
"dyeOrange",
|
||||
"dyeWhite"};
|
||||
public static final String[] NAMES = {
|
||||
"Black",
|
||||
"Red",
|
||||
"Green",
|
||||
"Brown",
|
||||
"Blue",
|
||||
"Purple",
|
||||
"Cyan",
|
||||
"LightGray",
|
||||
"Gray",
|
||||
"Pink",
|
||||
"Lime",
|
||||
"Yellow",
|
||||
"LightBlue",
|
||||
"Magenta",
|
||||
"Orange",
|
||||
"White"};
|
||||
public static final int[] DARK_HEX = {
|
||||
0x2D2D2D,
|
||||
0xA33835,
|
||||
0x394C1E,
|
||||
0x5C3A24,
|
||||
0x3441A2,
|
||||
0x843FBF,
|
||||
0x36809E,
|
||||
0x888888,
|
||||
0x444444,
|
||||
0xE585A0,
|
||||
0x3FAA36,
|
||||
0xCFC231,
|
||||
0x7F9AD1,
|
||||
0xFF64FF,
|
||||
0xFF6A00,
|
||||
0xFFFFFF};
|
||||
public static final int[] LIGHT_HEX = {
|
||||
0x181414,
|
||||
0xBE2B27,
|
||||
0x007F0E,
|
||||
0x89502D,
|
||||
0x253193,
|
||||
0x7e34bf,
|
||||
0x299799,
|
||||
0xa0a7a7,
|
||||
0x7A7A7A,
|
||||
0xD97199,
|
||||
0x39D52E,
|
||||
0xFFD91C,
|
||||
0x66AAFF,
|
||||
0xD943C6,
|
||||
0xEA7835,
|
||||
0xe4e4e4};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[] brushIcons;
|
||||
|
||||
public int getDarkHex() {
|
||||
return DARK_HEX[ordinal()];
|
||||
}
|
||||
|
||||
public int getLightHex() {
|
||||
return LIGHT_HEX[ordinal()];
|
||||
}
|
||||
|
||||
public static EnumColor fromId(int id) {
|
||||
if (id < 0 || id >= VALUES.length) {
|
||||
return WHITE;
|
||||
}
|
||||
return VALUES[id];
|
||||
}
|
||||
|
||||
public static EnumColor fromDye(String dyeTag) {
|
||||
for (int id = 0; id < DYES.length; id++) {
|
||||
if (DYES[id].equals(dyeTag)) {
|
||||
return VALUES[id];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EnumColor fromName(String name) {
|
||||
for (int id = 0; id < NAMES.length; id++) {
|
||||
if (NAMES[id].equals(name)) {
|
||||
return VALUES[id];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EnumColor getRand() {
|
||||
return VALUES[new Random().nextInt(VALUES.length)];
|
||||
}
|
||||
|
||||
public EnumColor getNext() {
|
||||
EnumColor next = VALUES[(ordinal() + 1) % VALUES.length];
|
||||
return next;
|
||||
}
|
||||
|
||||
public EnumColor getPrevious() {
|
||||
EnumColor previous = VALUES[(ordinal() + VALUES.length - 1) % VALUES.length];
|
||||
return previous;
|
||||
}
|
||||
|
||||
public EnumColor inverse() {
|
||||
return EnumColor.VALUES[15 - ordinal()];
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return "color." + name().replace("_", ".").toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getBasicTag() {
|
||||
return name().replace("_", ".").toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return NAMES[ordinal()];
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return StatCollector.translateToLocal(getTag());
|
||||
}
|
||||
|
||||
public String getDye() {
|
||||
return DYES[ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = name().replace("_", " ");
|
||||
String[] words = s.split(" ");
|
||||
StringBuilder b = new StringBuilder();
|
||||
for (String word : words) {
|
||||
b.append(word.charAt(0)).append(word.substring(1).toLowerCase(Locale.ENGLISH)).append(" ");
|
||||
}
|
||||
return b.toString().trim();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister iconRegister) {
|
||||
brushIcons = new IIcon[16];
|
||||
for (EnumColor c : values()) {
|
||||
brushIcons[c.ordinal()] = iconRegister.registerIcon("buildcraft:triggers/color_"
|
||||
+ c.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return brushIcons [ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
/**
|
||||
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
|
||||
*/
|
||||
public interface IAreaProvider {
|
||||
|
||||
int xMin();
|
||||
|
||||
int yMin();
|
||||
|
||||
int zMin();
|
||||
|
||||
int xMax();
|
||||
|
||||
int yMax();
|
||||
|
||||
int zMax();
|
||||
|
||||
/**
|
||||
* Remove from the world all objects used to define the area.
|
||||
*/
|
||||
void removeFromWorld();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
public interface IBox extends IZone {
|
||||
|
||||
IBox expand(int amount);
|
||||
|
||||
IBox contract(int amount);
|
||||
|
||||
Position pMin();
|
||||
|
||||
Position pMax();
|
||||
|
||||
void createLaserData();
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public interface ICoreProxy {
|
||||
WeakReference<EntityPlayer> getBuildCraftPlayer(WorldServer world);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IIconProvider {
|
||||
|
||||
/**
|
||||
* @param iconIndex
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon(int iconIndex);
|
||||
|
||||
/**
|
||||
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
|
||||
* @param iconRegister
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IInvSlot {
|
||||
/**
|
||||
* Returns the slot number of the underlying Inventory.
|
||||
*
|
||||
* @return the slot number
|
||||
*/
|
||||
int getIndex();
|
||||
|
||||
boolean canPutStackInSlot(ItemStack stack);
|
||||
|
||||
boolean canTakeStackFromSlot(ItemStack stack);
|
||||
|
||||
ItemStack decreaseStackInSlot(int amount);
|
||||
|
||||
ItemStack getStackInSlot();
|
||||
|
||||
void setStackInSlot(ItemStack stack);
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IWorldProperty {
|
||||
|
||||
boolean get(World world, int x, int y, int z);
|
||||
|
||||
void clear();
|
||||
}
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public interface IZone {
|
||||
|
||||
double distanceTo(BlockIndex index);
|
||||
|
||||
boolean contains(double x, double y, double z);
|
||||
|
||||
BlockIndex getRandomBlockIndex(Random rand);
|
||||
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class JavaTools {
|
||||
public static double bounds(double value, double min, double max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
|
||||
public static <T> T[] concat(T[] first, T[] second) {
|
||||
T[] result = Arrays.copyOf(first, first.length + second.length);
|
||||
System.arraycopy(second, 0, result, first.length, second.length);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int[] concat(int[] first, int[] second) {
|
||||
int[] result = Arrays.copyOf(first, first.length + second.length);
|
||||
System.arraycopy(second, 0, result, first.length, second.length);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static float[] concat(float[] first, float[] second) {
|
||||
float[] result = Arrays.copyOf(first, first.length + second.length);
|
||||
System.arraycopy(second, 0, result, first.length, second.length);
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> T[] concatenate (T[] a, T[] b) {
|
||||
int aLen = a.length;
|
||||
int bLen = b.length;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T[] c = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen);
|
||||
System.arraycopy(a, 0, c, 0, aLen);
|
||||
System.arraycopy(b, 0, c, aLen, bLen);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public static List<Field> getAllFields(Class<?> clas) {
|
||||
List<Field> result = new ArrayList<Field>();
|
||||
|
||||
Class<?> current = clas;
|
||||
|
||||
while (current != null && current != Object.class) {
|
||||
for (Field f : current.getDeclaredFields()) {
|
||||
result.add(f);
|
||||
}
|
||||
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Method> getAllMethods(Class<?> clas) {
|
||||
List<Method> result = new ArrayList<Method>();
|
||||
|
||||
Class<?> current = clas;
|
||||
|
||||
while (current != null && current != Object.class) {
|
||||
for (Method m : current.getDeclaredMethods()) {
|
||||
result.add(m);
|
||||
}
|
||||
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String surroundWithQuotes(String stringToSurroundWithQuotes) {
|
||||
return String.format("\"%s\"", stringToSurroundWithQuotes);
|
||||
}
|
||||
|
||||
public static String stripSurroundingQuotes(String stringToStripQuotes) {
|
||||
return stringToStripQuotes.replaceAll("^\"|\"$", "");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
public @interface NetworkData {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Position {
|
||||
|
||||
@NetworkData
|
||||
public double x, y, z;
|
||||
|
||||
@NetworkData
|
||||
public ForgeDirection orientation;
|
||||
|
||||
public Position() {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = corientation;
|
||||
|
||||
if (orientation == null) {
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public Position(Position p) {
|
||||
x = p.x;
|
||||
y = p.y;
|
||||
z = p.z;
|
||||
orientation = p.orientation;
|
||||
}
|
||||
|
||||
public Position(NBTTagCompound nbttagcompound) {
|
||||
readFromNBT(nbttagcompound);
|
||||
}
|
||||
|
||||
public Position(TileEntity tile) {
|
||||
x = tile.xCoord;
|
||||
y = tile.yCoord;
|
||||
z = tile.zCoord;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public Position(BlockIndex index) {
|
||||
x = index.x;
|
||||
y = index.y;
|
||||
z = index.z;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public void moveRight(double step) {
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
x = x - step;
|
||||
break;
|
||||
case NORTH:
|
||||
x = x + step;
|
||||
break;
|
||||
case EAST:
|
||||
z = z + step;
|
||||
break;
|
||||
case WEST:
|
||||
z = z - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveLeft(double step) {
|
||||
moveRight(-step);
|
||||
}
|
||||
|
||||
public void moveForwards(double step) {
|
||||
switch (orientation) {
|
||||
case UP:
|
||||
y = y + step;
|
||||
break;
|
||||
case DOWN:
|
||||
y = y - step;
|
||||
break;
|
||||
case SOUTH:
|
||||
z = z + step;
|
||||
break;
|
||||
case NORTH:
|
||||
z = z - step;
|
||||
break;
|
||||
case EAST:
|
||||
x = x + step;
|
||||
break;
|
||||
case WEST:
|
||||
x = x - step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
public void moveBackwards(double step) {
|
||||
moveForwards(-step);
|
||||
}
|
||||
|
||||
public void moveUp(double step) {
|
||||
switch (orientation) {
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
case EAST:
|
||||
case WEST:
|
||||
y = y + step;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void moveDown(double step) {
|
||||
moveUp(-step);
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
if (orientation == null) {
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
nbttagcompound.setDouble("i", x);
|
||||
nbttagcompound.setDouble("j", y);
|
||||
nbttagcompound.setDouble("k", z);
|
||||
nbttagcompound.setByte("orientation", (byte) orientation.ordinal());
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||
x = nbttagcompound.getDouble("i");
|
||||
y = nbttagcompound.getDouble("j");
|
||||
z = nbttagcompound.getDouble("k");
|
||||
orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")];
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
public Position min(Position p) {
|
||||
return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z);
|
||||
}
|
||||
|
||||
public Position max(Position p) {
|
||||
return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z);
|
||||
}
|
||||
|
||||
public boolean isClose(Position newPosition, float f) {
|
||||
double dx = x - newPosition.x;
|
||||
double dy = y - newPosition.y;
|
||||
double dz = z - newPosition.z;
|
||||
|
||||
double sqrDis = dx * dx + dy * dy + dz * dz;
|
||||
|
||||
return !(sqrDis > f * f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class SafeTimeTracker {
|
||||
|
||||
private long lastMark = Long.MIN_VALUE;
|
||||
private long duration = -1;
|
||||
private long randomRange = 0;
|
||||
private long lastRandomDelay = 0;
|
||||
private long internalDelay = 1;
|
||||
|
||||
/**
|
||||
* @deprecated should use constructors with parameters instead
|
||||
*/
|
||||
public SafeTimeTracker () {
|
||||
|
||||
}
|
||||
|
||||
public SafeTimeTracker (long delay) {
|
||||
internalDelay = delay;
|
||||
}
|
||||
|
||||
/**
|
||||
* In many situations, it is a bad idea to have all objects of the same
|
||||
* kind to be waiting for the exact same amount of time, as that can lead
|
||||
* to some situation where they're all synchronized and got to work all
|
||||
* at the same time. When created with a random range, the mark that is set
|
||||
* when reaching the expect delay will be added with a random number
|
||||
* between [0, range[, meaning that the event will take between 0 and range
|
||||
* more tick to run.
|
||||
*/
|
||||
public SafeTimeTracker (long delay, long random) {
|
||||
internalDelay = delay;
|
||||
randomRange = random;
|
||||
}
|
||||
|
||||
public boolean markTimeIfDelay(World world) {
|
||||
return markTimeIfDelay(world, internalDelay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if a given delay has passed since last time marked was called
|
||||
* successfully.
|
||||
*
|
||||
* @deprecated should use the constructor with a delay instead, and call
|
||||
* this function without a parameter
|
||||
*/
|
||||
public boolean markTimeIfDelay(World world, long delay) {
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long currentTime = world.getTotalWorldTime();
|
||||
|
||||
if (currentTime < lastMark) {
|
||||
lastMark = currentTime;
|
||||
return false;
|
||||
} else if (lastMark + delay + lastRandomDelay <= currentTime) {
|
||||
duration = currentTime - lastMark;
|
||||
lastMark = currentTime;
|
||||
lastRandomDelay = (int) (Math.random() * randomRange);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public long durationOfLastDelay() {
|
||||
return duration > 0 ? duration : 0;
|
||||
}
|
||||
|
||||
public void markTime(World world) {
|
||||
lastMark = world.getTotalWorldTime();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* This class is used whenever stacks needs to be stored as keys.
|
||||
*/
|
||||
public final class StackKey {
|
||||
public final ItemStack stack;
|
||||
public final FluidStack fluidStack;
|
||||
|
||||
public StackKey(FluidStack fluidStack) {
|
||||
this(null, fluidStack);
|
||||
}
|
||||
|
||||
public StackKey(ItemStack stack) {
|
||||
this(stack, null);
|
||||
}
|
||||
|
||||
public StackKey(ItemStack stack, FluidStack fluidStack) {
|
||||
this.stack = stack;
|
||||
this.fluidStack = fluidStack;
|
||||
}
|
||||
|
||||
public static StackKey stack(Item item, int amount, int damage) {
|
||||
return new StackKey(new ItemStack(item, amount, damage));
|
||||
}
|
||||
|
||||
public static StackKey stack(Block block, int amount, int damage) {
|
||||
return new StackKey(new ItemStack(block, amount, damage));
|
||||
}
|
||||
|
||||
public static StackKey stack(Item item) {
|
||||
return new StackKey(new ItemStack(item, 1, 0));
|
||||
}
|
||||
|
||||
public static StackKey stack(Block block) {
|
||||
return new StackKey(new ItemStack(block, 1, 0));
|
||||
}
|
||||
|
||||
public static StackKey stack(ItemStack itemStack) {
|
||||
return new StackKey(itemStack);
|
||||
}
|
||||
|
||||
public static StackKey fluid(Fluid fluid, int amount) {
|
||||
return new StackKey(new FluidStack(fluid, amount));
|
||||
}
|
||||
|
||||
public static StackKey fluid(Fluid fluid) {
|
||||
return new StackKey(new FluidStack(fluid, FluidContainerRegistry.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
public static StackKey fluid(FluidStack fluidStack) {
|
||||
return new StackKey(fluidStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || o.getClass() != StackKey.class) {
|
||||
return false;
|
||||
}
|
||||
StackKey k = (StackKey) o;
|
||||
if ((stack == null ^ k.stack == null) || (fluidStack == null ^ k.fluidStack == null)) {
|
||||
return false;
|
||||
}
|
||||
if (stack != null) {
|
||||
if (stack.getItem() != k.stack.getItem() ||
|
||||
stack.getHasSubtypes() && stack.getItemDamage() != k.stack.getItemDamage() ||
|
||||
!objectsEqual(stack.getTagCompound(), k.stack.getTagCompound())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (fluidStack != null) {
|
||||
if (fluidStack.fluidID != k.fluidStack.fluidID ||
|
||||
fluidStack.amount != k.fluidStack.amount ||
|
||||
!objectsEqual(fluidStack.tag, k.fluidStack.tag)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 7;
|
||||
if (stack != null) {
|
||||
result = 31 * result + stack.getItem().hashCode();
|
||||
result = 31 * result + stack.getItemDamage();
|
||||
result = 31 * result + objectHashCode(stack.getTagCompound());
|
||||
}
|
||||
result = 31 * result + 7;
|
||||
if (fluidStack != null) {
|
||||
result = 31 * result + fluidStack.fluidID;
|
||||
result = 31 * result + fluidStack.amount;
|
||||
result = 31 * result + objectHashCode(fluidStack.tag);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean objectsEqual(Object o1, Object o2) {
|
||||
if (o1 == null && o2 == null) {
|
||||
return true;
|
||||
} else if (o1 == null || o2 == null) {
|
||||
return false;
|
||||
} else {
|
||||
return o1.equals(o2);
|
||||
}
|
||||
}
|
||||
|
||||
private int objectHashCode(Object o) {
|
||||
return o != null ? o.hashCode() : 0;
|
||||
}
|
||||
|
||||
public StackKey copy() {
|
||||
return new StackKey(stack != null ? stack.copy() : null,
|
||||
fluidStack != null ? fluidStack.copy() : null);
|
||||
}
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is a comparable container for block positions. TODO: should this be merged with position?
|
||||
*/
|
||||
public class WorldBlockIndex implements Comparable<WorldBlockIndex> {
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public int dimension;
|
||||
|
||||
public WorldBlockIndex() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an index for a block located on x, y. z
|
||||
*/
|
||||
public WorldBlockIndex(World world, int x, int y, int z) {
|
||||
|
||||
dimension = world.provider.dimensionId;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public WorldBlockIndex(NBTTagCompound c) {
|
||||
dimension = c.getInteger("dimension");
|
||||
x = c.getInteger("x");
|
||||
y = c.getInteger("y");
|
||||
z = c.getInteger("z");
|
||||
}
|
||||
|
||||
public WorldBlockIndex(Entity entity) {
|
||||
dimension = entity.worldObj.provider.dimensionId;
|
||||
x = (int) Math.floor(entity.posX);
|
||||
y = (int) Math.floor(entity.posY);
|
||||
z = (int) Math.floor(entity.posZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a deterministic and complete ordering of block positions.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(WorldBlockIndex o) {
|
||||
|
||||
if (o.dimension < dimension) {
|
||||
return 1;
|
||||
} else if (o.dimension > dimension) {
|
||||
return -1;
|
||||
} else if (o.x < x) {
|
||||
return 1;
|
||||
} else if (o.x > x) {
|
||||
return -1;
|
||||
} else if (o.z < z) {
|
||||
return 1;
|
||||
} else if (o.z > z) {
|
||||
return -1;
|
||||
} else if (o.y < y) {
|
||||
return 1;
|
||||
} else if (o.y > y) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void writeTo(NBTTagCompound c) {
|
||||
c.setInteger("dimension", dimension);
|
||||
c.setInteger("x", x);
|
||||
c.setInteger("y", y);
|
||||
c.setInteger("z", z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + dimension + ":" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof WorldBlockIndex) {
|
||||
WorldBlockIndex b = (WorldBlockIndex) obj;
|
||||
|
||||
return b.dimension == dimension && b.x == x && b.y == y && b.z == z;
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (dimension * 37 + (x * 37 + y)) * 37 + z;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
package buildcraft.api.core;
|
||||
import cpw.mods.fml.common.API;
|
||||
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import buildcraft.api.statements.IActionInternal;
|
||||
import buildcraft.api.statements.IStatement;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
|
||||
public abstract class GateExpansionController {
|
||||
|
||||
public final IGateExpansion type;
|
||||
public final TileEntity pipeTile;
|
||||
|
||||
public GateExpansionController(IGateExpansion type, TileEntity pipeTile) {
|
||||
this.pipeTile = pipeTile;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public IGateExpansion getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void tick(IGate gate) {
|
||||
}
|
||||
|
||||
public void startResolution() {
|
||||
}
|
||||
|
||||
public boolean resolveAction(IStatement action) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isTriggerActive(IStatement trigger, IStatementParameter[] parameters) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addTriggers(List<ITriggerInternal> list) {
|
||||
}
|
||||
|
||||
public void addActions(List<IActionInternal> list) {
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public final class GateExpansions {
|
||||
|
||||
private static final Map<String, IGateExpansion> expansions = new HashMap<String, IGateExpansion>();
|
||||
private static final ArrayList<IGateExpansion> expansionIDs = new ArrayList<IGateExpansion>();
|
||||
|
||||
private GateExpansions() {
|
||||
}
|
||||
|
||||
public static void registerExpansion(IGateExpansion expansion) {
|
||||
registerExpansion(expansion.getUniqueIdentifier(), expansion);
|
||||
}
|
||||
|
||||
public static void registerExpansion(String identifier, IGateExpansion expansion) {
|
||||
expansions.put(identifier, expansion);
|
||||
expansionIDs.add(expansion);
|
||||
}
|
||||
|
||||
public static IGateExpansion getExpansion(String identifier) {
|
||||
return expansions.get(identifier);
|
||||
}
|
||||
|
||||
public static Set<IGateExpansion> getExpansions() {
|
||||
Set<IGateExpansion> set = new HashSet<IGateExpansion>();
|
||||
set.addAll(expansionIDs);
|
||||
return set;
|
||||
}
|
||||
|
||||
// The code below is used by networking.
|
||||
|
||||
public static IGateExpansion getExpansionByID(int id) {
|
||||
return expansionIDs.get(id);
|
||||
}
|
||||
|
||||
public static int getExpansionID(IGateExpansion expansion) {
|
||||
return expansionIDs.indexOf(expansion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IGate {
|
||||
@Deprecated
|
||||
void setPulsing(boolean pulse);
|
||||
|
||||
ForgeDirection getSide();
|
||||
|
||||
IPipe getPipe();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface IGateExpansion {
|
||||
|
||||
String getUniqueIdentifier();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
GateExpansionController makeController(TileEntity pipeTile);
|
||||
|
||||
void registerBlockOverlay(IIconRegister iconRegister);
|
||||
|
||||
void registerItemOverlay(IIconRegister iconRegister);
|
||||
|
||||
IIcon getOverlayBlock();
|
||||
|
||||
IIcon getOverlayItem();
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
@API(apiVersion = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
||||
package buildcraft.api.gates;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public class ActionState {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IActionExternal extends IStatement {
|
||||
|
||||
void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface IActionInternal extends IStatement {
|
||||
|
||||
void actionActivate(IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IActionProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of actions that are available from the statement container holding the
|
||||
* gate.
|
||||
*/
|
||||
Collection<IActionInternal> getInternalActions(IStatementContainer container);
|
||||
|
||||
/**
|
||||
* Returns the list of actions available to a gate next to the given block.
|
||||
*/
|
||||
Collection<IActionExternal> getExternalActions(ForgeDirection side, TileEntity tile);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface IActionReceptor {
|
||||
void actionActivated(IStatement statement, IStatementParameter[] parameters);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IOverrideDefaultStatements {
|
||||
List<ITriggerExternal> overrideTriggers();
|
||||
List<IActionExternal> overrideActions();
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IStatement {
|
||||
|
||||
/**
|
||||
* Every trigger needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
String getUniqueTag();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
/**
|
||||
* Return the maximum number of parameter this trigger can have, 0 if none.
|
||||
*/
|
||||
int maxParameters();
|
||||
|
||||
/**
|
||||
* Return the minimum number of parameter this trigger can have, 0 if none.
|
||||
*/
|
||||
int minParameters();
|
||||
|
||||
/**
|
||||
* Return the trigger description in the UI
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* Create parameters for the trigger.
|
||||
*/
|
||||
IStatementParameter createParameter(int index);
|
||||
|
||||
/**
|
||||
* This returns the trigger after a left rotation. Used in particular in
|
||||
* blueprints orientation.
|
||||
*/
|
||||
IStatement rotateLeft();
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* This is implemented by objects containing Statements, such as
|
||||
* Gates and TileEntities.
|
||||
*/
|
||||
public interface IStatementContainer {
|
||||
TileEntity getTile();
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IStatementParameter {
|
||||
|
||||
/**
|
||||
* Every parameter needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
String getUniqueTag();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon();
|
||||
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* Something that is initially unintuitive: you HAVE to
|
||||
* keep your icons as static variables, due to the fact
|
||||
* that every IStatementParameter is instantiated upon creation,
|
||||
* in opposition to IStatements which are singletons (due to the
|
||||
* fact that they, unlike Parameters, store no additional data)
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
/**
|
||||
* Return the parameter description in the UI
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse);
|
||||
|
||||
void readFromNBT(NBTTagCompound compound);
|
||||
|
||||
void writeToNBT(NBTTagCompound compound);
|
||||
|
||||
/**
|
||||
* This returns the parameter after a left rotation. Used in particular in
|
||||
* blueprints orientation.
|
||||
*/
|
||||
IStatementParameter rotateLeft();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ITriggerExternal extends IStatement {
|
||||
|
||||
boolean isTriggerActive(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface ITriggerInternal extends IStatement {
|
||||
|
||||
boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ITriggerProvider {
|
||||
|
||||
/**
|
||||
* Returns the list of triggers that are available from the object holding the gate.
|
||||
*/
|
||||
Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container);
|
||||
|
||||
/**
|
||||
* Returns the list of triggers available to a gate next to the given block.
|
||||
*/
|
||||
Collection<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity tile);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public final class StatementManager {
|
||||
|
||||
public static Map<String, IStatement> statements = new HashMap<String, IStatement>();
|
||||
public static Map<String, Class<? extends IStatementParameter>> parameters = new HashMap<String, Class<? extends IStatementParameter>>();
|
||||
private static List<ITriggerProvider> triggerProviders = new LinkedList<ITriggerProvider>();
|
||||
private static List<IActionProvider> actionProviders = new LinkedList<IActionProvider>();
|
||||
|
||||
/**
|
||||
* Deactivate constructor
|
||||
*/
|
||||
private StatementManager() {
|
||||
}
|
||||
|
||||
public static void registerTriggerProvider(ITriggerProvider provider) {
|
||||
if (provider != null && !triggerProviders.contains(provider)) {
|
||||
triggerProviders.add(provider);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerActionProvider(IActionProvider provider) {
|
||||
if (provider != null && !actionProviders.contains(provider)) {
|
||||
actionProviders.add(provider);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerStatement(IStatement statement) {
|
||||
statements.put(statement.getUniqueTag(), statement);
|
||||
}
|
||||
|
||||
public static void registerParameterClass(Class<? extends IStatementParameter> param) {
|
||||
parameters.put(createParameter(param).getUniqueTag(), param);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void registerParameterClass(String name, Class<? extends IStatementParameter> param) {
|
||||
parameters.put(name, param);
|
||||
}
|
||||
|
||||
public static List<ITriggerExternal> getExternalTriggers(ForgeDirection side, TileEntity entity) {
|
||||
List<ITriggerExternal> result;
|
||||
|
||||
if (entity instanceof IOverrideDefaultStatements) {
|
||||
result = ((IOverrideDefaultStatements) entity).overrideTriggers();
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
result = new LinkedList<ITriggerExternal>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
Collection<ITriggerExternal> toAdd = provider.getExternalTriggers(side, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITriggerExternal t : toAdd) {
|
||||
if (!result.contains(t)) {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<IActionExternal> getExternalActions(ForgeDirection side, TileEntity entity) {
|
||||
List<IActionExternal> result = new LinkedList<IActionExternal>();
|
||||
|
||||
if (entity instanceof IOverrideDefaultStatements) {
|
||||
result = ((IOverrideDefaultStatements) entity).overrideActions();
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
Collection<IActionExternal> toAdd = provider.getExternalActions(side, entity);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IActionExternal t : toAdd) {
|
||||
if (!result.contains(t)) {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
List<ITriggerInternal> result = new LinkedList<ITriggerInternal>();
|
||||
|
||||
for (ITriggerProvider provider : triggerProviders) {
|
||||
Collection<ITriggerInternal> toAdd = provider.getInternalTriggers(container);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (ITriggerInternal t : toAdd) {
|
||||
if (!result.contains(t)) {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<IActionInternal> getInternalActions(IStatementContainer container) {
|
||||
List<IActionInternal> result = new LinkedList<IActionInternal>();
|
||||
|
||||
for (IActionProvider provider : actionProviders) {
|
||||
Collection<IActionInternal> toAdd = provider.getInternalActions(container);
|
||||
|
||||
if (toAdd != null) {
|
||||
for (IActionInternal t : toAdd) {
|
||||
if (!result.contains(t)) {
|
||||
result.add(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static IStatementParameter createParameter(String kind) {
|
||||
return createParameter(parameters.get(kind));
|
||||
}
|
||||
|
||||
private static IStatementParameter createParameter(Class<? extends IStatementParameter> param) {
|
||||
try {
|
||||
return param.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generally, this function should be called by every mod implementing
|
||||
* the Statements API ***as a container*** (that is, adding its own gates)
|
||||
* on the client side from a given Item of choice.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister register) {
|
||||
for (IStatement statement : statements.values()) {
|
||||
statement.registerIcons(register);
|
||||
}
|
||||
|
||||
for (Class<? extends IStatementParameter> parameter : parameters.values()) {
|
||||
createParameter(parameter).registerIcons(register);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public final class StatementMouseClick {
|
||||
private int button;
|
||||
private boolean shift;
|
||||
|
||||
public StatementMouseClick(int button, boolean shift) {
|
||||
this.button = button;
|
||||
this.shift = shift;
|
||||
}
|
||||
|
||||
public boolean isShift() {
|
||||
return shift;
|
||||
}
|
||||
|
||||
public int getButton() {
|
||||
return button;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class StatementParameterItemStack implements IStatementParameter {
|
||||
|
||||
protected ItemStack stack;
|
||||
|
||||
@Override
|
||||
public IIcon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(IStatementContainer source, IStatement stmt, ItemStack stack, StatementMouseClick mouse) {
|
||||
if (stack != null) {
|
||||
this.stack = stack.copy();
|
||||
this.stack.stackSize = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound) {
|
||||
if (stack != null) {
|
||||
NBTTagCompound tagCompound = new NBTTagCompound();
|
||||
stack.writeToNBT(tagCompound);
|
||||
compound.setTag("stack", tagCompound);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound) {
|
||||
stack = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("stack"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof StatementParameterItemStack) {
|
||||
StatementParameterItemStack param = (StatementParameterItemStack) object;
|
||||
|
||||
return ItemStack.areItemStacksEqual(stack, param.stack)
|
||||
&& ItemStack.areItemStackTagsEqual(stack, param.stack);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
if (stack != null) {
|
||||
return stack.getDisplayName();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUniqueTag() {
|
||||
return "buildcraft:stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatementParameter rotateLeft() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
@API(apiVersion = "1.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
||||
package buildcraft.api.statements;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implement and register with the PipeManager if you want to suppress connections from wooden pipes.
|
||||
*/
|
||||
public interface IExtractionHandler {
|
||||
|
||||
/**
|
||||
* Can this pipe extract items from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractItems(Object extractor, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractFluids(Object extractor, World world, int i, int j, int k);
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.gates.IGate;
|
||||
|
||||
public interface IPipe {
|
||||
|
||||
int x();
|
||||
|
||||
int y();
|
||||
|
||||
int z();
|
||||
|
||||
IPipeTile getTile();
|
||||
|
||||
IGate getGate(ForgeDirection side);
|
||||
|
||||
boolean hasGate(ForgeDirection side);
|
||||
|
||||
boolean isWired(PipeWire wire);
|
||||
|
||||
boolean isWireActive(PipeWire wire);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
public interface IPipeConnection {
|
||||
|
||||
enum ConnectOverride {
|
||||
|
||||
CONNECT, DISCONNECT, DEFAULT
|
||||
};
|
||||
|
||||
/**
|
||||
* Allows you to override pipe connection logic.
|
||||
*
|
||||
* @param type
|
||||
* @param with
|
||||
* @return CONNECT to force a connection, DISCONNECT to force no connection,
|
||||
* and DEFAULT to let the pipe decide.
|
||||
*/
|
||||
ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IPipePluggable {
|
||||
void writeToNBT(NBTTagCompound nbt);
|
||||
|
||||
void readFromNBT(NBTTagCompound nbt);
|
||||
|
||||
ItemStack[] getDropItems(IPipeTile pipe);
|
||||
|
||||
void onAttachedPipe(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
void onDetachedPipe(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
boolean blocking(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
void invalidate();
|
||||
|
||||
void validate(IPipeTile pipe, ForgeDirection direction);
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import buildcraft.api.core.EnumColor;
|
||||
|
||||
public interface IPipeTile {
|
||||
|
||||
public enum PipeType {
|
||||
|
||||
ITEM, FLUID, POWER, STRUCTURE;
|
||||
}
|
||||
|
||||
PipeType getPipeType();
|
||||
|
||||
/**
|
||||
* Offers an ItemStack for addition to the pipe. Will be rejected if the
|
||||
* pipe doesn't accept items from that side.
|
||||
*
|
||||
* @param stack ItemStack offered for addition. Do not manipulate this!
|
||||
* @param doAdd If false no actual addition should take place. Implementors
|
||||
* should simulate.
|
||||
* @param from Orientation the ItemStack is offered from.
|
||||
* @param color The color of the item to be added to the pipe, or null for no color.
|
||||
* @return Amount of items used from the passed stack.
|
||||
*/
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
|
||||
|
||||
/**
|
||||
* Same as
|
||||
* {@link #injectItem(ItemStack, boolean, ForgeDirection, EnumColor)}
|
||||
* but with no color attribute.
|
||||
*/
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from);
|
||||
|
||||
/**
|
||||
* True if the pipe is connected to the block/pipe in the specific direction
|
||||
*
|
||||
* @param with
|
||||
* @return true if connect
|
||||
*/
|
||||
boolean isPipeConnected(ForgeDirection with);
|
||||
|
||||
TileEntity getAdjacentTile(ForgeDirection dir);
|
||||
|
||||
IPipe getPipe();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IStripesHandler {
|
||||
public static enum StripesHandlerType {
|
||||
ITEM_USE,
|
||||
BLOCK_BREAK
|
||||
}
|
||||
|
||||
StripesHandlerType getType();
|
||||
|
||||
boolean shouldHandle(ItemStack stack);
|
||||
|
||||
boolean handle(World world, int x, int y, int z, ForgeDirection direction,
|
||||
ItemStack stack, EntityPlayer player, IStripesPipe pipe);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IStripesPipe extends IPipe {
|
||||
void sendItem(ItemStack itemStack, ForgeDirection direction);
|
||||
void dropItem(ItemStack itemStack, ForgeDirection direction);
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public abstract class PipeManager {
|
||||
|
||||
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
|
||||
public static List<IExtractionHandler> extractionHandlers = new ArrayList<IExtractionHandler>();
|
||||
|
||||
public static void registerExtractionHandler(IExtractionHandler handler) {
|
||||
extractionHandlers.add(handler);
|
||||
}
|
||||
|
||||
public static void registerStripesHandler(IStripesHandler handler) {
|
||||
stripesHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers) {
|
||||
if (!handler.canExtractItems(extractor, world, i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers) {
|
||||
if (!handler.canExtractFluids(extractor, world, i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public enum PipeWire {
|
||||
|
||||
RED, BLUE, GREEN, YELLOW;
|
||||
public static Item item;
|
||||
public static final PipeWire[] VALUES = values();
|
||||
|
||||
public PipeWire reverse() {
|
||||
switch (this) {
|
||||
case RED:
|
||||
return YELLOW;
|
||||
case BLUE:
|
||||
return GREEN;
|
||||
case GREEN:
|
||||
return BLUE;
|
||||
default:
|
||||
return RED;
|
||||
}
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return name().toLowerCase(Locale.ENGLISH) + "PipeWire";
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
String name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
char first = Character.toUpperCase(name.charAt(0));
|
||||
return first + name.substring(1);
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return getStack(1);
|
||||
}
|
||||
|
||||
public ItemStack getStack(int qty) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new ItemStack(item, qty, ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isPipeWire(ItemStack stack) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
} else if (stack.getItem() != item) {
|
||||
return false;
|
||||
} else {
|
||||
return stack.getItemDamage() == ordinal();
|
||||
}
|
||||
}
|
||||
|
||||
public static PipeWire fromOrdinal(int ordinal) {
|
||||
if (ordinal < 0 || ordinal >= VALUES.length) {
|
||||
return RED;
|
||||
} else {
|
||||
return VALUES[ordinal];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
@API(apiVersion = "2.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
|
||||
package buildcraft.api.transport;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not
|
||||
* accept it; otherwise just use IEnergyHandler.
|
||||
*
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
*
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is received from.
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to receive.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received.
|
||||
*/
|
||||
int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyHandler, internal distribution is left entirely to the IEnergyHandler.
|
||||
*
|
||||
* @param from
|
||||
* Orientation the energy is extracted from.
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to extract.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted.
|
||||
*/
|
||||
int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(ForgeDirection from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(ForgeDirection from);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Equipped head slot items that extend this class will be able to perform most functions that
|
||||
* goggles of revealing can apart from view nodes which is handled by IRevealer.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IGoggles {
|
||||
|
||||
/*
|
||||
* If this method returns true things like block essentia contents will be shown.
|
||||
*/
|
||||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package thaumcraft.api;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Interface used to identify scribing tool items used in research table
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IScribeTools {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package thaumcraft.api.crafting;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
|
||||
*
|
||||
*/
|
||||
public interface IInfusionStabiliser {
|
||||
|
||||
/**
|
||||
* returns true if the block can stabilise things
|
||||
*/
|
||||
public boolean canStabaliseInfusion(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package thaumcraft.api.nodes;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Azanor
|
||||
*
|
||||
* Equipped head slot items that extend this class will make nodes visible in world.
|
||||
*
|
||||
*/
|
||||
|
||||
public interface IRevealer {
|
||||
|
||||
/*
|
||||
* If this method returns true the nodes will be visible.
|
||||
*/
|
||||
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:15:28 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import vazkii.botania.api.brew.Brew;
|
||||
import vazkii.botania.api.internal.DummyMethodHandler;
|
||||
import vazkii.botania.api.internal.DummySubTile;
|
||||
import vazkii.botania.api.internal.IInternalMethodHandler;
|
||||
import vazkii.botania.api.lexicon.KnowledgeType;
|
||||
import vazkii.botania.api.lexicon.LexiconCategory;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
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 vazkii.botania.api.subtile.signature.BasicSignature;
|
||||
import vazkii.botania.api.subtile.signature.SubTileSignature;
|
||||
import vazkii.botania.api.wiki.IWikiProvider;
|
||||
import vazkii.botania.api.wiki.SimpleWikiProvider;
|
||||
import vazkii.botania.api.wiki.WikiHooks;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
public final class BotaniaAPI {
|
||||
|
||||
private static List<LexiconCategory> categories = new ArrayList<LexiconCategory>();
|
||||
private static List<LexiconEntry> allEntries = new ArrayList<LexiconEntry>();
|
||||
|
||||
public static Map<String, KnowledgeType> knowledgeTypes = new HashMap<String, KnowledgeType>();
|
||||
|
||||
public static Map<String, Brew> brewMap = new LinkedHashMap<String, Brew>();
|
||||
|
||||
public static List<RecipePetals> petalRecipes = new ArrayList<RecipePetals>();
|
||||
public static List<RecipeRuneAltar> runeAltarRecipes = new ArrayList<RecipeRuneAltar>();
|
||||
public static List<RecipeManaInfusion> manaInfusionRecipes = new ArrayList<RecipeManaInfusion>();
|
||||
public static List<RecipeElvenTrade> elvenTradeRecipes = new ArrayList<RecipeElvenTrade>();
|
||||
public static List<RecipeBrew> brewRecipes = new ArrayList<RecipeBrew>();
|
||||
|
||||
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
|
||||
private static Map<Class<? extends SubTileEntity>, SubTileSignature> subTileSignatures = new HashMap<Class<? extends SubTileEntity>, SubTileSignature>();
|
||||
public static Set<String> subtilesForCreativeMenu = new LinkedHashSet();
|
||||
|
||||
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
|
||||
public static Map<Item, Block> seeds = new HashMap();
|
||||
|
||||
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
|
||||
|
||||
public static ArmorMaterial elementiumArmorMaterial = EnumHelper.addArmorMaterial("B_ELEMENTIUM", 18, new int[] { 2, 6, 5, 2 }, 18);
|
||||
public static ToolMaterial elementiumToolMaterial = EnumHelper.addToolMaterial("B_ELEMENTIUM", 3, 720, 6.2F, 2F, 20);
|
||||
|
||||
public static ArmorMaterial terrasteelArmorMaterial = EnumHelper.addArmorMaterial("TERRASTEEL", 34, new int[] {3, 8, 6, 3}, 26);
|
||||
public static ToolMaterial terrasteelToolMaterial = EnumHelper.addToolMaterial("TERRASTEEL", 3, 2300, 9F, 3F, 26);
|
||||
|
||||
public static KnowledgeType basicKnowledge, elvenKnowledge;
|
||||
|
||||
public static Brew fallbackBrew = new Brew("fallback", "botania.brew.fallback", 0, 0);
|
||||
|
||||
static {
|
||||
registerSubTile("", DummySubTile.class);
|
||||
|
||||
basicKnowledge = registerKnowledgeType("minecraft", EnumChatFormatting.RESET, true);
|
||||
elvenKnowledge = registerKnowledgeType("alfheim", EnumChatFormatting.DARK_GREEN, false);
|
||||
|
||||
addOreWeight("oreAluminum", 3940); // Tinkers' Construct
|
||||
addOreWeight("oreAmber", 2075); // Thaumcraft
|
||||
addOreWeight("oreApatite", 1595); // Forestry
|
||||
addOreWeight("oreBlueTopaz", 3195); // Ars Magica
|
||||
addOreWeight("oreCassiterite", 1634); // GregTech
|
||||
addOreWeight("oreCertusQuartz", 3975); // Applied Energistics
|
||||
addOreWeight("oreChimerite", 3970); // Ars Magica
|
||||
addOreWeight("oreCinnabar", 2585); // Thaumcraft
|
||||
addOreWeight("oreCoal", 46525); // Vanilla
|
||||
addOreWeight("oreCooperite", 5); // GregTech
|
||||
addOreWeight("oreCopper", 8325); // IC2, Thermal Expansion, Tinkers' Construct, etc.
|
||||
addOreWeight("oreDarkIron", 1700); // Factorization
|
||||
addOreWeight("oreDiamond", 1265); // Vanilla
|
||||
addOreWeight("oreEmerald", 780); // Vanilla
|
||||
addOreWeight("oreEmery", 415); // GregTech
|
||||
addOreWeight("oreGalena", 1000); // Factorization
|
||||
addOreWeight("oreGold", 2970); // Vanilla
|
||||
addOreWeight("oreInfusedAir", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedEarth", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedEntropy", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedFire", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedOrder", 925); // Thaumcraft
|
||||
addOreWeight("oreInfusedWater", 925); // Thaumcraft
|
||||
addOreWeight("oreIridium", 30); // GregTech
|
||||
addOreWeight("oreIron", 20665); // Vanilla
|
||||
addOreWeight("oreLapis", 1285); // Vanilla
|
||||
addOreWeight("oreLead", 7985); // IC2, Thermal Expansion, Factorization, etc.
|
||||
addOreWeight("oreMCropsEssence", 3085); // Magical Crops
|
||||
addOreWeight("oreNickel", 2275); // Thermal Expansion
|
||||
addOreWeight("oreOlivine", 1100); // Project RED
|
||||
addOreWeight("oreRedstone", 6885); // Vanilla
|
||||
addOreWeight("oreRuby", 1100); // Project RED
|
||||
addOreWeight("oreSapphire", 1100); // Project RED
|
||||
addOreWeight("oreSilver", 6300); // Thermal Expansion, Factorization, etc.
|
||||
addOreWeight("oreSphalerite", 25); // GregTech
|
||||
addOreWeight("oreSulfur", 1105); // Railcraft
|
||||
addOreWeight("oreTetrahedrite", 4040); // GregTech
|
||||
addOreWeight("oreTin", 9450); // IC2, Thermal Expansion, etc.
|
||||
addOreWeight("oreTungstate", 20); // GregTech
|
||||
addOreWeight("oreUranium", 1337); // IC2
|
||||
addOreWeight("oreVinteum", 5925); // Ars Magica
|
||||
addOreWeight("oreYellorite", 3520); // Big Reactors
|
||||
addOreWeight("oreZinc", 6485); // Flaxbeard's Steam Power
|
||||
|
||||
addSeed(Items.wheat_seeds, Blocks.wheat);
|
||||
addSeed(Items.potato, Blocks.potatoes);
|
||||
addSeed(Items.carrot, Blocks.carrots);
|
||||
addSeed(Items.nether_wart, Blocks.nether_wart);
|
||||
addSeed(Items.pumpkin_seeds, Blocks.pumpkin_stem);
|
||||
addSeed(Items.melon_seeds, Blocks.melon_stem);
|
||||
|
||||
registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s"));
|
||||
|
||||
IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s");
|
||||
IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s");
|
||||
IWikiProvider buildcraftWiki = new SimpleWikiProvider("BuildCraft Wiki", "http://www.mod-buildcraft.com/wiki/doku.php?id=%s");
|
||||
|
||||
registerModWiki("Mekanism", mekanismWiki);
|
||||
registerModWiki("MekanismGenerators", mekanismWiki);
|
||||
registerModWiki("MekanismTools", mekanismWiki);
|
||||
registerModWiki("EnderIO", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s"));
|
||||
registerModWiki("TropiCraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s"));
|
||||
registerModWiki("RandomThings", new SimpleWikiProvider("Random Things Wiki", "http://randomthingsminecraftmod.wikispaces.com/%s"));
|
||||
registerModWiki("Witchery", new SimpleWikiProvider("Witchery Wiki", "https://sites.google.com/site/witcherymod/%s", "-"));
|
||||
registerModWiki("AppliedEnergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s"));
|
||||
registerModWiki("BigReactors", technicWiki);
|
||||
registerModWiki("BuildCraft|Core", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Builders", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Energy", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Factory", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Silicon", buildcraftWiki);
|
||||
registerModWiki("BuildCraft|Transport", buildcraftWiki);
|
||||
registerModWiki("ArsMagica2", new SimpleWikiProvider("ArsMagica2 Wiki", "http://wiki.arsmagicamod.com/wiki/%s"));
|
||||
registerModWiki("PneumaticCraft", new SimpleWikiProvider("PneumaticCraft Wiki", "http://www.minemaarten.com/wikis/pneumaticcraft-wiki/pneumaticcraft-wiki-%s"));
|
||||
registerModWiki("StevesCarts2", new SimpleWikiProvider("Steve's Carts Wiki", "http://stevescarts2.wikispaces.com/%s"));
|
||||
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
|
||||
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
|
||||
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
|
||||
}
|
||||
|
||||
/**
|
||||
* The internal method handler in use. Do not overwrite.
|
||||
* @see IInternalMethodHandler
|
||||
*/
|
||||
public static IInternalMethodHandler internalHandler = new DummyMethodHandler();
|
||||
|
||||
|
||||
/**
|
||||
* Registers a new Knowledge Type.
|
||||
* @param id The ID for this knowledge type.
|
||||
* @param color The color to display this knowledge type as.
|
||||
*/
|
||||
public static KnowledgeType registerKnowledgeType(String id, EnumChatFormatting color, boolean autoUnlock) {
|
||||
KnowledgeType type = new KnowledgeType(id, color, autoUnlock);
|
||||
knowledgeTypes.put(id, type);
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew and returns it.
|
||||
*/
|
||||
public static Brew registerBrew(Brew brew) {
|
||||
brewMap.put(brew.getKey(), brew);
|
||||
return brew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a brew from the key passed in, returns the fallback if
|
||||
* it's not in the map.
|
||||
*/
|
||||
public static Brew getBrewFromKey(String key) {
|
||||
if(brewMap.containsKey(key))
|
||||
return brewMap.get(key);
|
||||
return fallbackBrew;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Petal Recipe.
|
||||
* @param output The ItemStack to craft.
|
||||
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
|
||||
* or String (case for Ore Dictionary). The array can't be larger than 16.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipePetals registerPetalRecipe(ItemStack output, Object... inputs) {
|
||||
RecipePetals recipe = new RecipePetals(output, inputs);
|
||||
petalRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Rune Altar
|
||||
* @param output The ItemStack to craft.
|
||||
* @param mana The amount of mana required. Don't go over 100000!
|
||||
* @param inputs The objects for crafting. Can be ItemStack, MappableStackWrapper
|
||||
* or String (case for Ore Dictionary). The array can't be larger than 16.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeRuneAltar registerRuneAltarRecipe(ItemStack output, int mana, Object... inputs) {
|
||||
RecipeRuneAltar recipe = new RecipeRuneAltar(output, mana, inputs);
|
||||
runeAltarRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Mana Infusion Recipe (throw an item in a mana pool)
|
||||
* @param output The ItemStack to craft
|
||||
* @param input The input item, be it an ItemStack or an ore dictionary entry String.
|
||||
* @param mana The amount of mana required. Don't go over 100000!
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaInfusionRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = new RecipeManaInfusion(output, input, mana);
|
||||
manaInfusionRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Mana Infusion Recipe and flags it as an Alchemy recipe (requires an
|
||||
* Alchemy Catalyst below the pool).
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaAlchemyRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
recipe.setAlchemy(true);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a Mana Infusion Recipe and flags it as an Conjuration recipe (requires a
|
||||
* Conjuration Catalyst below the pool).
|
||||
* @see BotaniaAPI#registerManaInfusionRecipe
|
||||
*/
|
||||
public static RecipeManaInfusion registerManaConjurationRecipe(ItemStack output, Object input, int mana) {
|
||||
RecipeManaInfusion recipe = registerManaInfusionRecipe(output, input, mana);
|
||||
recipe.setConjuration(true);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Elven Trade recipe (throw an item in an Alfheim Portal).
|
||||
* @param output The ItemStack to return.
|
||||
* @param inputs The items required, can be ItemStack or ore dictionary entry string.
|
||||
* @return The recipe created.
|
||||
*/
|
||||
public static RecipeElvenTrade registerElvenTradeRecipe(ItemStack output, Object... inputs) {
|
||||
RecipeElvenTrade recipe = new RecipeElvenTrade(output, inputs);
|
||||
elvenTradeRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Brew Recipe (for the Botanical Brewery).
|
||||
* @param brew The brew in to be set in this recipe.
|
||||
* @inputs The items used in the recipe, no more than 6.
|
||||
*/
|
||||
public static RecipeBrew registerBrewRecipe(Brew brew, Object... inputs) {
|
||||
RecipeBrew recipe = new RecipeBrew(brew, inputs);
|
||||
brewRecipes.add(recipe);
|
||||
return recipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a SubTileEntity, a new special flower. Look in the subtile package of the API.
|
||||
*/
|
||||
public static void registerSubTile(String key, Class<? extends SubTileEntity> subtileClass) {
|
||||
subTiles.put(key, subtileClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a SubTileEntity's signature.
|
||||
* @see SubTileSignature
|
||||
*/
|
||||
public static void registerSubTileSignature(Class<? extends SubTileEntity> subtileClass, SubTileSignature signature) {
|
||||
subTileSignatures.put(subtileClass, signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton signature for a SubTileEntity class. Registers a fallback if one wasn't registered
|
||||
* before the call.
|
||||
*/
|
||||
public static SubTileSignature getSignatureForClass(Class<? extends SubTileEntity> subtileClass) {
|
||||
if(!subTileSignatures.containsKey(subtileClass))
|
||||
registerSubTileSignature(subtileClass, new BasicSignature(subTiles.inverse().get(subtileClass)));
|
||||
|
||||
return subTileSignatures.get(subtileClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton signature for a SubTileEntity's name. Registers a fallback if one wasn't registered
|
||||
* before the call.
|
||||
*/
|
||||
public static SubTileSignature getSignatureForName(String name) {
|
||||
Class<? extends SubTileEntity> subtileClass = subTiles.get(name);
|
||||
return getSignatureForClass(subtileClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the key for a SubTileEntity into the creative menu. This goes into the
|
||||
* subtilesForCreativeMenu Set.
|
||||
*/
|
||||
public static void addSubTileToCreativeMenu(String key) {
|
||||
subtilesForCreativeMenu.add(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a category to the list of registered categories to appear in the Lexicon.
|
||||
*/
|
||||
public static void addCategory(LexiconCategory category) {
|
||||
categories.add(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all registered categories.
|
||||
*/
|
||||
public static List<LexiconCategory> getAllCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all registered entries.
|
||||
*/
|
||||
public static List<LexiconEntry> getAllEntries() {
|
||||
return allEntries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Lexicon Entry and adds it to the category passed in.
|
||||
*/
|
||||
public static void addEntry(LexiconEntry entry, LexiconCategory category) {
|
||||
allEntries.add(entry);
|
||||
category.entries.add(entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps an ore (ore dictionary key) to it's weight on the world generation. This
|
||||
* is used for the Orechid flower. Check the static block in the BotaniaAPI class
|
||||
* to get the weights for the vanilla blocks.<br>
|
||||
* Alternatively get the values with the OreDetector mod:<br>
|
||||
* https://gist.github.com/Vazkii/9493322
|
||||
*/
|
||||
public static void addOreWeight(String ore, int weight) {
|
||||
oreWeights.put(ore, weight);
|
||||
}
|
||||
|
||||
public static int getOreWeight(String ore) {
|
||||
return oreWeights.get(ore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows an item to be counted as a seed. Any item in this list can be
|
||||
* dispensed by a dispenser, the block is the block to be placed.
|
||||
*/
|
||||
public static void addSeed(Item item, Block block) {
|
||||
seeds.put(item, block);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last recipe to have been added to the recipe list.
|
||||
*/
|
||||
public static IRecipe getLatestAddedRecipe() {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
return list.get(list.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the last x recipes added to the recipe list.
|
||||
*/
|
||||
public static List<IRecipe> getLatestAddedRecipes(int x) {
|
||||
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
|
||||
List<IRecipe> newList = new ArrayList();
|
||||
for(int i = x - 1; i >= 0; i--)
|
||||
newList.add(list.get(list.size() - 1 - i));
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Wiki provider for a mod so it uses that instead of the fallback
|
||||
* FTB wiki. Make sure to call this on PostInit only!
|
||||
*/
|
||||
public static void registerModWiki(String mod, IWikiProvider provider) {
|
||||
WikiHooks.registerModWiki(mod, provider);
|
||||
}
|
||||
|
||||
public static Class<? extends SubTileEntity> getSubTileMapping(String key) {
|
||||
if(!subTiles.containsKey(key))
|
||||
key = "";
|
||||
|
||||
return subTiles.get(key);
|
||||
}
|
||||
|
||||
public static String getSubTileStringMapping(Class<? extends SubTileEntity> clazz) {
|
||||
return subTiles.inverse().get(clazz);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:09:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.boss;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import net.minecraft.entity.boss.BossStatus;
|
||||
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
|
||||
* minecraft boss since it has IBossDisplayData. Instead of using the typical
|
||||
* BossStatus.setBossStatus(entity, true) to set the health bar in the render use
|
||||
* BotaniaAPI.internalMethodHandler.setBossStatus(entity);<br><br>
|
||||
* Alternatively, you can check if botania is loaded and use the vanilla one
|
||||
* if that's not the case.
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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 callback for when this boss's boss bar renders, you can do aditional rendering
|
||||
* here if needed.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void bossBarRenderCallback();
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* A Botania boss whose HP bar makes use of shaders. Shaders
|
||||
* used through this have a few uniforms available:
|
||||
* <li><b><i>int</i> time</b> - The amount of total ticks elapsed.</li>
|
||||
* <li><b><i>int</i> startX</b> - The U coordinate passed in for the render of this bar's texture.</li>
|
||||
* <li><b><i>int</i> startY</b> - The V coordinate passed in for the render of this bar's texture.</li>
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:22:54 PM (GMT)]
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* The class for a Brew definition, each one is a singleton.
|
||||
*/
|
||||
public class Brew {
|
||||
|
||||
String key;
|
||||
String name;
|
||||
int color;
|
||||
int cost;
|
||||
List<PotionEffect> 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 6:26:40 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this counts as a Brew Container, by which
|
||||
* it can be used a center item for brew recipes and can contain
|
||||
* a brew.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 1, 2014, 9:20:33 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.brew;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* An Item that implements this is a Brew item, by which it contains
|
||||
* a brew. This is only used in vanilla to prevent the brew item
|
||||
* from going back into the brewery but other mods might use it for whatever.
|
||||
*/
|
||||
public interface IBrewItem {
|
||||
|
||||
public Brew getBrew(ItemStack brew);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
import vazkii.botania.api.mana.TileSignature;
|
||||
|
||||
public class DummyManaNetwork implements IManaNetwork {
|
||||
|
||||
public static final DummyManaNetwork instance = new DummyManaNetwork();
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@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 List<TileSignature> getAllCollectorsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileSignature> getAllPoolsInWorld(World world) {
|
||||
return new ArrayList();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
|
||||
public class DummyMethodHandler implements IInternalMethodHandler {
|
||||
|
||||
@Override
|
||||
public LexiconPage textPage(String key) {
|
||||
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 craftingRecipePage(String key, IRecipe recipe) {
|
||||
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 runeRecipesPage(String key, List<RecipeRuneAltar> recipes) {
|
||||
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 manaInfusionRecipePage(String key, RecipeManaInfusion recipe) {
|
||||
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 brewPage(String key, String bottomText, RecipeBrew recipe) {
|
||||
return 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 IIcon getSubTileIconForName(String name) {
|
||||
return Blocks.red_flower.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@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 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 IInventory getBaublesInventory(EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldForceCheck() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPassiveFlowerDecay() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultBossBarTexture() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBossStatus(IBotaniaBoss status) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuildcraftPipe(TileEntity tile) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* A dummy page. It does absolutely nothing and is only
|
||||
* existant to make sure everything goes right even if
|
||||
* Botania isn't loaded.
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Internal interface for the Lexicon Entry GUI. This contains
|
||||
* everything that can be accessed from it. It's safe to cast
|
||||
* this type to GuiScreen.
|
||||
*/
|
||||
public interface IGuiLexiconEntry {
|
||||
|
||||
/**
|
||||
* 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 leftmost part of the GUI.
|
||||
*/
|
||||
public int getLeft();
|
||||
|
||||
/**
|
||||
* Gets the topmost part of the GUI.
|
||||
*/
|
||||
public int getTop();
|
||||
|
||||
/**
|
||||
* Gets the GUI's width.
|
||||
*/
|
||||
public int getWidth();
|
||||
|
||||
/**
|
||||
* Gets the GUI's height
|
||||
*/
|
||||
public int getHeight();
|
||||
|
||||
/**
|
||||
* 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 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 delta (1F = 1 tick) between this render call
|
||||
* and the last one.
|
||||
*/
|
||||
public float getTickDelta();
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:34:34 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.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.boss.IBotaniaBoss;
|
||||
import vazkii.botania.api.lexicon.LexiconPage;
|
||||
import vazkii.botania.api.recipe.RecipeBrew;
|
||||
import vazkii.botania.api.recipe.RecipeElvenTrade;
|
||||
import vazkii.botania.api.recipe.RecipeManaInfusion;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* Any methods that refer to internal methods in Botania are here.
|
||||
* This is defaulted to a dummy handler, whose methods do nothing.
|
||||
* This handler is set to a proper one on PreInit. Make sure to
|
||||
* make your mod load after Botania if you have any intention of
|
||||
* doing anythign with this on PreInit.
|
||||
*/
|
||||
public interface IInternalMethodHandler {
|
||||
|
||||
public LexiconPage textPage(String key);
|
||||
|
||||
public LexiconPage imagePage(String key, String resource);
|
||||
|
||||
public LexiconPage craftingRecipesPage(String key, List<IRecipe> recipes);
|
||||
|
||||
public LexiconPage craftingRecipePage(String key, IRecipe recipe);
|
||||
|
||||
public LexiconPage petalRecipesPage(String key, List<RecipePetals> recipes);
|
||||
|
||||
public LexiconPage petalRecipePage(String key, RecipePetals recipe);
|
||||
|
||||
public LexiconPage runeRecipesPage(String key, List<RecipeRuneAltar> recipes);
|
||||
|
||||
public LexiconPage runeRecipePage(String key, RecipeRuneAltar recipe);
|
||||
|
||||
public LexiconPage manaInfusionRecipesPage(String key, List<RecipeManaInfusion> recipes);
|
||||
|
||||
public LexiconPage manaInfusionRecipePage(String key, RecipeManaInfusion recipe);
|
||||
|
||||
public LexiconPage elvenTradePage(String key, List<RecipeElvenTrade> recipes);
|
||||
|
||||
public LexiconPage elvenTradesPage(String key, RecipeElvenTrade recipe);
|
||||
|
||||
public LexiconPage brewPage(String key, String bottomText, RecipeBrew recipe);
|
||||
|
||||
public IManaNetwork getManaNetworkInstance();
|
||||
|
||||
public ItemStack getSubTileAsStack(String subTile);
|
||||
|
||||
public IIcon getSubTileIconForName(String name);
|
||||
|
||||
public void registerBasicSignatureIcons(String name, IIconRegister register);
|
||||
|
||||
public boolean shouldForceCheck();
|
||||
|
||||
public int getPassiveFlowerDecay();
|
||||
|
||||
public IInventory getBaublesInventory(EntityPlayer player);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void drawSimpleManaHUD(int color, int mana, int maxMana, String name, ScaledResolution res);
|
||||
|
||||
@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 void setBossStatus(IBotaniaBoss status);
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 31, 2014, 4:36:13 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
|
||||
/**
|
||||
* Interface for the Mana Burst entity. This can safely be casted to EntityThrowable.
|
||||
*/
|
||||
public interface IManaBurst {
|
||||
|
||||
public boolean isFake();
|
||||
|
||||
public void setMotion(double x, double y, double z);
|
||||
|
||||
public int getColor();
|
||||
|
||||
public void setColor(int color);
|
||||
|
||||
public int getMana();
|
||||
|
||||
public void setMana(int mana);
|
||||
|
||||
public int getStartingMana();
|
||||
|
||||
public void setStartingMana(int mana);
|
||||
|
||||
public int getMinManaLoss();
|
||||
|
||||
public void setMinManaLoss(int minManaLoss);
|
||||
|
||||
public float getManaLossPerTick();
|
||||
|
||||
public void setManaLossPerTick(float mana);
|
||||
|
||||
public float getGravity();
|
||||
|
||||
public void setGravity(float gravity);
|
||||
|
||||
public ChunkCoordinates getBurstSourceChunkCoordinates();
|
||||
|
||||
public void setBurstSourceCoords(int x, int y, int z);
|
||||
|
||||
public ItemStack getSourceLens();
|
||||
|
||||
public void setSourceLens(ItemStack lens);
|
||||
|
||||
public boolean hasAlreadyCollidedAt(int x, int y, int z);
|
||||
|
||||
public int getTicksExisted();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
import vazkii.botania.api.mana.TileSignature;
|
||||
|
||||
/**
|
||||
* A basic interface for a world's Mana Network.
|
||||
* @see IInternalMethodHandler#getManaNetworkInstance()
|
||||
*/
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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 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);
|
||||
}
|
||||
@@ -0,0 +1,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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 6:31:35 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
/**
|
||||
* A Callback for when a shader is called. Used to define shader uniforms.
|
||||
*/
|
||||
public abstract class ShaderCallback {
|
||||
|
||||
public abstract void call(int shader);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Aug 30, 2014, 4:28:29 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
/**
|
||||
* A TileEntity that implements this can be heated by an Exoflame flower.
|
||||
*/
|
||||
public interface IExoflameHeatable {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Aug 6, 2014, 6:02:29 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
/**
|
||||
* An interface that defines an instance of PlayerControllerMP with
|
||||
* the ability to modify reach. See vazkii.botania.client.core.handler.BotaniaPlayerController
|
||||
*/
|
||||
public interface IExtendedPlayerController {
|
||||
|
||||
/**
|
||||
* Sets the extra reach the player should have.
|
||||
*/
|
||||
public void setReachDistanceExtension(float f);
|
||||
|
||||
/**
|
||||
* Gets the current reach extension.
|
||||
*/
|
||||
public float getReachDistanceExtension();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A WorldProvider that implements this will not have Botania flowers generated.
|
||||
*/
|
||||
public interface IFlowerlessWorld {
|
||||
|
||||
/**
|
||||
* @return Should this world be allowed to generate flowers?
|
||||
*/
|
||||
public boolean generateFlowers(World world);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Oct 29, 2014, 4:52:04 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A BlockBush can implement this to check if it can be broken
|
||||
* by a Horn/Drum of the Wild or not.
|
||||
*/
|
||||
public interface IGrassHornExcempt {
|
||||
|
||||
public boolean canUproot(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Aug 30, 2014, 4:22:15 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
/**
|
||||
* Base Interface for the Petal Apothecary block. Can
|
||||
* be safely casted to TileEntity.
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Aug 6, 2014, 6:06:27 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Any item that implements this allows for pixies to be spawned when the player takes damage when...<br>
|
||||
* - Case the item is armor, having it equipped.<br>
|
||||
* - Case the item is a bauble, having it worn.<br>
|
||||
* - On any other case, having the item being the current held item.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jun 8, 2014, 7:02:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
/**
|
||||
* Have a LexiconEntry implement this to signify it's an "Addon entry", as
|
||||
* in, one provided by an Addon. This allows it to draw a subtitle of
|
||||
* sorts, to prevent the [Mod tag here] nonsense that happened with thaumcraft
|
||||
* addons. It can also be used for other purposes, such as stating an
|
||||
* entry is WIP.
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Basic interface for the Lexica Botania.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 20, 2014, 7:05:44 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Any block that implements this can be right clicked with
|
||||
* a Lexica Botania to open a entry page.
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Mar 20, 2014, 6:08:48 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Have an Item implement this so that the method used for mapping it into
|
||||
* the lexicon recipe mappings isn't the typical id:meta key.
|
||||
*/
|
||||
public interface IRecipeKeyProvider {
|
||||
|
||||
public String getKey(ItemStack stack);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Nov 3, 2014, 2:59:55 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
/**
|
||||
* A LexiconPage that implements this has two unlocalized names
|
||||
* rather than one. (See brew pages)
|
||||
*/
|
||||
public interface ITwoNamedPage {
|
||||
|
||||
public void setSecondUnlocalizedName(String name);
|
||||
|
||||
public String getSecondUnlocalizedName();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class KnowledgeType {
|
||||
|
||||
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 String getUnlocalizedName() {
|
||||
return "botania.knowledge." + id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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 {
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final List<LexiconEntry> entries = new ArrayList<LexiconEntry>();
|
||||
private ResourceLocation icon;
|
||||
|
||||
/**
|
||||
* @param unlocalizedName The unlocalized name of this category. This will be localized by the client display.
|
||||
*/
|
||||
public LexiconCategory(String unlocalizedName) {
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
public LexiconCategory setIcon(ResourceLocation icon) {
|
||||
this.icon = icon;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ResourceLocation getIcon() {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:17:06 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
|
||||
public final String unlocalizedName;
|
||||
public final LexiconCategory category;
|
||||
|
||||
private KnowledgeType type = BotaniaAPI.basicKnowledge;
|
||||
|
||||
public List<LexiconPage> pages = new ArrayList<LexiconPage>();
|
||||
private boolean priority = false;
|
||||
|
||||
/**
|
||||
* @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 this page as prioritized, as in, will appear before others in the lexicon.
|
||||
*/
|
||||
public LexiconEntry setPriority() {
|
||||
priority = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Knowledge type of this entry.
|
||||
*/
|
||||
public LexiconEntry setKnowledgeType(KnowledgeType type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KnowledgeType getKnowledgeType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets what pages you want this entry to have.
|
||||
*/
|
||||
public LexiconEntry setLexiconPages(LexiconPage... pages) {
|
||||
this.pages.addAll(Arrays.asList(pages));
|
||||
|
||||
for(int i = 0; i < this.pages.size(); i++) {
|
||||
LexiconPage page = this.pages.get(i);
|
||||
if(!page.skipRegistry)
|
||||
page.onPageAdded(this, i);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a page to the list of pages.
|
||||
*/
|
||||
public void addPage(LexiconPage page) {
|
||||
pages.add(page);
|
||||
}
|
||||
|
||||
public final String getNameForSorting() {
|
||||
return (priority ? 0 : 1) + StatCollector.translateToLocal(getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LexiconEntry o) {
|
||||
return getNameForSorting().compareTo(o.getNameForSorting());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 14, 2014, 6:17:24 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.lexicon;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
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 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);
|
||||
|
||||
/**
|
||||
* 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 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 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 {@link LexiconEntry#setLexiconPages(LexiconPage...)} is called.
|
||||
*/
|
||||
public void onPageAdded(LexiconEntry entry, int index) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
return unlocalizedName;
|
||||
}
|
||||
|
||||
public LexiconPage setSkipRegistry() {
|
||||
skipRegistry = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This class contains mappings for which entry and page correspond to each
|
||||
* craftable ItemStack. Use the map method to map an ItemStack to a page in
|
||||
* an entry in the lexicon.
|
||||
*/
|
||||
public final class LexiconRecipeMappings {
|
||||
|
||||
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);
|
||||
|
||||
if(force || !mappings.containsKey(str))
|
||||
mappings.put(str, data);
|
||||
}
|
||||
|
||||
public static void map(ItemStack stack, LexiconEntry entry, int page) {
|
||||
map(stack, entry, page, false);
|
||||
}
|
||||
|
||||
|
||||
public static EntryData getDataForStack(ItemStack stack) {
|
||||
return mappings.get(stackToString(stack));
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack) {
|
||||
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
|
||||
|
||||
return stack.getUnlocalizedName() + "~" + stack.getItemDamage();
|
||||
}
|
||||
|
||||
public static class EntryData {
|
||||
|
||||
public final LexiconEntry entry;
|
||||
public final int page;
|
||||
|
||||
public EntryData(LexiconEntry entry, int page) {
|
||||
this.entry = entry;
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 31, 2014, 3:49:30 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
/**
|
||||
* The properties of a mana burst, when shot. This is passed to the lens
|
||||
* currently on the mana spreader to apply changes.
|
||||
*/
|
||||
public final class BurstProperties {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jul 2, 2014, 5:26:02 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
/**
|
||||
* A TileEntity that implements this will get it's recieveMana call
|
||||
* called on both client and server. If this is not implemented
|
||||
* the call will only occur on the server.
|
||||
*/
|
||||
public interface IClientManaHandler extends IManaReceiver {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [May 25, 2014, 7:34:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Have an item implement this to flag it as an infinite
|
||||
* mana source for the purposes of the HUD rendered when
|
||||
* an IManaUserItem implementing item is present.
|
||||
*/
|
||||
public interface ICreativeManaProvider {
|
||||
|
||||
public boolean isCreative(ItemStack stack);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jul 11, 2014, 4:29:32 PM (GMT)]
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jul 26, 2014, 9:51:58 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* A block that implements this has a flag for whether it can be moved by the Shard of Laputa.
|
||||
*/
|
||||
public interface ILaputaImmobile {
|
||||
|
||||
public boolean canMove(World world, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Apr 14, 2014, 7:30:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import vazkii.botania.api.internal.IManaBurst;
|
||||
|
||||
/**
|
||||
* Have an item implement this for it to count as a lens effect and
|
||||
* be able to change the properties of Mana Bursts.
|
||||
*/
|
||||
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 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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 4:59:05 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
/**
|
||||
* A TileEntity that implements this is considered a Mana Block.
|
||||
* Just being a Mana Block doesn't mean much, look at the other IMana
|
||||
* interfaces.
|
||||
*/
|
||||
public interface IManaBlock {
|
||||
|
||||
/**
|
||||
* Gets the amount of mana currently in this block.
|
||||
*/
|
||||
public int getCurrentMana();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 5:01:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Mar 10, 2014, 7:49:19 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
/**
|
||||
* Any TileEntity that implements this can be counted as a "ghost" block of
|
||||
* sorts, that won't call the collision code for the mana bursts.
|
||||
*/
|
||||
public interface IManaCollisionGhost {
|
||||
|
||||
public boolean isGhost();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Mar 6, 2014, 9:07:40 AM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
/**
|
||||
* An item that implements this can be counted as an item that can
|
||||
* contain mana.
|
||||
*/
|
||||
public interface IManaItem {
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* 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 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 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);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 5:03:09 PM (GMT)]
|
||||
*/
|
||||
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();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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 a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [Jan 22, 2014, 4:55:00 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
/**
|
||||
* Any TileEntity that implements this can receive mana from mana bursts.
|
||||
*/
|
||||
public interface IManaReceiver extends IManaBlock {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
}
|
||||
Loaded 100 of 1177 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user