mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-10 15:56:41 -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 {
|
ivy {
|
||||||
name 'CoFHLib'
|
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 {
|
ivy {
|
||||||
name 'MineFactoryReloaded'
|
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 {
|
ivy {
|
||||||
name 'ComputerCraft'
|
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 {
|
ivy {
|
||||||
name 'EnderIO'
|
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 {
|
ivy {
|
||||||
name 'Railcraft'
|
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 {
|
ivy {
|
||||||
name 'BloodMagic'
|
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 "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
|
||||||
provided "mcp.mobius.waila:Waila:${config.waila.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 "appeng:appliedenergistics2:${config.ae2.version}:dev"
|
||||||
provided "codechicken:EnderStorage:${config.minecraft.version}-${config.es.version}:dev"
|
provided "codechicken:EnderStorage:${config.minecraft.version}-${config.es.version}:dev"
|
||||||
provided "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev"
|
provided "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev"
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
minecraft.version=1.8
|
minecraft.version=1.8
|
||||||
forge.version=11.14.1.1329
|
forge.version=11.14.1.1341
|
||||||
|
|
||||||
oc.version=1.5.4
|
oc.version=1.5.4
|
||||||
oc.subversion=dev
|
oc.subversion=dev
|
||||||
|
|
||||||
ae2.version=rv1-stable-1
|
ae2.version=rv2-beta-22
|
||||||
bc.version=6.2.6
|
bc.version=6.4.5
|
||||||
bloodmagic.cf=2223/203
|
bloodmagic.cf=2223/203
|
||||||
bloodmagic.version=1.3.0a-1
|
bloodmagic.version=1.3.0a-1
|
||||||
cc.cf=2216/236
|
cc.cf=2216/236
|
||||||
cc.version=1.65
|
cc.version=1.65
|
||||||
ccc.version=1.0.5.34
|
ccc.version=1.0.5.34
|
||||||
ccl.version=1.1.2.115
|
ccl.version=1.1.2.115
|
||||||
cofhlib.cf=2218/257
|
cofhlib.cf=2230/207
|
||||||
cofhlib.version=[1.7.10]1.0.0B7-dev-29
|
cofhlib.version=[1.7.10]1.0.0RC7-127
|
||||||
eio.cf=2219/296
|
eio.cf=2219/296
|
||||||
eio.version=1.7.10-2.2.1.276
|
eio.version=1.7.10-2.2.1.276
|
||||||
es.version=1.4.5.24
|
es.version=1.4.5.24
|
||||||
@ -25,14 +25,14 @@ gt.version=5.04.06
|
|||||||
ic2.version=2.2.654-experimental
|
ic2.version=2.2.654-experimental
|
||||||
mekanism.build=5
|
mekanism.build=5
|
||||||
mekanism.version=7.1.2
|
mekanism.version=7.1.2
|
||||||
mfr.cf=2213/46
|
mfr.cf=2229/626
|
||||||
mfr.version=[1.7.10]2.8.0RC3-dev-591
|
mfr.version=[1.7.10]2.8.0RC8-86
|
||||||
nei.version=1.0.5.82
|
nei.version=1.0.5.82
|
||||||
projred.version=4.5.8.59
|
projred.version=4.5.8.59
|
||||||
rc.cf=2219/321
|
rc.cf=2219/321
|
||||||
rc.version=1.7.10-9.4.0.0
|
rc.version=1.7.10-9.4.0.0
|
||||||
redlogic.version=59.0.3
|
redlogic.version=59.0.3
|
||||||
rotc.version=1
|
rotc.version=V5c
|
||||||
tmech.version=75.0afb56c
|
tmech.version=75.0afb56c
|
||||||
re.version=3.0.0.342
|
re.version=3.0.0.342
|
||||||
waila.version=1.6.0_B1_1.8.1
|
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
|
# this many shapes *per state* (the reasoning being that only one state
|
||||||
# will ever be visible at a time).
|
# will ever be visible at a time).
|
||||||
maxPrinterShapes: 24
|
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).
|
# 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 assemblerBlacklist = config.getStringList("misc.assemblerBlacklist")
|
||||||
val threadPriority = config.getInt("misc.threadPriority")
|
val threadPriority = config.getInt("misc.threadPriority")
|
||||||
val maxPrintComplexity = config.getInt("misc.maxPrinterShapes")
|
val maxPrintComplexity = config.getInt("misc.maxPrinterShapes")
|
||||||
|
val printRecycleRate = config.getDouble("misc.printRecycleRate")
|
||||||
|
|
||||||
// ----------------------------------------------------------------------- //
|
// ----------------------------------------------------------------------- //
|
||||||
// integration
|
// 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() {
|
override def updateEntity() {
|
||||||
super.updateEntity()
|
super.updateEntity()
|
||||||
|
|
||||||
@ -202,28 +228,22 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isActive && output.isEmpty && canMergeOutput) {
|
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)
|
computeCosts(data) match {
|
||||||
val totalSurface = data.stateOn.foldLeft(0)((acc, shape) => acc + shape.bounds.surface) + data.stateOff.foldLeft(0)((acc, shape) => acc + shape.bounds.surface)
|
case Some((materialRequired, inkRequired)) =>
|
||||||
|
totalRequiredEnergy = Settings.get.printCost
|
||||||
|
requiredEnergy = totalRequiredEnergy
|
||||||
|
|
||||||
if (totalVolume == 0) {
|
if (amountMaterial >= materialRequired && amountInk >= inkRequired) {
|
||||||
isActive = false
|
amountMaterial -= materialRequired
|
||||||
data = new PrintData()
|
amountInk -= inkRequired
|
||||||
}
|
limit -= 1
|
||||||
else {
|
output = Option(data.createItemStack())
|
||||||
val materialRequired = (totalVolume / 2) max 1
|
if (limit < 1) isActive = false
|
||||||
val inkRequired = (totalSurface / 6) max 1
|
ServerPacketSender.sendPrinting(this, printing = true)
|
||||||
|
}
|
||||||
totalRequiredEnergy = Settings.get.printCost
|
case _ =>
|
||||||
requiredEnergy = totalRequiredEnergy
|
isActive = false
|
||||||
|
data = new PrintData()
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,10 +269,11 @@ class Printer extends traits.Environment with traits.Inventory with traits.Rotat
|
|||||||
ServerPacketSender.sendPrinting(this, have > 0.5 && output.isDefined)
|
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)
|
val material = decrStackSize(slotMaterial, 1)
|
||||||
if (material != null) {
|
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 getInventoryStackLimit = 64
|
||||||
|
|
||||||
override def isItemValidForSlot(slot: Int, stack: ItemStack) =
|
override def isItemValidForSlot(slot: Int, stack: ItemStack) =
|
||||||
if (slot == 0)
|
if (slot == slotMaterial)
|
||||||
api.Items.get(stack) == api.Items.get("chamelium")
|
materialValue(stack) > 0
|
||||||
else if (slot == 1)
|
else if (slot == slotInk)
|
||||||
api.Items.get(stack) == api.Items.get("inkCartridge")
|
api.Items.get(stack) == api.Items.get("inkCartridge")
|
||||||
else false
|
else false
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ object Mods {
|
|||||||
|
|
||||||
def All = knownMods.clone()
|
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 BattleGear2 = new SimpleMod(IDs.BattleGear2)
|
||||||
val BloodMagic = new SimpleMod(IDs.BloodMagic)
|
val BloodMagic = new SimpleMod(IDs.BloodMagic)
|
||||||
val BuildCraft = new SimpleMod(IDs.BuildCraft)
|
val BuildCraft = new SimpleMod(IDs.BuildCraft)
|
||||||
|
@ -9,7 +9,6 @@ import appeng.api.networking.security.MachineSource
|
|||||||
import appeng.api.storage.data.IAEItemStack
|
import appeng.api.storage.data.IAEItemStack
|
||||||
import appeng.me.helpers.IGridProxyable
|
import appeng.me.helpers.IGridProxyable
|
||||||
import appeng.tile.misc.TileInterface
|
import appeng.tile.misc.TileInterface
|
||||||
import appeng.tile.networking.TileController
|
|
||||||
import appeng.util.item.AEItemStack
|
import appeng.util.item.AEItemStack
|
||||||
import com.google.common.collect.ImmutableSet
|
import com.google.common.collect.ImmutableSet
|
||||||
import li.cil.oc.OpenComputers
|
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.ExtendedNBT._
|
||||||
import li.cil.oc.util.ResultWrapper._
|
import li.cil.oc.util.ResultWrapper._
|
||||||
import net.minecraft.block.Block
|
import net.minecraft.block.Block
|
||||||
|
import net.minecraft.item.Item
|
||||||
import net.minecraft.item.ItemStack
|
import net.minecraft.item.ItemStack
|
||||||
import net.minecraft.nbt.NBTTagCompound
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraft.tileentity.TileEntity
|
import net.minecraft.tileentity.TileEntity
|
||||||
@ -44,10 +44,11 @@ import scala.language.existentials
|
|||||||
object DriverController extends DriverTileEntity with EnvironmentAware {
|
object DriverController extends DriverTileEntity with EnvironmentAware {
|
||||||
private type AETile = TileEntity with IGridProxyable with IActionHost
|
private type AETile = TileEntity with IGridProxyable with IActionHost
|
||||||
|
|
||||||
def getTileEntityClass = {
|
def getTileEntityClass: Class[_] = {
|
||||||
if (AEApi.instance != null && AEApi.instance.blocks != null) {
|
if (AEApi.instance != null && AEApi.instance.blocks != null) {
|
||||||
if (AEApi.instance.blocks.blockController != null && AEApi.instance.blocks.blockController.item != 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
|
else
|
||||||
classOf[TileInterface]
|
classOf[TileInterface]
|
||||||
}
|
}
|
||||||
@ -78,10 +79,13 @@ object DriverController extends DriverTileEntity with EnvironmentAware {
|
|||||||
"coprocessors" -> cpu.getCoProcessors,
|
"coprocessors" -> cpu.getCoProcessors,
|
||||||
"busy" -> cpu.isBusy)))
|
"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] = {
|
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.
|
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 patterns = tileEntity.getProxy.getCrafting.getCraftingFor(stack, null, 0, tileEntity.getWorldObj)
|
||||||
val result = patterns.find(pattern => pattern.getOutputs.exists(_.isSameType(stack))) match {
|
val result = patterns.find(pattern => pattern.getOutputs.exists(_.isSameType(stack))) match {
|
||||||
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
case Some(pattern) => pattern.getOutputs.find(_.isSameType(stack)).get
|
||||||
@ -91,9 +95,13 @@ object DriverController extends DriverTileEntity with EnvironmentAware {
|
|||||||
}).toArray)
|
}).toArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(doc = "function():table -- Get a list of the stored items in the network.")
|
@Callback(doc = "function([filter:table]):table -- Get a list of the stored items in the network.")
|
||||||
def getItemsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
def getItemsInNetwork(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
result(tileEntity.getProxy.getStorage.getItemInventory.getStorageList.map(_.getItemStack).toArray)
|
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.")
|
@Callback(doc = "function():table -- Get a list of the stored fluids in the network.")
|
||||||
def getFluidsInNetwork(context: Context, args: Arguments): Array[AnyRef] =
|
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. ")
|
@Callback(doc = "function():number -- Get the stored power in the network. ")
|
||||||
def getStoredPower(context: Context, args: Arguments): Array[AnyRef] =
|
def getStoredPower(context: Context, args: Arguments): Array[AnyRef] =
|
||||||
result(tileEntity.getProxy.getEnergy.getStoredPower)
|
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 {
|
class Craftable(var controller: AETile, var stack: IAEItemStack) extends AbstractValue with ICraftingRequester {
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package li.cil.oc.server.component
|
package li.cil.oc.server.component
|
||||||
|
|
||||||
import li.cil.oc.Settings
|
import li.cil.oc.Settings
|
||||||
|
import li.cil.oc.api
|
||||||
import li.cil.oc.api.driver.EnvironmentHost
|
import li.cil.oc.api.driver.EnvironmentHost
|
||||||
import li.cil.oc.api.internal
|
import li.cil.oc.api.internal
|
||||||
|
import li.cil.oc.api.network.Message
|
||||||
import li.cil.oc.api.prefab
|
import li.cil.oc.api.prefab
|
||||||
import li.cil.oc.util.BlockPosition
|
import li.cil.oc.util.BlockPosition
|
||||||
import li.cil.oc.util.ExtendedWorld._
|
import li.cil.oc.util.ExtendedWorld._
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.nbt.NBTTagCompound
|
||||||
import net.minecraft.tileentity.TileEntitySign
|
import net.minecraft.tileentity.TileEntitySign
|
||||||
import net.minecraft.util.ChatComponentText
|
import net.minecraft.util.ChatComponentText
|
||||||
import net.minecraft.util.EnumFacing
|
import net.minecraft.util.EnumFacing
|
||||||
@ -63,4 +67,20 @@ abstract class UpgradeSign extends prefab.ManagedEnvironment {
|
|||||||
MinecraftForge.EVENT_BUS.post(event)
|
MinecraftForge.EVENT_BUS.post(event)
|
||||||
!(event.isCanceled || event.getResult == Event.Result.DENY)
|
!(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