Merge branch 'Prototik-api' into NextGen

This commit is contained in:
SpaceToad 2014-04-30 20:01:37 +02:00
commit 9e397870a2
90 changed files with 74 additions and 36 deletions

View file

@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
/** /**
* This class allow to specify specific behavior for blocks stored in * This class allow to specify specific behavior for blocks stored in

View file

@ -8,8 +8,7 @@
*/ */
package buildcraft.api.core; package buildcraft.api.core;
import buildcraft.core.Version; import java.lang.reflect.Method;
import cpw.mods.fml.common.FMLLog;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -21,7 +20,7 @@ public class BCLog {
// TODO: check if the code below is still useful and remove otherwise. // TODO: check if the code below is still useful and remove otherwise.
//logger.setParent(FMLLog.getLogger()); //logger.setParent(FMLLog.getLogger());
logger.info("Starting BuildCraft " + Version.getVersion()); logger.info("Starting BuildCraft " + getVersion());
logger.info("Copyright (c) SpaceToad, 2011"); logger.info("Copyright (c) SpaceToad, 2011");
logger.info("http://www.mod-buildcraft.com"); logger.info("http://www.mod-buildcraft.com");
} }
@ -40,4 +39,14 @@ public class BCLog {
logger.log(Level.SEVERE, msg.toString()); logger.log(Level.SEVERE, msg.toString());
} }
} }
public static String getVersion() {
try {
Class<?> clazz = Class.forName("buildcraft.core.Version");
Method method = clazz.getDeclaredMethod("getVersion");
return String.valueOf(method.invoke(null));
} catch (Exception e) {
return "UNKNOWN VERSION";
}
}
} }

View file

@ -0,0 +1,22 @@
package buildcraft.api.core;
import net.minecraft.item.ItemStack;
public interface IInvSlot {
/**
* Returns the slot number of the underlying Inventory.
*
* @return the slot number
*/
int getIndex();
boolean canPutStackInSlot(ItemStack stack);
boolean canTakeStackFromSlot(ItemStack stack);
ItemStack decreaseStackInSlot();
ItemStack getStackInSlot();
void setStackInSlot(ItemStack stack);
}

View file

@ -51,6 +51,11 @@ sourceSets {
// include 'some inclusion' // include 'some inclusion'
} }
} }
api {
java {
srcDir 'api'
}
}
} }
processResources processResources
@ -77,9 +82,15 @@ processResources
// add a source jar // add a source jar
task sourceJar(type: Jar) { task sourceJar(type: Jar) {
from sourceSets.main.allSource from sourceSets.main.allSource
from sourceSets.api.allSource
classifier = 'sources' classifier = 'sources'
} }
// add api classes to javadoc
javadoc {
source += sourceSets.api.allSource
}
// add a javadoc jar // add a javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) { task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc' classifier = 'javadoc'
@ -89,11 +100,22 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
// because the normal output has been made to be obfuscated // because the normal output has been made to be obfuscated
task deobfJar(type: Jar) { task deobfJar(type: Jar) {
from sourceSets.main.output from sourceSets.main.output
from sourceSets.api.output
classifier = 'dev' classifier = 'dev'
} }
task apiJar(type: Jar) {
from sourceSets.api.output
classifier = 'api'
}
// add api classes to main package
jar {
from sourceSets.api.output
}
// make sure all of these happen when we run build // make sure all of these happen when we run build
build.dependsOn sourceJar, javadocJar, deobfJar build.dependsOn sourceJar, javadocJar, deobfJar, apiJar
// -------------------- // --------------------
// maven section // maven section
@ -115,6 +137,7 @@ artifacts {
archives sourceJar archives sourceJar
archives javadocJar archives javadocJar
archives deobfJar archives deobfJar
archives apiJar
} }
uploadArchives { uploadArchives {

View file

@ -35,7 +35,7 @@ import buildcraft.core.BlockIndex;
import buildcraft.core.blueprints.BuildingSlotBlock.Mode; import buildcraft.core.blueprints.BuildingSlotBlock.Mode;
import buildcraft.core.inventory.InventoryCopy; import buildcraft.core.inventory.InventoryCopy;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.BlockUtil; import buildcraft.core.utils.BlockUtil;

View file

@ -19,7 +19,7 @@ import buildcraft.builders.TileAbstractBuilder;
import buildcraft.core.BlockIndex; import buildcraft.core.BlockIndex;
import buildcraft.core.blueprints.BuildingSlotBlock.Mode; import buildcraft.core.blueprints.BuildingSlotBlock.Mode;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.utils.BlockUtil; import buildcraft.core.utils.BlockUtil;
public class BptBuilderTemplate extends BptBuilderBase { public class BptBuilderTemplate extends BptBuilderBase {

View file

@ -19,7 +19,7 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants; import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.filters.ArrayStackFilter; import buildcraft.core.inventory.filters.ArrayStackFilter;
import buildcraft.core.inventory.filters.IStackFilter; import buildcraft.core.inventory.filters.IStackFilter;

View file

@ -8,6 +8,7 @@
*/ */
package buildcraft.core.inventory; package buildcraft.core.inventory;
import buildcraft.api.core.IInvSlot;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -30,23 +31,4 @@ public class InventoryIterator {
return new InventoryIteratorSimple(inv); return new InventoryIteratorSimple(inv);
} }
public interface IInvSlot {
/**
* Returns the slot number of the underlying Inventory.
*
* @return the slot number
*/
int getIndex();
boolean canPutStackInSlot(ItemStack stack);
boolean canTakeStackFromSlot(ItemStack stack);
ItemStack decreaseStackInSlot();
ItemStack getStackInSlot();
void setStackInSlot(ItemStack stack);
}
} }

View file

@ -8,8 +8,9 @@
*/ */
package buildcraft.core.inventory; package buildcraft.core.inventory;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
import java.util.Iterator; import java.util.Iterator;
import buildcraft.api.core.IInvSlot;
import net.minecraft.inventory.ISidedInventory; import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;

View file

@ -8,8 +8,9 @@
*/ */
package buildcraft.core.inventory; package buildcraft.core.inventory;
import buildcraft.core.inventory.InventoryIterator.IInvSlot;
import java.util.Iterator; import java.util.Iterator;
import buildcraft.api.core.IInvSlot;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;

View file

@ -11,7 +11,7 @@ package buildcraft.core.inventory;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
public class TransactorRoundRobin extends TransactorSimple { public class TransactorRoundRobin extends TransactorSimple {

View file

@ -14,7 +14,7 @@ import java.util.List;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.filters.IStackFilter; import buildcraft.core.inventory.filters.IStackFilter;
public class TransactorSimple extends Transactor { public class TransactorSimple extends Transactor {

View file

@ -11,7 +11,7 @@ package buildcraft.core.recipes;
import buildcraft.api.recipes.IAssemblyRecipeManager; import buildcraft.api.recipes.IAssemblyRecipeManager;
import buildcraft.core.inventory.ITransactor; import buildcraft.core.inventory.ITransactor;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.Transactor; import buildcraft.core.inventory.Transactor;
import buildcraft.core.inventory.filters.ArrayStackFilter; import buildcraft.core.inventory.filters.ArrayStackFilter;
import java.util.LinkedList; import java.util.LinkedList;

View file

@ -18,7 +18,7 @@ import buildcraft.api.gates.ITileTrigger;
import buildcraft.api.gates.ITrigger; import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerParameter; import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.StringUtils; import buildcraft.core.utils.StringUtils;

View file

@ -18,7 +18,7 @@ import buildcraft.api.gates.ITileTrigger;
import buildcraft.api.gates.ITrigger; import buildcraft.api.gates.ITrigger;
import buildcraft.api.gates.ITriggerParameter; import buildcraft.api.gates.ITriggerParameter;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.StringUtils; import buildcraft.core.utils.StringUtils;

View file

@ -25,7 +25,7 @@ import buildcraft.core.TileBuildCraft;
import buildcraft.core.inventory.InvUtils; import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.InventoryConcatenator; import buildcraft.core.inventory.InventoryConcatenator;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.SimpleInventory; import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;
import buildcraft.core.utils.CraftingHelper; import buildcraft.core.utils.CraftingHelper;

View file

@ -43,7 +43,7 @@ import buildcraft.core.TileBuffer;
import buildcraft.core.inventory.InvUtils; import buildcraft.core.inventory.InvUtils;
import buildcraft.core.inventory.InventoryCopy; import buildcraft.core.inventory.InventoryCopy;
import buildcraft.core.inventory.InventoryIterator; import buildcraft.core.inventory.InventoryIterator;
import buildcraft.core.inventory.InventoryIterator.IInvSlot; import buildcraft.api.core.IInvSlot;
import buildcraft.core.inventory.InventoryMapper; import buildcraft.core.inventory.InventoryMapper;
import buildcraft.core.inventory.SimpleInventory; import buildcraft.core.inventory.SimpleInventory;
import buildcraft.core.inventory.StackHelper; import buildcraft.core.inventory.StackHelper;

0
gradlew vendored Normal file → Executable file
View file