mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 07:45:05 -04:00
Merge branch 'master-MC1.7.10' of github.com:MightyPirates/OpenComputers into master-MC1.8
Conflicts: build.gradle build.properties src/main/scala/li/cil/oc/client/renderer/block/BlockRenderer.scala src/main/scala/li/cil/oc/client/renderer/item/ItemRenderer.scala
This commit is contained in:
commit
f834a017c3
14
build.gradle
14
build.gradle
@ -119,27 +119,27 @@ repositories {
|
||||
|
||||
ivy {
|
||||
name 'CoFHLib'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.cofhlib.cf}/[module]-[revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.cofhlib.cf}/[module]-[revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'MineFactoryReloaded'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.mfr.cf}/[module]-[revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.mfr.cf}/[module]-[revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'ComputerCraft'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.cc.cf}/[module][revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.cc.cf}/[module][revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'EnderIO'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.eio.cf}/[module]-[revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.eio.cf}/[module]-[revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'Railcraft'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.rc.cf}/[module]_[revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.rc.cf}/[module]_[revision].[ext]"
|
||||
}
|
||||
ivy {
|
||||
name 'BloodMagic'
|
||||
artifactPattern "http://addons.cursecdn.com/files/${config.bloodmagic.cf}/[module]-${config.minecraft.version}-[revision].[ext]"
|
||||
artifactPattern "http://addons-origin.cursecdn.com/files/${config.bloodmagic.cf}/[module]-${config.minecraft.version}-[revision].[ext]"
|
||||
}
|
||||
*/
|
||||
}
|
||||
@ -156,7 +156,7 @@ dependencies {
|
||||
provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
|
||||
provided "mcp.mobius.waila:Waila:${config.waila.version}:dev"
|
||||
/*
|
||||
provided "api:rotarycraft:${config.rotc.version}"
|
||||
provided "appeng:RotaryCraft:${config.rotc.version}:api"
|
||||
provided "appeng:appliedenergistics2:${config.ae2.version}:dev"
|
||||
provided "codechicken:EnderStorage:${config.minecraft.version}-${config.es.version}:dev"
|
||||
provided "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev"
|
||||
|
@ -1,19 +1,19 @@
|
||||
minecraft.version=1.8
|
||||
forge.version=11.14.1.1329
|
||||
forge.version=11.14.1.1341
|
||||
|
||||
oc.version=1.5.4
|
||||
oc.subversion=dev
|
||||
|
||||
ae2.version=rv1-stable-1
|
||||
bc.version=6.2.6
|
||||
ae2.version=rv2-beta-22
|
||||
bc.version=6.4.5
|
||||
bloodmagic.cf=2223/203
|
||||
bloodmagic.version=1.3.0a-1
|
||||
cc.cf=2216/236
|
||||
cc.version=1.65
|
||||
ccc.version=1.0.5.34
|
||||
ccl.version=1.1.2.115
|
||||
cofhlib.cf=2218/257
|
||||
cofhlib.version=[1.7.10]1.0.0B7-dev-29
|
||||
cofhlib.cf=2230/207
|
||||
cofhlib.version=[1.7.10]1.0.0RC7-127
|
||||
eio.cf=2219/296
|
||||
eio.version=1.7.10-2.2.1.276
|
||||
es.version=1.4.5.24
|
||||
@ -25,14 +25,14 @@ gt.version=5.04.06
|
||||
ic2.version=2.2.654-experimental
|
||||
mekanism.build=5
|
||||
mekanism.version=7.1.2
|
||||
mfr.cf=2213/46
|
||||
mfr.version=[1.7.10]2.8.0RC3-dev-591
|
||||
mfr.cf=2229/626
|
||||
mfr.version=[1.7.10]2.8.0RC8-86
|
||||
nei.version=1.0.5.82
|
||||
projred.version=4.5.8.59
|
||||
rc.cf=2219/321
|
||||
rc.version=1.7.10-9.4.0.0
|
||||
redlogic.version=59.0.3
|
||||
rotc.version=1
|
||||
rotc.version=V5c
|
||||
tmech.version=75.0afb56c
|
||||
re.version=3.0.0.342
|
||||
waila.version=1.6.0_B1_1.8.1
|
||||
|
@ -1035,6 +1035,12 @@ opencomputers {
|
||||
# this many shapes *per state* (the reasoning being that only one state
|
||||
# will ever be visible at a time).
|
||||
maxPrinterShapes: 24
|
||||
|
||||
# How much of the material used to print a model is refunded when using
|
||||
# the model to refuel a printer. This the value the original material
|
||||
# cost is multiplied with, so 1 is a full refund, 0 disables the
|
||||
# functionality (won't be able to put prints into the material input).
|
||||
printRecycleRate: 0.75
|
||||
}
|
||||
|
||||
# Settings for mod integration (the mod previously known as OpenComponents).
|
||||
|
@ -295,6 +295,7 @@ class Settings(val config: Config) {
|
||||
val assemblerBlacklist = config.getStringList("misc.assemblerBlacklist")
|
||||
val threadPriority = config.getInt("misc.threadPriority")
|
||||
val maxPrintComplexity = config.getInt("misc.maxPrinterShapes")
|
||||
val printRecycleRate = config.getDouble("misc.printRecycleRate")
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
// integration
|
||||
|
@ -188,10 +188,36 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def canUpdate = isServer
|
||||
def computeCosts(data: PrintData) = {
|
||||
val totalVolume = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.volume) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.volume)
|
||||
val totalSurface = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.surface) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.surface)
|
||||
|
||||
if (totalVolume > 0) {
|
||||
val materialRequired = (totalVolume / 2) max 1
|
||||
val inkRequired = (totalSurface / 6) max 1
|
||||
|
||||
Option((materialRequired, inkRequired))
|
||||
}
|
||||
else None
|
||||
}
|
||||
|
||||
def materialValue(stack: ItemStack) = {
|
||||
if (api.Items.get(stack) == api.Items.get("chamelium"))
|
||||
materialPerItem
|
||||
else if (api.Items.get(stack) == api.Items.get("print")) {
|
||||
val data = new PrintData(stack)
|
||||
computeCosts(data) match {
|
||||
case Some((materialRequired, inkRequired)) => (materialRequired * Settings.get.printRecycleRate).toInt
|
||||
case _ => 0
|
||||
}
|
||||
}
|
||||
else 0
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def canUpdate = isServer
|
||||
|
||||
override def updateEntity() {
|
||||
super.updateEntity()
|
||||
|
||||
@ -202,28 +228,22 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
||||
}
|
||||
|
||||
if (isActive && output.isEmpty && canMergeOutput) {
|
||||
val totalVolume = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.volume) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.volume)
|
||||
val totalSurface = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.surface) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.surface)
|
||||
computeCosts(data) match {
|
||||
case Some((materialRequired, inkRequired)) =>
|
||||
totalRequiredEnergy = Settings.get.printCost
|
||||
requiredEnergy = totalRequiredEnergy
|
||||
|
||||
if (totalVolume == 0) {
|
||||
isActive = false
|
||||
data = new PrintData()
|
||||
}
|
||||
else {
|
||||
val materialRequired = (totalVolume / 2) max 1
|
||||
val inkRequired = (totalSurface / 6) max 1
|
||||
|
||||
totalRequiredEnergy = Settings.get.printCost
|
||||
requiredEnergy = totalRequiredEnergy
|
||||
|
||||
if (amountMaterial >= materialRequired && amountInk >= inkRequired) {
|
||||
amountMaterial -= materialRequired
|
||||
amountInk -= inkRequired
|
||||
limit -= 1
|
||||
output = Option(data.createItemStack())
|
||||
if (limit < 1) isActive = false
|
||||
ServerPacketSender.sendPrinting(this, printing = true)
|
||||
}
|
||||
if (amountMaterial >= materialRequired && amountInk >= inkRequired) {
|
||||
amountMaterial -= materialRequired
|
||||
amountInk -= inkRequired
|
||||
limit -= 1
|
||||
output = Option(data.createItemStack())
|
||||
if (limit < 1) isActive = false
|
||||
ServerPacketSender.sendPrinting(this, printing = true)
|
||||
}
|
||||
case _ =>
|
||||
isActive = false
|
||||
data = new PrintData()
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,10 +269,11 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
||||
ServerPacketSender.sendPrinting(this, have > 0.5 && output.isDefined)
|
||||
}
|
||||
|
||||
if (maxAmountMaterial - amountMaterial >= materialPerItem) {
|
||||
val inputValue = materialValue(getStackInSlot(slotMaterial))
|
||||
if (inputValue > 0 && maxAmountMaterial - amountMaterial >= inputValue) {
|
||||
val material = decrStackSize(slotMaterial, 1)
|
||||
if (material != null) {
|
||||
amountMaterial += materialPerItem
|
||||
amountMaterial += inputValue
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,9 +331,9 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
||||
override def getInventoryStackLimit = 64
|
||||
|
||||
override def isItemValidForSlot(slot: Int, stack: ItemStack) =
|
||||
if (slot == 0)
|
||||
api.Items.get(stack) == api.Items.get("chamelium")
|
||||
else if (slot == 1)
|
||||
if (slot == slotMaterial)
|
||||
materialValue(stack) > 0
|
||||
else if (slot == slotInk)
|
||||
api.Items.get(stack) == api.Items.get("inkCartridge")
|
||||
else false
|
||||
|
||||
|
@ -19,7 +19,7 @@ object Mods {
|
||||
|
||||
def All = knownMods.clone()
|
||||
|
||||
val AppliedEnergistics2 = new SimpleMod(IDs.AppliedEnergistics2, version = "@[rv1,rv2-beta-19)", providesPower = true)
|
||||
val AppliedEnergistics2 = new SimpleMod(IDs.AppliedEnergistics2, version = "@[rv1,)", providesPower = true)
|
||||
val BattleGear2 = new SimpleMod(IDs.BattleGear2)
|
||||
val BloodMagic = new SimpleMod(IDs.BloodMagic)
|
||||
val BuildCraft = new SimpleMod(IDs.BuildCraft)
|
||||
|
@ -9,7 +9,6 @@ import appeng.api.networking.security.MachineSource
|
||||
import appeng.api.storage.data.IAEItemStack
|
||||
import appeng.me.helpers.IGridProxyable
|
||||
import appeng.tile.misc.TileInterface
|
||||
import appeng.tile.networking.TileController
|
||||
import appeng.util.item.AEItemStack
|
||||
import com.google.common.collect.ImmutableSet
|
||||
import li.cil.oc.OpenComputers
|
||||
@ -26,6 +25,7 @@ import li.cil.oc.integration.ManagedTileEntityEnvironment
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import li.cil.oc.util.ResultWrapper._
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
@ -44,10 +44,11 @@ import scala.language.existentials
|
||||
object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||
private type AETile = TileEntity with IGridProxyable with IActionHost
|
||||
|
||||
def getTileEntityClass = {
|
||||
def getTileEntityClass: Class[_] = {
|
||||
if (AEApi.instance != null && AEApi.instance.blocks != null) {
|
||||
if (AEApi.instance.blocks.blockController != null && AEApi.instance.blocks.blockController.item != null)
|
||||
classOf[TileController]
|
||||
// Not classOf[TileController] because that derps the compiler when it tries to resolve the class (says can't find API classes from RotaryCraft).
|
||||
Class.forName("appeng.tile.networking.TileController")
|
||||
else
|
||||
classOf[TileInterface]
|
||||
}
|
||||
@ -78,10 +79,13 @@ object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||
"coprocessors" -> cpu.getCoProcessors,
|
||||
"busy" -> cpu.isBusy)))
|
||||
|
||||
@Callback(doc = "function():table -- Get a list of known item recipes. These can be used to issue crafting requests.")
|
||||
@Callback(doc = "function([filter:table]):table -- Get a list of known item recipes. These can be used to issue crafting requests.")
|
||||
def getCraftables(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val filter = args.optTable(0, Map.empty[AnyRef, AnyRef]).collect {
|
||||
case (key: String, value: AnyRef) => (key, value)
|
||||
}
|
||||
result(tileEntity.getProxy.getStorage.getItemInventory.getStorageList.
|
||||
filter(_.isCraftable).map(stack => {
|
||||
filter(_.isCraftable).filter(stack => matches(stack, filter)).map(stack => {
|
||||
val patterns = tileEntity.getProxy.getCrafting.getCraftingFor(stack, null, 0, tileEntity.getWorldObj)
|
||||
val result = patterns.find(pattern => pattern.getOutputs.exists(_.isSameType(stack))) match {
|
||||
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
||||
@ -91,9 +95,13 @@ object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||
}).toArray)
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Get a list of the stored items in the network.")
|
||||
def getItemsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
||||
result(tileEntity.getProxy.getStorage.getItemInventory.getStorageList.map(_.getItemStack).toArray)
|
||||
@Callback(doc = "function([filter:table]):table -- Get a list of the stored items in the network.")
|
||||
def getItemsInNetwork(context: Context, args: Arguments): Array[AnyRef] = {
|
||||
val filter = args.optTable(0, Map.empty[AnyRef, AnyRef]).collect {
|
||||
case (key: String, value: AnyRef) => (key, value)
|
||||
}
|
||||
result(tileEntity.getProxy.getStorage.getItemInventory.getStorageList.filter(stack => matches(stack, filter)).map(_.getItemStack).toArray)
|
||||
}
|
||||
|
||||
@Callback(doc = "function():table -- Get a list of the stored fluids in the network.")
|
||||
def getFluidsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
||||
@ -118,6 +126,17 @@ object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||
@Callback(doc = "function():number -- Get the stored power in the network. ")
|
||||
def getStoredPower(context: Context, args: Arguments): Array[AnyRef] =
|
||||
result(tileEntity.getProxy.getEnergy.getStoredPower)
|
||||
|
||||
private def matches(stack: IAEItemStack, filter: scala.collection.mutable.Map[String, AnyRef]) = {
|
||||
stack != null &&
|
||||
filter.get("damage").forall(_.equals(stack.getItemDamage.toDouble)) &&
|
||||
filter.get("maxDamage").forall(_.equals(stack.getItemStack.getMaxDamage.toDouble)) &&
|
||||
filter.get("size").forall(_.equals(stack.getStackSize.toDouble)) &&
|
||||
filter.get("maxSize").forall(_.equals(stack.getItemStack.getMaxStackSize.toDouble)) &&
|
||||
filter.get("hasTag").forall(_.equals(stack.hasTagCompound)) &&
|
||||
filter.get("name").forall(_.equals(Item.itemRegistry.getNameForObject(stack.getItem))) &&
|
||||
filter.get("label").forall(_.equals(stack.getItemStack.getDisplayName))
|
||||
}
|
||||
}
|
||||
|
||||
class Craftable(var controller: AETile, var stack: IAEItemStack) extends AbstractValue with ICraftingRequester {
|
||||
|
@ -1,12 +1,16 @@
|
||||
package li.cil.oc.server.component
|
||||
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.api.driver.EnvironmentHost
|
||||
import li.cil.oc.api.internal
|
||||
import li.cil.oc.api.network.Message
|
||||
import li.cil.oc.api.prefab
|
||||
import li.cil.oc.util.BlockPosition
|
||||
import li.cil.oc.util.ExtendedWorld._
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.tileentity.TileEntitySign
|
||||
import net.minecraft.util.ChatComponentText
|
||||
import net.minecraft.util.EnumFacing
|
||||
@ -63,4 +67,20 @@ abstract class UpgradeSign extends prefab.ManagedEnvironment {
|
||||
MinecraftForge.EVENT_BUS.post(event)
|
||||
!(event.isCanceled || event.getResult == Event.Result.DENY)
|
||||
}
|
||||
|
||||
override def onMessage(message: Message): Unit = {
|
||||
super.onMessage(message)
|
||||
if (message.name == "tablet.use") message.source.host match {
|
||||
case machine: api.machine.Machine => (machine.host, message.data) match {
|
||||
case (tablet: internal.Tablet, Array(nbt: NBTTagCompound, stack: ItemStack, player: EntityPlayer, blockPos: BlockPosition, side: EnumFacing, hitX: java.lang.Float, hitY: java.lang.Float, hitZ: java.lang.Float)) =>
|
||||
host.world.getTileEntity(blockPos) match {
|
||||
case sign: TileEntitySign =>
|
||||
nbt.setString("signText", sign.signText.mkString("\n"))
|
||||
case _ =>
|
||||
}
|
||||
case _ => // Ignore.
|
||||
}
|
||||
case _ => // Ignore.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user