mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-27 23:45:37 +00:00
Fixed and cleaned up merged code
This commit is contained in:
1 parent
18969fcf9a
commit
ccae98e6f8
22 files changed
+60
-52
No files matched your search
+2
-2
@@ -73,7 +73,7 @@ dependencies {
|
||||
compile "net.industrial-craft:industrialcraft-2:2.1.470-experimental:api"
|
||||
compile "net.sengir.forestry:forestry_1.7.2:2.4.1.22:api"
|
||||
compile "mcp.mobius.waila:Waila:1.5.2a"
|
||||
compile "net.bdew.thirdparty:CoFHLib:R1.0:api"
|
||||
compile "net.bdew.thirdparty:CoFHLib:R1.0.1:api"
|
||||
}
|
||||
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
@@ -102,7 +102,7 @@ processResources {
|
||||
}
|
||||
|
||||
task apiJar(type: Jar, dependsOn: 'classes') {
|
||||
from (sourceSets.main.output) {
|
||||
from(sourceSets.main.output) {
|
||||
include 'net/bdew/gendustry/api/**'
|
||||
}
|
||||
|
||||
|
||||
@@ -274,11 +274,11 @@ A = OD:gearBronze
|
||||
S = B:pistonBase
|
||||
|
||||
B_B
|
||||
_S_ => gendustry:ImportCover
|
||||
_S_ => I:gendustry:ImportCover
|
||||
_A_
|
||||
|
||||
_A_
|
||||
_S_ => gendustry:EjectCover
|
||||
_S_ => I:gendustry:EjectCover
|
||||
B_B
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
rootProject.name='gendustry'
|
||||
rootProject.name = 'gendustry'
|
||||
@@ -15,23 +15,26 @@ import net.bdew.gendustry.machines.advmutatron.TileMutatronAdv
|
||||
import net.bdew.gendustry.machines.apiary.TileApiary
|
||||
|
||||
object BlockApiImpl extends IBlockAPI {
|
||||
private def getTypedTileEntity[T](w: World, x: Int, y: Int, z: Int, cls: Class[T]) =
|
||||
Option(w.getTileEntity(x, y, z)) filter cls.isInstance map (_.asInstanceOf[T])
|
||||
|
||||
override def isWorkerMachine(w: World, x: Int, y: Int, z: Int) =
|
||||
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileWorker]
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileWorker]).isDefined
|
||||
|
||||
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
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileWorker]) getOrElse null
|
||||
|
||||
override def isAdvancedMutatron(w: World, x: Int, y: Int, z: Int) =
|
||||
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileMutatronAdv]
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileMutatronAdv]).isDefined
|
||||
|
||||
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
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileMutatronAdv]) getOrElse null
|
||||
|
||||
override def isIndustrialApiary(w: World, x: Int, y: Int, z: Int) =
|
||||
w.blockHasTileEntity(x, y, z) && w.getBlockTileEntity(x, y, z).isInstanceOf[TileApiary]
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileApiary]).isDefined
|
||||
|
||||
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
|
||||
getTypedTileEntity(w, x, y, z, classOf[TileApiary]) getOrElse null
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package net.bdew.gendustry.apiimpl
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.bdew.gendustry.config.Items
|
||||
import net.bdew.gendustry.api.items.IItemAPI
|
||||
import net.bdew.gendustry.items.{GeneTemplate, GeneSample}
|
||||
|
||||
object ItemApiImpl extends IItemAPI {
|
||||
|
||||
@@ -21,29 +22,29 @@ object ItemApiImpl extends IItemAPI {
|
||||
stack.getItem == Items.geneSampleBlank
|
||||
|
||||
override def isFullSample(stack: ItemStack) =
|
||||
stack.getItem == Items.geneSample
|
||||
stack.getItem == GeneSample
|
||||
|
||||
override def isEmptyTemplate(stack: ItemStack) =
|
||||
stack.getItem == Items.geneTemplate && Items.geneTemplate.getSamples(stack).isEmpty
|
||||
stack.getItem == GeneTemplate && GeneTemplate.getSamples(stack).isEmpty
|
||||
|
||||
override def isFullTemplate(stack: ItemStack) =
|
||||
stack.getItem == Items.geneTemplate && !Items.geneTemplate.getSamples(stack).isEmpty
|
||||
stack.getItem == GeneTemplate && !GeneTemplate.getSamples(stack).isEmpty
|
||||
|
||||
override def isCompleteTemplate(stack: ItemStack) =
|
||||
stack.getItem == Items.geneTemplate && Items.geneTemplate.isComplete(stack)
|
||||
stack.getItem == GeneTemplate && GeneTemplate.isComplete(stack)
|
||||
|
||||
override def getTemplateGenome(stack: ItemStack) = {
|
||||
val root = Items.geneTemplate.getSpecies(stack)
|
||||
val samples = Items.geneTemplate.getSamples(stack)
|
||||
val root = GeneTemplate.getSpecies(stack)
|
||||
val samples = 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
|
||||
GeneTemplate.getSamples(stack).toList
|
||||
|
||||
override def getSampleInfo(stack: ItemStack) =
|
||||
Items.geneSample.getInfo(stack)
|
||||
GeneSample.getInfo(stack)
|
||||
|
||||
}
|
||||
@@ -10,10 +10,10 @@
|
||||
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
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
object BCPipePushProxy extends ItemPushProxy {
|
||||
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
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
|
||||
import cofh.api.transport.IItemDuct
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
object CofhConduitPushProxy extends ItemPushProxy {
|
||||
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
|
||||
(for (conduit <- Misc.getNeighbourTile(from, dir, classOf[IItemConduit])) yield
|
||||
(for (conduit <- Misc.getNeighbourTile(from, dir, classOf[IItemDuct])) yield
|
||||
conduit.insertItem(dir.getOpposite, stack)
|
||||
).getOrElse(stack)
|
||||
}
|
||||
@@ -10,9 +10,9 @@
|
||||
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
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
object ItemPush {
|
||||
var proxies = List.empty[ItemPushProxy]
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
package net.bdew.gendustry.compat.itempush
|
||||
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
trait ItemPushProxy {
|
||||
def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack): ItemStack
|
||||
|
||||
@@ -13,8 +13,8 @@ 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
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
object VanillaPush extends ItemPushProxy {
|
||||
override def pushStack(from: TileEntity, dir: ForgeDirection, stack: ItemStack) =
|
||||
|
||||
@@ -39,8 +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")))
|
||||
val coverEject = regItem(EjectCover)
|
||||
val coverImport = regItem(ImportCover)
|
||||
|
||||
Gendustry.logInfo("Items loaded")
|
||||
}
|
||||
@@ -10,8 +10,6 @@
|
||||
package net.bdew.gendustry.config
|
||||
|
||||
import net.bdew.lib.recipes.gencfg.ConfigSection
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe
|
||||
import buildcraft.core.recipes.AssemblyRecipeManager
|
||||
|
||||
object Tuning extends ConfigSection
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ 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 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
|
||||
|
||||
@@ -11,22 +11,22 @@ 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 net.minecraft.client.renderer.texture.IIconRegister
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.gendustry.compat.itempush.ItemPush
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class EjectCover(id: Int) extends SimpleItem(id, "EjectCover") with ItemCover {
|
||||
object EjectCover extends SimpleItem("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
|
||||
if (te.getWorldObj.getTotalWorldTime % 20 != 0) return
|
||||
val inv = te.asInstanceOf[ISidedInventory with IInventory]
|
||||
|
||||
for {
|
||||
@@ -37,13 +37,13 @@ class EjectCover(id: Int) extends SimpleItem(id, "EjectCover") with ItemCover {
|
||||
val stackLeft = ItemPush.pushStack(te, side, stack.copy())
|
||||
if (stackLeft == null || stackLeft.stackSize < stack.stackSize) {
|
||||
inv.setInventorySlotContents(slot, stackLeft)
|
||||
inv.onInventoryChanged()
|
||||
inv.markDirty()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
override def registerIcons(reg: IIconRegister) {
|
||||
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/eject")
|
||||
}
|
||||
}
|
||||
@@ -11,38 +11,37 @@ 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 net.minecraft.client.renderer.texture.IIconRegister
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.lib.Misc
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class ImportCover(id: Int) extends SimpleItem(id, "ImportCover") with ItemCover {
|
||||
object ImportCover extends SimpleItem("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
|
||||
if (te.getWorldObj.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)
|
||||
if Misc.asInstanceOpt(from, classOf[ISidedInventory]).fold(true)(_.canExtractItem(slot, stack, side.getOpposite.ordinal()))
|
||||
} {
|
||||
from.setInventorySlotContents(slot, ItemUtils.addStackToSlots(stack, inv, insertSlots, true))
|
||||
from.onInventoryChanged()
|
||||
from.markDirty()
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
override def registerIcons(reg: IIconRegister) {
|
||||
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/import")
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ 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
|
||||
import net.minecraft.util.{ChatComponentTranslation, EnumChatFormatting}
|
||||
|
||||
object Sanity {
|
||||
def check(house: TileApiary) {
|
||||
@@ -30,9 +30,10 @@ object Sanity {
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
val player = house.worldObj.getClosestPlayer(house.xCoord, house.yCoord, house.zCoord, 20)
|
||||
val player = house.getWorld.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.")
|
||||
player.addChatMessage(new ChatComponentTranslation(
|
||||
EnumChatFormatting.RED + "[Gendustry] WARNING! Possibly bugged mutations detected, check the log for details."))
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
|
||||
@@ -20,7 +20,7 @@ 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
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class TileImprinter extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
|
||||
lazy val cfg = MachineImprinter
|
||||
|
||||
@@ -21,7 +21,7 @@ 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] BlockCoverable[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
|
||||
object BlockLiquifier extends Block(Material.rock) with HasTE[TileLiquifier] with BlockCoverable[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
|
||||
private var icons: Array[IIcon] = null
|
||||
val TEClass = classOf[TileLiquifier]
|
||||
lazy val guiId = MachineLiquifier.guiId
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
package net.bdew.gendustry.machines.mproducer
|
||||
|
||||
import net.bdew.gendustry.config.{Items, Fluids, Machines}
|
||||
import net.bdew.gendustry.config.{Items, Fluids}
|
||||
import net.bdew.gendustry.fluids.MutagenSources
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
|
||||
@@ -18,6 +18,9 @@ import net.bdew.lib.power.TileItemProcessor
|
||||
import net.bdew.gendustry.power.TilePowered
|
||||
import net.bdew.gendustry.compat.ExtraBeesProxy
|
||||
import net.bdew.gendustry.items.GeneSample
|
||||
import net.bdew.gendustry.apiimpl.TileWorker
|
||||
import net.bdew.lib.covers.TileCoverable
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class TileSampler extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
|
||||
lazy val cfg = MachineSampler
|
||||
|
||||
@@ -15,6 +15,9 @@ import net.bdew.lib.power.TileItemProcessor
|
||||
import net.bdew.gendustry.power.TilePowered
|
||||
import net.bdew.lib.items.IStack
|
||||
import net.bdew.gendustry.items.{GeneTemplate, GeneSample}
|
||||
import net.bdew.gendustry.apiimpl.TileWorker
|
||||
import net.bdew.lib.covers.TileCoverable
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class TileTransposer extends TileItemProcessor with TileWorker with TilePowered with TileCoverable {
|
||||
lazy val cfg = MachineTransposer
|
||||
|
||||
@@ -70,7 +70,7 @@ object NEICache {
|
||||
val pairs = mutations.toList.map(mutation => mutation.getPartner(sp1) -> mutation)
|
||||
// Select distinct partners
|
||||
pairs.map(_._1).distinct map { dsp =>
|
||||
// Find all results
|
||||
// Find all results
|
||||
dsp -> pairs.filter(_._1 == dsp).map(_._2)
|
||||
} filter { case (partner, results) =>
|
||||
// Filter for >1 results
|
||||
|
||||
Reference in new issue
Block a user