Merging changes from 1.6.4 branch

This commit is contained in:
bdew committed 2014-06-23 12:54:54 +03:00
commit 18969fcf9a
60 files changed
+938 -64

No files matched your search

-1
View File
@@ -4,7 +4,6 @@
<option name="PER_PROJECT_SETTINGS">
<value>
<ScalaCodeStyleSettings>
<option name="PLACE_CLOSURE_PARAMETERS_ON_NEW_LINE" value="false" />
<option name="SPACES_IN_ONE_LINE_BLOCKS" value="true" />
</ScalaCodeStyleSettings>
<XML>
+10
View File
@@ -2,6 +2,16 @@
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$/../bdlib" />
<option name="gradleHome" value="$PROJECT_DIR$/../../../gradle" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$/../bdlib" />
</set>
</option>
</GradleProjectSettings>
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
+1
View File
@@ -2,6 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/../bdlib/bdlib.iml" filepath="$PROJECT_DIR$/../bdlib/bdlib.iml" />
<module fileurl="file://$PROJECT_DIR$/gendustry.iml" filepath="$PROJECT_DIR$/gendustry.iml" />
</modules>
</component>
Generated
+9
View File
@@ -2,6 +2,15 @@
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../bdlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../bdlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../bdlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../bdlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$/../bdlib" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+23 -1
View File
@@ -25,6 +25,7 @@ apply plugin: 'forge'
version = "1.2.0"
ext.bdlibver = "1.3.0.10"
ext.versuffix = "mc172"
ext.apiVer = version
if (project.hasProperty('buildnum')) {
project.version = project.version + '.' + project.buildnum
@@ -41,6 +42,7 @@ minecraft {
version = "1.7.2-10.12.2.1126"
replace("BDLIB_VER", project.bdlibver)
replace("GENDUSTRY_VER", project.version)
replace("GENDUSTRY_APIVER", project.apiVer)
}
repositories {
@@ -99,8 +101,16 @@ processResources {
}
}
task apiJar(type: Jar, dependsOn: 'classes') {
from (sourceSets.main.output) {
include 'net/bdew/gendustry/api/**'
}
extension = 'jar'
classifier = 'api'
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
task deobfJar(type: Jar) {
@@ -108,14 +118,24 @@ task deobfJar(type: Jar) {
exclude "**/*.psd"
}
jar {
exclude "**/*.psd"
appendix = project.versuffix
}
afterEvaluate { project ->
// Fudge the inputs of api/source jars so we get the version after replacements
tasks.getByPath(":sourceJar").from(tasks.getByPath(":sourceMainScala").outputs.files)
tasks.getByPath(":apiJar").from(tasks.getByPath(":sourceMainScala").outputs.files, {
include 'net/bdew/gendustry/api/**'
})
}
artifacts {
archives sourceJar
archives deobfJar
archives apiJar
}
apply plugin: 'maven-publish'
@@ -128,6 +148,8 @@ publishing {
artifact sourceJar {
classifier "sources"
}
artifact apiJar
}
}
repositories {
@@ -267,6 +267,21 @@ OOO
BXB => S:gendustry:"upgrade.cooler"
BLB
// ==== COVERS ====
B = OD:ingotBronze
A = OD:gearBronze
S = B:pistonBase
B_B
_S_ => gendustry:ImportCover
_A_
_A_
_S_ => gendustry:EjectCover
B_B
mutagen: I:redstone -> 100
mutagen: B:redstone_block -> 900
mutagen: I:glowstone_dust -> 200
@@ -27,6 +27,8 @@ item.gendustry.GeneSampleBlank.name=Blank Gene Sample
item.gendustry.Waste.name=Genetic Waste
item.gendustry.grafter.name=Industrial Grafter
item.gendustry.scoop.name=Scooporator MX200 Turbo
item.gendustry.ImportCover.name=Item Import Cover
item.gendustry.EjectCover.name=Item Eject Cover
# ==== FLUIDS ====
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

+9
View File
@@ -26,6 +26,9 @@ import net.bdew.gendustry.config.loader.TuningLoader
import org.apache.logging.log4j.Logger
import net.minecraftforge.oredict.RecipeSorter
import net.bdew.gendustry.forestry.GeneRecipe
import net.bdew.gendustry.api.GendustryAPI
import net.bdew.gendustry.apiimpl.{BlockApiImpl, ItemApiImpl}
import net.bdew.gendustry.compat.itempush.ItemPush
@Mod(modid = Gendustry.modId, version = "GENDUSTRY_VER", name = "Gendustry", dependencies = "required-after:Forestry@[2.4.0.0,);after:BuildCraft|energy;after:BuildCraft|Silicon;after:IC2;after:CoFHCore;after:BinnieCore;after:ExtraBees;after:ExtraTrees;after:MineFactoryReloaded;required-after:bdlib@[BDLIB_VER,)", modLanguage = "scala")
object Gendustry {
@@ -47,7 +50,13 @@ object Gendustry {
@EventHandler
def preInit(event: FMLPreInitializationEvent) {
log = event.getModLog
GendustryAPI.Items = ItemApiImpl
GendustryAPI.Blocks = BlockApiImpl
PowerProxy.logModVersions()
ItemPush.init()
configDir = new File(event.getModConfigurationDirectory, "gendustry")
configFile = event.getSuggestedConfigurationFile
TuningLoader.loadConfigFiles()
@@ -11,33 +11,84 @@ package net.bdew.gendustry.api;
import net.minecraft.world.biome.BiomeGenBase;
/**
* Stores current modifiers from all upgrades in an apiary
*/
public class ApiaryModifiers {
/**
* Territory modifier, multiplicative
*/
public float territory = 1;
//max safe = 10 (degenerating - offspring become unnatural)
/**
* Mutation chance modifier, multiplicative
* max safe = 10 (degenerating - offspring become unnatural)
*/
public float mutation = 1;
//increases lifespan
/**
* Lifespan modifier, multiplicative, higher = longer
*/
public float lifespan = 1;
//increases chance to get products each cycle, max safe = 16 (overworked - becomes unnatural)
/**
* Production modifier - increases chance to get products each tick, multiplicative
* max safe = 10 (overworked - becomes unnatural)
*/
public float production = 1;
/**
* Flowering and pollination chance modifier, multiplicative
*/
public float flowering = 1;
// set to 0 to reduce decay from fatigue
/**
* Genetic decay chance, applies to fatigued unnatural bees, multiplicative
*/
public float geneticDecay = 1;
/**
* Sealed - bees can work in rain without the required traits
*/
public boolean isSealed = false;
/**
* Self lighted - bees can work in the night without the required traits, makes block emit light
*/
public boolean isSelfLighted = false;
/**
* Sunlight simulated - bees can work in caves without the required traits
*/
public boolean isSunlightSimulated = false;
/**
* Automated - will auto move offspring to the right slots to allow further breeding
*/
public boolean isAutomated = false;
/**
* Allows collection of pollen from trees
*/
public boolean isCollectingPollen = false;
/**
* If set - overrides biome as seen by jubilance checks, etc.
*/
public BiomeGenBase biomeOverride = null;
/**
* Energy use modifier, multiplicative
*/
public float energy = 1;
/**
* Temperature modifier, additive, same units as {@link BiomeGenBase#temperature}
*/
public float temperature = 0;
/**
* Humidity modifier, additive, same units as {@link BiomeGenBase#rainfall}
*/
public float humidity = 0;
}
@@ -0,0 +1,21 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api;
import net.bdew.gendustry.api.blocks.IBlockAPI;
import net.bdew.gendustry.api.items.IItemAPI;
/**
* Access to the API. This will be available after Gendustry PreInit runs.
*/
public class GendustryAPI {
public static IItemAPI Items;
public static IBlockAPI Blocks;
}
@@ -0,0 +1,28 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.blocks;
import net.minecraft.item.ItemStack;
import java.util.Map;
public interface IAdvancedMutatron extends IWorkerMachine {
/**
* @return List of possible mutations for current inventory
*/
Map<Integer, ItemStack> getPossibleMutations();
/**
* Sets the requested mutation and start process if possible
*
* @param mutation key of the required mutation in the map
*/
void setMutation(int mutation);
}
@@ -0,0 +1,48 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.blocks;
import net.minecraft.world.World;
/**
* Interface to various informations about blocks and TileEntities
* WARNING: Everything retrieved from this interface is not guaranteed to be correct or up to date on client side!
*/
public interface IBlockAPI {
/**
* @return True if a valid Industrial Apiary
*/
boolean isIndustrialApiary(World w, int x, int y, int z);
/**
* @return Industrial Apiary Interface
*/
IIndustrialApiary getIndustrialApiary(World w, int x, int y, int z);
/**
* @return True if a valid Advanced mutatron
*/
boolean isAdvancedMutatron(World w, int x, int y, int z);
/**
* @return Advanced mutatron Interface
*/
IAdvancedMutatron getAdvancedMutatron(World w, int x, int y, int z);
/**
* @return True if a valid machine that does work (most machines in this mod)
*/
boolean isWorkerMachine(World w, int x, int y, int z);
/**
* @return wroker interface
*/
IWorkerMachine getWorkerMachine(World w, int x, int y, int z);
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.blocks;
import forestry.api.apiculture.IBeeHousing;
import net.bdew.gendustry.api.ApiaryModifiers;
import net.minecraft.item.ItemStack;
import java.util.List;
/**
* Public interface to Industrial Apiary TileEntity
* Extends forestry IBeeHousing, IBeeModifier, IBeeListener, IHousing so all of those are usable as well
*/
public interface IIndustrialApiary extends IBeeHousing {
/**
* Do not cache, stored copies will not be updated
*
* @return calculated modifiers from all upgrades
*/
public ApiaryModifiers getModifiers();
/**
* @return List of upgrade itemstacks
*/
public List<ItemStack> getUpgrades();
}
@@ -0,0 +1,22 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.blocks;
public interface IWorkerMachine {
/**
* @return true if a process is ongoing
*/
boolean isWorking();
/**
* @return Progress of current operation [0, 1]
*/
float getProgress();
}
@@ -0,0 +1,51 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.items;
import net.bdew.gendustry.api.ApiaryModifiers;
import net.minecraft.item.ItemStack;
import java.util.List;
/**
* Apiary upgrade, this interface is implemented by the Item subclass of the upgrade
* Can be implemented by other mods to add custom upgrades
*/
public interface IApiaryUpgrade {
/**
* @return Human readable name
*/
String getDisplayName(ItemStack stack);
/**
* @return Human readable description (what would appear on a tooltip below the name)
*/
List<String> getDisplayDetails(ItemStack stack);
/**
* A unique ID for stacking purposes. If 2 itemstacks return the same ID they will
* be added together when counting upgrades to check maximum number.
* If two stacks return the same stacking ID they should return the same number from
* getMaxNumber or weirdness will ensue.
*
* @return Uniquie stacking id
*/
long getStackingId(ItemStack stack);
/**
* @return How many times this upgrade can be installed.
*/
int getMaxNumber(ItemStack stack);
/**
* Applies the effects of an upgrade
*/
void applyModifiers(ApiaryModifiers mods, ItemStack stack);
}
@@ -0,0 +1,41 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.items;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.ISpeciesRoot;
/**
* Represents a single genetic sample
* Returned from IItemApi.getSampleInfo and getTemplateSamples
*/
public interface IGeneSample {
/**
* @return Species root object
*/
public ISpeciesRoot root();
/**
* Chromosome number, see {@link forestry.api.apiculture.EnumBeeChromosome},
* {@link forestry.api.arboriculture.EnumTreeChromosome} and {@link forestry.api.lepidopterology.EnumButterflyChromosome}
*/
public int chromosome();
/**
* @return Sampled allele
*/
public IAllele allele();
/**
* Human-readable, localized string
*/
public String getLocalizedName();
}
@@ -0,0 +1,57 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api.items;
import forestry.api.genetics.IGenome;
import net.minecraft.item.ItemStack;
import java.util.List;
public interface IItemAPI {
/**
* @return true if stack is a template with atleast 1 sample added
*/
boolean isFullTemplate(ItemStack stack);
/**
* @return true if stack is a template with no samples added
*/
boolean isEmptyTemplate(ItemStack stack);
/**
* @return true if stack is a template with all required sample added (usable in replicator)
*/
boolean isCompleteTemplate(ItemStack stack);
/**
* @return true if stack is a filled sample
*/
boolean isFullSample(ItemStack stack);
/**
* @return true if stack is an empty sample
*/
boolean isEmptySample(ItemStack stack);
/**
* @return Contents of a sample
*/
IGeneSample getSampleInfo(ItemStack stack);
/**
* @return Contents of a template as a list of samples
*/
List<IGeneSample> getTemplateSamples(ItemStack stack);
/**
* Contents of a template as a forestry API genome. Any unfilled chromosomes will be taken from default template.
*/
IGenome getTemplateGenome(ItemStack stack);
}
@@ -0,0 +1,13 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
@API(apiVersion = "GENDUSTRY_APIVER", owner = "gendustry", provides = "gendustryAPI") //
package net.bdew.gendustry.api;
import cpw.mods.fml.common.API;
@@ -0,0 +1,37 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.apiimpl
import net.bdew.gendustry.api.blocks.IBlockAPI
import net.minecraft.world.World
import net.bdew.gendustry.machines.advmutatron.TileMutatronAdv
import net.bdew.gendustry.machines.apiary.TileApiary
object BlockApiImpl extends IBlockAPI {
override def isWorkerMachine(w: World, x: Int, y: Int, z: Int) =
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileWorker]
override def getWorkerMachine(w: World, x: Int, y: Int, z: Int) =
if (isWorkerMachine(w, x, y, z)) w.getBlockTileEntity(x, y, z).asInstanceOf[TileWorker] else null
override def isAdvancedMutatron(w: World, x: Int, y: Int, z: Int) =
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileMutatronAdv]
override def getAdvancedMutatron(w: World, x: Int, y: Int, z: Int) =
if (isWorkerMachine(w, x, y, z)) w.getBlockTileEntity(x, y, z).asInstanceOf[TileMutatronAdv] else null
override def isIndustrialApiary(w: World, x: Int, y: Int, z: Int) =
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileApiary]
override def getIndustrialApiary(w: World, x: Int, y: Int, z: Int) =
if (isWorkerMachine(w, x, y, z)) w.getBlockTileEntity(x, y, z).asInstanceOf[TileApiary] else null
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.apiimpl
import net.minecraft.item.ItemStack
import net.bdew.gendustry.config.Items
import net.bdew.gendustry.api.items.IItemAPI
object ItemApiImpl extends IItemAPI {
import scala.collection.JavaConversions._
override def isEmptySample(stack: ItemStack) =
stack.getItem == Items.geneSampleBlank
override def isFullSample(stack: ItemStack) =
stack.getItem == Items.geneSample
override def isEmptyTemplate(stack: ItemStack) =
stack.getItem == Items.geneTemplate && Items.geneTemplate.getSamples(stack).isEmpty
override def isFullTemplate(stack: ItemStack) =
stack.getItem == Items.geneTemplate && !Items.geneTemplate.getSamples(stack).isEmpty
override def isCompleteTemplate(stack: ItemStack) =
stack.getItem == Items.geneTemplate && Items.geneTemplate.isComplete(stack)
override def getTemplateGenome(stack: ItemStack) = {
val root = Items.geneTemplate.getSpecies(stack)
val samples = Items.geneTemplate.getSamples(stack)
val template = root.getDefaultTemplate
samples.foreach(x => template(x.chromosome) = x.allele)
root.templateAsGenome(template)
}
override def getTemplateSamples(stack: ItemStack) =
Items.geneTemplate.getSamples(stack).toList
override def getSampleInfo(stack: ItemStack) =
Items.geneSample.getInfo(stack)
}
@@ -7,14 +7,11 @@
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.api;
package net.bdew.gendustry.apiimpl
import net.minecraft.item.ItemStack;
import net.bdew.lib.power.TileBaseProcessor
import net.bdew.gendustry.api.blocks.IWorkerMachine
public interface IApiaryUpgrade {
void applyModifiers(ApiaryModifiers mods, ItemStack stack);
long getStackingId(ItemStack stack);
int getMaxNumber(ItemStack stack);
trait TileWorker extends TileBaseProcessor with IWorkerMachine {
override def getProgress = progress
}
@@ -0,0 +1,29 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.compat.itempush
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraft.item.ItemStack
import buildcraft.api.transport.IPipeTile
import net.bdew.lib.Misc
object BCPipePushProxy extends ItemPushProxy {
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
(for (pipe <- Misc.getNeighbourTile(from, dir, classOf[IPipeTile])) yield {
if (pipe.getPipeType == IPipeTile.PipeType.ITEM) {
val used = pipe.injectItem(stack, true, dir.getOpposite)
if (used >= stack.stackSize)
null
else
stack.splitStack(stack.stackSize - used)
} else stack
}).getOrElse(stack)
}
@@ -0,0 +1,23 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.compat.itempush
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraft.item.ItemStack
import net.bdew.lib.Misc
import cofh.api.transport.IItemConduit
object CofhConduitPushProxy extends ItemPushProxy {
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
(for (conduit <- Misc.getNeighbourTile(from, dir, classOf[IItemConduit])) yield
conduit.insertItem(dir.getOpposite, stack)
).getOrElse(stack)
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.compat.itempush
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraft.item.ItemStack
import net.bdew.gendustry.compat.PowerProxy
object ItemPush {
var proxies = List.empty[ItemPushProxy]
def init() {
register(VanillaPush)
if (PowerProxy.haveBC) register(BCPipePushProxy)
if (PowerProxy.haveTE) register(CofhConduitPushProxy)
}
def register(p: ItemPushProxy) = proxies :+= p
def pushStack(from: TileEntity, dir: ForgeDirection, st: ItemStack) = {
var stack = st
for (proxy <- proxies if stack != null && stack.stackSize > 0)
stack = proxy.pushStack(from, dir, stack)
if (stack != null && stack.stackSize <= 0)
null
else
stack
}
}
@@ -0,0 +1,18 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.compat.itempush
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraft.item.ItemStack
trait ItemPushProxy {
def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack): ItemStack
}
@@ -0,0 +1,25 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.compat.itempush
import net.bdew.lib.items.ItemUtils
import net.minecraft.inventory.IInventory
import net.bdew.lib.Misc
import net.minecraft.item.ItemStack
import net.minecraftforge.common.ForgeDirection
import net.minecraft.tileentity.TileEntity
object VanillaPush extends ItemPushProxy {
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
(for (target <- Misc.getNeighbourTile(from, dir, classOf[IInventory]) if stack != null) yield {
val slots = ItemUtils.getAccessibleSlotsFromSide(target, dir.getOpposite)
ItemUtils.addStackToSlots(stack, target, slots, true)
}) getOrElse stack
}
+4 -1
View File
@@ -9,7 +9,7 @@
package net.bdew.gendustry.config
import net.bdew.gendustry.items.{IndustrialScoop, IndustrialGrafter, GeneTemplate, GeneSample}
import net.bdew.gendustry.items._
import net.bdew.gendustry.machines.apiary.upgrades.ItemApiaryUpgrade
import net.bdew.lib.config.ItemManager
import net.bdew.gendustry.Gendustry
@@ -39,5 +39,8 @@ object Items extends ItemManager {
regSimpleItem("UpgradeFrame")
regSimpleItem("ClimateModule")
val coverEject = regItem(new EjectCover(ids.getItemId("EjectCover")))
val coverImport = regItem(new ImportCover(ids.getItemId("ImportCover")))
Gendustry.logInfo("Items loaded")
}
@@ -15,15 +15,17 @@ import forestry.api.apiculture.{EnumBeeChromosome, IBeeRoot}
import forestry.api.arboriculture.{IAlleleGrowth, IAlleleFruit, EnumTreeChromosome, ITreeRoot}
import forestry.api.lepidopterology.{EnumButterflyChromosome, IButterflyRoot}
import net.bdew.lib.Misc
import net.bdew.gendustry.api.items.IGeneSample
case class GeneSampleInfo(root: ISpeciesRoot, chromosome: Int, allele: IAllele) {
case class GeneSampleInfo(root: ISpeciesRoot, chromosome: Int, allele: IAllele) extends IGeneSample {
def writeToNBT(t: NBTTagCompound) {
t.setString("species", root.getUID)
t.setInteger("chromosome", chromosome)
t.setString("allele", allele.getUID)
}
def getText: String = {
@Override
def getLocalizedName: String = {
import scala.collection.JavaConverters._
val chr = GeneSampleInfo.getChromosomeName(root, chromosome)
val alstr = allele match {
@@ -76,6 +76,8 @@ trait BlockGuiWrenchable extends Block /*with IDismantleable*/ {
}
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: Int, xoffs: Float, yoffs: Float, zoffs: Float): Boolean = {
// If the click can be handled by something else - ignore it
if (super.onBlockActivated(world, x, y, z, player, side, xoffs, yoffs, zoffs)) return true
if (player.isSneaking) {
val equipped = if (player.getCurrentEquippedItem != null) player.getCurrentEquippedItem.getItem else null
if (equipped.isInstanceOf[IToolWrench] && equipped.asInstanceOf[IToolWrench].canWrench(player, x, y, z)) {
@@ -0,0 +1,49 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.items
import net.bdew.lib.items.SimpleItem
import net.bdew.lib.covers.{TileCoverable, ItemCover}
import net.minecraftforge.common.ForgeDirection
import net.minecraft.inventory.{IInventory, ISidedInventory}
import net.minecraft.client.renderer.texture.IconRegister
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.gendustry.Gendustry
import net.bdew.gendustry.compat.itempush.ItemPush
import net.minecraft.item.ItemStack
class EjectCover(id: Int) extends SimpleItem(id, "EjectCover") with ItemCover {
override def getCoverIcon(stack: ItemStack) = itemIcon
override def getSpriteNumber = 0
override def isValidTile(te: TileCoverable, stack: ItemStack) = te.isInstanceOf[ISidedInventory with IInventory]
override def tickCover(te: TileCoverable, side: ForgeDirection, coverStack: ItemStack): Unit = {
if (te.worldObj.getTotalWorldTime % 20 != 0) return
val inv = te.asInstanceOf[ISidedInventory with IInventory]
for {
slot <- inv.getAccessibleSlotsFromSide(side.ordinal())
stack <- Option(inv.getStackInSlot(slot))
if inv.canExtractItem(slot, stack, side.ordinal())
} {
val stackLeft = ItemPush.pushStack(te, side, stack.copy())
if (stackLeft == null || stackLeft.stackSize < stack.stackSize) {
inv.setInventorySlotContents(slot, stackLeft)
inv.onInventoryChanged()
}
}
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/eject")
}
}
@@ -39,7 +39,7 @@ object GeneSample extends SimpleItem("GeneSample") {
val tip = l.asInstanceOf[util.List[String]].asScala
val info = getInfo(stack)
tip += Misc.toLocal("gendustry.label.sample." + info.root.getUID)
tip += info.getText
tip += info.getLocalizedName
}
}
}
@@ -92,7 +92,7 @@ object GeneTemplate extends SimpleItem("GeneTemplate") {
try {
tip += Misc.toLocal("gendustry.label.template." + tag.getString("species"))
val root = getSpecies(stack)
val samples = getSamples(stack).map(x => x.chromosome -> x.getText).toMap
val samples = getSamples(stack).map(x => x.chromosome -> x.getLocalizedName).toMap
val required = getRequiredChromosomes(root)
tip +=
@@ -0,0 +1,48 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.items
import net.bdew.lib.items.{ItemUtils, SimpleItem}
import net.bdew.lib.covers.{TileCoverable, ItemCover}
import net.minecraftforge.common.ForgeDirection
import net.minecraft.inventory.{IInventory, ISidedInventory}
import net.minecraft.client.renderer.texture.IconRegister
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.gendustry.Gendustry
import net.bdew.lib.Misc
import net.minecraft.item.ItemStack
class ImportCover(id: Int) extends SimpleItem(id, "ImportCover") with ItemCover {
override def getCoverIcon(stack: ItemStack) = itemIcon
override def getSpriteNumber = 0
override def isValidTile(te: TileCoverable, stack: ItemStack) = te.isInstanceOf[ISidedInventory with IInventory]
override def tickCover(te: TileCoverable, side: ForgeDirection, coverStack: ItemStack): Unit = {
if (te.worldObj.getTotalWorldTime % 20 != 0) return
val inv = te.asInstanceOf[ISidedInventory with IInventory]
val insertSlots = inv.getAccessibleSlotsFromSide(side.ordinal())
for {
from <- Misc.getNeighbourTile(te, side, classOf[IInventory])
slot <- ItemUtils.getAccessibleSlotsFromSide(from, side.getOpposite)
stack <- Option(from.getStackInSlot(slot))
if (Misc.asInstanceOpt(from, classOf[ISidedInventory]) map (_.canExtractItem(slot, stack, side.getOpposite.ordinal()))
getOrElse true)
} {
from.setInventorySlotContents(slot, ItemUtils.addStackToSlots(stack, inv, insertSlots, true))
from.onInventoryChanged()
}
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/import")
}
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockMutatronAdv extends Block(Material.rock) with HasTE[TileMutatronAdv] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockMutatronAdv extends Block(Material.rock) with HasTE[TileMutatronAdv] with BlockCoverable[TileMutatronAdv] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileMutatronAdv]
private var icons: Array[IIcon] = null
lazy val guiId = MachineMutatronAdv.guiId
@@ -17,7 +17,7 @@ import net.minecraft.item.ItemStack
class SlotSelector(inv: TileMutatronAdv, slot: Int, x: Int, y: Int) extends Slot(inv, slot, x, y) with SlotClickable {
def onClick(button: Int, mods: Int, player: EntityPlayer): ItemStack = {
if (button == 0 && mods == 0 && !inv.getWorld.isRemote && !inv.isWorking && getHasStack) {
inv.selectedMutation := slotNumber
inv.setMutation(getSlotIndex)
}
return null
}
@@ -19,8 +19,11 @@ import net.bdew.gendustry.power.TilePowered
import net.bdew.lib.data.base.UpdateKind
import net.bdew.gendustry.forestry.GeneticsHelper
import net.minecraftforge.common.util.ForgeDirection
import net.bdew.gendustry.api.blocks.IAdvancedMutatron
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileMutatronAdv extends TileItemProcessor with TilePowered with ExposeTank {
class TileMutatronAdv extends TileItemProcessor with TileWorker with TilePowered with ExposeTank with IAdvancedMutatron with TileCoverable {
lazy val cfg = MachineMutatronAdv
val outputSlots = Seq(slots.outIndividual)
@@ -59,6 +62,16 @@ class TileMutatronAdv extends TileItemProcessor with TilePowered with ExposeTank
}
}
override def setMutation(mutation: Int) {
if (!isWorking && slots.selectors.contains(mutation) && inv(mutation) != null)
selectedMutation := mutation
}
override def getPossibleMutations = {
import scala.collection.JavaConverters._
(slots.selectors map (x => Integer.valueOf(x) -> inv(x)) filterNot (_._2 != null)).toMap.asJava
}
def canStart =
getStackInSlot(slots.inIndividual1) != null &&
getStackInSlot(slots.inIndividual2) != null &&
@@ -113,4 +126,6 @@ class TileMutatronAdv extends TileItemProcessor with TilePowered with ExposeTank
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = false
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = null
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = null
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -23,8 +23,9 @@ import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.minecraft.entity.EntityLivingBase
import net.minecraft.item.ItemStack
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockApiary extends Block(Material.rock) with HasTE[TileApiary] with BlockGuiWrenchable with BreakableInventoryBlock {
object BlockApiary extends Block(Material.rock) with HasTE[TileApiary] with BlockCoverable[TileApiary] with BlockGuiWrenchable with BreakableInventoryBlock {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileApiary]
lazy val guiId: Int = MachineApiary.guiId
@@ -0,0 +1,42 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
*
* This mod is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
*/
package net.bdew.gendustry.machines.apiary
import _root_.forestry.api.apiculture.IBeeRoot
import _root_.forestry.api.genetics.AlleleManager
import net.bdew.gendustry.Gendustry
import net.minecraft.util.EnumChatFormatting
object Sanity {
def check(house: TileApiary) {
import scala.collection.JavaConversions._
try {
val bees = AlleleManager.alleleRegistry.getSpeciesRoot("rootBees").asInstanceOf[IBeeRoot]
val defGenome = bees.templateAsGenome(bees.getDefaultTemplate)
val defSpecies = defGenome.getPrimary
var found = false
for (mutation <- bees.getMutations(false)) {
if (mutation.getChance(house, defSpecies, defSpecies, defGenome, defGenome) > 0) {
found = true
Gendustry.logWarn("Detected probably bugged mutation! %s+%s (class: %s) doesn't check the species. Please report it to the mod author.",
mutation.getAllele0.getName, mutation.getAllele1.getName, mutation.getClass.getCanonicalName)
}
}
if (found) {
val player = house.worldObj.getClosestPlayer(house.xCoord, house.yCoord, house.zCoord, 20)
if (player != null) {
player.addChatMessage(EnumChatFormatting.RED + "[Gendustry] WARNING! Possibly bugged mutations detected, check the log for details.")
}
}
} catch {
case t: Throwable => t.printStackTrace()
}
}
}
@@ -20,7 +20,7 @@ import forestry.api.arboriculture.EnumGermlingType
import net.bdew.lib.tile.TileExtended
import net.bdew.gendustry.config.Config
import net.bdew.lib.items.ItemUtils
import net.bdew.gendustry.api.{ApiaryModifiers, IApiaryUpgrade}
import net.bdew.gendustry.api.ApiaryModifiers
import net.minecraft.world.biome.BiomeGenBase
import net.bdew.lib.data.base.{UpdateKind, TileDataSlots}
import net.bdew.lib.data.DataSlotFloat
@@ -32,6 +32,9 @@ import net.bdew.lib.power.DataSlotPower
import net.bdew.gendustry.compat.triggers.ForestryErrorSource
import net.bdew.gendustry.gui.rscontrol.TileRSContollable
import net.minecraftforge.common.util.ForgeDirection
import net.bdew.gendustry.api.items.IApiaryUpgrade
import net.bdew.gendustry.api.blocks.IIndustrialApiary
import net.bdew.lib.covers.TileCoverable
class TileApiary extends TileExtended
with TileDataSlots
@@ -41,7 +44,8 @@ with BreakableInventoryTile
with TilePowered
with ForestryErrorSource
with TileRSContollable
with IBeeHousing {
with TileCoverable
with IIndustrialApiary {
object slots {
val queen = 0
@@ -186,6 +190,14 @@ with IBeeHousing {
override def canInsertItem(slot: Int, stack: ItemStack, side: Int) = slots.bees.contains(slot) && isItemValidForSlot(slot, stack)
override def canExtractItem(slot: Int, stack: ItemStack, side: Int) = slots.output.contains(slot)
//IIndustrialApiary
override def getUpgrades = {
import scala.collection.JavaConversions._
slots.upgrades map inv filterNot (_ == null)
}
override def getModifiers = mods
// IBeeListener
def onPostQueenDeath(queen: IBee) {
if (mods.isAutomated) movePrincess = true
@@ -246,4 +258,12 @@ with IBeeHousing {
p = ItemUtils.addStackToSlots(p, this, slots.output, false)
return p == null
}
override def validate() {
super.validate()
if (worldObj != null && !worldObj.isRemote)
Sanity.check(this)
}
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -10,7 +10,7 @@
package net.bdew.gendustry.machines.apiary.upgrades
import net.minecraft.item.{ItemStack, Item}
import net.bdew.gendustry.api.{ApiaryModifiers, IApiaryUpgrade}
import net.bdew.gendustry.api.ApiaryModifiers
import net.minecraft.client.renderer.texture.IIconRegister
import net.bdew.gendustry.Gendustry
import net.minecraft.util.IIcon
@@ -20,6 +20,7 @@ import java.util
import net.minecraft.entity.player.EntityPlayer
import net.bdew.lib.Misc
import net.bdew.lib.items.NamedItem
import net.bdew.gendustry.api.items.IApiaryUpgrade
object ItemApiaryUpgrade extends Item with IApiaryUpgrade with NamedItem {
var icons = Map.empty[Int, IIcon]
@@ -31,53 +32,60 @@ object ItemApiaryUpgrade extends Item with IApiaryUpgrade with NamedItem {
def formatModifier(f: Float, base: Float) = (if (f > base) "+" else "") + "%.0f".format((f - base) * 100) + "%"
override def addInformation(stack: ItemStack, player: EntityPlayer, list: util.List[_], par4: Boolean) {
if (!Upgrades.map.contains(stack.getItemDamage)) return
override def getDisplayName(stack: ItemStack) = Misc.toLocal(getUnlocalizedName(stack))
override def getDisplayDetails(stack: ItemStack): util.ArrayList[String] = {
val list = new util.ArrayList[String]()
if (!Upgrades.map.contains(stack.getItemDamage)) return list
val upgrade = Upgrades.map(stack.getItemDamage)
val l = list.asInstanceOf[util.List[String]]
val mods = new ApiaryModifiers
upgrade.mod(mods, 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.maxinstall") + " " + upgrade.maxNum.toString)
list.add(Misc.toLocal(Gendustry.modId + ".label.maxinstall") + " " + upgrade.maxNum.toString)
if (mods.isAutomated)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.automated"))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.automated"))
if (mods.biomeOverride != null)
l.add(Misc.toLocalF(Gendustry.modId + ".label.mod.biome", mods.biomeOverride.biomeName))
list.add(Misc.toLocalF(Gendustry.modId + ".label.mod.biome", mods.biomeOverride.biomeName))
if (mods.isSealed)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.sealed"))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.sealed"))
if (mods.isSelfLighted)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.selflighted"))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.selflighted"))
if (mods.isSunlightSimulated)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.sky"))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.sky"))
if (mods.isCollectingPollen)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.sieve"))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.sieve"))
if (mods.lifespan != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.lifespan") + " " + formatModifier(mods.lifespan, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.lifespan") + " " + formatModifier(mods.lifespan, 1))
if (mods.flowering != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.flowering") + " " + formatModifier(mods.flowering, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.flowering") + " " + formatModifier(mods.flowering, 1))
if (mods.geneticDecay != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.geneticDecay") + " " + formatModifier(mods.geneticDecay, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.geneticDecay") + " " + formatModifier(mods.geneticDecay, 1))
if (mods.mutation != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.mutation") + " " + formatModifier(mods.mutation, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.mutation") + " " + formatModifier(mods.mutation, 1))
if (mods.production != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.production") + " " + formatModifier(mods.production, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.production") + " " + formatModifier(mods.production, 1))
if (mods.territory != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.territory") + " " + formatModifier(mods.territory, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.territory") + " " + formatModifier(mods.territory, 1))
if (mods.humidity != 0)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.humidity") + " " + formatModifier(mods.humidity, 0))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.humidity") + " " + formatModifier(mods.humidity, 0))
if (mods.temperature != 0)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.temperature") + " " + formatModifier(mods.temperature, 0))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.temperature") + " " + formatModifier(mods.temperature, 0))
if (mods.energy != 1)
l.add(Misc.toLocal(Gendustry.modId + ".label.mod.energy") + " " + formatModifier(mods.energy, 1))
list.add(Misc.toLocal(Gendustry.modId + ".label.mod.energy") + " " + formatModifier(mods.energy, 1))
return list
}
def getStackingId(stack: ItemStack) = Item.getIdFromItem(this) * Int.MaxValue + stack.getItemDamage
override def addInformation(stack: ItemStack, player: EntityPlayer, list: util.List[_], par4: Boolean) {
list.asInstanceOf[util.List[String]].addAll(getDisplayDetails(stack))
}
def getMaxNumber(stack: ItemStack): Int = {
if (Upgrades.map.contains(stack.getItemDamage))
return Upgrades.map(stack.getItemDamage).maxNum
@@ -19,8 +19,9 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockExtractor extends Block(Material.rock) with HasTE[TileExtractor] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockExtractor extends Block(Material.rock) with HasTE[TileExtractor] with BlockCoverable[TileExtractor] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileExtractor]
lazy val guiId = MachineExtractor.guiId
@@ -20,8 +20,10 @@ import net.bdew.lib.data.base.UpdateKind
import net.bdew.lib.power.TileBaseProcessor
import net.bdew.gendustry.power.TilePowered
import net.minecraftforge.common.util.ForgeDirection
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileExtractor extends TileBaseProcessor with TilePowered with ExposeTank {
class TileExtractor extends TileBaseProcessor with TileWorker with TilePowered with ExposeTank with TileCoverable {
lazy val cfg = MachineExtractor
object slots {
@@ -84,4 +86,6 @@ class TileExtractor extends TileBaseProcessor with TilePowered with ExposeTank {
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean) = 0
override def canFill(from: ForgeDirection, fluid: Fluid) = false
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockImprinter extends Block(Material.rock) with HasTE[TileImprinter] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockImprinter extends Block(Material.rock) with HasTE[TileImprinter] with BlockCoverable[TileImprinter] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileImprinter]
private var icons: Array[IIcon] = null
lazy val guiId: Int = MachineImprinter.guiId
@@ -18,8 +18,11 @@ import scala.util.Random
import net.bdew.lib.power.TileItemProcessor
import net.bdew.gendustry.power.TilePowered
import net.bdew.gendustry.items.GeneTemplate
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
import net.minecraftforge.common.ForgeDirection
class TileImprinter extends TileItemProcessor with TilePowered {
class TileImprinter extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
lazy val cfg = MachineImprinter
val outputSlots = Seq(slots.outIndividual)
@@ -114,4 +117,6 @@ class TileImprinter extends TileItemProcessor with TilePowered {
override def canExtractItem(slot: Int, item: ItemStack, side: Int) =
slot == slots.outIndividual ||
(slot == slots.inTemplate && inv(slots.inIndividual) == null && (output :== null))
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockLiquifier extends Block(Material.rock) with HasTE[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockLiquifier extends Block(Material.rock) with HasTE[TileLiquifier] BlockCoverable[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileLiquifier]
lazy val guiId = MachineLiquifier.guiId
@@ -20,8 +20,10 @@ import net.bdew.lib.tile.ExposeTank
import net.bdew.lib.data.base.UpdateKind
import net.bdew.lib.power.TileBaseProcessor
import net.bdew.gendustry.power.TilePowered
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileLiquifier extends TileBaseProcessor with TilePowered with ExposeTank {
class TileLiquifier extends TileBaseProcessor with TileWorker with TilePowered with ExposeTank with TileCoverable {
lazy val cfg = MachineLiquifier
val tank = DataSlotTankRestricted("tank", this, cfg.tankSize, Fluids.protein.getID).setUpdate(UpdateKind.GUI, UpdateKind.SAVE)
@@ -76,4 +78,6 @@ class TileLiquifier extends TileBaseProcessor with TilePowered with ExposeTank {
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean) = 0
override def canFill(from: ForgeDirection, fluid: Fluid) = false
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockMutagenProducer extends Block(Material.rock) with HasTE[TileMutagenProducer] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockMutagenProducer extends Block(Material.rock) with HasTE[TileMutagenProducer] with BlockCoverable[TileMutagenProducer] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileMutagenProducer]
lazy val guiId = MachineMutagenProducer.guiId
@@ -9,7 +9,7 @@
package net.bdew.gendustry.machines.mproducer
import net.bdew.gendustry.config.Fluids
import net.bdew.gendustry.config.{Items, Fluids, Machines}
import net.bdew.gendustry.fluids.MutagenSources
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
@@ -20,8 +20,10 @@ import net.bdew.lib.tile.ExposeTank
import net.bdew.lib.data.base.UpdateKind
import net.bdew.lib.power.TileBaseProcessor
import net.bdew.gendustry.power.TilePowered
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileMutagenProducer extends TileBaseProcessor with TilePowered with ExposeTank {
class TileMutagenProducer extends TileBaseProcessor with TileWorker with TilePowered with ExposeTank with TileCoverable {
lazy val cfg = MachineMutagenProducer
val tank = DataSlotTankRestricted("tank", this, cfg.tankSize, Fluids.mutagen.getID).setUpdate(UpdateKind.GUI, UpdateKind.SAVE)
@@ -72,4 +74,6 @@ class TileMutagenProducer extends TileBaseProcessor with TilePowered with Expose
override def fill(from: ForgeDirection, resource: FluidStack, doFill: Boolean) = 0
override def canFill(from: ForgeDirection, fluid: Fluid) = false
override def isValidCover(side: ForgeDirection, cover: ItemStack) = cover.getItem == Items.coverImport
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockMutatron extends Block(Material.rock) with HasTE[TileMutatron] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockMutatron extends Block(Material.rock) with HasTE[TileMutatron] with BlockCoverable[TileMutatron] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileMutatron]
private var icons: Array[IIcon] = null
lazy val guiId: Int = MachineMutatron.guiId
@@ -19,8 +19,10 @@ import net.bdew.lib.power.TileItemProcessor
import net.bdew.gendustry.power.TilePowered
import net.bdew.lib.data.base.UpdateKind
import net.bdew.gendustry.forestry.GeneticsHelper
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileMutatron extends TileItemProcessor with TilePowered with ExposeTank {
class TileMutatron extends TileItemProcessor with TileWorker with TilePowered with ExposeTank with TileCoverable {
lazy val cfg = MachineMutatron
val outputSlots = Seq(slots.outIndividual)
@@ -77,4 +79,6 @@ class TileMutatron extends TileItemProcessor with TilePowered with ExposeTank {
override def canDrain(from: ForgeDirection, fluid: Fluid): Boolean = false
override def drain(from: ForgeDirection, resource: FluidStack, doDrain: Boolean): FluidStack = null
override def drain(from: ForgeDirection, maxDrain: Int, doDrain: Boolean): FluidStack = null
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockReplicator extends Block(Material.rock) with HasTE[TileReplicator] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockReplicator extends Block(Material.rock) with HasTE[TileReplicator] with BlockCoverable[TileReplicator] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileReplicator]
private var icons: Array[IIcon] = null
lazy val guiId: Int = MachineReplicator.guiId
@@ -18,8 +18,10 @@ import net.bdew.lib.power.TileItemProcessor
import net.bdew.gendustry.power.TilePowered
import net.bdew.gendustry.forestry.GeneticsHelper
import net.bdew.gendustry.items.GeneTemplate
import net.bdew.gendustry.apiimpl.TileWorker
import net.bdew.lib.covers.TileCoverable
class TileReplicator extends TileItemProcessor with TilePowered with IFluidHandler {
class TileReplicator extends TileItemProcessor with TileWorker with TilePowered with IFluidHandler with TileCoverable {
lazy val cfg = MachineReplicator
val outputSlots = Seq(slots.outIndividual)
@@ -66,4 +68,6 @@ class TileReplicator extends TileItemProcessor with TilePowered with IFluidHandl
def canFill(from: ForgeDirection, fluid: Fluid) = fluid == Fluids.dna || fluid == Fluids.protein
def canDrain(from: ForgeDirection, fluid: Fluid) = false
def getTankInfo(from: ForgeDirection) = Array(dnaTank.getInfo, proteinTank.getInfo)
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockSampler extends Block(Material.rock) with HasTE[TileSampler] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockSampler extends Block(Material.rock) with HasTE[TileSampler] with BlockCoverable[TileSampler] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileSampler]
private var icons: Array[IIcon] = null
lazy val guiId: Int = MachineSampler.guiId
@@ -19,7 +19,7 @@ import net.bdew.gendustry.power.TilePowered
import net.bdew.gendustry.compat.ExtraBeesProxy
import net.bdew.gendustry.items.GeneSample
class TileSampler extends TileItemProcessor with TilePowered {
class TileSampler extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
lazy val cfg = MachineSampler
val outputSlots = Seq(slots.outSample)
@@ -85,4 +85,6 @@ class TileSampler extends TileItemProcessor with TilePowered {
allowSided = true
override def canExtractItem(slot: Int, item: ItemStack, side: Int) = slot == slots.outSample
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -19,8 +19,9 @@ import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.gui.BlockGuiWrenchable
import net.bdew.lib.covers.BlockCoverable
object BlockTransposer extends Block(Material.rock) with HasTE[TileTransposer] with BreakableInventoryBlock with BlockGuiWrenchable {
object BlockTransposer extends Block(Material.rock) with HasTE[TileTransposer] with BlockCoverable[TileTransposer] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileTransposer]
private var icons: Array[IIcon] = null
lazy val guiId: Int = MachineTransposer.guiId
@@ -16,7 +16,7 @@ import net.bdew.gendustry.power.TilePowered
import net.bdew.lib.items.IStack
import net.bdew.gendustry.items.{GeneTemplate, GeneSample}
class TileTransposer extends TileItemProcessor with TilePowered {
class TileTransposer extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
lazy val cfg = MachineTransposer
val outputSlots = Seq(slots.outCopy)
@@ -79,4 +79,6 @@ class TileTransposer extends TileItemProcessor with TilePowered {
allowSided = true
override def canExtractItem(slot: Int, item: ItemStack, side: Int) =
slot == slots.outCopy || (slot == slots.inTemplate && inv(slots.inBlank) == null && (output :== null))
override def isValidCover(side: ForgeDirection, cover: ItemStack) = true
}
@@ -20,8 +20,6 @@ class BaseDataProvider[T](cls: Class[T]) extends IWailaDataProvider {
def getHeadStrings(target: T, stack: ItemStack, acc: IWailaDataAccessor, cfg: IWailaConfigHandler): Iterable[String] = None
def getBodyStrings(target: T, stack: ItemStack, acc: IWailaDataAccessor, cfg: IWailaConfigHandler): Iterable[String] = None
println("BDP: %s < %s".format(this, cls))
import scala.collection.JavaConversions._
final override def getWailaTail(itemStack: ItemStack, currenttip: util.List[String], accessor: IWailaDataAccessor, config: IWailaConfigHandler) = {