use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassi method fullFill.
@Override
public LogisticsOrder fullFill(LogisticsPromise promise, IRequestItems destination, IAdditionalTargetInformation info) {
if (!isEnabled()) {
return null;
}
for (int i = 0; i < getChassiSize(); i++) {
LogisticsModule x = _module.getSubModule(i);
if (x instanceof ILegacyActiveModule) {
ILegacyActiveModule y = (ILegacyActiveModule) x;
LogisticsOrder result = y.fullFill(promise, destination, info);
if (result != null) {
spawnParticle(Particles.WhiteParticle, 2);
return result;
}
}
}
return null;
}
use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassi method itemLost.
@Override
public void itemLost(ItemIdentifierStack item, IAdditionalTargetInformation info) {
if (MainProxy.isServer(getWorld())) {
if (info instanceof ChassiTargetInformation) {
ChassiTargetInformation target = (ChassiTargetInformation) info;
LogisticsModule module = _module.getSubModule(target.moduleSlot);
if (module instanceof IRequireReliableTransport) {
((IRequireReliableTransport) module).itemLost(item, info);
}
} else {
if (LPConstants.DEBUG) {
System.out.println(item);
new RuntimeException("[ItemLost] Information weren't ment for a chassi pipe").printStackTrace();
}
}
}
}
use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.
the class PipeLogisticsChassi method addToBuffer.
@Override
public int addToBuffer(ItemIdentifierStack item, IAdditionalTargetInformation info) {
if (MainProxy.isServer(getWorld())) {
if (info instanceof ChassiTargetInformation) {
ChassiTargetInformation target = (ChassiTargetInformation) info;
LogisticsModule module = _module.getSubModule(target.moduleSlot);
if (module instanceof IBufferItems) {
return ((IBufferItems) module).addToBuffer(item, info);
}
} else {
if (LPConstants.DEBUG) {
System.out.println(item);
new RuntimeException("[AddToBuffer] Information weren't ment for a chassi pipe").printStackTrace();
}
}
}
return item.getStackSize();
}
use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.
the class Recipes method loadRecipes.
@Override
public void loadRecipes() {
String[] dyes = { "dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime", "dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite" };
for (int i = 0; i < 1000; i++) {
LogisticsModule module = LogisticsPipes.ModuleItem.getModuleForItem(new ItemStack(LogisticsPipes.ModuleItem, 1, i), null, null, null);
if (module != null) {
NBTTagCompound nbt = new NBTTagCompound();
boolean force = false;
try {
module.writeToNBT(nbt);
} catch (Exception e) {
force = true;
}
if (!nbt.equals(new NBTTagCompound()) || force) {
RecipeManager.craftingManager.addShapelessResetRecipe(LogisticsPipes.ModuleItem, i);
}
}
}
for (int i = 1; i < 17; i++) {
RecipeManager.craftingManager.addOrdererRecipe(new ItemStack(LogisticsPipes.LogisticsRemoteOrderer, 1, i), dyes[i - 1], new ItemStack(LogisticsPipes.LogisticsRemoteOrderer, 1, -1));
RecipeManager.craftingManager.addShapelessResetRecipe(LogisticsPipes.LogisticsRemoteOrderer, i);
}
RecipeManager.craftingManager.addShapelessResetRecipe(LogisticsPipes.LogisticsRemoteOrderer, 0);
ItemStack logisticsBlockFrame = new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_BLOCK_FRAME);
RecipeManager.craftingManager.addRecipe(logisticsBlockFrame, CraftingDependency.Basic, new RecipeManager.RecipeLayout("iri", " ", "w w"), new RecipeManager.RecipeIndex('i', "ingotIron"), new RecipeManager.RecipeIndex('r', "dustRedstone"), new RecipeManager.RecipeIndex('w', "plankWood"));
RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.SOLDERING_STATION), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" c ", "ifi", "ibi"), new RecipeManager.RecipeIndex('c', Blocks.crafting_table), new RecipeManager.RecipeIndex('i', "ingotIron"), new RecipeManager.RecipeIndex('f', logisticsBlockFrame), new RecipeManager.RecipeIndex('b', Items.blaze_powder));
RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_AUTOCRAFTING_TABLE), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" c ", "wfw", " p "), new RecipeManager.RecipeIndex('c', Blocks.crafting_table), new RecipeManager.RecipeIndex('w', "plankWood"), new RecipeManager.RecipeIndex('f', logisticsBlockFrame), new RecipeManager.RecipeIndex('p', Blocks.piston));
RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.BasicTransportPipe, 8), CraftingDependency.Basic, new RecipeManager.RecipeLayout("iri", "g g", "iri"), new RecipeManager.RecipeIndex('i', "ingotIron"), new RecipeManager.RecipeIndex('r', "dustRedstone"), new RecipeManager.RecipeIndex('g', "blockGlass"));
}
use of logisticspipes.modules.abstractmodules.LogisticsModule in project LogisticsPipes by RS485.
the class ItemModule method getModuleForItem.
public LogisticsModule getModuleForItem(ItemStack itemStack, LogisticsModule currentModule, IWorldProvider world, IPipeServiceProvider service) {
if (itemStack == null) {
return null;
}
if (itemStack.getItem() != this) {
return null;
}
for (Module module : modules) {
if (itemStack.getItemDamage() == module.getId()) {
if (module.getILogisticsModuleClass() == null) {
return null;
}
if (currentModule != null) {
if (module.getILogisticsModuleClass().equals(currentModule.getClass())) {
return currentModule;
}
}
LogisticsModule newmodule = module.getILogisticsModule();
if (newmodule == null) {
return null;
}
newmodule.registerHandler(world, service);
return newmodule;
}
}
return null;
}
Aggregations