mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-22 11:52:38 -04:00
Merge branch 'master-MC1.8.8' of github.com:MightyPirates/OpenComputers into OC1.5-MC1.8.8
# Conflicts: # build.gradle # build.properties # src/main/scala/li/cil/oc/integration/tis3d/SerialInterfaceProviderAdapter.scala
This commit is contained in:
commit
fa2273acd0
13
build.gradle
13
build.gradle
@ -72,18 +72,6 @@ repositories {
|
||||
name = "TIS-3D"
|
||||
url = "http://maven.cil.li/"
|
||||
}
|
||||
maven {
|
||||
name = "chickenbones"
|
||||
url = "http://chickenbones.net/maven/"
|
||||
}
|
||||
maven {
|
||||
name = "mobius"
|
||||
url = "http://mobiusstrip.eu/maven"
|
||||
}
|
||||
maven {
|
||||
name = "fallback"
|
||||
url = "http://maven.cil.li/"
|
||||
}
|
||||
maven {
|
||||
url "http://dvs1.progwml6.com/files/maven"
|
||||
}
|
||||
@ -203,6 +191,7 @@ dependencies {
|
||||
provided "com.bluepowermod:BluePower:${config.bluepower.version}:deobf"
|
||||
provided "com.gregoriust.gregtech:gregtech_${config.minecraft.version}:${config.gt.version}:dev"
|
||||
provided "igwmod:IGW-Mod-1.7.10:${config.igwmod.version}:userdev"
|
||||
provided "li.cil.tis3d:TIS-3D:${config.tis3d.version}:dev"
|
||||
provided "mcp.mobius.waila:Waila:${config.waila.version}_${config.minecraft.version}:dev"
|
||||
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
|
||||
provided "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}:dev"
|
||||
|
@ -28,7 +28,7 @@ gc.version=3.0.7
|
||||
gt.version=5.04.06
|
||||
ic2.version=2.2.654-experimental
|
||||
igwmod.version=1.1.3-18
|
||||
jei.version=2.1.3.14
|
||||
jei.version=2.12.0.51
|
||||
mekanism.build=5
|
||||
mekanism.version=7.1.2
|
||||
mfr.cf=2229/626
|
||||
@ -42,7 +42,7 @@ rc.cf=2219/321
|
||||
rc.version=1.7.10-9.4.0.0
|
||||
redlogic.version=59.0.3
|
||||
rotc.version=V5c
|
||||
tis3d.version=MC1.8.8-0.7.0.68
|
||||
tis3d.version=MC1.8.8-0.7.1.70
|
||||
tmech.version=75.0afb56c
|
||||
re.version=3.0.0.342
|
||||
waila.version=1.6.0_B1_1.8.1
|
||||
|
@ -0,0 +1,7 @@
|
||||
# Adapter
|
||||
|
||||

|
||||
|
||||
The adapter's serial interface does not implement a hard-coded protocol. Instead, the protocol is defined by the software running on the computer controlling the adapter. Please refer to the component's API using an OpenComputers computer for specifics.
|
||||
|
||||
The adapter's serial interface has a small internal buffer for values passed along in either direction. Note that by default the adapter's serial interface does not read from the serial port. Reading has to be enabled from the component's API.
|
Before Width: | Height: | Size: 242 B After Width: | Height: | Size: 242 B |
BIN
src/main/resources/assets/opencomputers/textures/items/robot.png
Normal file
BIN
src/main/resources/assets/opencomputers/textures/items/robot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 934 B |
@ -15,6 +15,7 @@
|
||||
"EnderStorage",
|
||||
"ForgeMultipart",
|
||||
"IC2",
|
||||
"JEI",
|
||||
"MineFactoryReloaded",
|
||||
"ProjRed|Transmission",
|
||||
"RedLogic",
|
||||
|
@ -88,7 +88,6 @@ object Textures {
|
||||
val UpgradeInventory = L("inventory_upgrade")
|
||||
val HologramEffect = L("hologram_effect")
|
||||
val Drone = L("drone")
|
||||
val DroneItem = L("drone_item")
|
||||
val Robot = L("robot")
|
||||
|
||||
override protected def basePath = "textures/model/%s.png"
|
||||
@ -97,26 +96,10 @@ object Textures {
|
||||
}
|
||||
|
||||
object Item extends TextureBundle {
|
||||
val Floppy = Array(
|
||||
L("floppy_dyeBlack"),
|
||||
L("floppy_dyeRed"),
|
||||
L("floppy_dyeGreen"),
|
||||
L("floppy_dyeBrown"),
|
||||
L("floppy_dyeBlue"),
|
||||
L("floppy_dyePurple"),
|
||||
L("floppy_dyeCyan"),
|
||||
L("floppy_dyeLightGray"),
|
||||
L("floppy_dyeGray"),
|
||||
L("floppy_dyePink"),
|
||||
L("floppy_dyeLime"),
|
||||
L("floppy_dyeYellow"),
|
||||
L("floppy_dyeLightBlue"),
|
||||
L("floppy_dyeMagenta"),
|
||||
L("floppy_dyeOrange"),
|
||||
L("floppy_dyeWhite")
|
||||
)
|
||||
val DroneItem = L("drone")
|
||||
val Robot = L("robot")
|
||||
|
||||
override protected def basePath = "items/%s.png"
|
||||
override protected def basePath = "items/%s"
|
||||
|
||||
override protected def loader(map: TextureMap, loc: ResourceLocation) = map.registerSprite(loc)
|
||||
}
|
||||
@ -564,6 +547,7 @@ object Textures {
|
||||
GUI.init(e.map)
|
||||
Icons.init(e.map)
|
||||
Model.init(e.map)
|
||||
Item.init(e.map)
|
||||
Block.init(e.map)
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ object DroneModel extends SmartBlockModelBase with ISmartItemModel {
|
||||
|
||||
override def handleItemState(stack: ItemStack) = new ItemModel(stack)
|
||||
|
||||
protected def droneTexture = Textures.getSprite(Textures.Model.DroneItem)
|
||||
protected def droneTexture = Textures.getSprite(Textures.Item.DroneItem)
|
||||
|
||||
protected def Boxes = Array(
|
||||
makeBox(new Vec3(1f / 16f, 7f / 16f, 1f / 16f), new Vec3(7f / 16f, 8f / 16f, 7f / 16f)),
|
||||
@ -26,15 +26,11 @@ object DroneModel extends SmartBlockModelBase with ISmartItemModel {
|
||||
)
|
||||
|
||||
class ItemModel(val stack: ItemStack) extends SmartBlockModelBase {
|
||||
override protected def textureScale = 32f
|
||||
|
||||
override def getGeneralQuads = {
|
||||
val faces = mutable.ArrayBuffer.empty[BakedQuad]
|
||||
|
||||
faces ++= Boxes.flatMap(box => bakeQuads(box, Array.fill(6)(droneTexture), None))
|
||||
|
||||
Textures.bind(Textures.Model.DroneItem)
|
||||
|
||||
bufferAsJavaList(faces)
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ object RobotModel extends SmartBlockModelBase with ISmartItemModel {
|
||||
// I don't know why this is super-bright when using 0xFF888888 :/
|
||||
private val tint = 0xFF555555
|
||||
|
||||
protected def robotTexture = Textures.getSprite(Textures.Model.Robot)
|
||||
protected def robotTexture = Textures.getSprite(Textures.Item.Robot)
|
||||
|
||||
private def interpolate(v0: (Float, Float, Float, Float, Float), v1: (Float, Float, Float, Float, Float)) =
|
||||
(v0._1 * 0.5f + v1._1 * 0.5f,
|
||||
@ -46,13 +46,13 @@ object RobotModel extends SmartBlockModelBase with ISmartItemModel {
|
||||
|
||||
private def quad(verts: (Float, Float, Float, Float, Float)*) = {
|
||||
val added = interpolate(verts.last, verts.head)
|
||||
(verts :+ added).map {
|
||||
(verts :+ added).flatMap {
|
||||
case ((x, y, z, u, v)) => rawData(
|
||||
(x - 0.5f) * 1.4f + 0.5f,
|
||||
(y - 0.5f) * 1.4f + 0.5f,
|
||||
(z - 0.5f) * 1.4f + 0.5f,
|
||||
EnumFacing.UP, robotTexture, u, v)
|
||||
}.flatten.toArray
|
||||
EnumFacing.UP, robotTexture, robotTexture.getInterpolatedU(u * 16), robotTexture.getInterpolatedV(v * 16))
|
||||
}.toArray
|
||||
}
|
||||
|
||||
override def getGeneralQuads = {
|
||||
@ -68,8 +68,6 @@ object RobotModel extends SmartBlockModelBase with ISmartItemModel {
|
||||
faces += new BakedQuad(quad(bottom, bottom3, bottom4), tint, EnumFacing.SOUTH)
|
||||
faces += new BakedQuad(quad(bottom, bottom4, bottom1), tint, EnumFacing.WEST)
|
||||
|
||||
Textures.bind(Textures.Model.Robot)
|
||||
|
||||
bufferAsJavaList(faces)
|
||||
}
|
||||
}
|
||||
|
@ -80,8 +80,6 @@ trait SmartBlockModelBase extends ISmartBlockModel with ISmartItemModel {
|
||||
|
||||
protected final val NoTint = -1
|
||||
|
||||
protected def textureScale = 1f
|
||||
|
||||
/**
|
||||
* Generates a list of arrays, each containing the four vertices making up a
|
||||
* face of the box with the specified size.
|
||||
@ -182,8 +180,8 @@ trait SmartBlockModelBase extends ISmartBlockModel with ISmartItemModel {
|
||||
java.lang.Float.floatToRawIntBits(y.toFloat),
|
||||
java.lang.Float.floatToRawIntBits(z.toFloat),
|
||||
getFaceShadeColor(face),
|
||||
java.lang.Float.floatToRawIntBits(u * textureScale),
|
||||
java.lang.Float.floatToRawIntBits(v * textureScale),
|
||||
java.lang.Float.floatToRawIntBits(u),
|
||||
java.lang.Float.floatToRawIntBits(v),
|
||||
vx | (vy << 0x08) | (vz << 0x10)
|
||||
)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import li.cil.oc.common.Tier
|
||||
import li.cil.oc.common.block.property.PropertyRotatable
|
||||
import li.cil.oc.common.item.data.MicrocontrollerData
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.integration.util.Wrench
|
||||
import li.cil.oc.util.InventoryUtils
|
||||
import li.cil.oc.util.Rarity
|
||||
@ -29,7 +29,7 @@ import scala.reflect.ClassTag
|
||||
|
||||
class Microcontroller(protected implicit val tileTag: ClassTag[tileentity.Microcontroller]) extends RedstoneAware with traits.PowerAcceptor with traits.StateAware with traits.CustomDrops[tileentity.Microcontroller] {
|
||||
setCreativeTab(null)
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
|
||||
override def createBlockState(): BlockState = new BlockState(this, PropertyRotatable.Facing)
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.integration.Mods
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.block.state.IBlockState
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
@ -16,7 +16,7 @@ import net.minecraft.world.World
|
||||
class PowerConverter extends SimpleBlock with traits.PowerAcceptor {
|
||||
if (Settings.get.ignorePower) {
|
||||
setCreativeTab(null)
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
}
|
||||
|
||||
private val formatter = new DecimalFormat("#.#")
|
||||
|
@ -9,7 +9,7 @@ import li.cil.oc.Settings
|
||||
import li.cil.oc.common.block.property.PropertyTile
|
||||
import li.cil.oc.common.item.data.PrintData
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.util.ExtendedAABB
|
||||
import li.cil.oc.util.ExtendedAABB._
|
||||
import li.cil.oc.util.InventoryUtils
|
||||
@ -40,7 +40,7 @@ class Print(protected implicit val tileTag: ClassTag[tileentity.Print]) extends
|
||||
setLightOpacity(1)
|
||||
setHardness(1)
|
||||
setCreativeTab(null)
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
@ -7,7 +7,7 @@ import li.cil.oc.Settings
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.common.item.data.RobotData
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.util.Rarity
|
||||
import net.minecraft.block.state.IBlockState
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
@ -19,7 +19,7 @@ import net.minecraft.world.World
|
||||
class RobotAfterimage extends SimpleBlock {
|
||||
setLightOpacity(0)
|
||||
setCreativeTab(null)
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
@ -10,7 +10,7 @@ import li.cil.oc.client.KeyBindings
|
||||
import li.cil.oc.common.GuiType
|
||||
import li.cil.oc.common.item.data.RobotData
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.server.PacketSender
|
||||
import li.cil.oc.server.agent
|
||||
import li.cil.oc.util.BlockPosition
|
||||
@ -29,7 +29,7 @@ import net.minecraft.world.World
|
||||
class RobotProxy extends RedstoneAware with traits.StateAware {
|
||||
setLightOpacity(0)
|
||||
setCreativeTab(null)
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
|
||||
override val getUnlocalizedName = "Robot"
|
||||
|
||||
|
@ -8,7 +8,7 @@ import li.cil.oc.client.KeyBindings
|
||||
import li.cil.oc.client.renderer.block.DroneModel
|
||||
import li.cil.oc.common.entity
|
||||
import li.cil.oc.common.item.data.DroneData
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.server.agent
|
||||
import li.cil.oc.util.BlockPosition
|
||||
import li.cil.oc.util.Rarity
|
||||
@ -21,7 +21,7 @@ import net.minecraftforge.fml.relauncher.Side
|
||||
import net.minecraftforge.fml.relauncher.SideOnly
|
||||
|
||||
class Drone(val parent: Delegator) extends traits.Delegate with CustomModel {
|
||||
NEI.hide(this)
|
||||
ItemBlacklist.hide(this)
|
||||
|
||||
showInItemList = false
|
||||
|
||||
|
@ -12,7 +12,7 @@ import li.cil.oc.common.item.Delegator
|
||||
import li.cil.oc.common.item.data.PrintData
|
||||
import li.cil.oc.common.item.traits.Delegate
|
||||
import li.cil.oc.common.item.traits.SimpleItem
|
||||
import li.cil.oc.integration.util.NEI
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.util.Color
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.item.Item
|
||||
@ -77,7 +77,7 @@ object Recipes {
|
||||
register(delegate.createItemStack(), oreDict: _*)
|
||||
}
|
||||
else {
|
||||
NEI.hide(delegate)
|
||||
ItemBlacklist.hide(delegate)
|
||||
}
|
||||
delegate
|
||||
}
|
||||
@ -124,22 +124,22 @@ object Recipes {
|
||||
lazy val config: ConfigParseOptions = ConfigParseOptions.defaults.
|
||||
setSyntax(ConfigSyntax.CONF).
|
||||
setIncluder(new ConfigIncluder with ConfigIncluderFile {
|
||||
var fallback: ConfigIncluder = _
|
||||
var fallback: ConfigIncluder = _
|
||||
|
||||
override def withFallback(fallback: ConfigIncluder) = {
|
||||
this.fallback = fallback
|
||||
this
|
||||
}
|
||||
override def withFallback(fallback: ConfigIncluder) = {
|
||||
this.fallback = fallback
|
||||
this
|
||||
}
|
||||
|
||||
override def include(context: ConfigIncludeContext, what: String) = fallback.include(context, what)
|
||||
override def include(context: ConfigIncludeContext, what: String) = fallback.include(context, what)
|
||||
|
||||
override def includeFile(context: ConfigIncludeContext, what: File) = {
|
||||
val in = if (what.isAbsolute) new FileReader(what) else new FileReader(new File(userRecipes.getParentFile, what.getPath))
|
||||
val result = ConfigFactory.parseReader(in, config)
|
||||
in.close()
|
||||
result.root()
|
||||
}
|
||||
})
|
||||
override def includeFile(context: ConfigIncludeContext, what: File) = {
|
||||
val in = if (what.isAbsolute) new FileReader(what) else new FileReader(new File(userRecipes.getParentFile, what.getPath))
|
||||
val result = ConfigFactory.parseReader(in, config)
|
||||
in.close()
|
||||
result.root()
|
||||
}
|
||||
})
|
||||
val recipes = ConfigFactory.parseFile(userRecipes, config)
|
||||
|
||||
// Register all known recipes.
|
||||
@ -467,7 +467,7 @@ object Recipes {
|
||||
case itemBlock: ItemBlock => itemBlock.getBlock match {
|
||||
case simple: SimpleBlock =>
|
||||
simple.setCreativeTab(null)
|
||||
NEI.hide(simple)
|
||||
ItemBlacklist.hide(simple)
|
||||
case _ =>
|
||||
}
|
||||
case _ =>
|
||||
|
@ -51,6 +51,7 @@ object Mods {
|
||||
val IndustrialCraft2 = new SimpleMod(IDs.IndustrialCraft2, providesPower = true)
|
||||
val IndustrialCraft2Classic = new SimpleMod(IDs.IndustrialCraft2Classic, providesPower = true)
|
||||
val IngameWiki = new SimpleMod(IDs.IngameWiki, version = "@[1.1.3,)")
|
||||
val JustEnoughItems = new SimpleMod(IDs.JustEnoughItems)
|
||||
val Mekanism = new SimpleMod(IDs.Mekanism, providesPower = true)
|
||||
val MekanismGas = new SimpleMod(IDs.MekanismGas)
|
||||
val Minecraft = new SimpleMod(IDs.Minecraft)
|
||||
@ -200,6 +201,7 @@ object Mods {
|
||||
final val IndustrialCraft2 = "IC2"
|
||||
final val IndustrialCraft2Classic = "IC2-Classic"
|
||||
final val IngameWiki = "IGWMod"
|
||||
final val JustEnoughItems = "JEI"
|
||||
final val Mekanism = "Mekanism"
|
||||
final val MekanismGas = "MekanismAPI|gas"
|
||||
final val Minecraft = "Minecraft"
|
||||
|
@ -0,0 +1,27 @@
|
||||
package li.cil.oc.integration.jei
|
||||
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import mezz.jei.api.IItemRegistry
|
||||
import mezz.jei.api.IJeiHelpers
|
||||
import mezz.jei.api.IModPlugin
|
||||
import mezz.jei.api.IModRegistry
|
||||
import mezz.jei.api.IRecipeRegistry
|
||||
import mezz.jei.api.JEIPlugin
|
||||
|
||||
@JEIPlugin
|
||||
class ModPluginOpenComputers extends IModPlugin {
|
||||
override def isModLoaded: Boolean = true
|
||||
|
||||
override def onJeiHelpersAvailable(jeiHelpers: IJeiHelpers): Unit = {
|
||||
ItemBlacklist.consumers += jeiHelpers.getItemBlacklist.addItemToBlacklist
|
||||
}
|
||||
|
||||
override def onItemRegistryAvailable(itemRegistry: IItemRegistry): Unit = {
|
||||
}
|
||||
|
||||
override def register(registry: IModRegistry): Unit = {
|
||||
}
|
||||
|
||||
override def onRecipeRegistryAvailable(recipeRegistry: IRecipeRegistry): Unit = {
|
||||
}
|
||||
}
|
@ -36,6 +36,7 @@ import li.cil.oc.common.template._
|
||||
import li.cil.oc.integration.ModProxy
|
||||
import li.cil.oc.integration.Mods
|
||||
import li.cil.oc.integration.util.BundledRedstone
|
||||
import li.cil.oc.integration.util.ItemBlacklist
|
||||
import li.cil.oc.integration.util.WirelessRedstone
|
||||
import li.cil.oc.server.machine.luac.LuaStateFactory
|
||||
import li.cil.oc.server.machine.luac.NativeLua53Architecture
|
||||
@ -53,6 +54,8 @@ object ModOpenComputers extends ModProxy {
|
||||
override def getMod = Mods.OpenComputers
|
||||
|
||||
override def initialize() {
|
||||
ItemBlacklist.apply()
|
||||
|
||||
DroneTemplate.register()
|
||||
MicrocontrollerTemplate.register()
|
||||
NavigationUpgradeTemplate.register()
|
||||
|
@ -17,6 +17,7 @@ import li.cil.tis3d.api.prefab.manual.ResourceContentProvider
|
||||
import li.cil.tis3d.api.serial.SerialInterface
|
||||
import li.cil.tis3d.api.serial.SerialInterfaceProvider
|
||||
import li.cil.tis3d.api.serial.SerialProtocolDocumentationReference
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.util.BlockPos
|
||||
import net.minecraft.util.EnumFacing
|
||||
import net.minecraft.world.World
|
||||
@ -25,7 +26,7 @@ import scala.collection.mutable
|
||||
|
||||
object SerialInterfaceProviderAdapter extends SerialInterfaceProvider {
|
||||
def init(): Unit = {
|
||||
ManualAPI.addProvider(new ResourceContentProvider(Settings.resourceDomain, "doc/"))
|
||||
ManualAPI.addProvider(new ResourceContentProvider(Settings.resourceDomain, "doc/tis3d/"))
|
||||
SerialAPI.addProvider(this)
|
||||
}
|
||||
|
||||
@ -106,6 +107,20 @@ object SerialInterfaceProviderAdapter extends SerialInterfaceProvider {
|
||||
})
|
||||
}
|
||||
|
||||
override def readFromNBT(nbt: NBTTagCompound): Unit = {
|
||||
writeBuffer.clear()
|
||||
writeBuffer ++= nbt.getIntArray("writeBuffer").map(_.toShort)
|
||||
readBuffer.clear()
|
||||
readBuffer ++= nbt.getIntArray("readBuffer").map(_.toShort)
|
||||
isReading = nbt.getBoolean("isReading")
|
||||
}
|
||||
|
||||
override def writeToNBT(nbt: NBTTagCompound): Unit = {
|
||||
nbt.setIntArray("writeBuffer", writeBuffer.toArray.map(_.toInt))
|
||||
nbt.setIntArray("readBuffer", readBuffer.toArray.map(_.toInt))
|
||||
nbt.setBoolean("isReading", isReading)
|
||||
}
|
||||
|
||||
private def ensureConnected(): Unit = {
|
||||
if (tileEntity.node.network != node.network) {
|
||||
tileEntity.node.connect(node)
|
||||
|
@ -0,0 +1,27 @@
|
||||
package li.cil.oc.integration.util
|
||||
|
||||
import li.cil.oc.common.item.traits.Delegate
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
object ItemBlacklist {
|
||||
// Lazily evaluated stacks to avoid creating stacks with unregistered items/blocks.
|
||||
val hiddenItems = mutable.Set.empty[() => ItemStack]
|
||||
|
||||
// List of consumers for item stacks (blacklisting for NEI and JEI).
|
||||
val consumers = mutable.Set.empty[ItemStack => Unit]
|
||||
|
||||
def hide(block: Block): Unit = hiddenItems += (() => new ItemStack(block))
|
||||
|
||||
def hide(item: Delegate): Unit = hiddenItems += (() => item.createItemStack())
|
||||
|
||||
def apply(): Unit = {
|
||||
for (consumer <- consumers) {
|
||||
for (stack <- hiddenItems) {
|
||||
consumer(stack())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,18 +3,11 @@ package li.cil.oc.integration.util
|
||||
/* TODO NEI
|
||||
import codechicken.nei.LayoutManager
|
||||
*/
|
||||
import li.cil.oc.common.item.traits.Delegate
|
||||
import li.cil.oc.integration.Mods
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.gui.inventory.GuiContainer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
import scala.collection.mutable
|
||||
|
||||
object NEI {
|
||||
// Lazily evaluated stacks to avoid creating stacks with unregistered items/blocks.
|
||||
val hiddenItems = mutable.Set.empty[() => ItemStack]
|
||||
|
||||
def isInputFocused =
|
||||
Mods.NotEnoughItems.isAvailable && (try isInputFocused0 catch {
|
||||
case _: Throwable => false
|
||||
@ -29,8 +22,4 @@ object NEI {
|
||||
else None
|
||||
|
||||
private def hoveredStack0(container: GuiContainer, mouseX: Int, mouseY: Int) = null: ItemStack // TODO NEI LayoutManager.instance.getStackUnderMouse(container, mouseX, mouseY)
|
||||
|
||||
def hide(block: Block): Unit = if (Mods.NotEnoughItems.isAvailable) hiddenItems += (() => new ItemStack(block))
|
||||
|
||||
def hide(item: Delegate): Unit = if (Mods.NotEnoughItems.isAvailable) hiddenItems += (() => item.createItemStack())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user