mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-13 09:18:05 -04:00
Updated to Forestry 4.x API. Closes #1508.
This commit is contained in:
parent
528f2ee05e
commit
0eefb26b44
@ -21,7 +21,7 @@ eio.cf=2219/296
|
||||
eio.version=1.7.10-2.2.1.276
|
||||
es.version=1.4.5.24
|
||||
fmp.version=1.1.0.308
|
||||
forestry.version=3.5.7.16
|
||||
forestry.version=4.1.0.44
|
||||
gc.build=3
|
||||
gc.version=3.0.7
|
||||
gt.version=5.04.06
|
||||
|
@ -44,7 +44,7 @@ object Mods {
|
||||
val EnderStorage = new SimpleMod(IDs.EnderStorage)
|
||||
val ExtraCells = new SimpleMod(IDs.ExtraCells, version = "@[2.2.73,)")
|
||||
val Factorization = new SimpleMod(IDs.Factorization, providesPower = true)
|
||||
val Forestry = new SimpleMod(IDs.Forestry)
|
||||
val Forestry = new SimpleMod(IDs.Forestry, version = "@[4.0,)")
|
||||
val ForgeMultipart = new SimpleMod(IDs.ForgeMultipart)
|
||||
val Galacticraft = new SimpleMod(IDs.Galacticraft, providesPower = true)
|
||||
val GregTech = new ClassBasedMod(IDs.GregTech, "gregtech.api.GregTech_API")()
|
||||
|
@ -1,7 +1,6 @@
|
||||
package li.cil.oc.integration.forestry;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IMutation;
|
||||
import li.cil.oc.api.driver.Converter;
|
||||
@ -12,17 +11,17 @@ public class ConverterIAlleles implements Converter {
|
||||
@Override
|
||||
public void convert(final Object value, final Map<Object, Object> output) {
|
||||
if (value instanceof IMutation) {
|
||||
IMutation mutation = (IMutation) value;
|
||||
final IMutation mutation = (IMutation) value;
|
||||
|
||||
IAllele allele1 = mutation.getAllele0();
|
||||
if (allele1 instanceof IAlleleSpecies) {
|
||||
Map<Object, Object> allelMap1 = Maps.newHashMap();
|
||||
final IAlleleSpecies allele1 = mutation.getAllele0();
|
||||
if (allele1 != null) {
|
||||
final Map<Object, Object> allelMap1 = Maps.newHashMap();
|
||||
convert(allele1, allelMap1);
|
||||
output.put("allele1", allelMap1);
|
||||
}
|
||||
IAllele allele2 = mutation.getAllele1();
|
||||
if (allele2 instanceof IAlleleSpecies) {
|
||||
Map<Object, Object> allelMap2 = Maps.newHashMap();
|
||||
final IAlleleSpecies allele2 = mutation.getAllele1();
|
||||
if (allele2 != null) {
|
||||
final Map<Object, Object> allelMap2 = Maps.newHashMap();
|
||||
convert(allele2, allelMap2);
|
||||
output.put("allele2", allelMap2);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class ConverterIIndividual implements Converter {
|
||||
};
|
||||
|
||||
private interface IAlleleConverter<A extends IAllele> {
|
||||
public Object convert(A allele);
|
||||
Object convert(A allele);
|
||||
}
|
||||
|
||||
private static final Map<Class<? extends IAllele>, IAlleleConverter<?>> converters =
|
||||
|
@ -1,7 +1,7 @@
|
||||
package li.cil.oc.integration.forestry
|
||||
|
||||
import forestry.api.genetics.AlleleManager
|
||||
import forestry.core.gadgets.TileAnalyzer
|
||||
import forestry.core.tiles.TileAnalyzer
|
||||
import li.cil.oc.api.driver.NamedBlock
|
||||
import li.cil.oc.api.machine.Arguments
|
||||
import li.cil.oc.api.machine.Callback
|
||||
@ -21,13 +21,13 @@ class DriverAnalyzer extends DriverTileEntity {
|
||||
|
||||
override def priority = 0
|
||||
|
||||
@Callback(doc = "function():boolean -- Can the bees breed?")
|
||||
def isWorking(context: Context, args: Arguments): Array[AnyRef] = result(tileEntity.isWorking)
|
||||
@Callback(doc = "function():boolean -- Get whether the analyzer can work.")
|
||||
def isWorking(context: Context, args: Arguments): Array[AnyRef] = result(tileEntity.hasWork)
|
||||
|
||||
@Callback(doc = "function():boolean -- Can the bees breed?")
|
||||
@Callback(doc = "function():boolean -- Get the progress of the current operation.")
|
||||
def getProgress(context: Context, args: Arguments): Array[AnyRef] = result(1.0 - tileEntity.getProgressScaled(100) / 100.0)
|
||||
|
||||
@Callback(doc = "function():boolean -- Can the bees breed?")
|
||||
@Callback(doc = "function():boolean -- Get info on the currently present bee.")
|
||||
def getIndividualOnDisplay(context: Context, args: Arguments): Array[AnyRef] = result(AlleleManager.alleleRegistry.getIndividual(tileEntity.getIndividualOnDisplay))
|
||||
}
|
||||
|
||||
|
@ -38,12 +38,12 @@ public class DriverBeeHouse extends DriverTileEntity {
|
||||
|
||||
@Callback(doc = "function():boolean -- Can the bees breed?")
|
||||
public Object[] canBreed(final Context context, final Arguments args) {
|
||||
return new Object[]{tileEntity.canBreed()};
|
||||
return new Object[]{tileEntity.getBeekeepingLogic().canWork()};
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Get the drone")
|
||||
public Object[] getDrone(final Context context, final Arguments args) {
|
||||
final ItemStack drone = tileEntity.getDrone();
|
||||
final ItemStack drone = tileEntity.getBeeInventory().getDrone();
|
||||
if (drone != null) {
|
||||
return new Object[]{AlleleManager.alleleRegistry.getIndividual(drone)};
|
||||
}
|
||||
@ -52,7 +52,7 @@ public class DriverBeeHouse extends DriverTileEntity {
|
||||
|
||||
@Callback(doc = "function():table -- Get the queen")
|
||||
public Object[] getQueen(final Context context, final Arguments args) {
|
||||
final ItemStack queen = tileEntity.getQueen();
|
||||
final ItemStack queen = tileEntity.getBeeInventory().getQueen();
|
||||
if (queen != null) {
|
||||
return new Object[]{AlleleManager.alleleRegistry.getIndividual(queen)};
|
||||
}
|
||||
@ -68,14 +68,14 @@ public class DriverBeeHouse extends DriverTileEntity {
|
||||
|
||||
final Set<Map<String, Object>> result = Sets.newHashSet();
|
||||
for (IMutation mutation : beeRoot.getMutations(false)) {
|
||||
HashMap<String, Object> mutationMap = new HashMap<String, Object>();
|
||||
final HashMap<String, Object> mutationMap = new HashMap<String, Object>();
|
||||
|
||||
IAllele allele1 = mutation.getAllele0();
|
||||
final IAllele allele1 = mutation.getAllele0();
|
||||
if (allele1 != null) {
|
||||
mutationMap.put("allele1", allele1.getName());
|
||||
}
|
||||
|
||||
IAllele allele2 = mutation.getAllele1();
|
||||
final IAllele allele2 = mutation.getAllele1();
|
||||
if (allele2 != null) {
|
||||
mutationMap.put("allele2", allele2.getName());
|
||||
}
|
||||
@ -84,7 +84,7 @@ public class DriverBeeHouse extends DriverTileEntity {
|
||||
mutationMap.put("specialConditions", mutation
|
||||
.getSpecialConditions().toArray());
|
||||
|
||||
IAllele[] template = mutation.getTemplate();
|
||||
final IAllele[] template = mutation.getTemplate();
|
||||
if (template != null && template.length > 0) {
|
||||
mutationMap.put("result", template[0].getName());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user