mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 19:59:36 +00:00
Merge branch '1.11'
This commit is contained in:
commit
1a5262a659
2404 files changed
+8164
-10354
No files matched your search
Binary file not shown.
+1
-1
@@ -68,7 +68,7 @@ dependencies {
|
||||
compile files(
|
||||
'Baubles-deobf.jar'
|
||||
)
|
||||
deobfCompile "mezz.jei:jei_1.10.2:3.7.8.234"
|
||||
deobfCompile "mezz.jei:jei_1.11.2:4.2.0.210"
|
||||
|
||||
//and a bit more for SCP
|
||||
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
|
||||
|
||||
+6
-6
@@ -1,11 +1,11 @@
|
||||
#
|
||||
#Fri Mar 10 17:53:56 GMT 2017
|
||||
#Sat Jan 21 17:42:42 GMT 2017
|
||||
mod_name=Botania
|
||||
cf_meta_version=1.10.2
|
||||
forge_version=12.18.1.2076
|
||||
cf_meta_version=1.11.2
|
||||
forge_version=13.20.0.2206
|
||||
dir_repo=./
|
||||
mc_mappings=snapshot_20160518
|
||||
mc_mappings=snapshot_20161227
|
||||
version=r1.9
|
||||
dir_output=../Build Output/Botania/
|
||||
mc_version=1.10.2
|
||||
build_number=342
|
||||
mc_version=1.11.2
|
||||
build_number=340
|
||||
@@ -1,42 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
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() {}
|
||||
|
||||
@Deprecated
|
||||
public static void logErrorAPI(String mod, Throwable error, Class<?> classFile) {
|
||||
logErrorAPI(error, classFile);
|
||||
}
|
||||
|
||||
public static void logErrorAPI(Throwable error, Class<?> classFile) {
|
||||
StringBuilder msg = new StringBuilder("API error! Please update your mods. Error: ");
|
||||
msg.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.append("API error: ").append(classFile.getSimpleName()).append(" is loaded from ").append(classFile.getProtectionDomain().getCodeSource().getLocation());
|
||||
logger.log(Level.ERROR, msg.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String getVersion() {
|
||||
return BuildCraftAPI.getVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public final class BuildCraftAPI {
|
||||
|
||||
public static ICoreProxy proxy;
|
||||
|
||||
public static final Set<Block> softBlocks = Sets.newHashSet();
|
||||
public static final HashMap<String, IWorldProperty> worldProperties = Maps.newHashMap();
|
||||
|
||||
/** Deactivate constructor */
|
||||
private BuildCraftAPI() {}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
public static IWorldProperty getWorldProperty(String name) {
|
||||
return worldProperties.get(name);
|
||||
}
|
||||
|
||||
public static void registerWorldProperty(String name, IWorldProperty property) {
|
||||
if (worldProperties.containsKey(name)) {
|
||||
BCLog.logger.warn("The WorldProperty key '" + name + "' is being overidden with " + property.getClass().getSimpleName() + "!");
|
||||
}
|
||||
worldProperties.put(name, property);
|
||||
}
|
||||
|
||||
public static boolean isSoftBlock(World world, BlockPos pos) {
|
||||
return worldProperties.get("soft").get(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
/** Use this to access the various config options. It is recommended that you use this as opposed to the variables in
|
||||
* the mod, as users may only install the modules that they want, and not the one you may have refereed to. */
|
||||
@Deprecated
|
||||
public final class ConfigAccessor {
|
||||
public enum EMod {
|
||||
CORE,
|
||||
BUILDERS,
|
||||
ENERGY,
|
||||
FACTORY,
|
||||
ROBITICS,
|
||||
SILICON,
|
||||
TRANSPORT
|
||||
}
|
||||
|
||||
private static Map<EMod, IBuildCraftMod> mods = Maps.newHashMap();
|
||||
|
||||
private ConfigAccessor() {}
|
||||
|
||||
public static Property getOption(EMod mod, String name) {
|
||||
if (mods.containsKey(mod)) {
|
||||
return mods.get(mod).getOption(name);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getBoolean(EMod mod, String name, boolean defaultBoolean) {
|
||||
Property prop = getOption(mod, name);
|
||||
if (prop == null) {
|
||||
return defaultBoolean;
|
||||
} else {
|
||||
return prop.getBoolean(defaultBoolean);
|
||||
}
|
||||
}
|
||||
|
||||
/** WARNING: INTERNAL USE ONLY! */
|
||||
public static void addMod(EMod mod, IBuildCraftMod actual) {
|
||||
mods.put(mod, actual);
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/** Use minecraft's EnumDyeColor in as many places as possible. */
|
||||
@Deprecated
|
||||
public enum EnumColor implements IStringSerializable {
|
||||
|
||||
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 ResourceLocation iconSheet;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static TextureAtlasSprite[] brushSprites;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName() {
|
||||
return NAMES[ordinal()];
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
return I18n.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 registerSprites(TextureAtlasSprite[] sprites) {
|
||||
brushSprites = sprites;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public TextureAtlasSprite getSprite() {
|
||||
return brushSprites[ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTPrimitive;
|
||||
import net.minecraft.nbt.NBTTagString;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public enum EnumPipePart implements IStringSerializable,INetworkLoadable_BC8<EnumPipePart> {
|
||||
DOWN(EnumFacing.DOWN),
|
||||
UP(EnumFacing.UP),
|
||||
NORTH(EnumFacing.NORTH),
|
||||
SOUTH(EnumFacing.SOUTH),
|
||||
WEST(EnumFacing.WEST),
|
||||
EAST(EnumFacing.EAST),
|
||||
/** CENTER, UNKNOWN and ALL are all valid uses of this constant. */
|
||||
CENTER(null);
|
||||
|
||||
private static final Map<EnumFacing, EnumPipePart> facingMap = Maps.newEnumMap(EnumFacing.class);
|
||||
private static final Map<String, EnumPipePart> nameMap = Maps.newHashMap();
|
||||
private static final int MAX_VALUES = values().length;
|
||||
|
||||
public final EnumFacing face;
|
||||
|
||||
static {
|
||||
for (EnumPipePart part : values()) {
|
||||
nameMap.put(part.name(), part);
|
||||
if (part.face != null) facingMap.put(part.face, part);
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumPipePart fromFacing(EnumFacing face) {
|
||||
if (face == null) return EnumPipePart.CENTER;
|
||||
return facingMap.get(face);
|
||||
}
|
||||
|
||||
public static EnumPipePart[] validFaces() {
|
||||
return new EnumPipePart[] { DOWN, UP, NORTH, SOUTH, WEST, EAST };
|
||||
}
|
||||
|
||||
public static EnumPipePart fromMeta(int meta) {
|
||||
if (meta < 0 || meta >= MAX_VALUES) return EnumPipePart.CENTER;
|
||||
return values()[meta];
|
||||
}
|
||||
|
||||
private EnumPipePart(EnumFacing face) {
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
if (face == null) return 6;
|
||||
return face.getIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public EnumPipePart next() {
|
||||
switch (this) {
|
||||
case DOWN:
|
||||
return EAST;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
case NORTH:
|
||||
return SOUTH;
|
||||
case SOUTH:
|
||||
return UP;
|
||||
case UP:
|
||||
return WEST;
|
||||
case WEST:
|
||||
return DOWN;
|
||||
default:
|
||||
return DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
public EnumPipePart opposite() {
|
||||
if (this == CENTER) return CENTER;
|
||||
return fromFacing(face.getOpposite());
|
||||
}
|
||||
|
||||
public static EnumPipePart readFromNBT(NBTBase base) {
|
||||
if (base == null) return CENTER;
|
||||
if (base instanceof NBTTagString) {
|
||||
NBTTagString nbtString = (NBTTagString) base;
|
||||
String string = nbtString.getString();
|
||||
return nameMap.containsKey(string) ? nameMap.get(string) : CENTER;
|
||||
} else {
|
||||
byte ord = ((NBTPrimitive) base).getByte();
|
||||
if (ord < 0 || ord > 6) return CENTER;
|
||||
return values()[ord];
|
||||
}
|
||||
}
|
||||
|
||||
public NBTBase writeToNBT() {
|
||||
return new NBTTagString(name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPipePart readFromByteBuf(ByteBuf buf) {
|
||||
byte ord = buf.readByte();
|
||||
return fromMeta(ord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToByteBuf(ByteBuf buf) {
|
||||
buf.writeByte(ordinal());
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/** To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers. */
|
||||
public interface IAreaProvider {
|
||||
BlockPos min();
|
||||
|
||||
BlockPos max();
|
||||
|
||||
/** Remove from the world all objects used to define the area. */
|
||||
void removeFromWorld();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IBox extends IZone {
|
||||
IBox expand(int amount);
|
||||
|
||||
IBox contract(int amount);
|
||||
|
||||
BlockPos min();
|
||||
|
||||
BlockPos max();
|
||||
|
||||
void createLaserData();
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
|
||||
public interface IBuildCraftMod {
|
||||
Property getOption(String name);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IIconProvider {
|
||||
public TextureAtlasSprite getIcon(int iconIndex);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(TextureMap iconRegister);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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);
|
||||
|
||||
boolean isItemValidForSlot(ItemStack stack);
|
||||
|
||||
ItemStack decreaseStackInSlot(int amount);
|
||||
|
||||
ItemStack getStackInSlot();
|
||||
|
||||
void setStackInSlot(ItemStack stack);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
|
||||
/** @param <T> The type that will be loaded from and saved too. This essentially allows Immutable objects to be safely
|
||||
* loaded without helper methods everywhere. However you are allowed to return this if you are a mutable
|
||||
* object */
|
||||
public interface INBTLoadable_BC8<T> {
|
||||
/** @return An object that has the properties loaded. WARNIG! This might be the same object as the one this method
|
||||
* was called on! (You should always replace the object you have stored with whatever this returns) */
|
||||
T readFromNBT(NBTBase nbt);
|
||||
|
||||
NBTBase writeToNBT();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/** Use {@link INBTLoadable_BC8} instead of this, as this gives you more control over what NBT goes where, and what
|
||||
* objects are allowed to do. */
|
||||
@Deprecated
|
||||
public interface INBTStoreable {
|
||||
void readFromNBT(NBTTagCompound tag);
|
||||
|
||||
void writeToNBT(NBTTagCompound tag);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public interface INetworkLoadable_BC8<T> {
|
||||
T readFromByteBuf(ByteBuf buf);
|
||||
|
||||
void writeToByteBuf(ByteBuf buf);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/** To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers. */
|
||||
public interface IPathProvider {
|
||||
List<BlockPos> getPath();
|
||||
|
||||
/**
|
||||
* Remove from the world all objects used to define the path.
|
||||
*/
|
||||
void removeFromWorld();
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, 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 io.netty.buffer.ByteBuf;
|
||||
|
||||
/** Use {@link INetworkLoadable_BC8} instead, as that gives you more control over how you use objects */
|
||||
@Deprecated
|
||||
public interface ISerializable {
|
||||
/** Serializes the state to the stream
|
||||
*
|
||||
* @param data */
|
||||
void writeData(ByteBuf data);
|
||||
|
||||
/** Deserializes the state from the stream
|
||||
*
|
||||
* @param data */
|
||||
void readData(ByteBuf data);
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IWorldProperty {
|
||||
boolean get(World world, BlockPos pos);
|
||||
|
||||
void clear();
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
public interface IZone {
|
||||
/** Returns the smallest possible distance that the index would have to be changed by in order for
|
||||
* {@link #contains(Vec3d)} to return true. If the position is already inside then this will return 0 */
|
||||
double distanceTo(BlockPos index);
|
||||
|
||||
/** Returns {@link #distanceTo(BlockPos)} but squared. Usually this will be quicker to calculate. */
|
||||
double distanceToSquared(BlockPos index);
|
||||
|
||||
/** Returns true if the point is enclosed by this zone, such that none of the coordinates lie outside the range
|
||||
* specified by this zone. */
|
||||
boolean contains(Vec3d point);
|
||||
|
||||
/** Gets a random position that {@link #contains(Vec3d)} will return true. */
|
||||
BlockPos getRandomBlockPos(Random rand);
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class JavaTools {
|
||||
private JavaTools() {
|
||||
|
||||
}
|
||||
|
||||
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 static String surroundWithQuotes(String stringToSurroundWithQuotes) {
|
||||
return String.format("\"%s\"", stringToSurroundWithQuotes);
|
||||
}
|
||||
|
||||
public static String stripSurroundingQuotes(String stringToStripQuotes) {
|
||||
return stringToStripQuotes.replaceAll("^\"|\"$", "");
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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;
|
||||
|
||||
/** Only use this if the delay time changes (say, if you use this to determine when a refining should be complete */
|
||||
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. */
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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.FluidRegistry;
|
||||
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.getFluid() != k.fluidStack.getFluid() || 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 + FluidRegistry.getFluidID(fluidStack.getFluid());
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License.
|
||||
* Please check the contents of the license, which should be located
|
||||
* as "LICENSE.API" in the BuildCraft source code distribution.
|
||||
*/
|
||||
@API(apiVersion = "2.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -1,27 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, 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.render;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
/* This interface designates a block as a state machine responsible for culling For implementation details look into
|
||||
* FakeBlock implementation */
|
||||
public interface ICullable {
|
||||
|
||||
// Side Rendering States
|
||||
// They are used to effectively cull obstructed sides while processing facades.
|
||||
// Make sure your implementation is correct otherwise expect FPS drop
|
||||
|
||||
void setRenderSide(EnumFacing side, boolean render);
|
||||
|
||||
void setRenderAllSides();
|
||||
|
||||
boolean shouldSideBeRendered(IBlockAccess blockAccess, BlockPos pos, int side);
|
||||
|
||||
void setRenderMask(int mask);
|
||||
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package buildcraft.api.core.render;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
public interface ITextureStateManager {
|
||||
void set(TextureAtlasSprite icon);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, 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.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
public interface ITextureStates extends ICullable {
|
||||
|
||||
ITextureStateManager getTextureState();
|
||||
|
||||
TextureAtlasSprite getIcon(int side, int meta);
|
||||
|
||||
Block getBlock();
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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, int count) {
|
||||
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) {}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
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 static final Map<IGateExpansion, ItemStack> recipes = HashBiMap.create();
|
||||
|
||||
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 void registerExpansion(IGateExpansion expansion, ItemStack addedRecipe) {
|
||||
registerExpansion(expansion.getUniqueIdentifier(), expansion);
|
||||
recipes.put(expansion, addedRecipe);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import buildcraft.api.statements.IStatement;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
import buildcraft.api.statements.StatementSlot;
|
||||
import buildcraft.api.statements.containers.ISidedStatementContainer;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IGate extends ISidedStatementContainer {
|
||||
@Deprecated
|
||||
void setPulsing(boolean pulse);
|
||||
|
||||
IPipe getPipe();
|
||||
|
||||
List<IStatement> getTriggers();
|
||||
|
||||
List<IStatement> getActions();
|
||||
|
||||
List<StatementSlot> getActiveActions();
|
||||
|
||||
List<IStatementParameter> getTriggerParameters(int index);
|
||||
|
||||
List<IStatementParameter> getActionParameters(int index);
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IGateExpansion {
|
||||
|
||||
String getUniqueIdentifier();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
GateExpansionController makeController(TileEntity pipeTile);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
void textureStitch(TextureMap map);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
IGateStaticRenderState getRenderState();
|
||||
|
||||
public interface IGateStaticRenderState {
|
||||
List<BakedQuad> bake(VertexFormat format);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
||||
package buildcraft.api.gates;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -1,9 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public class ActionState {
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IActionExternal extends IStatement {
|
||||
void actionActivate(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface IActionInternal extends IStatement {
|
||||
|
||||
void actionActivate(IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
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(EnumFacing side, TileEntity tile);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface IActionReceptor {
|
||||
void actionActivated(IStatement statement, IStatementParameter[] parameters);
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IOverrideDefaultStatements {
|
||||
List<ITriggerExternal> overrideTriggers();
|
||||
|
||||
List<IActionExternal> overrideActions();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IStatement {
|
||||
/** Every statement needs a unique tag, it should be in the format of "<modid>:<name>.
|
||||
*
|
||||
* @return the unique id */
|
||||
String getUniqueTag();
|
||||
|
||||
/** Return the maximum number of parameter this statement can have, 0 if none. */
|
||||
int maxParameters();
|
||||
|
||||
/** Return the minimum number of parameter this statement can have, 0 if none. */
|
||||
int minParameters();
|
||||
|
||||
/** Return the statement description in the UI */
|
||||
String getDescription();
|
||||
|
||||
/** Create parameters for the statement. */
|
||||
IStatementParameter createParameter(int index);
|
||||
|
||||
/** This returns the statement after a left rotation. Used in particular in blueprints orientation. */
|
||||
IStatement rotateLeft();
|
||||
|
||||
/** This should return the icon for this statement, suitable for rending directly into a GUI. This should refer to a
|
||||
* texture on the map block texture map. */
|
||||
@SideOnly(Side.CLIENT)
|
||||
TextureAtlasSprite getGuiSprite();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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();
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.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)
|
||||
TextureAtlasSprite getIcon();
|
||||
|
||||
ItemStack getItemStack();
|
||||
|
||||
/** 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();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface ITriggerExternal extends IStatement {
|
||||
|
||||
boolean isTriggerActive(TileEntity target, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/** This interface can be used by tiles to override external trigger behaviour.
|
||||
*
|
||||
* Please use wisely. */
|
||||
public interface ITriggerExternalOverride {
|
||||
public enum Result {
|
||||
TRUE,
|
||||
FALSE,
|
||||
IGNORE
|
||||
}
|
||||
|
||||
Result override(EnumFacing side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
public interface ITriggerInternal extends IStatement {
|
||||
|
||||
boolean isTriggerActive(IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
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(EnumFacing side, TileEntity tile);
|
||||
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.core.BCLog;
|
||||
|
||||
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(EnumFacing 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(EnumFacing side, TileEntity entity) {
|
||||
List<IActionExternal> result = new LinkedList<IActionExternal>();
|
||||
|
||||
if (entity instanceof IOverrideDefaultStatements) {
|
||||
result = ((IOverrideDefaultStatements) entity).overrideActions();
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
result = new LinkedList<IActionExternal>();
|
||||
|
||||
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();
|
||||
} catch (Error error) {
|
||||
BCLog.logErrorAPI(error, IStatementParameter.class);
|
||||
throw error;
|
||||
}
|
||||
|
||||
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(TextureAtlasSpriteRegister register) {
|
||||
// for (IStatement statement : statements.values()) {
|
||||
// statement.registerIcons(register);
|
||||
// }
|
||||
//
|
||||
// for (Class<? extends IStatementParameter> parameter : parameters.values()) {
|
||||
// createParameter(parameter).registerIcons(register);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class StatementParameterItemStack implements IStatementParameter {
|
||||
|
||||
protected ItemStack stack;
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite 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;
|
||||
} else {
|
||||
this.stack = null;
|
||||
}
|
||||
}
|
||||
|
||||
@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(TextureAtlasSpriteRegister iconRegister) {
|
||||
//
|
||||
// }
|
||||
|
||||
@Override
|
||||
public IStatementParameter rotateLeft() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, 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 StatementSlot {
|
||||
public IStatement statement;
|
||||
public IStatementParameter[] parameters;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null || !(o instanceof StatementSlot)) {
|
||||
return false;
|
||||
}
|
||||
StatementSlot s = (StatementSlot) o;
|
||||
if (s.statement != statement || parameters.length != s.parameters.length) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < parameters.length; i++) {
|
||||
IStatementParameter p1 = parameters[i];
|
||||
IStatementParameter p2 = s.parameters[i];
|
||||
if (p1 == null && p2 != null) {
|
||||
return false;
|
||||
}
|
||||
if (!(p1.equals(p2))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package buildcraft.api.statements.containers;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IRedstoneStatementContainer {
|
||||
/** Get the redstone input from a given side.
|
||||
*
|
||||
* @param side The side - use "UNKNOWN" for maximum input.
|
||||
* @return The redstone input, from 0 to 15. */
|
||||
int getRedstoneInput(EnumFacing side);
|
||||
|
||||
/** Set the redstone input for a given side.
|
||||
*
|
||||
* @param side The side - use "UNKNOWN" for all sides.
|
||||
* @return Whether the set was successful. */
|
||||
boolean setRedstoneOutput(EnumFacing side, int value);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package buildcraft.api.statements.containers;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
|
||||
/** Created by asie on 3/14/15. */
|
||||
public interface ISidedStatementContainer extends IStatementContainer {
|
||||
EnumFacing getSide();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -1,12 +0,0 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICustomPipeConnection {
|
||||
/** @return How long the connecting pipe should extend for. Values less than -4/16 indicate that the pipe will not
|
||||
* connect at all, and will render as it it was not connected. */
|
||||
public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IInjectable {
|
||||
boolean canInjectItems(EnumFacing from);
|
||||
|
||||
/** Offers an ItemStack for 3addition 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, EnumFacing from, EnumDyeColor color);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, 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;
|
||||
|
||||
/** To be implemented by the real item pipe in Transport mod, but leaves knowledge for classes that do not have direct
|
||||
* dependency on transport. */
|
||||
public interface IItemPipe {
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
|
||||
public interface IPipe {
|
||||
IPipeTile getTile();
|
||||
|
||||
IGate getGate(EnumFacing side);
|
||||
|
||||
boolean hasGate(EnumFacing side);
|
||||
|
||||
boolean isWired(PipeWire wire);
|
||||
|
||||
boolean isWireActive(PipeWire wire);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
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(IPipeTile.PipeType type, EnumFacing with);
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
|
||||
public interface IPipeTile extends IInjectable {
|
||||
enum PipeType {
|
||||
ITEM,
|
||||
FLUID,
|
||||
POWER,
|
||||
STRUCTURE
|
||||
}
|
||||
|
||||
PipeType getPipeType();
|
||||
|
||||
World getWorldBC();
|
||||
|
||||
/** True if the pipe is connected to the block/pipe in the specific direction
|
||||
*
|
||||
* @param with
|
||||
* @return true if connect */
|
||||
boolean isPipeConnected(EnumFacing with);
|
||||
|
||||
Block getNeighborBlock(EnumFacing dir);
|
||||
|
||||
TileEntity getNeighborTile(EnumFacing dir);
|
||||
|
||||
IPipe getNeighborPipe(EnumFacing dir);
|
||||
|
||||
IPipe getPipe();
|
||||
|
||||
int getPipeColor();
|
||||
|
||||
PipePluggable getPipePluggable(EnumFacing direction); // Now in IPluggableProvider
|
||||
|
||||
boolean hasPipePluggable(EnumFacing direction); // Now in IPluggableProvider
|
||||
|
||||
boolean hasBlockingPluggable(EnumFacing direction);
|
||||
|
||||
void scheduleNeighborChange();
|
||||
|
||||
void scheduleRenderUpdate();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IStripesActivator {
|
||||
void sendItem(ItemStack itemStack, EnumFacing direction);
|
||||
|
||||
void dropItem(ItemStack itemStack, EnumFacing direction);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IStripesHandler {
|
||||
enum StripesHandlerType {
|
||||
ITEM_USE,
|
||||
BLOCK_BREAK
|
||||
}
|
||||
|
||||
StripesHandlerType getType();
|
||||
|
||||
boolean shouldHandle(ItemStack stack);
|
||||
|
||||
boolean handle(World world, BlockPos pos, EnumFacing direction, ItemStack stack, EntityPlayer player, IStripesActivator activator);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
|
||||
public interface IStripesPipe extends IPipe, IStripesActivator, IEnergyHandler {}
|
||||
@@ -1,48 +0,0 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/** Use this class to register blocks with custom block sizes so that pipes can connect to them properly. Note that you
|
||||
* do not need to register a custom pipe connection if your block implements ICustomPipeConnection. The registered
|
||||
* version does not override your own implementation. */
|
||||
public final class PipeConnectionAPI {
|
||||
private static final Map<Block, ICustomPipeConnection> connections = Maps.newHashMap();
|
||||
private static final ICustomPipeConnection NOTHING = new ICustomPipeConnection() {
|
||||
@Override
|
||||
public float getExtension(World world, BlockPos pos, EnumFacing face, IBlockState state) {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
/** Register a block with a custom connection. Useful if you don't own the block class or are adding it for some-one
|
||||
*
|
||||
* @param block The block instance
|
||||
* @param connection The connection instance */
|
||||
public static void registerConnection(Block block, ICustomPipeConnection connection) {
|
||||
connections.put(block, connection);
|
||||
}
|
||||
|
||||
public static void registerConnectionAsNothing(Block block) {
|
||||
connections.put(block, NOTHING);
|
||||
}
|
||||
|
||||
/** Gets the current custom connection that the block uses. Will be null if nothing has been set. */
|
||||
public static ICustomPipeConnection getCustomConnection(Block block) {
|
||||
if (block instanceof ICustomPipeConnection) {
|
||||
return (ICustomPipeConnection) block;
|
||||
}
|
||||
ICustomPipeConnection connection = connections.get(block);
|
||||
if (connection != null) {
|
||||
return connection;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
|
||||
public abstract class PipeManager {
|
||||
|
||||
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
|
||||
public static ArrayList<Class<? extends PipePluggable>> pipePluggables = new ArrayList<Class<? extends PipePluggable>>();
|
||||
private static Map<String, Class<? extends PipePluggable>> pipePluggableNames = new HashMap<String, Class<? extends PipePluggable>>();
|
||||
private static Map<Class<? extends PipePluggable>, String> pipePluggableByNames = new HashMap<Class<? extends PipePluggable>, String>();
|
||||
private static Map<IStripesHandler, Integer> stripesHandlerPriorities = new HashMap<IStripesHandler, Integer>();
|
||||
|
||||
@Deprecated
|
||||
public static boolean canExtractItems(Object extractor, World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean canExtractFluids(Object extractor, World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static void registerStripesHandler(IStripesHandler handler) {
|
||||
registerStripesHandler(handler, 0);
|
||||
}
|
||||
|
||||
/** Register a Stripes Pipe handler.
|
||||
*
|
||||
* @param handler The handler.
|
||||
* @param priority The priority - 0 is normal, higher numbers have higher priority. */
|
||||
public static void registerStripesHandler(IStripesHandler handler, int priority) {
|
||||
stripesHandlers.add(handler);
|
||||
stripesHandlerPriorities.put(handler, priority);
|
||||
|
||||
Collections.sort(stripesHandlers, new Comparator<IStripesHandler>() {
|
||||
@Override
|
||||
public int compare(IStripesHandler o1, IStripesHandler o2) {
|
||||
return stripesHandlerPriorities.get(o2) - stripesHandlerPriorities.get(o1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerPipePluggable(Class<? extends PipePluggable> pluggable, String name) {
|
||||
pipePluggables.add(pluggable);
|
||||
pipePluggableNames.put(name, pluggable);
|
||||
pipePluggableByNames.put(pluggable, name);
|
||||
}
|
||||
|
||||
public static Class<?> getPluggableByName(String pluggableName) {
|
||||
return pipePluggableNames.get(pluggableName);
|
||||
}
|
||||
|
||||
public static String getPluggableName(Class<? extends PipePluggable> aClass) {
|
||||
return pipePluggableByNames.get(aClass);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -1,7 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IConnectionMatrix {
|
||||
boolean isConnected(EnumFacing face);
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
|
||||
public interface IFacadePluggable {
|
||||
IBlockState getCurrentState();
|
||||
|
||||
boolean isTransparent();
|
||||
|
||||
boolean isHollow();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableDynamicRenderer {
|
||||
void renderDynamicPluggable(IPipe pipe, EnumFacing side, PipePluggable pipePluggable, double x, double y, double z);
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableItem {
|
||||
PipePluggable createPipePluggable(IPipe pipe, EnumFacing side, ItemStack stack);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
public interface IPipePluggableState {
|
||||
IConnectionMatrix getPluggableConnections();
|
||||
|
||||
PipePluggable getPluggable(EnumFacing face);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableStaticRenderer {
|
||||
List<BakedQuad> bakeCutout(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable, EnumFacing face);
|
||||
|
||||
/** Use this if you need to render in the translucent pass. */
|
||||
public interface Translucent extends IPipePluggableStaticRenderer {
|
||||
/** For performance return a list that is as small as possible */
|
||||
List<BakedQuad> bakeTranslucent(IPipeRenderState render, IPipePluggableState pluggableState, IPipe pipe, PipePluggable pluggable,
|
||||
EnumFacing face);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
public interface IPipeRenderState {
|
||||
IConnectionMatrix getPipeConnectionMatrix();
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/** Copyright (c) 2011-2015, SpaceToad and the BuildCraft Team http://www.mod-buildcraft.com
|
||||
*
|
||||
* The BuildCraft API is distributed under the terms of the MIT License. Please check the contents of the license, which
|
||||
* should be located as "LICENSE.API" in the BuildCraft source code distribution. */
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import buildcraft.api.core.INBTStoreable;
|
||||
import buildcraft.api.core.ISerializable;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
|
||||
/** An IPipePluggable MUST have an empty constructor for client-side rendering! */
|
||||
public abstract class PipePluggable implements INBTStoreable, ISerializable {
|
||||
public abstract ItemStack[] getDropItems(IPipeTile pipe);
|
||||
|
||||
public void update(IPipeTile pipe, EnumFacing direction) {
|
||||
|
||||
}
|
||||
|
||||
public void onAttachedPipe(IPipeTile pipe, EnumFacing direction) {
|
||||
validate(pipe, direction);
|
||||
}
|
||||
|
||||
public void onDetachedPipe(IPipeTile pipe, EnumFacing direction) {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public abstract boolean isBlocking(IPipeTile pipe, EnumFacing direction);
|
||||
|
||||
public void invalidate() {
|
||||
|
||||
}
|
||||
|
||||
public void validate(IPipeTile pipe, EnumFacing direction) {
|
||||
|
||||
}
|
||||
|
||||
public boolean isSolidOnSide(IPipeTile pipe, EnumFacing direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract AxisAlignedBB getBoundingBox(EnumFacing side);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract IPipePluggableStaticRenderer getRenderer();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IPipePluggableDynamicRenderer getDynamicRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean requiresRenderUpdate(PipePluggable old) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* <p>
|
||||
* 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(EnumFacing from);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
* <p>
|
||||
* Note that {@link IEnergyReceiver} and {@link IEnergyProvider} are extensions of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored(EnumFacing from);
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored(EnumFacing from);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyProvider extends IEnergyHandler {
|
||||
|
||||
/**
|
||||
* Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider.
|
||||
*
|
||||
* @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(EnumFacing from, int maxExtract, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
|
||||
/**
|
||||
* Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyReceiver extends IEnergyHandler {
|
||||
|
||||
/**
|
||||
* Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver.
|
||||
*
|
||||
* @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(EnumFacing from, int maxReceive, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -694,7 +694,7 @@ public final class BotaniaAPI {
|
||||
}
|
||||
|
||||
private static String getMagnetKey(ItemStack stack) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return "";
|
||||
|
||||
return "i_" + stack.getItem().getUnlocalizedName() + "@" + stack.getItemDamage();
|
||||
|
||||
@@ -142,7 +142,7 @@ public final class CorporeaHelper {
|
||||
* Bridge for requestItem() using an ItemStack.
|
||||
*/
|
||||
public static List<ItemStack> requestItem(ItemStack stack, ICorporeaSpark spark, boolean checkNBT, boolean doit) {
|
||||
return requestItem(stack, stack.stackSize, spark, checkNBT, doit);
|
||||
return requestItem(stack, stack.getCount(), spark, checkNBT, doit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,14 +232,14 @@ public final class CorporeaHelper {
|
||||
* Gets if two stacks match.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack1, ItemStack stack2, boolean checkNBT) {
|
||||
return stack1 != null && stack2 != null && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
|
||||
return !stack1.isEmpty() && !stack2.isEmpty() && stack1.isItemEqual(stack2) && (!checkNBT || ItemStack.areItemStackTagsEqual(stack1, stack2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the name of a stack matches the string passed in.
|
||||
*/
|
||||
public static boolean stacksMatch(ItemStack stack, String s) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
|
||||
boolean contains = false;
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface IManaNetwork {
|
||||
/**
|
||||
* 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>
|
||||
* A way of getting the dimension is via world.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
|
||||
@@ -43,7 +43,7 @@ public interface IManaNetwork {
|
||||
/**
|
||||
* 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>
|
||||
* A way of getting the dimension is via world.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
|
||||
|
||||
@@ -11,15 +11,24 @@
|
||||
package vazkii.botania.api.internal;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.server.management.PlayerChunkMapEntry;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
public final class VanillaPacketDispatcher {
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(TileEntity tile) {
|
||||
IBlockState state = tile.getWorld().getBlockState(tile.getPos());
|
||||
tile.getWorld().notifyBlockUpdate(tile.getPos(), state, state, 8);
|
||||
SPacketUpdateTileEntity packet = tile.getUpdatePacket();
|
||||
|
||||
if(packet != null && tile.getWorld() instanceof WorldServer) {
|
||||
PlayerChunkMapEntry chunk = ((WorldServer) tile.getWorld()).getPlayerChunkMap().getEntry(tile.getPos().getX() >> 4, tile.getPos().getZ() >> 4);
|
||||
if(chunk != null) {
|
||||
chunk.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void dispatchTEToNearbyPlayers(World world, BlockPos pos) {
|
||||
|
||||
@@ -33,7 +33,7 @@ public interface IManaProficiencyArmor {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, @Nullable ItemStack rod) {
|
||||
default boolean shouldGiveProficiency(ItemStack armorStack, EntityEquipmentSlot slot, EntityPlayer player, ItemStack rod) {
|
||||
return shouldGiveProficiency(armorStack, slot, player);
|
||||
}
|
||||
|
||||
@@ -41,17 +41,17 @@ public interface IManaProficiencyArmor {
|
||||
|
||||
@Deprecated
|
||||
public static boolean hasProficiency(EntityPlayer player) {
|
||||
return hasProficiency(player, null);
|
||||
return hasProficiency(player, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
public static boolean hasProficiency(EntityPlayer player, @Nullable ItemStack rod) {
|
||||
public static boolean hasProficiency(EntityPlayer player, ItemStack rod) {
|
||||
boolean proficient = false;
|
||||
|
||||
for(EntityEquipmentSlot e: EntityEquipmentSlot.values()) {
|
||||
if(e.getSlotType() != EntityEquipmentSlot.Type.ARMOR)
|
||||
continue;
|
||||
ItemStack armor = player.getItemStackFromSlot(e);
|
||||
if(armor != null) {
|
||||
if(!armor.isEmpty()) {
|
||||
Item item = armor.getItem();
|
||||
if(item instanceof IManaProficiencyArmor && ((IManaProficiencyArmor) item).shouldGiveProficiency(armor, e, player, rod)) {
|
||||
proficient = true;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
|
||||
public final List<LexiconPage> pages = new ArrayList<>();
|
||||
private boolean priority = false;
|
||||
private ItemStack icon = null;
|
||||
private ItemStack icon = ItemStack.EMPTY;
|
||||
|
||||
private final List<ItemStack> extraDisplayedRecipes = new ArrayList<>();
|
||||
|
||||
@@ -130,13 +130,10 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
ArrayList<ItemStack> list = new ArrayList<>();
|
||||
for(LexiconPage page : pages) {
|
||||
List<ItemStack> l = page.getDisplayedRecipes();
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
|
||||
|
||||
if(l != null) {
|
||||
ArrayList<ItemStack> itemsAddedThisPage = new ArrayList<>();
|
||||
|
||||
for(ItemStack s : l) {
|
||||
addItem: {
|
||||
for(ItemStack s : page.getDisplayedRecipes()) {
|
||||
addItem: {
|
||||
for(ItemStack s1 : itemsAddedThisPage)
|
||||
if(s1.getItem() == s.getItem())
|
||||
break addItem;
|
||||
@@ -147,7 +144,6 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
|
||||
itemsAddedThisPage.add(s);
|
||||
list.add(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.api.lexicon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -84,10 +85,10 @@ public abstract class LexiconPage {
|
||||
|
||||
/**
|
||||
* Shows the list of recipes present in this page for display in the category
|
||||
* page. Can return null for an entry with no recipes.
|
||||
* page.
|
||||
*/
|
||||
public List<ItemStack> getDisplayedRecipes() {
|
||||
return null;
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
public String getUnlocalizedName() {
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class LexiconRecipeMappings {
|
||||
|
||||
if(force || !mappings.containsKey(str))
|
||||
mappings.put(str, data);
|
||||
if(entry.getIcon() == null)
|
||||
if(entry.getIcon().isEmpty())
|
||||
entry.setIcon(stack.copy());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public final class LexiconRecipeMappings {
|
||||
}
|
||||
|
||||
public static String stackToString(ItemStack stack, boolean forceIgnore) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
if(stack.isEmpty())
|
||||
return "NULL";
|
||||
|
||||
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
|
||||
|
||||
@@ -84,12 +84,12 @@ public class Multiblock {
|
||||
}
|
||||
|
||||
private void addStack(ItemStack stack) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return;
|
||||
|
||||
for(ItemStack oStack : materials)
|
||||
if(oStack.isItemEqual(stack) && ItemStack.areItemStackTagsEqual(oStack, stack)) {
|
||||
oStack.stackSize += stack.stackSize;
|
||||
oStack.grow(stack.getCount());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ public class ManaDiscountEvent extends Event {
|
||||
private float discount;
|
||||
private ItemStack tool;
|
||||
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, @Nullable ItemStack tool) {
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount, ItemStack tool) {
|
||||
this.entityPlayer = entityPlayer;
|
||||
this.discount = discount;
|
||||
this.tool = tool;
|
||||
@@ -30,10 +30,10 @@ public class ManaDiscountEvent extends Event {
|
||||
|
||||
@Deprecated
|
||||
public ManaDiscountEvent(EntityPlayer entityPlayer, float discount) {
|
||||
this(entityPlayer, discount, null);
|
||||
this(entityPlayer, discount, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
public ItemStack getTool() {
|
||||
return tool;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,10 @@ import java.util.Map.Entry;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
|
||||
public final class ManaItemHandler {
|
||||
@@ -36,15 +37,15 @@ public final class ManaItemHandler {
|
||||
if (player == null)
|
||||
return new ArrayList<ItemStack>();
|
||||
|
||||
IInventory mainInv = player.inventory;
|
||||
IItemHandler mainInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
|
||||
|
||||
List<ItemStack> toReturn = new ArrayList<ItemStack>();
|
||||
int size = mainInv.getSizeInventory();
|
||||
int size = mainInv.getSlots();
|
||||
|
||||
for(int slot = 0; slot < size; slot++) {
|
||||
ItemStack stackInSlot = mainInv.getStackInSlot(slot);
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IManaItem) {
|
||||
toReturn.add(stackInSlot);
|
||||
}
|
||||
}
|
||||
@@ -63,18 +64,18 @@ public final class ManaItemHandler {
|
||||
if (player == null)
|
||||
return new HashMap<Integer, ItemStack>();
|
||||
|
||||
IInventory baublesInv = BotaniaAPI.internalHandler.getBaublesInventory(player);
|
||||
IItemHandler baublesInv = BotaniaAPI.internalHandler.getBaublesInventoryWrapped(player);
|
||||
if (baublesInv == null)
|
||||
return new HashMap<Integer, ItemStack>();
|
||||
|
||||
|
||||
Map<Integer, ItemStack> toReturn = new HashMap<Integer, ItemStack>();
|
||||
int size = baublesInv.getSizeInventory();
|
||||
int size = baublesInv.getSlots();
|
||||
|
||||
for(int slot = 0; slot < size; slot++) {
|
||||
ItemStack stackInSlot = baublesInv.getStackInSlot(slot);
|
||||
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
|
||||
if(!stackInSlot.isEmpty() && stackInSlot.getItem() instanceof IManaItem) {
|
||||
toReturn.put(slot, stackInSlot);
|
||||
}
|
||||
}
|
||||
@@ -90,7 +91,7 @@ public final class ManaItemHandler {
|
||||
* @return The amount of mana received from the request.
|
||||
*/
|
||||
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return 0;
|
||||
|
||||
List<ItemStack> items = getManaItems(player);
|
||||
@@ -143,7 +144,7 @@ public final class ManaItemHandler {
|
||||
* @return If the request was succesful.
|
||||
*/
|
||||
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
|
||||
List<ItemStack> items = getManaItems(player);
|
||||
@@ -191,7 +192,7 @@ public final class ManaItemHandler {
|
||||
* @return The amount of mana actually sent.
|
||||
*/
|
||||
public static int dispatchMana(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return 0;
|
||||
|
||||
List<ItemStack> items = getManaItems(player);
|
||||
@@ -251,7 +252,7 @@ public final class ManaItemHandler {
|
||||
* @return If an item received the mana sent.
|
||||
*/
|
||||
public static boolean dispatchManaExact(ItemStack stack, EntityPlayer player, int manaToSend, boolean add) {
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
|
||||
List<ItemStack> items = getManaItems(player);
|
||||
@@ -328,11 +329,11 @@ public final class ManaItemHandler {
|
||||
* Gets the sum of all the discounts on IManaDiscountArmor items equipped
|
||||
* on the player passed in. This discount can vary based on what the passed tool is.
|
||||
*/
|
||||
public static float getFullDiscountForTools(EntityPlayer player, @Nullable ItemStack tool) {
|
||||
public static float getFullDiscountForTools(EntityPlayer player, ItemStack tool) {
|
||||
float discount = 0F;
|
||||
for(int i = 0; i < player.inventory.armorInventory.length; i++) {
|
||||
ItemStack armor = player.inventory.armorInventory[i];
|
||||
if(armor != null && armor.getItem() instanceof IManaDiscountArmor)
|
||||
for(int i = 0; i < player.inventory.armorInventory.size(); i++) {
|
||||
ItemStack armor = player.inventory.armorInventory.get(i);
|
||||
if(!armor.isEmpty() && armor.getItem() instanceof IManaDiscountArmor)
|
||||
discount += ((IManaDiscountArmor) armor.getItem()).getDiscount(armor, i, player, tool);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
*/
|
||||
package vazkii.botania.api.mana;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
@@ -24,7 +20,7 @@ public class ManaProficiencyEvent extends Event {
|
||||
private ItemStack rod;
|
||||
private boolean proficient;
|
||||
|
||||
public ManaProficiencyEvent(EntityPlayer entityPlayer, @Nullable ItemStack rod, boolean proficient) {
|
||||
public ManaProficiencyEvent(EntityPlayer entityPlayer, ItemStack rod, boolean proficient) {
|
||||
this.entityPlayer = entityPlayer;
|
||||
this.rod = rod;
|
||||
this.proficient = proficient;
|
||||
@@ -34,7 +30,6 @@ public class ManaProficiencyEvent extends Event {
|
||||
return entityPlayer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ItemStack getRod() {
|
||||
return rod;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@API(owner = "Botania", apiVersion = "85", provides = "BotaniaAPI")
|
||||
@API(owner = "Botania", apiVersion = "86", provides = "BotaniaAPI")
|
||||
package vazkii.botania.api;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class RecipeBrew {
|
||||
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
break;
|
||||
|
||||
if(stack.getItem() instanceof IBrewContainer)
|
||||
@@ -106,7 +106,7 @@ public class RecipeBrew {
|
||||
}
|
||||
|
||||
public ItemStack getOutput(ItemStack stack) {
|
||||
if(stack == null || !(stack.getItem() instanceof IBrewContainer))
|
||||
if(stack.isEmpty() || !(stack.getItem() instanceof IBrewContainer))
|
||||
return new ItemStack(Items.GLASS_BOTTLE); // Fallback...
|
||||
IBrewContainer container = (IBrewContainer) stack.getItem();
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class RecipeElvenTrade {
|
||||
List<ItemStack> stacksToRemove = new ArrayList<>();
|
||||
|
||||
for(ItemStack stack : stacks) {
|
||||
if(stack == null) {
|
||||
if(stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if(inputsMissing.isEmpty())
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RecipePetals {
|
||||
|
||||
for(int i = 0; i < inv.getSlots(); i++) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if(stack == null)
|
||||
if(stack.isEmpty())
|
||||
break;
|
||||
|
||||
int stackIndex = -1, oredictIndex = -1;
|
||||
|
||||
@@ -59,7 +59,7 @@ public class RecipePureDaisy {
|
||||
}
|
||||
|
||||
private boolean isOreDict(ItemStack stack, String entry) {
|
||||
if(stack == null || stack.getItem() == null)
|
||||
if(stack.isEmpty())
|
||||
return false;
|
||||
|
||||
List<ItemStack> ores;
|
||||
|
||||
@@ -9,53 +9,53 @@ import net.minecraft.util.SoundEvent;
|
||||
*/
|
||||
public final class BotaniaSoundEvents {
|
||||
|
||||
public static final SoundEvent airRod = getRegisteredSoundEvent("botania:airRod");
|
||||
public static final SoundEvent agricarnation = getRegisteredSoundEvent("botania:agricarnation");
|
||||
public static final SoundEvent altarCraft = getRegisteredSoundEvent("botania:altarCraft");
|
||||
public static final SoundEvent babylonAttack = getRegisteredSoundEvent("botania:babylonAttack");
|
||||
public static final SoundEvent babylonSpawn = getRegisteredSoundEvent("botania:babylonSpawn");
|
||||
public static final SoundEvent bellows = getRegisteredSoundEvent("botania:bellows");
|
||||
public static final SoundEvent bifrostRod = getRegisteredSoundEvent("botania:bifrostRod");
|
||||
public static final SoundEvent blackLotus = getRegisteredSoundEvent("botania:blackLotus");
|
||||
public static final SoundEvent dash = getRegisteredSoundEvent("botania:dash");
|
||||
public static final SoundEvent ding = getRegisteredSoundEvent("botania:ding");
|
||||
public static final SoundEvent divaCharm = getRegisteredSoundEvent("botania:divaCharm");
|
||||
public static final SoundEvent divinationRod = getRegisteredSoundEvent("botania:divinationRod");
|
||||
public static final SoundEvent doit = getRegisteredSoundEvent("botania:doit");
|
||||
public static final SoundEvent enchanterFade = getRegisteredSoundEvent("botania:enchanterForm");
|
||||
public static final SoundEvent enchanterForm = getRegisteredSoundEvent("botania:enchanterFade");
|
||||
public static final SoundEvent enchanterEnchant = getRegisteredSoundEvent("botania:enchanterEnchant");
|
||||
public static final SoundEvent endoflame = getRegisteredSoundEvent("botania:endoflame");
|
||||
public static final SoundEvent equipBauble = getRegisteredSoundEvent("botania:equipBauble");
|
||||
public static final SoundEvent gaiaTrap = getRegisteredSoundEvent("botania:gaiaTrap");
|
||||
public static final SoundEvent goldenLaurel = getRegisteredSoundEvent("botania:goldenLaurel");
|
||||
public static final SoundEvent holyCloak = getRegisteredSoundEvent("botania:holyCloak");
|
||||
public static final SoundEvent laputaStart = getRegisteredSoundEvent("botania:laputaStart");
|
||||
public static final SoundEvent lexiconOpen = getRegisteredSoundEvent("botania:lexiconOpen");
|
||||
public static final SoundEvent lexiconPage = getRegisteredSoundEvent("botania:lexiconPage");
|
||||
public static final SoundEvent lightRelay = getRegisteredSoundEvent("botania:lightRelay");
|
||||
public static final SoundEvent manaBlaster = getRegisteredSoundEvent("botania:manaBlaster");
|
||||
public static final SoundEvent manaPoolCraft = getRegisteredSoundEvent("botania:manaPoolCraft");
|
||||
public static final SoundEvent missile = getRegisteredSoundEvent("botania:missile");
|
||||
public static final SoundEvent orechid = getRegisteredSoundEvent("botania:orechid");
|
||||
public static final SoundEvent potionCreate = getRegisteredSoundEvent("botania:potionCreate");
|
||||
public static final SoundEvent runeAltarCraft = getRegisteredSoundEvent("botania:runeAltarCraft");
|
||||
public static final SoundEvent runeAltarStart = getRegisteredSoundEvent("botania:runeAltarStart");
|
||||
public static final SoundEvent spreaderFire = getRegisteredSoundEvent("botania:spreaderFire");
|
||||
public static final SoundEvent starcaller = getRegisteredSoundEvent("botania:starcaller");
|
||||
public static final SoundEvent terraBlade = getRegisteredSoundEvent("botania:terraBlade");
|
||||
public static final SoundEvent terraformRod = getRegisteredSoundEvent("botania:terraformRod");
|
||||
public static final SoundEvent terraPickMode = getRegisteredSoundEvent("botania:terraPickMode");
|
||||
public static final SoundEvent terrasteelCraft = getRegisteredSoundEvent("botania:terrasteelCraft");
|
||||
public static final SoundEvent thermalily = getRegisteredSoundEvent("botania:thermalily");
|
||||
public static final SoundEvent unholyCloak = getRegisteredSoundEvent("botania:unholyCloak");
|
||||
public static final SoundEvent way = getRegisteredSoundEvent("botania:way");
|
||||
public static final SoundEvent airRod = getRegisteredSoundEvent("airrod");
|
||||
public static final SoundEvent agricarnation = getRegisteredSoundEvent("agricarnation");
|
||||
public static final SoundEvent altarCraft = getRegisteredSoundEvent("altarcraft");
|
||||
public static final SoundEvent babylonAttack = getRegisteredSoundEvent("babylonattack");
|
||||
public static final SoundEvent babylonSpawn = getRegisteredSoundEvent("babylonspawn");
|
||||
public static final SoundEvent bellows = getRegisteredSoundEvent("bellows");
|
||||
public static final SoundEvent bifrostRod = getRegisteredSoundEvent("bifrostrod");
|
||||
public static final SoundEvent blackLotus = getRegisteredSoundEvent("blacklotus");
|
||||
public static final SoundEvent dash = getRegisteredSoundEvent("dash");
|
||||
public static final SoundEvent ding = getRegisteredSoundEvent("ding");
|
||||
public static final SoundEvent divaCharm = getRegisteredSoundEvent("divacharm");
|
||||
public static final SoundEvent divinationRod = getRegisteredSoundEvent("divinationrod");
|
||||
public static final SoundEvent doit = getRegisteredSoundEvent("doit");
|
||||
public static final SoundEvent enchanterFade = getRegisteredSoundEvent("enchanterform");
|
||||
public static final SoundEvent enchanterForm = getRegisteredSoundEvent("enchanterfade");
|
||||
public static final SoundEvent enchanterEnchant = getRegisteredSoundEvent("enchanterenchant");
|
||||
public static final SoundEvent endoflame = getRegisteredSoundEvent("endoflame");
|
||||
public static final SoundEvent equipBauble = getRegisteredSoundEvent("equipbauble");
|
||||
public static final SoundEvent gaiaTrap = getRegisteredSoundEvent("gaiatrap");
|
||||
public static final SoundEvent goldenLaurel = getRegisteredSoundEvent("goldenlaurel");
|
||||
public static final SoundEvent holyCloak = getRegisteredSoundEvent("holycloak");
|
||||
public static final SoundEvent laputaStart = getRegisteredSoundEvent("laputastart");
|
||||
public static final SoundEvent lexiconOpen = getRegisteredSoundEvent("lexiconopen");
|
||||
public static final SoundEvent lexiconPage = getRegisteredSoundEvent("lexiconpage");
|
||||
public static final SoundEvent lightRelay = getRegisteredSoundEvent("lightrelay");
|
||||
public static final SoundEvent manaBlaster = getRegisteredSoundEvent("manablaster");
|
||||
public static final SoundEvent manaPoolCraft = getRegisteredSoundEvent("manapoolcraft");
|
||||
public static final SoundEvent missile = getRegisteredSoundEvent("missile");
|
||||
public static final SoundEvent orechid = getRegisteredSoundEvent("orechid");
|
||||
public static final SoundEvent potionCreate = getRegisteredSoundEvent("potioncreate");
|
||||
public static final SoundEvent runeAltarCraft = getRegisteredSoundEvent("runealtarcraft");
|
||||
public static final SoundEvent runeAltarStart = getRegisteredSoundEvent("runealtarstart");
|
||||
public static final SoundEvent spreaderFire = getRegisteredSoundEvent("spreaderfire");
|
||||
public static final SoundEvent starcaller = getRegisteredSoundEvent("starcaller");
|
||||
public static final SoundEvent terraBlade = getRegisteredSoundEvent("terrablade");
|
||||
public static final SoundEvent terraformRod = getRegisteredSoundEvent("terraformrod");
|
||||
public static final SoundEvent terraPickMode = getRegisteredSoundEvent("terrapickmode");
|
||||
public static final SoundEvent terrasteelCraft = getRegisteredSoundEvent("terrasteelcraft");
|
||||
public static final SoundEvent thermalily = getRegisteredSoundEvent("thermalily");
|
||||
public static final SoundEvent unholyCloak = getRegisteredSoundEvent("unholycloak");
|
||||
public static final SoundEvent way = getRegisteredSoundEvent("way");
|
||||
|
||||
public static final SoundEvent gaiaMusic1 = getRegisteredSoundEvent("botania:music.gaia1");
|
||||
public static final SoundEvent gaiaMusic2 = getRegisteredSoundEvent("botania:music.gaia2");
|
||||
public static final SoundEvent gaiaMusic1 = getRegisteredSoundEvent("music.gaia1");
|
||||
public static final SoundEvent gaiaMusic2 = getRegisteredSoundEvent("music.gaia2");
|
||||
|
||||
private static SoundEvent getRegisteredSoundEvent(String name) {
|
||||
return SoundEvent.REGISTRY.getObject(new ResourceLocation(name));
|
||||
return SoundEvent.REGISTRY.getObject(new ResourceLocation("botania", name));
|
||||
}
|
||||
|
||||
private BotaniaSoundEvents() {}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class SubTileEntity {
|
||||
/**
|
||||
* Called when a player right clicks this sub tile.
|
||||
*/
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ) { return false; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { return false; }
|
||||
|
||||
/**
|
||||
* Called when this sub tile is added to the world.
|
||||
|
||||
@@ -137,7 +137,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
return false;
|
||||
|
||||
knownMana = mana;
|
||||
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
|
||||
|
||||
return super.onWanded(player, wand);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
|
||||
double dist = pos.distanceSq(supertile.getPos());
|
||||
if(range >= dist) {
|
||||
TileEntity tile = player.worldObj.getTileEntity(pos);
|
||||
TileEntity tile = player.world.getTileEntity(pos);
|
||||
if(tile instanceof IManaPool) {
|
||||
linkedPool = tile;
|
||||
return true;
|
||||
@@ -210,7 +210,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
}
|
||||
|
||||
public boolean isValidBinding() {
|
||||
return linkedPool != null && linkedPool.hasWorldObj() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
return linkedPool != null && linkedPool.hasWorld() && !linkedPool.isInvalid() && supertile.getWorld().isBlockLoaded(linkedPool.getPos(), false) && supertile.getWorld().getTileEntity(linkedPool.getPos()) == linkedPool;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -197,7 +197,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
public void populateDropStackNBTs(List<ItemStack> drops) {
|
||||
if(isPassiveFlower() && ticksExisted > 0 && BotaniaAPI.internalHandler.getPassiveFlowerDecay() > 0) {
|
||||
ItemStack drop = drops.get(0);
|
||||
if(drop != null) {
|
||||
if(!drop.isEmpty()) {
|
||||
if(!drop.hasTagCompound())
|
||||
drop.setTagCompound(new NBTTagCompound());
|
||||
NBTTagCompound cmp = drop.getTagCompound();
|
||||
@@ -220,11 +220,11 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
if(player == null)
|
||||
return false;
|
||||
|
||||
if(!player.worldObj.isRemote)
|
||||
if(!player.world.isRemote)
|
||||
sync();
|
||||
|
||||
knownMana = mana;
|
||||
player.worldObj.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
|
||||
player.world.playSound(null, player.posX, player.posY, player.posZ, BotaniaSoundEvents.ding, SoundCategory.PLAYERS, 0.1F, 1F);
|
||||
|
||||
return super.onWanded(player, wand);
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class SubTileGenerating extends SubTileEntity {
|
||||
|
||||
double dist = pos.distanceSq(supertile.getPos());
|
||||
if(range >= dist) {
|
||||
TileEntity tile = player.worldObj.getTileEntity(pos);
|
||||
TileEntity tile = player.world.getTileEntity(pos);
|
||||
if(tile instanceof IManaCollector) {
|
||||
linkedCollector = tile;
|
||||
return true;
|
||||
|
||||
@@ -53,10 +53,10 @@ public class SimpleWikiProvider implements IWikiProvider {
|
||||
|
||||
ItemStack stack = state.getBlock().getPickBlock(state, pos, world, bPos, player);
|
||||
|
||||
if(stack == null || stack.getItem() == null)
|
||||
if(stack.isEmpty())
|
||||
stack = new ItemStack(state.getBlock(), 1, state.getBlock().damageDropped(state));
|
||||
|
||||
if(stack.getItem() == null)
|
||||
if(stack.isEmpty())
|
||||
return null;
|
||||
|
||||
String name = stack.getDisplayName();
|
||||
|
||||
Loaded 100 of 2404 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user