mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-14 01:04:16 +00:00
Update Buildcraft API
This commit is contained in:
1 parent
4b532b4cec
commit
ce9c270786
68 files changed
+737
-595
No files matched your search
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -27,7 +27,7 @@ public final class BCLog {
|
||||
public static void initLog() {
|
||||
|
||||
logger.info("Starting BuildCraft " + getVersion());
|
||||
logger.info("Copyright (c) SpaceToad, 2011-2014");
|
||||
logger.info("Copyright (c) SpaceToad, 2011-2015");
|
||||
logger.info("http://www.mod-buildcraft.com");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is a comparable container for block positions. TODO: should this be merged with position?
|
||||
* This class is a comparable container for integer block positions.
|
||||
*/
|
||||
public class BlockIndex implements Comparable<BlockIndex> {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class BlockIndex implements Comparable<BlockIndex> {
|
||||
return b.x == x && b.y == y && b.z == z;
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class BlockMetaPair implements Comparable<BlockMetaPair> {
|
||||
private int id, meta;
|
||||
|
||||
public BlockMetaPair(Block block, int meta) {
|
||||
this.id = Block.getIdFromBlock(block);
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public Block getBlock() {
|
||||
return Block.getBlockById(id);
|
||||
}
|
||||
|
||||
public int meta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 17 * meta + id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null || !(other instanceof BlockMetaPair)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((BlockMetaPair) other).id == id && ((BlockMetaPair) other).meta == meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(BlockMetaPair arg) {
|
||||
if (arg.id != id) {
|
||||
return (id - arg.id) * 16;
|
||||
} else {
|
||||
return meta - arg.meta;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.getBlock() == null) {
|
||||
return "invalid";
|
||||
}
|
||||
|
||||
return Block.blockRegistry.getNameForObject(this.getBlock()) + ":" + (this.meta == OreDictionary.WILDCARD_VALUE ? "*" : this.meta);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -19,16 +20,7 @@ public final class BuildCraftAPI {
|
||||
public static ICoreProxy proxy;
|
||||
|
||||
public static final Set<Block> softBlocks = new HashSet<Block>();
|
||||
|
||||
public static IWorldProperty isSoftProperty;
|
||||
public static IWorldProperty isWoodProperty;
|
||||
public static IWorldProperty isLeavesProperty;
|
||||
public static IWorldProperty[] isOreProperty;
|
||||
public static IWorldProperty isHarvestableProperty;
|
||||
public static IWorldProperty isFarmlandProperty;
|
||||
public static IWorldProperty isDirtProperty;
|
||||
public static IWorldProperty isShoveled;
|
||||
public static IWorldProperty isFluidSource;
|
||||
public static final HashMap<String, IWorldProperty> worldProperties = new HashMap<String, IWorldProperty>();
|
||||
|
||||
/**
|
||||
* Deactivate constructor
|
||||
@@ -36,7 +28,18 @@ public final class BuildCraftAPI {
|
||||
private BuildCraftAPI() {
|
||||
}
|
||||
|
||||
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, int x, int y, int z) {
|
||||
return isSoftProperty.get(world, x, y, z);
|
||||
return worldProperties.get("soft").get(world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -36,6 +34,7 @@ public enum EnumColor {
|
||||
MAGENTA,
|
||||
ORANGE,
|
||||
WHITE;
|
||||
|
||||
public static final EnumColor[] VALUES = values();
|
||||
public static final String[] DYES = {
|
||||
"dyeBlack",
|
||||
@@ -191,13 +190,8 @@ public enum EnumColor {
|
||||
return b.toString().trim();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void registerIcons(IIconRegister iconRegister) {
|
||||
brushIcons = new IIcon[16];
|
||||
for (EnumColor c : values()) {
|
||||
brushIcons[c.ordinal()] = iconRegister.registerIcon("buildcraft:triggers/color_"
|
||||
+ c.name().toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
public static void setIconArray(IIcon[] icons) {
|
||||
brushIcons = icons;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -12,7 +12,6 @@ package buildcraft.api.core;
|
||||
* To be implemented by TileEntities able to provide a square area on the world, typically BuildCraft markers.
|
||||
*/
|
||||
public interface IAreaProvider {
|
||||
|
||||
int xMin();
|
||||
|
||||
int yMin();
|
||||
@@ -29,5 +28,4 @@ public interface IAreaProvider {
|
||||
* Remove from the world all objects used to define the area.
|
||||
*/
|
||||
void removeFromWorld();
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -22,6 +22,8 @@ public interface IInvSlot {
|
||||
|
||||
boolean canTakeStackFromSlot(ItemStack stack);
|
||||
|
||||
boolean isItemValidForSlot(ItemStack stack);
|
||||
|
||||
ItemStack decreaseStackInSlot(int amount);
|
||||
|
||||
ItemStack getStackInSlot();
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public interface INBTStoreable {
|
||||
void readFromNBT(NBTTagCompound tag);
|
||||
void writeToNBT(NBTTagCompound tag);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* To be implemented by TileEntities able to provide a path on the world, typically BuildCraft path markers.
|
||||
*/
|
||||
public interface IPathProvider {
|
||||
List<BlockIndex> getPath();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Implemented by classes representing serializable packet state
|
||||
*/
|
||||
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,17 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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 interface IWorldProperty {
|
||||
|
||||
boolean get(World world, int x, int y, int z);
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -14,6 +14,8 @@ public interface IZone {
|
||||
|
||||
double distanceTo(BlockIndex index);
|
||||
|
||||
double distanceToSquared(BlockIndex index);
|
||||
|
||||
boolean contains(double x, double y, double z);
|
||||
|
||||
BlockIndex getRandomBlockIndex(Random rand);
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class JavaTools {
|
||||
public static double bounds(double value, double min, double max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
public 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);
|
||||
@@ -38,50 +33,6 @@ public class JavaTools {
|
||||
return result;
|
||||
}
|
||||
|
||||
public <T> T[] concatenate (T[] a, T[] b) {
|
||||
int aLen = a.length;
|
||||
int bLen = b.length;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
T[] c = (T[]) Array.newInstance(a.getClass().getComponentType(), aLen + bLen);
|
||||
System.arraycopy(a, 0, c, 0, aLen);
|
||||
System.arraycopy(b, 0, c, aLen, bLen);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
public static List<Field> getAllFields(Class<?> clas) {
|
||||
List<Field> result = new ArrayList<Field>();
|
||||
|
||||
Class<?> current = clas;
|
||||
|
||||
while (current != null && current != Object.class) {
|
||||
for (Field f : current.getDeclaredFields()) {
|
||||
result.add(f);
|
||||
}
|
||||
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<Method> getAllMethods(Class<?> clas) {
|
||||
List<Method> result = new ArrayList<Method>();
|
||||
|
||||
Class<?> current = clas;
|
||||
|
||||
while (current != null && current != Object.class) {
|
||||
for (Method m : current.getDeclaredMethods()) {
|
||||
result.add(m);
|
||||
}
|
||||
|
||||
current = current.getSuperclass();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String surroundWithQuotes(String stringToSurroundWithQuotes) {
|
||||
return String.format("\"%s\"", stringToSurroundWithQuotes);
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
public @interface NetworkData {
|
||||
|
||||
}
|
||||
@@ -1,24 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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 io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class Position {
|
||||
public class Position implements ISerializable {
|
||||
|
||||
@NetworkData
|
||||
public double x, y, z;
|
||||
|
||||
@NetworkData
|
||||
public ForgeDirection orientation;
|
||||
|
||||
public Position() {
|
||||
@@ -178,4 +176,25 @@ public class Position {
|
||||
|
||||
return !(sqrDis > f * f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(ByteBuf stream) {
|
||||
x = stream.readDouble();
|
||||
y = stream.readDouble();
|
||||
z = stream.readDouble();
|
||||
orientation = ForgeDirection.getOrientation(stream.readByte());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(ByteBuf stream) {
|
||||
stream.writeDouble(x);
|
||||
stream.writeDouble(y);
|
||||
stream.writeDouble(z);
|
||||
stream.writeByte(orientation.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (51 * (int) x) + (13 * (int) y) + (int) z;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -82,4 +82,4 @@ public class SafeTimeTracker {
|
||||
public void markTime(World world) {
|
||||
lastMark = world.getTotalWorldTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class StackKey {
|
||||
}
|
||||
}
|
||||
if (fluidStack != null) {
|
||||
if (fluidStack.fluidID != k.fluidStack.fluidID ||
|
||||
if (fluidStack.getFluid().getID() != k.fluidStack.getFluid().getID() ||
|
||||
fluidStack.amount != k.fluidStack.amount ||
|
||||
!objectsEqual(fluidStack.tag, k.fluidStack.tag)) {
|
||||
return false;
|
||||
@@ -106,7 +106,7 @@ public final class StackKey {
|
||||
}
|
||||
result = 31 * result + 7;
|
||||
if (fluidStack != null) {
|
||||
result = 31 * result + fluidStack.fluidID;
|
||||
result = 31 * result + fluidStack.getFluid().getID();
|
||||
result = 31 * result + fluidStack.amount;
|
||||
result = 31 * result + objectHashCode(fluidStack.tag);
|
||||
}
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* This class is a comparable container for block positions. TODO: should this be merged with position?
|
||||
*/
|
||||
public class WorldBlockIndex implements Comparable<WorldBlockIndex> {
|
||||
|
||||
public int x;
|
||||
public int y;
|
||||
public int z;
|
||||
public int dimension;
|
||||
|
||||
public WorldBlockIndex() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an index for a block located on x, y. z
|
||||
*/
|
||||
public WorldBlockIndex(World world, int x, int y, int z) {
|
||||
|
||||
dimension = world.provider.dimensionId;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public WorldBlockIndex(NBTTagCompound c) {
|
||||
dimension = c.getInteger("dimension");
|
||||
x = c.getInteger("x");
|
||||
y = c.getInteger("y");
|
||||
z = c.getInteger("z");
|
||||
}
|
||||
|
||||
public WorldBlockIndex(Entity entity) {
|
||||
dimension = entity.worldObj.provider.dimensionId;
|
||||
x = (int) Math.floor(entity.posX);
|
||||
y = (int) Math.floor(entity.posY);
|
||||
z = (int) Math.floor(entity.posZ);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a deterministic and complete ordering of block positions.
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(WorldBlockIndex o) {
|
||||
|
||||
if (o.dimension < dimension) {
|
||||
return 1;
|
||||
} else if (o.dimension > dimension) {
|
||||
return -1;
|
||||
} else if (o.x < x) {
|
||||
return 1;
|
||||
} else if (o.x > x) {
|
||||
return -1;
|
||||
} else if (o.z < z) {
|
||||
return 1;
|
||||
} else if (o.z > z) {
|
||||
return -1;
|
||||
} else if (o.y < y) {
|
||||
return 1;
|
||||
} else if (o.y > y) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void writeTo(NBTTagCompound c) {
|
||||
c.setInteger("dimension", dimension);
|
||||
c.setInteger("x", x);
|
||||
c.setInteger("y", y);
|
||||
c.setInteger("z", z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + dimension + ":" + x + ", " + y + ", " + z + "}";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof WorldBlockIndex) {
|
||||
WorldBlockIndex b = (WorldBlockIndex) obj;
|
||||
|
||||
return b.dimension == dimension && b.x == x && b.y == y && b.z == z;
|
||||
}
|
||||
|
||||
return super.equals(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (dimension * 37 + (x * 37 + y)) * 37 + z;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.0", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
@API(apiVersion = "1.5", owner = "BuildCraft|Core", provides = "BuildCraftAPI|core")
|
||||
package buildcraft.api.core;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.world.IBlockAccess;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/*
|
||||
* 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(ForgeDirection side, boolean render);
|
||||
|
||||
void setRenderAllSides();
|
||||
|
||||
boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side);
|
||||
|
||||
void setRenderMask(int mask);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package buildcraft.api.core.render;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface ITextureStateManager {
|
||||
void set(IIcon icon);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.util.IIcon;
|
||||
|
||||
public interface ITextureStates extends ICullable {
|
||||
|
||||
ITextureStateManager getTextureState();
|
||||
|
||||
IIcon getIcon(int side, int meta);
|
||||
|
||||
Block getBlock();
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class GateExpansionController {
|
||||
public void startResolution() {
|
||||
}
|
||||
|
||||
public boolean resolveAction(IStatement action) {
|
||||
public boolean resolveAction(IStatement action, int count) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -14,10 +14,14 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public final class GateExpansions {
|
||||
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() {
|
||||
}
|
||||
@@ -31,6 +35,11 @@ public final class GateExpansions {
|
||||
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);
|
||||
}
|
||||
@@ -40,6 +49,10 @@ public final class GateExpansions {
|
||||
set.addAll(expansionIDs);
|
||||
return set;
|
||||
}
|
||||
|
||||
public static Map<IGateExpansion, ItemStack> getRecipesForPostInit() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
// The code below is used by networking.
|
||||
|
||||
|
||||
@@ -1,22 +1,32 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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 net.minecraftforge.common.util.ForgeDirection;
|
||||
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 {
|
||||
public interface IGate extends ISidedStatementContainer {
|
||||
@Deprecated
|
||||
void setPulsing(boolean pulse);
|
||||
|
||||
ForgeDirection getSide();
|
||||
|
||||
IPipe getPipe();
|
||||
|
||||
List<IStatement> getTriggers();
|
||||
List<IStatement> getActions();
|
||||
|
||||
List<StatementSlot> getActiveActions();
|
||||
|
||||
List<IStatementParameter> getTriggerParameters(int index);
|
||||
List<IStatementParameter> getActionParameters(int index);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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 = "3.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
||||
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|gates")
|
||||
package buildcraft.api.gates;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -12,7 +12,5 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IActionExternal extends IStatement {
|
||||
|
||||
void actionActivate(TileEntity target, ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IStatement {
|
||||
|
||||
/**
|
||||
* Every trigger needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
* Every statement needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>.
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
@@ -31,27 +29,27 @@ public interface IStatement {
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
/**
|
||||
* Return the maximum number of parameter this trigger can have, 0 if none.
|
||||
* Return the maximum number of parameter this statement can have, 0 if none.
|
||||
*/
|
||||
int maxParameters();
|
||||
|
||||
/**
|
||||
* Return the minimum number of parameter this trigger can have, 0 if none.
|
||||
* Return the minimum number of parameter this statement can have, 0 if none.
|
||||
*/
|
||||
int minParameters();
|
||||
|
||||
/**
|
||||
* Return the trigger description in the UI
|
||||
* Return the statement description in the UI
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* Create parameters for the trigger.
|
||||
* Create parameters for the statement.
|
||||
*/
|
||||
IStatementParameter createParameter(int index);
|
||||
|
||||
/**
|
||||
* This returns the trigger after a left rotation. Used in particular in
|
||||
* This returns the statement after a left rotation. Used in particular in
|
||||
* blueprints orientation.
|
||||
*/
|
||||
IStatement rotateLeft();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -20,7 +19,7 @@ public interface IStatementParameter {
|
||||
|
||||
/**
|
||||
* Every parameter needs a unique tag, it should be in the format of
|
||||
* "<modid>:<name>".
|
||||
* "<modi>:<name>".
|
||||
*
|
||||
* @return the unique id
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package buildcraft.api.statements;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
/**
|
||||
* 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(ForgeDirection side, IStatementContainer source, IStatementParameter[] parameters);
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
@@ -92,6 +92,8 @@ public final class StatementManager {
|
||||
result = ((IOverrideDefaultStatements) entity).overrideActions();
|
||||
if (result != null) {
|
||||
return result;
|
||||
} else {
|
||||
result = new LinkedList<IActionExternal>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.IIconRegister;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -32,6 +31,8 @@ public class StatementParameterItemStack implements IStatementParameter {
|
||||
if (stack != null) {
|
||||
this.stack = stack.copy();
|
||||
this.stack.stackSize = 1;
|
||||
} else {
|
||||
this.stack = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package buildcraft.api.statements.containers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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(ForgeDirection 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(ForgeDirection side, int value);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package buildcraft.api.statements.containers;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
|
||||
/**
|
||||
* Created by asie on 3/14/15.
|
||||
*/
|
||||
public interface ISidedStatementContainer extends IStatementContainer {
|
||||
ForgeDirection getSide();
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.0", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
||||
@API(apiVersion = "1.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|statements")
|
||||
package buildcraft.api.statements;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* Implement and register with the PipeManager if you want to suppress connections from wooden pipes.
|
||||
*/
|
||||
public interface IExtractionHandler {
|
||||
|
||||
/**
|
||||
* Can this pipe extract items from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractItems(Object extractor, World world, int i, int j, int k);
|
||||
|
||||
/**
|
||||
* Can this pipe extract liquids from the block located at these coordinates?
|
||||
* param extractor can be null
|
||||
*/
|
||||
boolean canExtractFluids(Object extractor, World world, int i, int j, int k);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.EnumColor;
|
||||
|
||||
public interface IInjectable {
|
||||
boolean canInjectItems(ForgeDirection 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, ForgeDirection from, EnumColor color);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 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,24 +1,18 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.gates.IGate;
|
||||
|
||||
public interface IPipe {
|
||||
|
||||
int x();
|
||||
|
||||
int y();
|
||||
|
||||
int z();
|
||||
|
||||
IPipeTile getTile();
|
||||
|
||||
IGate getGate(ForgeDirection side);
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
public interface IPipeConnection {
|
||||
|
||||
enum ConnectOverride {
|
||||
|
||||
CONNECT, DISCONNECT, DEFAULT
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows you to override pipe connection logic.
|
||||
@@ -27,5 +25,5 @@ public interface IPipeConnection {
|
||||
* @return CONNECT to force a connection, DISCONNECT to force no connection,
|
||||
* and DEFAULT to let the pipe decide.
|
||||
*/
|
||||
ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with);
|
||||
ConnectOverride overridePipeConnection(IPipeTile.PipeType type, ForgeDirection with);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* http://www.mod-buildcraft.com
|
||||
*
|
||||
* BuildCraft is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://www.mod-buildcraft.com/MMPL-1.0.txt
|
||||
*/
|
||||
package buildcraft.api.transport;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IPipePluggable {
|
||||
void writeToNBT(NBTTagCompound nbt);
|
||||
|
||||
void readFromNBT(NBTTagCompound nbt);
|
||||
|
||||
ItemStack[] getDropItems(IPipeTile pipe);
|
||||
|
||||
void onAttachedPipe(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
void onDetachedPipe(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
boolean blocking(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
void invalidate();
|
||||
|
||||
void validate(IPipeTile pipe, ForgeDirection direction);
|
||||
}
|
||||
@@ -1,46 +1,36 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.EnumColor;
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
|
||||
public interface IPipeTile {
|
||||
|
||||
public enum PipeType {
|
||||
|
||||
ITEM, FLUID, POWER, STRUCTURE;
|
||||
public interface IPipeTile extends IInjectable {
|
||||
enum PipeType {
|
||||
ITEM, FLUID, POWER, STRUCTURE
|
||||
}
|
||||
|
||||
PipeType getPipeType();
|
||||
|
||||
/**
|
||||
* Offers an ItemStack for addition to the pipe. Will be rejected if the
|
||||
* pipe doesn't accept items from that side.
|
||||
*
|
||||
* @param stack ItemStack offered for addition. Do not manipulate this!
|
||||
* @param doAdd If false no actual addition should take place. Implementors
|
||||
* should simulate.
|
||||
* @param from Orientation the ItemStack is offered from.
|
||||
* @param color The color of the item to be added to the pipe, or null for no color.
|
||||
* @return Amount of items used from the passed stack.
|
||||
*/
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
|
||||
World getWorld();
|
||||
|
||||
/**
|
||||
* Same as
|
||||
* {@link #injectItem(ItemStack, boolean, ForgeDirection, EnumColor)}
|
||||
* but with no color attribute.
|
||||
*/
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from);
|
||||
int x();
|
||||
|
||||
int y();
|
||||
|
||||
int z();
|
||||
|
||||
/**
|
||||
* True if the pipe is connected to the block/pipe in the specific direction
|
||||
@@ -50,7 +40,23 @@ public interface IPipeTile {
|
||||
*/
|
||||
boolean isPipeConnected(ForgeDirection with);
|
||||
|
||||
TileEntity getAdjacentTile(ForgeDirection dir);
|
||||
Block getNeighborBlock(ForgeDirection dir);
|
||||
TileEntity getNeighborTile(ForgeDirection dir);
|
||||
IPipe getNeighborPipe(ForgeDirection dir);
|
||||
|
||||
IPipe getPipe();
|
||||
int getPipeColor();
|
||||
|
||||
PipePluggable getPipePluggable(ForgeDirection direction); // Now in IPluggableProvider
|
||||
boolean hasPipePluggable(ForgeDirection direction); // Now in IPluggableProvider
|
||||
boolean hasBlockingPluggable(ForgeDirection direction);
|
||||
|
||||
void scheduleNeighborChange();
|
||||
void scheduleRenderUpdate();
|
||||
|
||||
// For compatibility with BC 6.2.x and below
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from, EnumColor color);
|
||||
|
||||
@Deprecated // Now in IInjectable
|
||||
int injectItem(ItemStack stack, boolean doAdd, ForgeDirection from);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IStripesActivator {
|
||||
void sendItem(ItemStack itemStack, ForgeDirection direction);
|
||||
void dropItem(ItemStack itemStack, ForgeDirection direction);
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
/**
|
||||
* 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;
|
||||
@@ -6,7 +14,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IStripesHandler {
|
||||
public static enum StripesHandlerType {
|
||||
enum StripesHandlerType {
|
||||
ITEM_USE,
|
||||
BLOCK_BREAK
|
||||
}
|
||||
@@ -16,5 +24,5 @@ public interface IStripesHandler {
|
||||
boolean shouldHandle(ItemStack stack);
|
||||
|
||||
boolean handle(World world, int x, int y, int z, ForgeDirection direction,
|
||||
ItemStack stack, EntityPlayer player, IStripesPipe pipe);
|
||||
ItemStack stack, EntityPlayer player, IStripesActivator activator);
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
/**
|
||||
* 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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface IStripesPipe extends IPipe {
|
||||
void sendItem(ItemStack itemStack, ForgeDirection direction);
|
||||
void dropItem(ItemStack itemStack, ForgeDirection direction);
|
||||
public interface IStripesPipe extends IPipe, IStripesActivator {
|
||||
}
|
||||
@@ -1,54 +1,78 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.world.World;
|
||||
|
||||
import buildcraft.api.transport.pluggable.PipePluggable;
|
||||
|
||||
public abstract class PipeManager {
|
||||
|
||||
public static List<IStripesHandler> stripesHandlers = new ArrayList<IStripesHandler>();
|
||||
public static List<IExtractionHandler> extractionHandlers = new ArrayList<IExtractionHandler>();
|
||||
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>();
|
||||
|
||||
public static void registerExtractionHandler(IExtractionHandler handler) {
|
||||
extractionHandlers.add(handler);
|
||||
}
|
||||
|
||||
public static void registerStripesHandler(IStripesHandler handler) {
|
||||
stripesHandlers.add(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean canExtractItems(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers) {
|
||||
if (!handler.canExtractItems(extractor, world, i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* param extractor can be null
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean canExtractFluids(Object extractor, World world, int i, int j, int k) {
|
||||
for (IExtractionHandler handler : extractionHandlers) {
|
||||
if (!handler.canExtractFluids(extractor, world, i, j, k)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@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,10 +1,10 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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;
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
|
||||
* 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
|
||||
* 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.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
|
||||
@API(apiVersion = "4.1", owner = "BuildCraftAPI|core", provides = "BuildCraftAPI|transport")
|
||||
package buildcraft.api.transport;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public interface IFacadePluggable {
|
||||
Block getCurrentBlock();
|
||||
|
||||
int getCurrentMetadata();
|
||||
|
||||
boolean isTransparent();
|
||||
|
||||
boolean isHollow();
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableDynamicRenderer {
|
||||
void renderPluggable(IPipe pipe, ForgeDirection side, PipePluggable pipePluggable, double x, double y, double z);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableItem {
|
||||
PipePluggable createPipePluggable(IPipe pipe, ForgeDirection side, ItemStack stack);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package buildcraft.api.transport.pluggable;
|
||||
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.render.ITextureStates;
|
||||
import buildcraft.api.transport.IPipe;
|
||||
|
||||
public interface IPipePluggableRenderer {
|
||||
void renderPluggable(RenderBlocks renderblocks, IPipe pipe, ForgeDirection side,
|
||||
PipePluggable pipePluggable, ITextureStates blockStateMachine,
|
||||
int renderPass, int x, int y, int z);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 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.AxisAlignedBB;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
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, ForgeDirection direction) {
|
||||
|
||||
}
|
||||
|
||||
public void onAttachedPipe(IPipeTile pipe, ForgeDirection direction) {
|
||||
validate(pipe, direction);
|
||||
}
|
||||
|
||||
public void onDetachedPipe(IPipeTile pipe, ForgeDirection direction) {
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public abstract boolean isBlocking(IPipeTile pipe, ForgeDirection direction);
|
||||
|
||||
public void invalidate() {
|
||||
|
||||
}
|
||||
|
||||
public void validate(IPipeTile pipe, ForgeDirection direction) {
|
||||
|
||||
}
|
||||
|
||||
public boolean isSolidOnSide(IPipeTile pipe, ForgeDirection direction) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract AxisAlignedBB getBoundingBox(ForgeDirection side);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public abstract IPipePluggableRenderer getRenderer();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IPipePluggableDynamicRenderer getDynamicRenderer() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean requiresRenderUpdate(PipePluggable old) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user