Initial update to MC 1.7.2

This commit is contained in:
bdew committed 2014-04-14 09:59:44 +03:00
1 parent ada04a64e1
commit 8fbed991bd
68 files changed
+285 -479

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
/out
/build
/run
/deps/run
/.idea/workspace.xml
/.idea/dictionaries
/eclipse
-200
View File
@@ -14,206 +14,6 @@
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
<option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
<option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="0" />
<arrangement>
<groups>
<group>
<type>GETTERS_AND_SETTERS</type>
<order>KEEP</order>
</group>
</groups>
<rules>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PUBLIC />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PROTECTED />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PACKAGE_PRIVATE />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PRIVATE />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PUBLIC />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PROTECTED />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PACKAGE_PRIVATE />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PRIVATE />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PUBLIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PROTECTED />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PACKAGE_PRIVATE />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<FINAL />
<PRIVATE />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PUBLIC />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PROTECTED />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PACKAGE_PRIVATE />
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<FIELD />
<PRIVATE />
</AND>
</match>
</rule>
<rule>
<match>
<FIELD />
</match>
</rule>
<rule>
<match>
<CONSTRUCTOR />
</match>
</rule>
<rule>
<match>
<AND>
<METHOD />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<METHOD />
</match>
</rule>
<rule>
<match>
<ENUM />
</match>
</rule>
<rule>
<match>
<INTERFACE />
</match>
</rule>
<rule>
<match>
<AND>
<CLASS />
<STATIC />
</AND>
</match>
</rule>
<rule>
<match>
<CLASS />
</match>
</rule>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
+10 -5
View File
@@ -9,18 +9,22 @@ buildscript {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.0-SNAPSHOT'
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
apply plugin: 'forge'
apply plugin: 'scala'
version = "1.1.1"
ext.bdlibver = "1.2.0.38"
ext.versuffix = "mc164"
version = "1.2.0"
ext.bdlibver = "1.3.0.4"
ext.versuffix = "mc172"
if (project.hasProperty('buildnum')) {
project.version = project.version + '.' + project.buildnum
@@ -34,7 +38,7 @@ group = "net.bdew"
archivesBaseName = "gendustry"
minecraft {
version = "1.6.4-9.11.1.964"
version = "1.7.2-10.12.0.1057"
replace("BDLIB_VER", project.bdlibver)
replace("GENDUSTRY_VER", project.version)
}
@@ -49,6 +53,7 @@ repositories {
dependencies {
compile "net.bdew:bdlib:" + bdlibver
// compile "com.mod-buildcraft:buildcraft:5.0.0.+:dev"
compile project(path: ':deps', configuration: 'deps')
}
+13 -13
View File
@@ -28,18 +28,18 @@ group= "net.bdew.gendustry"
archivesBaseName = "deps"
minecraft {
version = "1.6.4-9.11.1.964"
version = "1.7.2-10.12.0.1057"
}
apply from: 'downloader.gradle'
addGitDep("cofh","https://github.com/KingLemming/CoFHLib.git","24600c4cfda893a16316c0631972170413f3a1e3")
addGitDep("bc","https://github.com/BuildCraft/BuildCraft.git","03acd96b2b5a9a3270985246cd835c0ca866def7")
addGitDep("ccl","https://github.com/Chicken-Bones/CodeChickenLib.git","a315c0059e2397977b227f438db9d21ef8de1a8e")
addHgDep("ccc","https://bitbucket.org/ChickenBones/codechickencore","4bad417f4db168b24662b684d349048b6003ad0a")
addHgDep("nei","https://bitbucket.org/ChickenBones/notenoughitems","3d7c952ca8f5c669d719e553cf873ebf57da605a")
addZipDep("forestry","http://bit.ly/IYjfWc","2.3.1.0")
addZipDep("ic2","http://ic2api.player.to:8080/job/IC2_experimental/307/artifact/packages/industrialcraft-2-api_2.0.307-experimental.zip","307")
//addGitDep("cofh","https://github.com/KingLemming/CoFHLib.git","24600c4cfda893a16316c0631972170413f3a1e3")
addGitDep("bc","https://github.com/BuildCraft/BuildCraft.git","30882a155b4d364c400ac02753455ba80dd833f8")
//addGitDep("ccl","https://github.com/Chicken-Bones/CodeChickenLib.git","a315c0059e2397977b227f438db9d21ef8de1a8e")
//addHgDep("ccc","https://bitbucket.org/ChickenBones/codechickencore","4bad417f4db168b24662b684d349048b6003ad0a")
//addHgDep("nei","https://bitbucket.org/ChickenBones/notenoughitems","3d7c952ca8f5c669d719e553cf873ebf57da605a")
addZipDep("forestry","http://player.to/forestry/forestry-2.4.0.0-711-api.zip","2.4.0.0-711")
addZipDep("ic2","http://ic2api.player.to:8080/job/IC2_experimental/459/artifact/build/libs/industrialcraft-2-2.1.459-experimental-api.jar","459")
task patchDeps(type: Sync) {
dependsOn getDeps
@@ -51,9 +51,9 @@ task patchDeps(type: Sync) {
exclude "ue/src/cofh"
exclude "ue/src/ic2"
doLast {
println("Applying patch...")
ant.fixcrlf(srcDir: "deps", includes: "**/*.java")
ant.patch(patchfile: "fixes.patch", strip: "1", dir: "deps", ignorewhitespace: "Yes", failonerror: "Yes")
// println("Applying patch...")
// ant.fixcrlf(srcDir: "deps", includes: "**/*.java")
// ant.patch(patchfile: "fixes.patch", strip: "1", dir: "deps", ignorewhitespace: "Yes", failonerror: "Yes")
}
}
@@ -63,7 +63,7 @@ afterEvaluate {
sourceMainJava.dependsOn(patchDeps)
}
deobfBinJar.addTransformer('deps/nei/nei_at.cfg')
//deobfBinJar.addTransformer('deps/nei/nei_at.cfg')
sourceSets {
main {
@@ -78,7 +78,7 @@ sourceSets {
include 'forestry/**'
srcDir 'deps/bc/common'
include 'buildcraft/api/**'
include 'buildcraft/**'
srcDir 'deps/ic2'
include 'ic2/**'
+2 -1
View File
@@ -1 +1,2 @@
include "deps"
include "deps"
rootProject.name='gendustry'
@@ -59,10 +59,10 @@ class CommandGiveSample extends CommandBase {
if (!isValidAllele(root, chromosome, allele)) throw new CommandException("gendustry.givesample.error.invalid")
val sample = Items.geneSample.newStack(GeneSampleInfo(root, chromosome, allele))
val entityitem = player.dropPlayerItem(sample)
val entityitem = player.entityDropItem(sample, 0)
entityitem.delayBeforeCanPickup = 0
CommandBase.notifyAdmins(sender, "gendustry.givesample.success", rootUid, chromosomeName, alleleUid, player.username)
CommandBase.notifyAdmins(sender, "gendustry.givesample.success", rootUid, chromosomeName, alleleUid, player.getDisplayName)
}
override def addTabCompletionOptions(sender: ICommandSender, params: Array[String]): List[_] = {
@@ -39,10 +39,10 @@ class CommandGiveTemplate extends CommandBase {
if (!validSpecies.contains(uid))
throw new WrongUsageException("gendustry.givetemplate.usage")
val entityitem = player.dropPlayerItem(GeneticsHelper.templateFromSpeciesUID(uid))
val entityitem = player.entityDropItem(GeneticsHelper.templateFromSpeciesUID(uid), 0)
entityitem.delayBeforeCanPickup = 0
CommandBase.notifyAdmins(sender, "gendustry.givetemplate.success", uid, player.username)
CommandBase.notifyAdmins(sender, "gendustry.givetemplate.success", uid, player.getDisplayName)
}
override def addTabCompletionOptions(sender: ICommandSender, params: Array[String]): List[_] = {
@@ -13,30 +13,31 @@ import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.minecraft.world.IBlockAccess
import net.minecraft.world.World
import net.minecraftforge.fluids.{Fluid, BlockFluidClassic}
class BlockFluid(id: Int, val fluid: Fluid, val ownIcons: Boolean) extends BlockFluidClassic(id, fluid, Material.water) {
setUnlocalizedName(Gendustry.modId + "." + fluid.getName)
class BlockFluid(val fluid: Fluid, val ownIcons: Boolean) extends BlockFluidClassic(fluid, Material.water) {
setBlockName(Gendustry.modId + "." + fluid.getName)
override def canDisplace(world: IBlockAccess, x: Int, y: Int, z: Int): Boolean = {
if (world.getBlockMaterial(x, y, z).isLiquid) return false
world.getBlock(x, y, z).getMaterial.isLiquid
if (world.getBlock(x, y, z).getMaterial.isLiquid) return false
return super.canDisplace(world, x, y, z)
}
override def displaceIfPossible(world: World, x: Int, y: Int, z: Int): Boolean = {
if (world.getBlockMaterial(x, y, z).isLiquid) return false
if (world.getBlock(x, y, z).getMaterial.isLiquid) return false
return super.displaceIfPossible(world, x, y, z)
}
@SideOnly(Side.CLIENT)
override def getIcon(side: Int, meta: Int): Icon = if (side == 0 || side == 1) fluid.getStillIcon else fluid.getFlowingIcon
override def getIcon(side: Int, meta: Int): IIcon = if (side == 0 || side == 1) fluid.getStillIcon else fluid.getFlowingIcon
@SideOnly(Side.CLIENT)
override def registerIcons(register: IconRegister) {
override def registerBlockIcons(register: IIconRegister) {
if (ownIcons) {
fluid.setStillIcon(register.registerIcon(Gendustry.modId + ":fluids/" + fluid.getName + "/still"))
fluid.setFlowingIcon(register.registerIcon(Gendustry.modId + ":fluids/" + fluid.getName + "/flowing"))
@@ -12,32 +12,33 @@ package net.bdew.gendustry.fluids
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.item.{Item, ItemStack, ItemBucket}
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.item.{ItemStack, ItemBucket}
import net.minecraftforge.fluids.Fluid
import net.minecraftforge.event.ForgeSubscribe
import net.minecraftforge.event.entity.player.FillBucketEvent
import net.minecraftforge.event.Event.Result
import net.minecraftforge.common.MinecraftForge
import cpw.mods.fml.common.eventhandler.SubscribeEvent
import cpw.mods.fml.common.eventhandler.Event.Result
import cpw.mods.fml.common.registry.GameRegistry
class ItemFluidBucket(id: Int, fluid: Fluid) extends ItemBucket(id, fluid.getBlockID) {
class ItemFluidBucket(fluid: Fluid) extends ItemBucket(fluid.getBlock) {
setUnlocalizedName(Gendustry.modId + "." + fluid.getName.toLowerCase + ".bucket")
setContainerItem(Item.bucketEmpty)
setContainerItem(GameRegistry.findItem("minecraft", "bucket"))
MinecraftForge.EVENT_BUS.register(this)
@ForgeSubscribe
@SubscribeEvent
def onBucketFill(event: FillBucketEvent) {
if (event.world.getBlockMetadata(event.target.blockX, event.target.blockY, event.target.blockZ) != 0) return
if (event.world.getBlockId(event.target.blockX, event.target.blockY, event.target.blockZ) != fluid.getBlockID) return
if (event.world.getBlock(event.target.blockX, event.target.blockY, event.target.blockZ) != fluid.getBlock) return
event.world.setBlockToAir(event.target.blockX, event.target.blockY, event.target.blockZ)
event.result = new ItemStack(this)
event.setResult(Result.ALLOW)
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
override def registerIcons(reg: IIconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":bucket/" + fluid.getName.toLowerCase)
}
}
@@ -12,15 +12,15 @@ package net.bdew.gendustry.fluids
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.item.Item
import net.minecraftforge.fluids.Fluid
class ItemFluidCan(id: Int, fluid: Fluid) extends Item(id) {
class ItemFluidCan(fluid: Fluid) extends Item() {
setUnlocalizedName(Gendustry.modId + "." + fluid.getName.toLowerCase + ".can")
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
override def registerIcons(reg: IIconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":can/" + fluid.getName.toLowerCase)
}
}
@@ -9,32 +9,28 @@
package net.bdew.gendustry.fluids
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import scala.collection.mutable
import net.minecraftforge.oredict.OreDictionary
class FluidRegistry {
val values = mutable.Map.empty[Int, mutable.Map[Int, Int]]
val values = mutable.Map.empty[Item, mutable.Map[Int, Int]]
def register(block: Block, value: Integer): Unit = register(block.blockID, OreDictionary.WILDCARD_VALUE, value)
def register(item: Item, value: Integer): Unit = register(item.itemID, OreDictionary.WILDCARD_VALUE, value)
def register(item: ItemStack, value: Integer): Unit = register(item.itemID, item.getItemDamage, value)
def register(stack: ItemStack, value: Int): Unit = register(stack.getItem, stack.getItemDamage, value)
def register(id: Int, damage: Int, value: Int) {
if (values.contains(id)) {
values(id) += (damage -> value)
def register(item: Item, damage: Int, value: Int) {
if (values.contains(item)) {
values(item) += (damage -> value)
} else {
val sub = mutable.Map.empty[Int, Int]
sub += (damage -> value)
values.put(id, sub)
values.put(item, sub)
}
}
def getValue(item: ItemStack): Int = {
if (!values.contains(item.itemID)) return 0
val sub = values(item.itemID)
val sub = values.getOrElse(item.getItem, return 0)
if (sub.contains(item.getItemDamage)) {
return sub(item.getItemDamage)
} else if (sub.contains(OreDictionary.WILDCARD_VALUE)) {
+4 -6
View File
@@ -9,12 +9,10 @@
package net.bdew.gendustry
import java.util.logging.Logger
import net.bdew.gendustry.config._
import cpw.mods.fml.common.Mod
import cpw.mods.fml.common.Mod.EventHandler
import cpw.mods.fml.common.event.{FMLServerStartingEvent, FMLInitializationEvent, FMLPostInitializationEvent, FMLPreInitializationEvent}
import cpw.mods.fml.common.network.NetworkMod
import cpw.mods.fml.common.network.NetworkRegistry
import java.io.File
import net.bdew.gendustry.machines.apiary.upgrades.Upgrades
@@ -23,9 +21,9 @@ import cpw.mods.fml.relauncher.Side
import net.bdew.gendustry.gui.HintIcons
import net.bdew.gendustry.compat.triggers.TriggerProvider
import net.minecraft.command.CommandHandler
import org.apache.logging.log4j.Logger
@Mod(modid = Gendustry.modId, version = "GENDUSTRY_VER", name = "Gendustry", dependencies = "required-after:Forestry@[2.3.1.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")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
@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 {
var log: Logger = null
var instance = this
@@ -37,7 +35,7 @@ object Gendustry {
var configFile: File = null
def logInfo(msg: String, args: Any*) = log.info(msg.format(args: _*))
def logWarn(msg: String, args: Any*) = log.warning(msg.format(args: _*))
def logWarn(msg: String, args: Any*) = log.warn(msg.format(args: _*))
@EventHandler
def preInit(event: FMLPreInitializationEvent) {
@@ -57,7 +55,7 @@ object Gendustry {
@EventHandler
def init(event: FMLInitializationEvent) {
Config.load(configFile)
NetworkRegistry.instance.registerGuiHandler(this, Config.guiHandler)
NetworkRegistry.INSTANCE.registerGuiHandler(this, Config.guiHandler)
Upgrades.init()
TuningLoader.loadDealayed()
}
@@ -34,7 +34,7 @@ object ExtraBeesProxy {
if (itemSerum != null) Gendustry.logInfo("ExtraBees serum item: %s", itemSerum)
def isSerum(stack: ItemStack) = if (itemSerum != null) stack.itemID == itemSerum.itemID else false
def isSerum(stack: ItemStack) = if (itemSerum != null) stack.getItem == itemSerum else false
def getSerumSample(stack: ItemStack): GeneSampleInfo = {
if (!isSerum(stack)) return null
@@ -10,24 +10,24 @@
package net.bdew.gendustry.compat.triggers
import buildcraft.api.gates.{ITriggerParameter, ITrigger}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.Misc
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
abstract class BaseTrigger[T <: TileEntity](val id: String, ordering: String, tileClass: Class[T]) extends ITrigger {
var icon: Icon = null
var icon: IIcon = null
def getLegacyId = -1
def getUniqueTag = "gendustry." + ordering + "." + id
def getIcon = icon
def registerIcons(ir: IconRegister) =
def registerIcons(ir: IIconRegister) =
icon = ir.registerIcon("gendustry:trigger/" + id)
def hasParameter = false
def requiresParameter = false
def getDescription = Misc.toLocal("gendustry.trigger." + id)
def createParameter() = null
def rotateLeft() = this
def isTriggerActive(side: ForgeDirection, tile: TileEntity, parameter: ITriggerParameter) =
if (tileClass.isInstance(tile))
getState(side, tile.asInstanceOf[T])
@@ -9,12 +9,12 @@
package net.bdew.gendustry.compat.triggers
import net.minecraftforge.common.ForgeDirection
import net.bdew.gendustry.machines.apiary.{ErrorCodes, TileApiary}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.tileentity.TileEntity
import net.bdew.gendustry.Gendustry
import buildcraft.api.gates.ActionManager
import net.minecraftforge.common.util.ForgeDirection
trait ForestryErrorSource extends TileEntity {
def getErrorOrdinal: Int
@@ -23,7 +23,7 @@ trait ForestryErrorSource extends TileEntity {
case class ForestryErrorTrigger(code: Int) extends BaseTrigger("forestry.error." + code, "y%03d".format(code), classOf[ForestryErrorSource]) {
override def getIcon = ErrorCodes.getIcon(code).icon
override def getDescription = ErrorCodes.getDescription(code)
override def registerIcons(ir: IconRegister) {}
override def registerIcons(ir: IIconRegister) {}
def getState(side: ForgeDirection, tile: ForestryErrorSource) =
tile.asInstanceOf[TileApiary].getErrorOrdinal == code
}
@@ -10,8 +10,8 @@
package net.bdew.gendustry.compat.triggers
import net.bdew.gendustry.power.TilePowered
import net.minecraftforge.common.ForgeDirection
import buildcraft.api.gates.ActionManager
import net.minecraftforge.common.util.ForgeDirection
object TriggerPower0 extends BaseTrigger("power0", "z1", classOf[TilePowered]) {
def getState(side: ForgeDirection, tile: TilePowered) = tile.power.stored == 0
@@ -12,14 +12,14 @@ package net.bdew.gendustry.compat.triggers
import buildcraft.api.gates.{ActionManager, ITrigger, ITriggerProvider}
import net.minecraft.block.Block
import net.minecraft.tileentity.TileEntity
import buildcraft.api.transport.IPipe
import buildcraft.api.transport.IPipeTile
import net.bdew.gendustry.machines.apiary.TileApiary
import java.util
import net.bdew.gendustry.power.TilePowered
import net.bdew.lib.power.TileBaseProcessor
object TriggerProvider extends ITriggerProvider {
def getPipeTriggers(pipe: IPipe) = null
def getPipeTriggers(pipe: IPipeTile) = null
def getNeighborTriggers(block: Block, tile: TileEntity) = {
import scala.collection.JavaConversions._
@@ -10,7 +10,7 @@
package net.bdew.gendustry.compat.triggers
import net.bdew.lib.power.TileBaseProcessor
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
object TriggerWorking extends BaseTrigger("working", "x", classOf[TileBaseProcessor]) {
def getState(side: ForgeDirection, tile: TileBaseProcessor) = tile.isWorking
+1 -1
View File
@@ -12,6 +12,6 @@ package net.bdew.gendustry.config
import net.bdew.lib.config.BlockManager
import net.bdew.gendustry.Gendustry
object Blocks extends BlockManager(Config.IDs) {
object Blocks extends BlockManager() {
Gendustry.logInfo("Blocks loaded")
}
+1 -4
View File
@@ -9,13 +9,11 @@
package net.bdew.gendustry.config
import net.minecraftforge.common.Configuration
import java.io.File
import net.bdew.lib.config.IdManager
import net.bdew.lib.gui.GuiHandler
import net.minecraftforge.common.config.Configuration
object Config {
var IDs: IdManager = null
val guiHandler = new GuiHandler
var neiAddSamples = false
@@ -30,7 +28,6 @@ object Config {
neiAddSamples = c.get("NEI", "Add samples", true).getBoolean(false)
powerShowUnits = c.get("Display", "PowerShowUnits", "MJ", "Units to use when displaying power. Valid values: MJ, EU, RF").getString
if (powerShowUnits != "MJ") powerShowMultiplier = Tuning.getSection("Power").getFloat(powerShowUnits + "_MJ_Ratio")
IDs = new IdManager(c, 15000, 3500)
Fluids.load()
Blocks.load()
Items.load()
+8 -8
View File
@@ -15,11 +15,11 @@ import net.bdew.gendustry.Gendustry
import net.minecraftforge.fluids.{FluidStack, FluidContainerRegistry, FluidRegistry, Fluid}
import net.bdew.lib.Misc
import cpw.mods.fml.common.registry.GameRegistry
import net.minecraft.item.{Item, ItemStack}
import net.minecraft.item.ItemStack
import forestry.api.core.ItemInterface
object Fluids extends FluidManager(Config.IDs) {
val emptyBucket = new ItemStack(Item.bucketEmpty)
object Fluids extends FluidManager() {
val emptyBucket = new ItemStack(GameRegistry.findItem("minecraft", "bucket"))
val emptyCan = ItemInterface.getItem("canEmpty")
def registerFluid(id: String,
@@ -45,17 +45,17 @@ object Fluids extends FluidManager(Config.IDs) {
true
}
val fluid = FluidRegistry.getFluid(id.toLowerCase)
if (fluid.getBlockID == -1) {
val block = new BlockFluid(ids.getBlockId(id), fluid, ownFluid)
if (fluid.getBlock == null) {
val block = new BlockFluid(fluid, ownFluid)
GameRegistry.registerBlock(block, "fluid." + id)
fluid.setBlockID(block)
fluid.setBlock(block)
}
if (FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, 1000), emptyBucket) == null) {
val bucket = Items.regItem(new ItemFluidBucket(ids.getItemId(id + "Bucket"), fluid), id + "Bucket")
val bucket = Items.regItem(new ItemFluidBucket(fluid), id + "Bucket")
FluidContainerRegistry.registerFluidContainer(fluid, new ItemStack(bucket), emptyBucket)
}
if (FluidContainerRegistry.fillFluidContainer(new FluidStack(fluid, 1000), emptyCan) == null) {
val can = Items.regItem(new ItemFluidCan(ids.getItemId(id + "Can"), fluid), id + "Can")
val can = Items.regItem(new ItemFluidCan(fluid), id + "Can")
FluidContainerRegistry.registerFluidContainer(fluid, new ItemStack(can), emptyCan)
}
return fluid
+3 -3
View File
@@ -15,13 +15,13 @@ import net.bdew.gendustry.machines.apiary.upgrades.ItemApiaryUpgrade
import net.bdew.lib.config.ItemManager
import net.bdew.gendustry.Gendustry
object Items extends ItemManager(Config.IDs) {
object Items extends ItemManager() {
val labware = regSimpleItem("Labware")
val waste = regSimpleItem("Waste")
val geneSampleBlank = regSimpleItem("GeneSampleBlank")
val geneSample = regItem(new GeneSample(ids.getItemId("GeneSample")))
val geneTemplate = regItem(new GeneTemplate(ids.getItemId("GeneTemplate")))
val geneSample = regItem(new GeneSample())
val geneTemplate = regItem(new GeneTemplate())
val upgradeItem = regItemCls(classOf[ItemApiaryUpgrade], "ApiaryUpgrade")
+1 -1
View File
@@ -22,7 +22,7 @@ import net.bdew.gendustry.machines.extractor.MachineExtractor
import net.bdew.gendustry.machines.transposer.MachineTransposer
import net.bdew.gendustry.machines.replicator.MachineReplicator
object Machines extends MachineManager(Config.IDs, Tuning.getSection("Machines"), Config.guiHandler) {
object Machines extends MachineManager(Tuning.getSection("Machines"), Config.guiHandler) {
val mutagenProducer = registerMachine(new MachineMutagenProducer)
val mutatron = registerMachine(new MachineMutatron)
val apiary = registerMachine(new MachineApiary)
+11 -10
View File
@@ -13,11 +13,12 @@ import net.bdew.lib.recipes.gencfg._
import net.bdew.lib.recipes._
import net.bdew.gendustry.fluids.{LiquidDNASources, ProteinSources, MutagenSources}
import net.minecraftforge.oredict.OreDictionary
import buildcraft.api.recipes.AssemblyRecipe
import java.io.{InputStreamReader, FileReader, File}
import net.bdew.gendustry.Gendustry
import net.bdew.lib.recipes.gencfg.ConfigSection
import net.bdew.lib.recipes.gencfg.CfgVal
import buildcraft.core.recipes.AssemblyRecipeManager.AssemblyRecipe
import buildcraft.core.recipes.AssemblyRecipeManager
object Tuning extends ConfigSection
@@ -81,37 +82,37 @@ object TuningLoader {
case StMutagen(st, mb) =>
for (x <- getAllConcreteStacks(st)) {
MutagenSources.register(x, mb)
log.info("Added Mutagen source %s -> %d mb".format(x, mb))
Gendustry.logInfo("Added Mutagen source %s -> %d mb".format(x, mb))
}
case StLiquidDNA(st, mb) =>
for (x <- getAllConcreteStacks(st)) {
LiquidDNASources.register(x, mb)
log.info("Added Liquid DNA source %s -> %d mb".format(x, mb))
Gendustry.logInfo("Added Liquid DNA source %s -> %d mb".format(x, mb))
}
case StProtein(st, mb) =>
for (x <- getAllConcreteStacks(st)) {
ProteinSources.register(x, mb)
log.info("Added Protein source %s -> %d mb".format(x, mb))
Gendustry.logInfo("Added Protein source %s -> %d mb".format(x, mb))
}
case StAssembly(rec, power, out, cnt) =>
log.info("Adding assembly recipe: %s + %d mj => %s * %d".format(rec, power, out, cnt))
Gendustry.logInfo("Adding assembly recipe: %s + %d mj => %s * %d".format(rec, power, out, cnt))
val outStack = getConcreteStack(out, cnt)
val stacks = rec.map {
case (c, n) =>
val s = getConcreteStack(currCharMap(c), n)
if (s.getItemDamage == OreDictionary.WILDCARD_VALUE) {
s.setItemDamage(0)
log.warning("%s added with wildcard metadata which is unsupported, assuming 0".format(s))
Gendustry.logWarn("%s added with wildcard metadata which is unsupported, assuming 0".format(s))
}
log.info("%s -> %s".format(c, s))
Gendustry.logInfo("%s -> %s".format(c, s))
s
}
log.info("Output: %s".format(outStack))
AssemblyRecipe.assemblyRecipes.add(new AssemblyRecipe(stacks.toArray, power, outStack))
log.info("Done")
Gendustry.logInfo("Output: %s".format(outStack))
AssemblyRecipeManager.INSTANCE.getRecipes.add(new AssemblyRecipe(outStack, power, stacks: _*))
Gendustry.logInfo("Done")
case _ => super.processDelayedStatement(s)
}
@@ -14,20 +14,20 @@ import net.minecraft.entity.player.EntityPlayer
import buildcraft.api.tools.IToolWrench
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import cpw.mods.fml.common.Optional
import net.bdew.gendustry.compat.PowerProxy
import cofh.api.block.IDismantleable
//import cofh.api.block.IDismantleable
import net.minecraft.item.ItemStack
import net.bdew.lib.tile.inventory.BreakableInventoryTile
import net.bdew.lib.items.ItemUtils
@Optional.Interface(modid = PowerProxy.TE_MOD_ID, iface = "cofh.api.block.IDismantleable")
trait BlockGuiWrenchable extends Block with IDismantleable {
//@Optional.Interface(modid = PowerProxy.TE_MOD_ID, iface = "cofh.api.block.IDismantleable")
trait BlockGuiWrenchable extends Block /*with IDismantleable*/ {
val guiId: Int
def dismantleBlock(player: EntityPlayer, world: World, x: Int, y: Int, z: Int, returnBlock: Boolean): ItemStack = {
val item = new ItemStack(this)
val te = world.getBlockTileEntity(x, y, z)
val te = world.getTileEntity(x, y, z)
if (te != null && te.isInstanceOf[BreakableInventoryTile])
te.asInstanceOf[BreakableInventoryTile].dropItems()
@@ -46,7 +46,7 @@ trait BlockGuiWrenchable extends Block with IDismantleable {
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)) {
if (!world.isRemote) world.destroyBlock(x, y, z, true)
if (!world.isRemote) world.getBlock(x, y, z).harvestBlock(world, player, x, y, z, world.getBlockMetadata(x, y, z))
return true
}
return false
@@ -13,18 +13,18 @@ import net.bdew.lib.gui.widgets.WidgetProgressBar
import net.bdew.lib.gui.{Texture, Point, Rect}
import net.bdew.lib.data.DataSlotFloat
import scala.collection.mutable
import net.bdew.gendustry.nei.NEIRecipeProxy
import net.bdew.lib.Misc
//import net.bdew.gendustry.nei.NEIRecipeProxy
class WidgetProgressBarNEI(rect: Rect, texture: Texture, dslot: DataSlotFloat, recipeid: String) extends WidgetProgressBar(rect, texture, dslot) {
//FIXME disabled for initial port
override def mouseClicked(p: Point, button: Int) {
if (NEIRecipeProxy.hasNei)
NEIRecipeProxy.openRecipes(recipeid)
// if (NEIRecipeProxy.hasNei)
// NEIRecipeProxy.openRecipes(recipeid)
}
override def handleTooltip(p: Point, tip: mutable.MutableList[String]) {
super.handleTooltip(p, tip)
if (NEIRecipeProxy.hasNei) tip += Misc.toLocal("gendustry.label.recipes")
// if (NEIRecipeProxy.hasNei) tip += Misc.toLocal("gendustry.label.recipes")
}
}
@@ -15,7 +15,7 @@ trait TileRSContollable extends TileDataSlots {
val rsmode = DataslotRSMode("rsmode", this).setUpdate(UpdateKind.SAVE, UpdateKind.GUI, UpdateKind.WORLD)
def canWork = {
val powered = worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)
val powered = getWorldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)
(rsmode :== RSMode.ALWAYS) ||
((rsmode :== RSMode.RS_ON) && powered) ||
((rsmode :== RSMode.RS_OFF) && !powered)
@@ -14,6 +14,8 @@ import net.bdew.lib.gui.widgets.Widget
import net.bdew.gendustry.gui.Textures
import scala.collection.mutable
import net.bdew.lib.{Misc, Client}
import net.minecraft.client.audio.PositionedSoundRecord
import net.minecraft.util.ResourceLocation
class WidgetRSModeButton(p: Point, te: TileRSContollable, container: ContainerRSControllable) extends Widget {
val rect = new Rect(p, 16, 16)
@@ -36,7 +38,7 @@ class WidgetRSModeButton(p: Point, te: TileRSContollable, container: ContainerRS
}
override def mouseClicked(p: Point, button: Int) {
Client.minecraft.sndManager.playSoundFX("random.click", 1.0F, 1.0F)
Client.minecraft.getSoundHandler.playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F))
Client.minecraft.playerController.windowClick(container.windowId, container.RSMODE_SLOT_NUM, RSMode.next(te.rsmode).id, 0, Client.player)
}
}
@@ -18,7 +18,7 @@ import net.bdew.gendustry.forestry.GeneSampleInfo
import net.bdew.gendustry.config.Items
import net.bdew.lib.items.SimpleItem
class GeneSample(id: Int) extends SimpleItem(id, "GeneSample") {
class GeneSample extends SimpleItem("GeneSample") {
setMaxStackSize(1)
setContainerItem(Items.geneSampleBlank)
@@ -23,7 +23,7 @@ import forestry.api.arboriculture.{ITreeRoot, EnumTreeChromosome}
import forestry.api.lepidopterology.{IButterflyRoot, EnumButterflyChromosome}
import net.minecraft.util.EnumChatFormatting
class GeneTemplate(id: Int) extends SimpleItem(id, "GeneTemplate") {
class GeneTemplate extends SimpleItem("GeneTemplate") {
setMaxStackSize(1)
val unusedBeeChromosomes = Set(EnumBeeChromosome.HUMIDITY)
@@ -54,7 +54,7 @@ class GeneTemplate(id: Int) extends SimpleItem(id, "GeneTemplate") {
def getSamples(stack: ItemStack): Iterable[GeneSampleInfo] = {
val tag = stack.getTagCompound
if (tag != null)
return Misc.iterNbtList[NBTTagCompound](tag.getTagList("samples")).map(x => GeneSampleInfo.fromNBT(x))
return Misc.iterNbtCompoundList(tag, "samples").map(x => GeneSampleInfo.fromNBT(x))
else
return Seq.empty[GeneSampleInfo]
}
@@ -9,7 +9,7 @@
package net.bdew.gendustry.items
import net.minecraft.item.{ItemStack, EnumToolMaterial, ItemTool}
import net.minecraft.item.{Item, ItemStack, ItemTool}
import forestry.api.arboriculture.IToolGrafter
import net.minecraft.world.World
import net.minecraft.entity.player.EntityPlayer
@@ -22,13 +22,13 @@ import net.minecraft.entity.EntityLivingBase
import java.util
import net.minecraft.creativetab.CreativeTabs
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import cpw.mods.fml.common.Optional
import net.bdew.gendustry.compat.PowerProxy
import net.bdew.gendustry.power.ItemPowered
@Optional.Interface(modid = PowerProxy.IC2_MOD_ID, iface = "ic2.api.item.ISpecialElectricItem")
class IndustrialGrafter(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON, Array.empty[Block]) with ItemPowered with IToolGrafter {
class IndustrialGrafter extends ItemTool(0, Item.ToolMaterial.IRON, new util.HashSet[Block]) with ItemPowered with IToolGrafter {
lazy val cfg = Tuning.getSection("Items").getSection("IndustrialGrafter")
lazy val mjPerCharge = cfg.getInt("MjPerCharge")
lazy val maxCharge = cfg.getInt("Charges") * mjPerCharge
@@ -41,31 +41,32 @@ class IndustrialGrafter(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON,
efficiencyOnProperMaterial = 32
override def getStrVsBlock(stack: ItemStack, block: Block, meta: Int): Float = getStrVsBlock(stack, block)
override def getStrVsBlock(stack: ItemStack, block: Block): Float = {
if (!hasCharges(stack)) return 0.1F
if (block.blockMaterial == Material.leaves) return efficiencyOnProperMaterial
return 0.1F
}
override def getDigSpeed(stack: ItemStack, block: Block, meta: Int) =
if (!hasCharges(stack))
0.1F
else if (block.getMaterial == Material.leaves)
efficiencyOnProperMaterial
else
0.1F
override def onBlockDestroyed(stack: ItemStack, world: World, blockId: Int, x: Int, y: Int, z: Int, player: EntityLivingBase): Boolean = {
if (Block.blocksList(blockId).blockMaterial == Material.leaves) {
override def onBlockDestroyed(stack: ItemStack, world: World, block: Block, x: Int, y: Int, z: Int, player: EntityLivingBase): Boolean = {
if (block.getMaterial == Material.leaves) {
if (!world.isRemote && player.isInstanceOf[EntityPlayer] && !player.isSneaking) {
for (dx <- -1 * aoe to aoe;
dy <- -1 * aoe to aoe;
dz <- -1 * aoe to aoe
if dy + y > 0 && dy + y < world.getHeight) {
val bl = Block.blocksList(world.getBlockId(x + dx, y + dy, z + dz))
if (bl != null && bl.blockMaterial == Material.leaves && hasCharges(stack)) {
bl.removeBlockByPlayer(world, player.asInstanceOf[EntityPlayer], x + dx, y + dy, z + dz)
val bl = world.getBlock(x + dx, y + dy, z + dz)
if (bl != null && bl.getMaterial == Material.leaves && hasCharges(stack)) {
bl.removedByPlayer(world, player.asInstanceOf[EntityPlayer], x + dx, y + dy, z + dz)
useCharge(stack, 1, player)
}
}
}
useCharge(stack, 1, player)
return true
}
return false
} else
return false
}
override def hitEntity(stack: ItemStack, target: EntityLivingBase, player: EntityLivingBase): Boolean = false
@@ -77,7 +78,7 @@ class IndustrialGrafter(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON,
tip += Misc.toLocalF("gendustry.label.charges", getCharge(stack) / mjPerCharge)
}
override def getSubItems(par1: Int, tabs: CreativeTabs, l: util.List[_]) {
override def getSubItems(item: Item, tabs: CreativeTabs, l: util.List[_]) {
import scala.collection.JavaConverters._
val items = l.asInstanceOf[util.List[ItemStack]].asScala
items += new ItemStack(this)
@@ -91,7 +92,7 @@ class IndustrialGrafter(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON,
def getSaplingModifier(stack: ItemStack, world: World, player: EntityPlayer, x: Int, y: Int, z: Int): Float = if (hasCharges(stack)) saplingModifier else 0
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
override def registerIcons(reg: IIconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":grafter")
}
}
@@ -9,7 +9,7 @@
package net.bdew.gendustry.items
import net.minecraft.item.{ItemStack, EnumToolMaterial, ItemTool}
import net.minecraft.item.{Item, ItemStack, ItemTool}
import net.minecraft.world.World
import net.minecraft.entity.player.EntityPlayer
import net.bdew.gendustry.Gendustry
@@ -20,15 +20,16 @@ import net.minecraft.entity.EntityLivingBase
import java.util
import net.minecraft.creativetab.CreativeTabs
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import cpw.mods.fml.common.Optional
import net.bdew.gendustry.compat.PowerProxy
import net.bdew.gendustry.power.ItemPowered
import forestry.api.core.IToolScoop
import net.minecraftforge.common.{ForgeHooks, MinecraftForge}
import net.minecraftforge.common.ForgeHooks
import net.minecraft.block.material.Material
@Optional.Interface(modid = PowerProxy.IC2_MOD_ID, iface = "ic2.api.item.ISpecialElectricItem")
class IndustrialScoop(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON, Array.empty[Block]) with ItemPowered with IToolScoop {
class IndustrialScoop extends ItemTool(0, Item.ToolMaterial.IRON, new util.HashSet[Block]) with ItemPowered with IToolScoop {
lazy val cfg = Tuning.getSection("Items").getSection("IndustrialScoop")
lazy val mjPerCharge = cfg.getInt("MjPerCharge")
lazy val maxCharge = cfg.getInt("Charges") * mjPerCharge
@@ -37,21 +38,21 @@ class IndustrialScoop(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON, Ar
setMaxStackSize(1)
setMaxDamage(101)
MinecraftForge.setToolClass(this, "scoop", 3)
efficiencyOnProperMaterial = 32
override def getStrVsBlock(stack: ItemStack, block: Block) = getStrVsBlock(stack, block, 1)
override def getStrVsBlock(stack: ItemStack, block: Block, meta: Int) =
override def getHarvestLevel(stack: ItemStack, toolClass: String) =
if (toolClass == "scoop") 3 else -1
override def getDigSpeed(stack: ItemStack, block: Block, meta: Int) =
if (!hasCharges(stack))
0.1F
else if (ForgeHooks.isToolEffective(stack, block, meta))
else if (block.getMaterial == Material.leaves)
efficiencyOnProperMaterial
else
0.1F
override def onBlockDestroyed(stack: ItemStack, world: World, blockId: Int, x: Int, y: Int, z: Int, player: EntityLivingBase): Boolean = {
if (ForgeHooks.isToolEffective(stack, Block.blocksList(world.getBlockId(x, y, z)), world.getBlockMetadata(x, y, z))) {
override def onBlockDestroyed(stack: ItemStack, world: World, block: Block, x: Int, y: Int, z: Int, player: EntityLivingBase): Boolean = {
if (ForgeHooks.isToolEffective(stack, block, world.getBlockMetadata(x, y, z))) {
useCharge(stack, 1, player)
return true
}
@@ -67,7 +68,7 @@ class IndustrialScoop(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON, Ar
tip += Misc.toLocalF("gendustry.label.charges", getCharge(stack) / mjPerCharge)
}
override def getSubItems(par1: Int, tabs: CreativeTabs, l: util.List[_]) {
override def getSubItems(item: Item, tabs: CreativeTabs, l: util.List[_]) {
import scala.collection.JavaConverters._
val items = l.asInstanceOf[util.List[ItemStack]].asScala
items += new ItemStack(this)
@@ -79,7 +80,7 @@ class IndustrialScoop(id: Int) extends ItemTool(id, 0, EnumToolMaterial.IRON, Ar
override def isBookEnchantable(itemstack1: ItemStack, itemstack2: ItemStack): Boolean = false
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
override def registerIcons(reg: IIconRegister) {
itemIcon = reg.registerIcon(Gendustry.modId + ":scoop")
}
}
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockMutatronAdv(id: Int) extends Block(id, Material.rock) with HasTE[TileMutatronAdv] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockMutatronAdv extends Block(Material.rock) with HasTE[TileMutatronAdv] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileMutatronAdv]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.mutatronAdv.guiId
setUnlocalizedName(Gendustry.modId + ".mutatron.adv")
setBlockName(Gendustry.modId + ".mutatron.adv")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockMutatronAdv(id: Int) extends Block(id, Material.rock) with HasTE[Tile
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":mutatron_adv/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":mutatron_adv/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":mutatron_adv/side")
@@ -27,10 +27,10 @@ class ContainerMutatronAdv(val te: TileMutatronAdv, player: EntityPlayer) extend
bindPlayerInventory(player.inventory, 8, 106, 164)
te.lastPlayer := player.username
te.lastPlayer := player.getDisplayName
override def slotClick(slotnum: Int, button: Int, modifiers: Int, player: EntityPlayer): ItemStack = {
te.lastPlayer := player.username
te.lastPlayer := player.getDisplayName
// This is a hacky workaround!
// When a player changes the contents of a slot, playerInventoryBeingManipulated is set to true,
// preventing updates to OTHER slots from being detected and sent back
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineMutatronAdv extends Machine("MutatronAdv", new BlockMutatronAdv(_)) with GuiProvider with ProcessorMachine {
class MachineMutatronAdv extends Machine("MutatronAdv", new BlockMutatronAdv) with GuiProvider with ProcessorMachine {
def guiId = 6
type TEClass = TileMutatronAdv
@@ -16,7 +16,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.worldObj.isRemote && !inv.isWorking && getHasStack) {
if (button == 0 && mods == 0 && !inv.getWorld.isRemote && !inv.isWorking && getHasStack) {
inv.selectedMutation := slotNumber
}
return null
@@ -11,7 +11,6 @@ package net.bdew.gendustry.machines.advmutatron
import net.bdew.gendustry.config.{Fluids, Items, Machines}
import net.minecraft.item.ItemStack
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data.{DataSlotString, DataSlotInt, DataSlotTankRestricted}
import net.bdew.lib.tile.ExposeTank
@@ -19,6 +18,7 @@ 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.minecraftforge.common.util.ForgeDirection
class TileMutatronAdv extends TileItemProcessor with TilePowered with ExposeTank {
lazy val cfg = Machines.mutatronAdv
@@ -40,9 +40,9 @@ class TileMutatronAdv extends TileItemProcessor with TilePowered with ExposeTank
def getTankFromDirection(dir: ForgeDirection): IFluidTank = tank
override def onInventoryChanged() {
override def markDirty() {
updateSelectors()
super.onInventoryChanged()
super.markDirty()
}
def updateSelectors() {
@@ -12,9 +12,9 @@ package net.bdew.gendustry.machines.apiary
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.entity.player.EntityPlayerMP
import net.minecraft.util.Icon
import net.minecraft.util.IIcon
import net.minecraft.world.{IBlockAccess, World}
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
@@ -25,28 +25,28 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.item.ItemStack
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockApiary(id: Int) extends Block(id, Material.rock) with HasTE[TileApiary] with BlockGuiWrenchable with BreakableInventoryBlock {
private var icons: Array[Icon] = null
class BlockApiary extends Block(Material.rock) with HasTE[TileApiary] with BlockGuiWrenchable with BreakableInventoryBlock {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileApiary]
lazy val guiId: Int = Machines.apiary.guiId
setUnlocalizedName(Gendustry.modId + ".apiary")
setBlockName(Gendustry.modId + ".apiary")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = if (side < 2) icons(0) else icons(1)
override def getIcon(side: Int, meta: Int): IIcon = if (side < 2) icons(0) else icons(1)
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](2)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](2)
icons(0) = reg.registerIcon(Gendustry.modId + ":apiary/top")
icons(1) = reg.registerIcon(Gendustry.modId + ":apiary/side")
}
override def getLightValue(world: IBlockAccess, x: Int, y: Int, z: Int): Int = {
val block: Block = Block.blocksList(world.getBlockId(x, y, z))
val block = world.getBlock(x, y, z)
if (block != null && block != this)
return block.getLightValue(world, x, y, z)
else if (world.getBlockTileEntity(x, y, z) != null && getTE(world, x, y, z).hasLight)
else if (world.getTileEntity(x, y, z) != null && getTE(world, x, y, z).hasLight)
return 15
else
return 0
@@ -54,6 +54,6 @@ class BlockApiary(id: Int) extends Block(id, Material.rock) with HasTE[TileApiar
override def onBlockPlacedBy(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, stack: ItemStack) {
if (player.isInstanceOf[EntityPlayerMP])
getTE(world, x, y, z).owner := player.asInstanceOf[EntityPlayerMP].username
getTE(world, x, y, z).owner := player.asInstanceOf[EntityPlayerMP].getCommandSenderName
}
}
@@ -9,7 +9,7 @@
package net.bdew.gendustry.machines.apiary
import net.minecraft.util.Icon
import net.minecraft.util.IIcon
import net.bdew.lib.gui.Texture
object ErrorCodes {
@@ -28,7 +28,7 @@ object ErrorCodes {
def isValid(i: Int) = values.isDefinedAt(i)
def getIcon(i: Int) = Texture(Texture.ITEMS, mGetIcon.invoke(values(i)).asInstanceOf[Icon])
def getIcon(i: Int) = Texture(Texture.ITEMS, mGetIcon.invoke(values(i)).asInstanceOf[IIcon])
def getDescription(i: Int) = mGet.invoke(iLocalization, mGetDescription.invoke(values(i)).asInstanceOf[String]).asInstanceOf[String]
def getHelp(i: Int) = mGet.invoke(iLocalization, mGetHelp.invoke(values(i)).asInstanceOf[String]).asInstanceOf[String]
}
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, PoweredMachine}
import net.bdew.lib.gui.GuiProvider
class MachineApiary extends Machine("IndustrialApiary", new BlockApiary(_)) with GuiProvider with PoweredMachine {
class MachineApiary extends Machine("IndustrialApiary", new BlockApiary) with GuiProvider with PoweredMachine {
def guiId = 3
type TEClass = TileApiary
@@ -12,7 +12,6 @@ package net.bdew.gendustry.machines.apiary
import net.bdew.lib.data._
import net.bdew.lib.tile.inventory.{BreakableInventoryTile, SidedInventory, PersistentInventoryTile}
import forestry.api.apiculture._
import net.minecraftforge.common.ForgeDirection
import forestry.api.genetics.{AlleleManager, IIndividual}
import net.minecraft.item.ItemStack
import forestry.api.core.{EnumHumidity, EnumTemperature}
@@ -33,6 +32,7 @@ import net.bdew.gendustry.power.TilePowered
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
class TileApiary extends TileExtended
with TileDataSlots
@@ -88,9 +88,9 @@ with IBeeHousing {
super.setInventorySlotContents(slot, stack)
}
override def onInventoryChanged() {
override def markDirty() {
updateModifiers()
super.onInventoryChanged()
super.markDirty()
}
def doMovePrincess() {
@@ -11,9 +11,9 @@ package net.bdew.gendustry.machines.apiary.upgrades
import net.minecraft.item.{ItemStack, Item}
import net.bdew.gendustry.api.{ApiaryModifiers, IApiaryUpgrade}
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.client.renderer.texture.IIconRegister
import net.bdew.gendustry.Gendustry
import net.minecraft.util.Icon
import net.minecraft.util.IIcon
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.creativetab.CreativeTabs
import java.util
@@ -21,8 +21,8 @@ import net.minecraft.entity.player.EntityPlayer
import net.bdew.lib.Misc
import cpw.mods.fml.common.registry.GameRegistry
class ItemApiaryUpgrade(id: Int) extends Item(id) with IApiaryUpgrade {
val icons = collection.mutable.Map.empty[Int, Icon]
class ItemApiaryUpgrade extends Item with IApiaryUpgrade {
val icons = collection.mutable.Map.empty[Int, IIcon]
setHasSubtypes(true)
setMaxDamage(-1)
@@ -79,7 +79,7 @@ class ItemApiaryUpgrade(id: Int) extends Item(id) with IApiaryUpgrade {
}
def getStackingId(stack: ItemStack) = itemID * Int.MaxValue + stack.getItemDamage
def getStackingId(stack: ItemStack) = Item.getIdFromItem(this) * Int.MaxValue + stack.getItemDamage
def getMaxNumber(stack: ItemStack): Int = {
if (Upgrades.map.contains(stack.getItemDamage))
return Upgrades.map(stack.getItemDamage).maxNum
@@ -93,7 +93,7 @@ class ItemApiaryUpgrade(id: Int) extends Item(id) with IApiaryUpgrade {
}
}
override def getIconFromDamage(meta: Int): Icon = {
override def getIconFromDamage(meta: Int): IIcon = {
if (icons.contains(meta))
return icons(meta)
return null
@@ -105,14 +105,14 @@ class ItemApiaryUpgrade(id: Int) extends Item(id) with IApiaryUpgrade {
return "invalid"
}
override def getSubItems(par1: Int, par2CreativeTabs: CreativeTabs, list: util.List[_]) {
override def getSubItems(par1: Item, par2CreativeTabs: CreativeTabs, list: util.List[_]) {
val l = list.asInstanceOf[util.List[ItemStack]]
for ((id, name) <- Upgrades.map)
l.add(new ItemStack(this, 1, id))
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
override def registerIcons(reg: IIconRegister) {
for ((id, upgrade) <- Upgrades.map) {
icons += id -> reg.registerIcon("%s:upgrades/%s".format(Gendustry.modId, upgrade.name))
}
@@ -12,8 +12,8 @@ package net.bdew.gendustry.machines.extractor
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
@@ -21,15 +21,15 @@ import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockExtractor(id: Int) extends Block(id, Material.rock) with HasTE[TileExtractor] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[Icon] = null
class BlockExtractor extends Block(Material.rock) with HasTE[TileExtractor] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileExtractor]
lazy val guiId = Machines.extractor.guiId
setUnlocalizedName(Gendustry.modId + ".extractor")
setBlockName(Gendustry.modId + ".extractor")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockExtractor(id: Int) extends Block(id, Material.rock) with HasTE[TileEx
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":extractor/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":extractor/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":extractor/side")
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{SideOnly, Side}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineExtractor extends Machine("Extractor", new BlockExtractor(_)) with GuiProvider with ProcessorMachine {
class MachineExtractor extends Machine("Extractor", new BlockExtractor) with GuiProvider with ProcessorMachine {
def guiId = 8
type TEClass = TileExtractor
@@ -13,13 +13,13 @@ import net.bdew.gendustry.config.{Items, Fluids, Machines}
import net.bdew.gendustry.fluids.LiquidDNASources
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data._
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.minecraftforge.common.util.ForgeDirection
class TileExtractor extends TileBaseProcessor with TilePowered with ExposeTank {
lazy val cfg = Machines.extractor
@@ -58,7 +58,7 @@ class TileExtractor extends TileBaseProcessor with TilePowered with ExposeTank {
def sendFluid() {
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
val te: TileEntity = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
val te: TileEntity = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
if (te != null && te.isInstanceOf[IFluidHandler]) {
val pumped = te.asInstanceOf[IFluidHandler].fill(dir.getOpposite, tank.getFluid, true)
if (pumped > 0) {
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockImprinter(id: Int) extends Block(id, Material.rock) with HasTE[TileImprinter] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockImprinter extends Block(Material.rock) with HasTE[TileImprinter] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileImprinter]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.imprinter.guiId
setUnlocalizedName(Gendustry.modId + ".imprinter")
setBlockName(Gendustry.modId + ".imprinter")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockImprinter(id: Int) extends Block(id, Material.rock) with HasTE[TileIm
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":imprinter/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":imprinter/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":imprinter/side")
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineImprinter extends Machine("Imprinter", new BlockImprinter(_)) with GuiProvider with ProcessorMachine {
class MachineImprinter extends Machine("Imprinter", new BlockImprinter) with GuiProvider with ProcessorMachine {
def guiId = 4
type TEClass = TileImprinter
@@ -75,7 +75,7 @@ class TileImprinter extends TileItemProcessor with TilePowered {
val newTag = new NBTTagCompound()
root.templateAsGenome(primary, secondary).writeToNBT(newTag)
newStack.getTagCompound.setCompoundTag("Genome", newTag)
newStack.getTagCompound.setTag("Genome", newTag)
doStart(newStack)
@@ -12,8 +12,8 @@ package net.bdew.gendustry.machines.liquifier
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
@@ -21,15 +21,15 @@ import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockLiquifier(id: Int) extends Block(id, Material.rock) with HasTE[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[Icon] = null
class BlockLiquifier extends Block(Material.rock) with HasTE[TileLiquifier] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileLiquifier]
lazy val guiId = Machines.liquifier.guiId
setUnlocalizedName(Gendustry.modId + ".liquifier")
setBlockName(Gendustry.modId + ".liquifier")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockLiquifier(id: Int) extends Block(id, Material.rock) with HasTE[TileLi
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":liquifier/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":liquifier/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":liquifier/side")
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{SideOnly, Side}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineLiquifier extends Machine("Liquifier", new BlockLiquifier(_)) with GuiProvider with ProcessorMachine {
class MachineLiquifier extends Machine("Liquifier", new BlockLiquifier) with GuiProvider with ProcessorMachine {
def guiId = 7
type TEClass = TileLiquifier
@@ -13,7 +13,7 @@ import net.bdew.gendustry.config.{Fluids, Machines}
import net.bdew.gendustry.fluids.ProteinSources
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data._
import net.bdew.lib.tile.ExposeTank
@@ -54,7 +54,7 @@ class TileLiquifier extends TileBaseProcessor with TilePowered with ExposeTank {
def sendFluid() {
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
val te: TileEntity = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
val te: TileEntity = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
if (te != null && te.isInstanceOf[IFluidHandler]) {
val pumped = te.asInstanceOf[IFluidHandler].fill(dir.getOpposite, tank.getFluid, true)
if (pumped > 0) {
@@ -12,8 +12,8 @@ package net.bdew.gendustry.machines.mproducer
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import cpw.mods.fml.relauncher.Side
import cpw.mods.fml.relauncher.SideOnly
import net.bdew.lib.block.HasTE
@@ -21,15 +21,15 @@ import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockMutagenProducer(id: Int) extends Block(id, Material.rock) with HasTE[TileMutagenProducer] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[Icon] = null
class BlockMutagenProducer extends Block(Material.rock) with HasTE[TileMutagenProducer] with BreakableInventoryBlock with BlockGuiWrenchable {
private var icons: Array[IIcon] = null
val TEClass = classOf[TileMutagenProducer]
lazy val guiId = Machines.mutagenProducer.guiId
setUnlocalizedName(Gendustry.modId + ".mutagen.producer")
setBlockName(Gendustry.modId + ".mutagen.producer")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockMutagenProducer(id: Int) extends Block(id, Material.rock) with HasTE[
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array(3)
icons(0) = reg.registerIcon(Gendustry.modId + ":mutagenproducer/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":mutagenproducer/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":mutagenproducer/side")
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{SideOnly, Side}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineMutagenProducer extends Machine("MutagenProducer", new BlockMutagenProducer(_)) with GuiProvider with ProcessorMachine {
class MachineMutagenProducer extends Machine("MutagenProducer", new BlockMutagenProducer) with GuiProvider with ProcessorMachine {
def guiId = 1
type TEClass = TileMutagenProducer
@@ -13,7 +13,7 @@ import net.bdew.gendustry.config.{Fluids, Machines}
import net.bdew.gendustry.fluids.MutagenSources
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data._
import net.bdew.lib.tile.ExposeTank
@@ -50,7 +50,7 @@ class TileMutagenProducer extends TileBaseProcessor with TilePowered with Expose
def sendFluid() {
for (dir <- ForgeDirection.VALID_DIRECTIONS) {
val te: TileEntity = worldObj.getBlockTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
val te: TileEntity = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ)
if (te != null && te.isInstanceOf[IFluidHandler]) {
val pumped = te.asInstanceOf[IFluidHandler].fill(dir.getOpposite, tank.getFluid, true)
if (pumped > 0) {
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockMutatron(id: Int) extends Block(id, Material.rock) with HasTE[TileMutatron] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockMutatron extends Block(Material.rock) with HasTE[TileMutatron] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileMutatron]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.mutatron.guiId
setUnlocalizedName(Gendustry.modId + ".mutatron")
setBlockName(Gendustry.modId + ".mutatron")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockMutatron(id: Int) extends Block(id, Material.rock) with HasTE[TileMut
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array(3)
icons(0) = reg.registerIcon(Gendustry.modId + ":mutatron/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":mutatron/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":mutatron/side")
@@ -23,10 +23,10 @@ class ContainerMutatron(val te: TileMutatron, player: EntityPlayer) extends Base
addSlotToContainer(new SlotValidating(te, 3, 98, 17))
bindPlayerInventory(player.inventory, 8, 84, 142)
te.lastPlayer := player.username
te.lastPlayer := player.getDisplayName
override def slotClick(slotnum: Int, button: Int, modifiers: Int, player: EntityPlayer): ItemStack = {
te.lastPlayer := player.username
te.lastPlayer := player.getDisplayName
super.slotClick(slotnum, button, modifiers, player)
}
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineMutatron extends Machine("Mutatron", new BlockMutatron(_)) with GuiProvider with ProcessorMachine {
class MachineMutatron extends Machine("Mutatron", new BlockMutatron) with GuiProvider with ProcessorMachine {
def guiId = 2
type TEClass = TileMutatron
@@ -11,7 +11,7 @@ package net.bdew.gendustry.machines.mutatron
import net.bdew.gendustry.config.{Fluids, Items, Machines}
import net.minecraft.item.ItemStack
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data.{DataSlotString, DataSlotTankRestricted}
import net.bdew.lib.tile.ExposeTank
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockReplicator(id: Int) extends Block(id, Material.rock) with HasTE[TileReplicator] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockReplicator extends Block(Material.rock) with HasTE[TileReplicator] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileReplicator]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.replicator.guiId
setUnlocalizedName(Gendustry.modId + ".replicator")
setBlockName(Gendustry.modId + ".replicator")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockReplicator(id: Int) extends Block(id, Material.rock) with HasTE[TileR
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":replicator/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":replicator/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":replicator/side")
@@ -14,7 +14,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineReplicator extends Machine("Replicator", new BlockReplicator(_)) with GuiProvider with ProcessorMachine {
class MachineReplicator extends Machine("Replicator", new BlockReplicator) with GuiProvider with ProcessorMachine {
def guiId = 10
type TEClass = TileReplicator
@@ -11,7 +11,7 @@ package net.bdew.gendustry.machines.replicator
import net.bdew.gendustry.config.{Fluids, Items, Machines}
import net.minecraft.item.ItemStack
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._
import net.bdew.lib.data.DataSlotTankRestricted
import net.bdew.lib.power.TileItemProcessor
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockSampler(id: Int) extends Block(id, Material.rock) with HasTE[TileSampler] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockSampler extends Block(Material.rock) with HasTE[TileSampler] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileSampler]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.sampler.guiId
setUnlocalizedName(Gendustry.modId + ".sampler")
setBlockName(Gendustry.modId + ".sampler")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockSampler(id: Int) extends Block(id, Material.rock) with HasTE[TileSamp
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":sampler/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":sampler/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":sampler/side")
@@ -16,7 +16,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineSampler extends Machine("Sampler", new BlockSampler(_)) with GuiProvider with ProcessorMachine {
class MachineSampler extends Machine("Sampler", new BlockSampler) with GuiProvider with ProcessorMachine {
def guiId = 5
type TEClass = TileSampler
@@ -14,22 +14,22 @@ import cpw.mods.fml.relauncher.SideOnly
import net.bdew.gendustry.Gendustry
import net.minecraft.block.Block
import net.minecraft.block.material.Material
import net.minecraft.client.renderer.texture.IconRegister
import net.minecraft.util.Icon
import net.minecraft.client.renderer.texture.IIconRegister
import net.minecraft.util.IIcon
import net.bdew.lib.block.HasTE
import net.bdew.lib.tile.inventory.BreakableInventoryBlock
import net.bdew.gendustry.config.Machines
import net.bdew.gendustry.gui.BlockGuiWrenchable
class BlockTransposer(id: Int) extends Block(id, Material.rock) with HasTE[TileTransposer] with BreakableInventoryBlock with BlockGuiWrenchable {
class BlockTransposer extends Block(Material.rock) with HasTE[TileTransposer] with BreakableInventoryBlock with BlockGuiWrenchable {
val TEClass = classOf[TileTransposer]
private var icons: Array[Icon] = null
private var icons: Array[IIcon] = null
lazy val guiId: Int = Machines.transposer.guiId
setUnlocalizedName(Gendustry.modId + ".transposer")
setBlockName(Gendustry.modId + ".transposer")
setHardness(5)
override def getIcon(side: Int, meta: Int): Icon = {
override def getIcon(side: Int, meta: Int): IIcon = {
side match {
case 0 =>
return icons(0)
@@ -41,8 +41,8 @@ class BlockTransposer(id: Int) extends Block(id, Material.rock) with HasTE[TileT
}
@SideOnly(Side.CLIENT)
override def registerIcons(reg: IconRegister) {
icons = new Array[Icon](3)
override def registerBlockIcons(reg: IIconRegister) {
icons = new Array[IIcon](3)
icons(0) = reg.registerIcon(Gendustry.modId + ":transposer/bottom")
icons(1) = reg.registerIcon(Gendustry.modId + ":transposer/top")
icons(2) = reg.registerIcon(Gendustry.modId + ":transposer/side")
@@ -16,7 +16,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.bdew.lib.machine.{Machine, ProcessorMachine}
import net.bdew.lib.gui.GuiProvider
class MachineTransposer extends Machine("Transposer", new BlockTransposer(_)) with GuiProvider with ProcessorMachine {
class MachineTransposer extends Machine("Transposer", new BlockTransposer) with GuiProvider with ProcessorMachine {
def guiId = 9
type TEClass = TileTransposer
@@ -29,8 +29,8 @@ trait ItemPoweredEU extends ItemPoweredBase with ISpecialElectricItem {
}
def canProvideEnergy(itemStack: ItemStack) = false
def getChargedItemId(itemStack: ItemStack) = itemID
def getEmptyItemId(itemStack: ItemStack) = itemID
override def getEmptyItem(itemStack: ItemStack) = this
override def getChargedItem(itemStack: ItemStack) = this
def getMaxCharge(itemStack: ItemStack) = (maxCharge * ratio).round
def getTier(itemStack: ItemStack) = 2
def getTransferLimit(itemStack: ItemStack) = 2048
@@ -10,7 +10,7 @@
package net.bdew.gendustry.power
import net.bdew.gendustry.compat.PowerProxy
import net.minecraftforge.common.{ForgeDirection, MinecraftForge}
import net.minecraftforge.common.MinecraftForge
import ic2.api.energy.event.{EnergyTileUnloadEvent, EnergyTileLoadEvent}
import ic2.api.energy.tile.IEnergySink
import net.bdew.gendustry.config.Tuning
@@ -18,6 +18,7 @@ import net.minecraft.tileentity.TileEntity
import cpw.mods.fml.common.Optional
import net.bdew.lib.power.TilePoweredBase
import net.bdew.lib.Misc
import net.minecraftforge.common.util.ForgeDirection
@Optional.Interface(modid = PowerProxy.IC2_MOD_ID, iface = "ic2.api.energy.tile.IEnergySink")
trait TilePoweredEU extends TilePoweredBase with IEnergySink {
@@ -10,12 +10,12 @@
package net.bdew.gendustry.power
import buildcraft.api.power.{PowerHandler, IPowerReceptor}
import net.minecraftforge.common.ForgeDirection
import cpw.mods.fml.common.Optional
import net.bdew.gendustry.compat.PowerProxy
import net.bdew.gendustry.config.Tuning
import net.bdew.lib.machine.PoweredMachine
import net.bdew.lib.power.TilePoweredBase
import net.minecraftforge.common.util.ForgeDirection
@Optional.Interface(modid = PowerProxy.BC_MOD_ID, iface = "buildcraft.api.power.IPowerReceptor")
trait TilePoweredMJ extends TilePoweredBase with IPowerReceptor {
@@ -25,14 +25,14 @@ trait TilePoweredMJ extends TilePoweredBase with IPowerReceptor {
def getPowerReceiver(side: ForgeDirection) = if (PowerProxy.MJEnabled) powerHandler.getPowerReceiver else null
def getWorld = worldObj
def getWorld = getWorldObj
if (PowerProxy.haveBC) {
serverTick.listen(() => {
if (power.stored < power.capacity && powerHandler.getEnergyStored > 0) {
// this is needed because perdition is stupid and can get applied after getEnergyStored and ninja-reduce the value >.>
val canSend = powerHandler.useEnergy(0, power.capacity - power.stored, false)
val transferred = power.inject(canSend, false)
val transferred = power.inject(canSend.toFloat, false)
powerHandler.useEnergy(transferred, transferred, true)
}
})