mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 19:25:20 -04:00
icon -> iicon, iconregster -> iiconregister
This commit is contained in:
parent
fb0b4e0d5d
commit
4fc03a6ca7
@ -4,17 +4,18 @@ import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraft.block.Block
|
||||
|
||||
class Adapter(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "Adapter"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -24,7 +25,7 @@ class Adapter(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":adapter_top")
|
||||
|
||||
@ -42,8 +43,8 @@ class Adapter(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case adapter: tileentity.Adapter => adapter.neighborChanged()
|
||||
case _ => // Ignore.
|
||||
}
|
||||
|
@ -6,17 +6,18 @@ import li.cil.oc.api.network.{SidedEnvironment, Environment}
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{Settings, api}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.{Icon, AxisAlignedBB}
|
||||
import net.minecraft.util.{IIcon, AxisAlignedBB}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraft.block.Block
|
||||
|
||||
class Cable(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
val unlocalizedName = "Cable"
|
||||
|
||||
private var icon: Icon = _
|
||||
private var icon: IIcon = _
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -28,7 +29,7 @@ class Cable(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
override def icon(side: ForgeDirection) = Some(icon)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
}
|
||||
@ -40,26 +41,26 @@ class Cable(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
override def createTileEntity(world: World) = Some(new tileentity.Cable)
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case cable: tileentity.Cable => api.Network.joinOrCreateNetwork(cable)
|
||||
case _ =>
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||
override def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def isSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||
override def opacity(world: IBlockAccess, x: Int, y: Int, z: Int) = 0
|
||||
|
||||
override def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) {
|
||||
world.markBlockForRenderUpdate(x, y, z)
|
||||
super.neighborBlockChanged(world, x, y, z, blockId)
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) {
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
super.neighborBlockChanged(world, x, y, z, block)
|
||||
}
|
||||
|
||||
override def updateBounds(world: IBlockAccess, x: Int, y: Int, z: Int) {
|
||||
@ -92,7 +93,7 @@ object Cable {
|
||||
var result = 0
|
||||
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (!world.isAirBlock(tx, ty, tz)) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
if (!world.isAirBlock(tx, ty, tz)) world.getTileEntity(tx, ty, tz) match {
|
||||
case robot: tileentity.RobotProxy =>
|
||||
case host: SidedEnvironment =>
|
||||
val connects = if (host.getWorldObj.isRemote) host.canConnect(side.getOpposite) else host.sidedNode(side.getOpposite) != null
|
||||
|
@ -4,17 +4,18 @@ import java.util
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{api, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.{World, IBlockAccess}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import net.minecraft.block.Block
|
||||
|
||||
class Capacitor(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "Capacitor"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -24,7 +25,7 @@ class Capacitor(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal()))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":capacitor_top")
|
||||
|
||||
@ -45,15 +46,15 @@ class Capacitor(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case capacitor: tileentity.Capacitor =>
|
||||
api.Network.joinOrCreateNetwork(capacitor)
|
||||
capacitor.recomputeCapacity(updateSecondGradeNeighbors = true)
|
||||
case _ =>
|
||||
}
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case capacitor: tileentity.Capacitor => capacitor.recomputeCapacity()
|
||||
case _ =>
|
||||
}
|
||||
|
@ -5,13 +5,13 @@ import li.cil.oc.common.{GuiType, tileentity}
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.util.mods.BuildCraft
|
||||
import li.cil.oc.{OpenComputers, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.IBlockAccess
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with SimpleDelegate {
|
||||
val unlocalizedName = "Case" + tier
|
||||
@ -30,12 +30,12 @@ abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with Simp
|
||||
}
|
||||
|
||||
private object Icons {
|
||||
val on = Array.fill[Icon](6)(null)
|
||||
val off = Array.fill[Icon](6)(null)
|
||||
val on = Array.fill[IIcon](6)(null)
|
||||
val off = Array.fill[IIcon](6)(null)
|
||||
}
|
||||
|
||||
override def icon(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection) = {
|
||||
getIcon(localSide, world.getBlockTileEntity(x, y, z) match {
|
||||
getIcon(localSide, world.getTileEntity(x, y, z) match {
|
||||
case computer: tileentity.Case => computer.isRunning
|
||||
case _ => false
|
||||
})
|
||||
@ -46,7 +46,7 @@ abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with Simp
|
||||
private def getIcon(side: ForgeDirection, isOn: Boolean) =
|
||||
Some(if (isOn) Icons.on(side.ordinal) else Icons.off(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
Icons.off(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":case_top")
|
||||
Icons.on(ForgeDirection.DOWN.ordinal) = Icons.off(ForgeDirection.DOWN.ordinal)
|
||||
Icons.off(ForgeDirection.UP.ordinal) = Icons.off(ForgeDirection.DOWN.ordinal)
|
||||
@ -82,7 +82,7 @@ abstract class Case(val parent: SimpleDelegator) extends RedstoneAware with Simp
|
||||
}
|
||||
|
||||
override def removedByEntity(world: World, x: Int, y: Int, z: Int, player: EntityPlayer) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case c: tileentity.Case => c.canInteract(player.getCommandSenderName)
|
||||
case _ => super.removedByEntity(world, x, y, z, player)
|
||||
}
|
||||
|
@ -7,18 +7,19 @@ import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.server.PacketSender
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.util.mods.BuildCraft
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Charger(val parent: SimpleDelegator) extends RedstoneAware with SimpleDelegate {
|
||||
val unlocalizedName = "Charger"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val iconsCharging = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
private val iconsCharging = Array.fill[IIcon](6)(null)
|
||||
|
||||
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
|
||||
tooltip.addAll(Tooltip.get(unlocalizedName))
|
||||
@ -28,12 +29,12 @@ class Charger(val parent: SimpleDelegator) extends RedstoneAware with SimpleDele
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def icon(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case charger: tileentity.Charger if charger.chargeSpeed > 0 => Some(iconsCharging(localSide.ordinal()))
|
||||
case _ => Some(icons(localSide.ordinal()))
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
@ -56,7 +57,7 @@ class Charger(val parent: SimpleDelegator) extends RedstoneAware with SimpleDele
|
||||
override def canConnectToRedstone(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = true
|
||||
|
||||
override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case charger: tileentity.Charger if BuildCraft.holdsApplicableWrench(player, x, y, z) =>
|
||||
if (!world.isRemote) {
|
||||
charger.invertSignal = !charger.invertSignal
|
||||
@ -68,11 +69,11 @@ class Charger(val parent: SimpleDelegator) extends RedstoneAware with SimpleDele
|
||||
case _ => super.rightClick(world, x, y, z, player, side, hitX, hitY, hitZ)
|
||||
}
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case charger: tileentity.Charger => charger.onNeighborChanged()
|
||||
case _ =>
|
||||
}
|
||||
super.neighborBlockChanged(world, x, y, z, blockId)
|
||||
super.neighborBlockChanged(world, x, y, z, block)
|
||||
}
|
||||
}
|
||||
|
@ -2,15 +2,16 @@ package li.cil.oc.common.block
|
||||
|
||||
import cpw.mods.fml.relauncher.{SideOnly, Side}
|
||||
import li.cil.oc.common.tileentity
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.{Entity, EntityLivingBase}
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.{MovingObjectPosition, Vec3, AxisAlignedBB, Icon}
|
||||
import net.minecraft.util.{MovingObjectPosition, Vec3, AxisAlignedBB, IIcon}
|
||||
import net.minecraft.world.IBlockAccess
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
trait Delegate {
|
||||
val unlocalizedName: String
|
||||
@ -22,7 +23,7 @@ trait Delegate {
|
||||
def parent: Delegator[_]
|
||||
|
||||
def setBlock(world: World, x: Int, y: Int, z: Int, flags: Int) = {
|
||||
world.setBlock(x, y, z, parent.blockID, blockId, flags)
|
||||
world.setBlock(x, y, z, parent, blockId, flags)
|
||||
}
|
||||
|
||||
def createItemStack(amount: Int = 1) = new ItemStack(parent, amount, itemDamage)
|
||||
@ -35,7 +36,7 @@ trait Delegate {
|
||||
|
||||
def drops(world: World, x: Int, y: Int, z: Int, fortune: Int): Option[java.util.ArrayList[ItemStack]] = None
|
||||
|
||||
def isNormalCube(world: World, x: Int, y: Int, z: Int) = true
|
||||
def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) = true
|
||||
|
||||
def validRotations(world: World, x: Int, y: Int, z: Int) = validRotations_
|
||||
|
||||
@ -73,16 +74,16 @@ trait Delegate {
|
||||
def addedByEntity(world: World, x: Int, y: Int, z: Int, player: EntityLivingBase, stack: ItemStack) {}
|
||||
|
||||
def aboutToBeRemoved(world: World, x: Int, y: Int, z: Int) =
|
||||
if (!world.isRemote) world.getBlockTileEntity(x, y, z) match {
|
||||
if (!world.isRemote) world.getTileEntity(x, y, z) match {
|
||||
case inventory: tileentity.Inventory => inventory.dropAllSlots()
|
||||
case _ => // Ignore.
|
||||
}
|
||||
|
||||
def removedFromWorld(world: World, x: Int, y: Int, z: Int, blockId: Int) {}
|
||||
def removedFromWorld(world: World, x: Int, y: Int, z: Int, block: Block) {}
|
||||
|
||||
def removedByEntity(world: World, x: Int, y: Int, z: Int, player: EntityPlayer) = true
|
||||
|
||||
def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) {}
|
||||
def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) {}
|
||||
|
||||
def leftClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer) {}
|
||||
|
||||
@ -99,7 +100,7 @@ trait Delegate {
|
||||
@SideOnly(Side.CLIENT)
|
||||
def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: java.util.List[String], advanced: Boolean) {}
|
||||
|
||||
def opacity(world: World, x: Int, y: Int, z: Int) = 255
|
||||
def opacity(world: IBlockAccess, x: Int, y: Int, z: Int) = 255
|
||||
|
||||
def luminance(world: IBlockAccess, x: Int, y: Int, z: Int) = 0
|
||||
|
||||
@ -113,10 +114,10 @@ trait Delegate {
|
||||
def color(world: IBlockAccess, x: Int, y: Int, z: Int): Int = color
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def icon(side: ForgeDirection): Option[Icon] = None
|
||||
def icon(side: ForgeDirection): Option[IIcon] = None
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def icon(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection): Option[Icon] = icon(localSide)
|
||||
def icon(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection): Option[IIcon] = icon(localSide)
|
||||
|
||||
def itemBounds(): Unit = parent.setBlockBoundsForItemRender()
|
||||
|
||||
@ -124,7 +125,7 @@ trait Delegate {
|
||||
def preItemRender() {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def registerIcons(iconRegister: IconRegister) {}
|
||||
def registerIcons(iconRegister: IIconRegister) {}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -148,5 +149,5 @@ trait SpecialDelegate extends Delegate {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) =
|
||||
!world.isBlockOpaqueCube(x, y, z)
|
||||
!world.isSideSolid(x, y, z, side, true)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import li.cil.oc.util.ItemCosts
|
||||
import li.cil.oc.{Settings, CreativeTab}
|
||||
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.creativetab.CreativeTabs
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.{EnumCreatureType, Entity, EntityLivingBase}
|
||||
@ -18,12 +18,12 @@ import net.minecraft.item.{ItemBlock, ItemStack}
|
||||
import net.minecraft.tileentity.TileEntity
|
||||
import net.minecraft.util.{MovingObjectPosition, Vec3, AxisAlignedBB}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.input
|
||||
import powercrystals.minefactoryreloaded.api.rednet.{IRedNetNetworkContainer, RedNetConnectionType, IConnectableRedNet}
|
||||
import scala.collection.mutable
|
||||
|
||||
class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
class Delegator[Child <: Delegate] extends Block(Material.iron) {
|
||||
setHardness(2f)
|
||||
setCreativeTab(CreativeTab)
|
||||
|
||||
@ -42,13 +42,13 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
|
||||
def subBlock(stack: ItemStack): Option[Child] =
|
||||
stack.getItem match {
|
||||
case block: ItemBlock if Block.blocksList(block.getBlockID) == this =>
|
||||
case block: ItemBlock if block.field_150939_a == this =>
|
||||
subBlock(block.getMetadata(stack.getItemDamage))
|
||||
case _ => None
|
||||
}
|
||||
|
||||
def subBlock(world: IBlockAccess, x: Int, y: Int, z: Int): Option[Child] =
|
||||
if (world.getBlockId(x, y, z) == blockID) subBlock(world.getBlockMetadata(x, y, z))
|
||||
if (world.getBlock(x, y, z) == this) subBlock(world.getBlockMetadata(x, y, z))
|
||||
else None
|
||||
|
||||
def subBlock(metadata: Int): Option[Child] =
|
||||
@ -57,7 +57,7 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
case _ => None
|
||||
}
|
||||
|
||||
override def getSubBlocks(itemId: Int, creativeTab: CreativeTabs, list: util.List[_]) = {
|
||||
override def getSubBlocks(item: net.minecraft.item.Item, creativeTab: CreativeTabs, list: util.List[_]) = {
|
||||
// Workaround for MC's untyped lists...
|
||||
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
||||
subBlockItemStacks().sortBy(_.getUnlocalizedName).foreach(add(list, _))
|
||||
@ -72,27 +72,27 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
def getFacing(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case tileEntity: tileentity.Rotatable => tileEntity.facing
|
||||
case _ => ForgeDirection.UNKNOWN
|
||||
}
|
||||
|
||||
def setFacing(world: World, x: Int, y: Int, z: Int, value: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rotatable: tileentity.Rotatable =>
|
||||
rotatable.setFromFacing(value); true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
def setRotationFromEntityPitchAndYaw(world: World, x: Int, y: Int, z: Int, value: Entity) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rotatable: tileentity.Rotatable =>
|
||||
rotatable.setFromEntityPitchAndYaw(value); true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
private def toLocal(world: IBlockAccess, x: Int, y: Int, z: Int, value: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rotatable: tileentity.Rotatable => rotatable.toLocal(value)
|
||||
case _ => value
|
||||
}
|
||||
@ -101,9 +101,9 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
// Block
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def canBeReplacedByLeaves(world: World, x: Int, y: Int, z: Int) = false
|
||||
override def canBeReplacedByLeaves(world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def canCreatureSpawn(creature: EnumCreatureType, world: World, x: Int, y: Int, z: Int) = false
|
||||
override def canCreatureSpawn(creature: EnumCreatureType, world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
def getUnlocalizedName(metadata: Int) =
|
||||
subBlock(metadata) match {
|
||||
@ -123,17 +123,17 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
case _ => super.getPickBlock(target, world, x, y, z)
|
||||
}
|
||||
|
||||
override def getBlockDropped(world: World, x: Int, y: Int, z: Int, metadata: Int, fortune: Int) =
|
||||
override def getDrops(world: World, x: Int, y: Int, z: Int, metadata: Int, fortune: Int) =
|
||||
subBlock(metadata) match {
|
||||
case Some(subBlock) => subBlock.drops(world, x, y, z, fortune).getOrElse(super.getBlockDropped(world, x, y, z, metadata, fortune))
|
||||
case _ => super.getBlockDropped(world, x, y, z, metadata, fortune)
|
||||
case Some(subBlock) => subBlock.drops(world, x, y, z, fortune).getOrElse(super.getDrops(world, x, y, z, metadata, fortune))
|
||||
case _ => super.getDrops(world, x, y, z, metadata, fortune)
|
||||
}
|
||||
|
||||
def dropBlockAsItem(world: World, x: Int, y: Int, z: Int, stack: ItemStack) {
|
||||
dropBlockAsItem_do(world, x, y, z, stack)
|
||||
def internalDropBlockAsItem(world: World, x: Int, y: Int, z: Int, stack: ItemStack) {
|
||||
dropBlockAsItem(world, x, y, z, stack)
|
||||
}
|
||||
|
||||
override def isBlockNormalCube(world: World, x: Int, y: Int, z: Int) =
|
||||
override def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
subBlock(world.getBlockMetadata(x, y, z)) match {
|
||||
case Some(subBlock) => subBlock.isNormalCube(world, x, y, z)
|
||||
case _ => false
|
||||
@ -145,11 +145,12 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
case _ => super.getValidRotations(world, x, y, z)
|
||||
}
|
||||
|
||||
override def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: Int, stack: ItemStack) =
|
||||
subBlock(stack) match {
|
||||
case Some(subBlock) => subBlock.canPlaceBlockOnSide(world, x, y, z, ForgeDirection.getOrientation(side).getOpposite)
|
||||
case _ => super.canPlaceBlockOnSide(world, x, y, z, side, stack)
|
||||
}
|
||||
// TODO need a side check that takes a stack, or have to make keyboard an extra item
|
||||
// override def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: Int, stack: ItemStack) =
|
||||
// subBlock(stack) match {
|
||||
// case Some(subBlock) => subBlock.canPlaceBlockOnSide(world, x, y, z, ForgeDirection.getOrientation(side).getOpposite)
|
||||
// case _ => super.canPlaceBlockOnSide(world, x, y, z, side, stack)
|
||||
// }
|
||||
|
||||
override def getCollisionBoundingBoxFromPool(world: World, x: Int, y: Int, z: Int) = {
|
||||
setBlockBoundsBasedOnState(world, x, y, z)
|
||||
@ -186,9 +187,9 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
super.collisionRayTrace(world, x, y, z, origin, direction)
|
||||
|
||||
override def rotateBlock(world: World, x: Int, y: Int, z: Int, axis: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rotatable: tileentity.Rotatable if rotatable.rotate(axis) =>
|
||||
world.markBlockForRenderUpdate(x, y, z)
|
||||
world.markBlockForUpdate(x, y, z)
|
||||
true
|
||||
case _ => false
|
||||
}
|
||||
@ -259,23 +260,23 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
case _ => // Invalid but avoid match error.
|
||||
}
|
||||
|
||||
override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, metadata: Int) = {
|
||||
override def breakBlock(world: World, x: Int, y: Int, z: Int, block: Block, metadata: Int) = {
|
||||
subBlock(metadata) match {
|
||||
case Some(subBlock) => subBlock.removedFromWorld(world, x, y, z, blockId)
|
||||
case Some(subBlock) => subBlock.removedFromWorld(world, x, y, z, block)
|
||||
case _ => // Invalid but avoid match error.
|
||||
}
|
||||
super.breakBlock(world, x, y, z, blockId, metadata)
|
||||
super.breakBlock(world, x, y, z, block, metadata)
|
||||
}
|
||||
|
||||
override def removeBlockByPlayer(world: World, player: EntityPlayer, x: Int, y: Int, z: Int) =
|
||||
override def removedByPlayer(world: World, player: EntityPlayer, x: Int, y: Int, z: Int) =
|
||||
(subBlock(world, x, y, z) match {
|
||||
case Some(subBlock) => subBlock.removedByEntity(world, x, y, z, player)
|
||||
case _ => true
|
||||
}) && super.removeBlockByPlayer(world, player, x, y, z)
|
||||
}) && super.removedByPlayer(world, player, x, y, z)
|
||||
|
||||
override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, blockId: Int) =
|
||||
override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||
subBlock(world, x, y, z) match {
|
||||
case Some(subBlock) => subBlock.neighborBlockChanged(world, x, y, z, blockId)
|
||||
case Some(subBlock) => subBlock.neighborBlockChanged(world, x, y, z, block)
|
||||
case _ => // Invalid but avoid match error.
|
||||
}
|
||||
|
||||
@ -319,7 +320,7 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
|
||||
override def getRenderType = BlockRenderer.getRenderId
|
||||
|
||||
override def getLightOpacity(world: World, x: Int, y: Int, z: Int) =
|
||||
override def getLightOpacity(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
subBlock(world, x, y, z) match {
|
||||
case Some(subBlock) => subBlock.opacity(world, x, y, z)
|
||||
case _ => 255
|
||||
@ -365,15 +366,15 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def getBlockTexture(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) =
|
||||
override def getIcon(world: IBlockAccess, x: Int, y: Int, z: Int, side: Int) =
|
||||
subBlock(world, x, y, z) match {
|
||||
case Some(subBlock) =>
|
||||
val orientation = ForgeDirection.getOrientation(side)
|
||||
subBlock.icon(world, x, y, z, orientation, toLocal(world, x, y, z, orientation)) match {
|
||||
case Some(icon) => icon
|
||||
case _ => super.getBlockTexture(world, x, y, z, side)
|
||||
case _ => super.getIcon(world, x, y, z, side)
|
||||
}
|
||||
case _ => super.getBlockTexture(world, x, y, z, side)
|
||||
case _ => super.getIcon(world, x, y, z, side)
|
||||
}
|
||||
|
||||
override def setBlockBoundsForItemRender() {
|
||||
@ -394,8 +395,8 @@ class Delegator[Child <: Delegate](id: Int) extends Block(id, Material.iron) {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
override def registerBlockIcons(iconRegister: IIconRegister) = {
|
||||
super.registerBlockIcons(iconRegister)
|
||||
subBlocks.foreach(_.registerIcons(iconRegister))
|
||||
}
|
||||
}
|
||||
@ -408,23 +409,21 @@ object Delegator {
|
||||
}
|
||||
|
||||
def subBlock(world: IBlockAccess, x: Int, y: Int, z: Int): Option[Delegate] = {
|
||||
val blockId = world.getBlockId(x, y, z)
|
||||
if (blockId > 0) subBlock(Block.blocksList(blockId), world.getBlockMetadata(x, y, z))
|
||||
else None
|
||||
subBlock(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z))
|
||||
}
|
||||
|
||||
def subBlock(stack: ItemStack): Option[Delegate] =
|
||||
if (stack != null) stack.getItem match {
|
||||
case block: ItemBlock =>
|
||||
subBlock(Block.blocksList(block.getBlockID), block.getMetadata(stack.getItemDamage))
|
||||
subBlock(block.field_150939_a, block.getMetadata(stack.getItemDamage))
|
||||
case _ => None
|
||||
}
|
||||
else None
|
||||
}
|
||||
|
||||
class SimpleDelegator(id: Int) extends Delegator[SimpleDelegate](id)
|
||||
class SimpleDelegator extends Delegator[SimpleDelegate]
|
||||
|
||||
class SpecialDelegator(id: Int) extends Delegator[SpecialDelegate](id) {
|
||||
class SpecialDelegator extends Delegator[SpecialDelegate] {
|
||||
override def isOpaqueCube = false
|
||||
|
||||
override def renderAsNormalBlock = false
|
||||
@ -450,13 +449,13 @@ trait RedstoneDelegator[Child <: Delegate] extends Delegator[Child] with IConnec
|
||||
override def getConnectionType(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) = RedNetConnectionType.CableAll
|
||||
|
||||
override def getOutputValue(world: World, x: Int, y: Int, z: Int, side: ForgeDirection, color: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case t: tileentity.BundledRedstoneAware => t.bundledOutput(side, color)
|
||||
case _ => 0
|
||||
}
|
||||
|
||||
override def getOutputValues(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case t: tileentity.BundledRedstoneAware => t.bundledOutput(side)
|
||||
case _ => Array.fill(16)(0)
|
||||
}
|
||||
@ -464,18 +463,18 @@ trait RedstoneDelegator[Child <: Delegate] extends Delegator[Child] with IConnec
|
||||
override def onInputChanged(world: World, x: Int, y: Int, z: Int, side: ForgeDirection, inputValue: Int) {}
|
||||
|
||||
override def onInputsChanged(world: World, x: Int, y: Int, z: Int, side: ForgeDirection, inputValues: Array[Int]) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case t: tileentity.BundledRedstoneAware => for (color <- 0 until 16) {
|
||||
t.rednetInput(side, color, inputValues(color))
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
|
||||
abstract override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, blockId: Int) {
|
||||
abstract override def onNeighborBlockChange(world: World, x: Int, y: Int, z: Int, block: Block) {
|
||||
if (Loader.isModLoaded("MineFactoryReloaded")) {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case t: tileentity.BundledRedstoneAware => for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
Block.blocksList(world.getBlockId(x + side.offsetX, y + side.offsetY, z + side.offsetZ)) match {
|
||||
world.getBlock(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
case block: IRedNetNetworkContainer =>
|
||||
case _ => for (color <- 0 until 16) {
|
||||
t.rednetInput(side, color, 0)
|
||||
@ -485,14 +484,14 @@ trait RedstoneDelegator[Child <: Delegate] extends Delegator[Child] with IConnec
|
||||
case _ =>
|
||||
}
|
||||
}
|
||||
super.onNeighborBlockChange(world, x, y, z, blockId)
|
||||
super.onNeighborBlockChange(world, x, y, z, block)
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleRedstoneDelegator(id: Int) extends SimpleDelegator(id) with RedstoneDelegator[SimpleDelegate] {
|
||||
class SimpleRedstoneDelegator extends SimpleDelegator with RedstoneDelegator[SimpleDelegate] {
|
||||
override def canProvidePower = true
|
||||
}
|
||||
|
||||
class SpecialRedstoneDelegator(id: Int) extends SpecialDelegator(id) with RedstoneDelegator[SpecialDelegate] {
|
||||
class SpecialRedstoneDelegator extends SpecialDelegator with RedstoneDelegator[SpecialDelegate] {
|
||||
override def canProvidePower = true
|
||||
}
|
||||
|
@ -5,17 +5,17 @@ import java.util
|
||||
import li.cil.oc.common.{GuiType, tileentity}
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{api, OpenComputers, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class DiskDrive(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "DiskDrive"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -28,7 +28,7 @@ class DiskDrive(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
@ -45,7 +45,7 @@ class DiskDrive(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
override def createTileEntity(world: World) = Some(new tileentity.DiskDrive)
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case drive: tileentity.DiskDrive => api.Network.joinOrCreateNetwork(drive)
|
||||
case _ =>
|
||||
}
|
||||
|
@ -7,14 +7,16 @@ import net.minecraft.block.Block
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemBlock, ItemStack}
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Item(id: Int) extends ItemBlock(id) {
|
||||
class Item(value: Block) extends ItemBlock(value) {
|
||||
setHasSubtypes(true)
|
||||
|
||||
def block = field_150939_a
|
||||
|
||||
override def addInformation(stack: ItemStack, player: EntityPlayer, tooltip: util.List[_], advanced: Boolean) {
|
||||
super.addInformation(stack, player, tooltip, advanced)
|
||||
Block.blocksList(getBlockID) match {
|
||||
block match {
|
||||
case delegator: Delegator[_] => delegator.addInformation(getMetadata(stack.getItemDamage), stack, player, tooltip.asInstanceOf[util.List[String]], advanced)
|
||||
case _ =>
|
||||
}
|
||||
@ -30,9 +32,9 @@ class Item(id: Int) extends ItemBlock(id) {
|
||||
override def getUnlocalizedName = Settings.namespace + "block"
|
||||
|
||||
override def getUnlocalizedName(stack: ItemStack) =
|
||||
Block.blocksList(getBlockID) match {
|
||||
block match {
|
||||
case delegator: Delegator[_] => Settings.namespace + "block." + delegator.getUnlocalizedName(stack.getItemDamage)
|
||||
case block => block.getUnlocalizedName
|
||||
case _ => block.getUnlocalizedName
|
||||
}
|
||||
|
||||
override def isBookEnchantable(a: ItemStack, b: ItemStack) = false
|
||||
@ -40,7 +42,7 @@ class Item(id: Int) extends ItemBlock(id) {
|
||||
override def placeBlockAt(stack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float, metadata: Int) = {
|
||||
if (super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata)) {
|
||||
// If it's a rotatable block try to make it face the player.
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard =>
|
||||
keyboard.setFromEntityPitchAndYaw(player)
|
||||
keyboard.setFromFacing(ForgeDirection.getOrientation(side))
|
||||
|
@ -5,18 +5,19 @@ import li.cil.oc.Settings
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.{AxisAlignedBB, Icon}
|
||||
import net.minecraft.util.{AxisAlignedBB, IIcon}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import org.lwjgl.opengl.GL11
|
||||
import net.minecraft.block.Block
|
||||
|
||||
class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
val unlocalizedName = "Keyboard"
|
||||
|
||||
var icon: Icon = null
|
||||
var icon: IIcon = null
|
||||
|
||||
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
|
||||
tooltip.addAll(Tooltip.get(unlocalizedName))
|
||||
@ -24,7 +25,7 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icon)
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":keyboard")
|
||||
}
|
||||
|
||||
@ -35,24 +36,24 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
override def createTileEntity(world: World) = Some(new tileentity.Keyboard(world.isRemote))
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard => api.Network.joinOrCreateNetwork(keyboard)
|
||||
case _ =>
|
||||
}
|
||||
|
||||
override def canPlaceBlockOnSide(world: World, x: Int, y: Int, z: Int, side: ForgeDirection) =
|
||||
world.isBlockSolidOnSide(x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite) &&
|
||||
(world.getBlockTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
world.isSideSolid(x + side.offsetX, y + side.offsetY, z + side.offsetZ, side.getOpposite) &&
|
||||
(world.getTileEntity(x + side.offsetX, y + side.offsetY, z + side.offsetZ) match {
|
||||
case screen: tileentity.Screen => screen.facing != side.getOpposite
|
||||
case _ => true
|
||||
})
|
||||
|
||||
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||
override def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||
override def opacity(world: IBlockAccess, x: Int, y: Int, z: Int) = 0
|
||||
|
||||
override def updateBounds(world: IBlockAccess, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard => parent.setBlockBounds(computeBounds(keyboard.pitch, keyboard.yaw))
|
||||
case _ => super.updateBounds(world, x, y, z)
|
||||
}
|
||||
@ -84,8 +85,8 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
math.max(x0, x1) + 0.5f, math.max(y0, y1) + 0.5f, math.max(z0, z1) + 0.5f)
|
||||
}
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard if canPlaceBlockOnSide(world, x, y, z, keyboard.facing.getOpposite) => // Can stay.
|
||||
case _ =>
|
||||
parent.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0)
|
||||
@ -100,7 +101,7 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
|
||||
def adjacentScreen(world: World, x: Int, y: Int, z: Int) =
|
||||
adjacencyInfo(world, x, y, z) match {
|
||||
case Some((_, _, sx, sy, sz, _)) => world.getBlockTileEntity(sx, sy, sz) match {
|
||||
case Some((_, _, sx, sy, sz, _)) => world.getTileEntity(sx, sy, sz) match {
|
||||
case screen: tileentity.Screen => Some(screen)
|
||||
case _ => None
|
||||
}
|
||||
@ -108,7 +109,7 @@ class Keyboard(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
}
|
||||
|
||||
def adjacencyInfo(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case keyboard: tileentity.Keyboard =>
|
||||
val (sx, sy, sz) = (
|
||||
x + keyboard.facing.getOpposite.offsetX,
|
||||
|
@ -6,17 +6,17 @@ import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class PowerConverter(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "PowerConverter"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
private val formatter = new DecimalFormat("#.#")
|
||||
|
||||
@ -49,7 +49,7 @@ class PowerConverter(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
|
@ -4,17 +4,17 @@ import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class PowerDistributor(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "PowerDistributor"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -24,7 +24,7 @@ class PowerDistributor(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal()))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
|
@ -5,17 +5,17 @@ import java.util
|
||||
import li.cil.oc.common.{GuiType, tileentity}
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{OpenComputers, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Rack(val parent: SpecialDelegator) extends RedstoneAware with SpecialDelegate {
|
||||
val unlocalizedName = "ServerRack"
|
||||
|
||||
val icons = Array.fill[Icon](6)(null)
|
||||
val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -25,7 +25,7 @@ class Rack(val parent: SpecialDelegator) extends RedstoneAware with SpecialDeleg
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
@ -37,7 +37,7 @@ class Rack(val parent: SpecialDelegator) extends RedstoneAware with SpecialDeleg
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def mixedBrightness(world: IBlockAccess, x: Int, y: Int, z: Int) = {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rack: tileentity.Rack =>
|
||||
def brightness(x: Int, y: Int, z: Int) = world.getLightBrightnessForSkyBlocks(x, y, z, parent.getLightValue(world, x, y, z))
|
||||
val value = brightness(x + rack.facing.offsetX, y + rack.facing.offsetY, z + rack.facing.offsetZ)
|
||||
|
@ -5,17 +5,17 @@ import java.util
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{Items, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Redstone(val parent: SimpleDelegator) extends RedstoneAware with SimpleDelegate {
|
||||
val unlocalizedName = "Redstone"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
|
||||
tooltip.addAll(Tooltip.get(unlocalizedName))
|
||||
@ -29,7 +29,7 @@ class Redstone(val parent: SimpleDelegator) extends RedstoneAware with SimpleDel
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal()))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":redstone_top")
|
||||
icons(ForgeDirection.UP.ordinal) = icons(ForgeDirection.DOWN.ordinal)
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
package li.cil.oc.common.block
|
||||
|
||||
import li.cil.oc.common.tileentity
|
||||
import net.minecraft.block.Block
|
||||
import net.minecraft.world.{World, IBlockAccess}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
abstract class RedstoneAware extends Delegate {
|
||||
override def hasTileEntity = true
|
||||
|
||||
override def canConnectToRedstone(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case redstone: tileentity.RedstoneAware => redstone.isOutputEnabled
|
||||
case _ => false
|
||||
}
|
||||
@ -17,13 +18,13 @@ abstract class RedstoneAware extends Delegate {
|
||||
isProvidingWeakPower(world, x, y, z, side)
|
||||
|
||||
override def isProvidingWeakPower(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case redstone: tileentity.RedstoneAware => math.min(math.max(redstone.output(side), 0), 15)
|
||||
case _ => super.isProvidingWeakPower(world, x, y, z, side)
|
||||
}
|
||||
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, blockId: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
override def neighborBlockChanged(world: World, x: Int, y: Int, z: Int, block: Block) =
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case redstone: tileentity.RedstoneAware => redstone.checkRedstoneInputChanged()
|
||||
case _ => // Ignore.
|
||||
}
|
||||
|
@ -3,19 +3,19 @@ package li.cil.oc.common.block
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.{Settings, Blocks}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.EnumRarity
|
||||
import net.minecraft.util.{Icon, MovingObjectPosition}
|
||||
import net.minecraft.util.{IIcon, MovingObjectPosition}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
val unlocalizedName = "RobotAfterimage"
|
||||
|
||||
showInItemList = false
|
||||
|
||||
private var icon: Icon = _
|
||||
private var icon: IIcon = _
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -25,7 +25,7 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
override def icon(side: ForgeDirection) = Some(icon)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
}
|
||||
@ -40,9 +40,9 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||
override def opacity(world: IBlockAccess, x: Int, y: Int, z: Int) = 0
|
||||
|
||||
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||
override def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def isSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
@ -51,7 +51,7 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def addedToWorld(world: World, x: Int, y: Int, z: Int) {
|
||||
world.scheduleBlockUpdate(x, y, z, parent.blockID, math.max((Settings.get.moveDelay * 20).toInt, 1) - 1)
|
||||
world.scheduleBlockUpdate(x, y, z, parent, math.max((Settings.get.moveDelay * 20).toInt, 1) - 1)
|
||||
}
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) {
|
||||
@ -67,7 +67,7 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
robot.moveFromX == x &&
|
||||
robot.moveFromY == y &&
|
||||
robot.moveFromZ == z =>
|
||||
robot.proxy.getBlockType.removeBlockByPlayer(world, player, robot.x, robot.y, robot.z)
|
||||
robot.proxy.getBlockType.removedByPlayer(world, player, robot.x, robot.y, robot.z)
|
||||
case _ => super.removedByEntity(world, x, y, z, player) // Probably broken by the robot we represent.
|
||||
}
|
||||
}
|
||||
@ -101,7 +101,7 @@ class RobotAfterimage(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
def findMovingRobot(world: IBlockAccess, x: Int, y: Int, z: Int): Option[tileentity.Robot] = {
|
||||
for (side <- ForgeDirection.VALID_DIRECTIONS) {
|
||||
val (tx, ty, tz) = (x + side.offsetX, y + side.offsetY, z + side.offsetZ)
|
||||
if (!world.isAirBlock(tx, ty, tz)) world.getBlockTileEntity(tx, ty, tz) match {
|
||||
if (!world.isAirBlock(tx, ty, tz)) world.getTileEntity(tx, ty, tz) match {
|
||||
case proxy: tileentity.RobotProxy if proxy.robot.moveFromX == x && proxy.robot.moveFromY == y && proxy.robot.moveFromZ == z => return Some(proxy.robot)
|
||||
case _ =>
|
||||
}
|
||||
|
@ -7,18 +7,18 @@ import li.cil.oc.server.PacketSender
|
||||
import li.cil.oc.server.component.robot
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{Blocks, Settings, OpenComputers}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.util.{Icon, MovingObjectPosition, AxisAlignedBB, Vec3}
|
||||
import net.minecraft.util.{IIcon, MovingObjectPosition, AxisAlignedBB, Vec3}
|
||||
import net.minecraft.world.{IBlockAccess, World}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with SpecialDelegate {
|
||||
val unlocalizedName = "Robot"
|
||||
|
||||
private var icon: Icon = _
|
||||
private var icon: IIcon = _
|
||||
|
||||
var moving = new ThreadLocal[Option[tileentity.Robot]] {
|
||||
override protected def initialValue = None
|
||||
@ -49,13 +49,13 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
override def icon(side: ForgeDirection) = Some(icon)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
}
|
||||
|
||||
override def pick(target: MovingObjectPosition, world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case proxy: tileentity.RobotProxy => proxy.robot.createItemStack()
|
||||
case _ => null
|
||||
}
|
||||
@ -71,11 +71,11 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def isNormalCube(world: World, x: Int, y: Int, z: Int) = false
|
||||
override def isNormalCube(world: IBlockAccess, x: Int, y: Int, z: Int) = false
|
||||
|
||||
override def isSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
override def opacity(world: World, x: Int, y: Int, z: Int) = 0
|
||||
override def opacity(world: IBlockAccess, x: Int, y: Int, z: Int) = 0
|
||||
|
||||
override def shouldSideBeRendered(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = false
|
||||
|
||||
@ -85,14 +85,14 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
|
||||
override def intersect(world: World, x: Int, y: Int, z: Int, origin: Vec3, direction: Vec3) = {
|
||||
val bounds = parent.getCollisionBoundingBoxFromPool(world, x, y, z)
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case proxy: tileentity.RobotProxy if proxy.robot.animationTicksLeft <= 0 && bounds.isVecInside(origin) => null
|
||||
case _ => super.intersect(world, x, y, z, origin, direction)
|
||||
}
|
||||
}
|
||||
|
||||
override def updateBounds(world: IBlockAccess, x: Int, y: Int, z: Int) {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case proxy: tileentity.RobotProxy =>
|
||||
val robot = proxy.robot
|
||||
val bounds = AxisAlignedBB.getBoundingBox(0.1, 0.1, 0.1, 0.9, 0.9, 0.9)
|
||||
@ -115,7 +115,7 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
// We only send slot changes to nearby players, so if there was no slot
|
||||
// change since this player got into range he might have the wrong one,
|
||||
// so we send him the current one just in case.
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case proxy: tileentity.RobotProxy =>
|
||||
PacketSender.sendRobotSelectedSlotChange(proxy.robot)
|
||||
case _ =>
|
||||
@ -129,7 +129,7 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
|
||||
override def addedByEntity(world: World, x: Int, y: Int, z: Int, entity: EntityLivingBase, stack: ItemStack) {
|
||||
super.addedByEntity(world, x, y, z, entity, stack)
|
||||
if (!world.isRemote) ((entity, world.getBlockTileEntity(x, y, z)) match {
|
||||
if (!world.isRemote) ((entity, world.getTileEntity(x, y, z)) match {
|
||||
case (player: robot.Player, proxy: tileentity.RobotProxy) =>
|
||||
Some((proxy.robot, player.robot.owner))
|
||||
case (player: EntityPlayer, proxy: tileentity.RobotProxy) =>
|
||||
@ -144,15 +144,15 @@ class RobotProxy(val parent: SpecialDelegator) extends RedstoneAware with Specia
|
||||
}
|
||||
|
||||
override def removedByEntity(world: World, x: Int, y: Int, z: Int, player: EntityPlayer): Boolean = {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case proxy: tileentity.RobotProxy =>
|
||||
val robot = proxy.robot
|
||||
if (robot.player == player) return false
|
||||
if (!world.isRemote && (!player.capabilities.isCreativeMode || proxy.globalBuffer > 1 || proxy.robot.xp > 0)) {
|
||||
parent.dropBlockAsItem(world, x, y, z, robot.createItemStack())
|
||||
parent.internalDropBlockAsItem(world, x, y, z, robot.createItemStack())
|
||||
}
|
||||
if (Blocks.blockSpecial.subBlock(world, robot.moveFromX, robot.moveFromY, robot.moveFromZ).exists(_ == Blocks.robotAfterimage)) {
|
||||
world.setBlock(robot.moveFromX, robot.moveFromY, robot.moveFromZ, 0, 0, 1)
|
||||
world.setBlock(robot.moveFromX, robot.moveFromY, robot.moveFromZ, net.minecraft.init.Blocks.air, 0, 1)
|
||||
}
|
||||
case _ =>
|
||||
}
|
||||
|
@ -5,17 +5,17 @@ import li.cil.oc.Settings
|
||||
import li.cil.oc.api
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Router(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
val unlocalizedName = "Router"
|
||||
|
||||
private val icons = Array.fill[Icon](6)(null)
|
||||
private val icons = Array.fill[IIcon](6)(null)
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
@ -25,7 +25,7 @@ class Router(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
|
||||
override def icon(side: ForgeDirection) = Some(icons(side.ordinal))
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
icons(ForgeDirection.DOWN.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":generic_top")
|
||||
icons(ForgeDirection.UP.ordinal) = iconRegister.registerIcon(Settings.resourceDomain + ":router_top")
|
||||
|
||||
@ -42,7 +42,7 @@ class Router(val parent: SimpleDelegator) extends SimpleDelegate {
|
||||
override def createTileEntity(world: World) = Some(new tileentity.Router)
|
||||
|
||||
override def update(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case router: tileentity.Router => api.Network.joinOrCreateNetwork(router)
|
||||
case _ =>
|
||||
}
|
||||
|
@ -6,15 +6,15 @@ import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.mods.BuildCraft
|
||||
import li.cil.oc.util.{PackedColor, Tooltip}
|
||||
import li.cil.oc.{Settings, OpenComputers}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.Entity
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.projectile.EntityArrow
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.IBlockAccess
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
import scala.Array
|
||||
|
||||
abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with SimpleDelegate {
|
||||
@ -31,7 +31,7 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
}
|
||||
|
||||
object Icons {
|
||||
var b, b2, bbl, bbl2, bbm, bbm2, bbr, bbr2, bhb, bhb2, bhm, bhm2, bht, bht2, bml, bmm, bmr, btl, btm, btr, bvb, bvb2, bvm, bvt, f, f2, fbl, fbl2, fbm, fbm2, fbr, fbr2, fhb, fhb2, fhm, fhm2, fht, fht2, fml, fmm, fmr, ftl, ftm, ftr, fvb, fvb2, fvm, fvt = null: Icon
|
||||
var b, b2, bbl, bbl2, bbm, bbm2, bbr, bbr2, bhb, bhb2, bhm, bhm2, bht, bht2, bml, bmm, bmr, btl, btm, btr, bvb, bvb2, bvm, bvt, f, f2, fbl, fbl2, fbm, fbm2, fbr, fbr2, fhb, fhb2, fhm, fhm2, fht, fht2, fml, fmm, fmr, ftl, ftm, ftr, fvb, fvb2, fvm, fvt = null: IIcon
|
||||
|
||||
lazy val fh = Array(fht, fhm, fhb)
|
||||
lazy val fv = Array(fvt, fvm, fvb)
|
||||
@ -78,7 +78,7 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
// compute ambient occlusion in a custom block renderer to keep the lighting
|
||||
// pretty... which would be even more grotesque.
|
||||
override def icon(world: IBlockAccess, x: Int, y: Int, z: Int, worldSide: ForgeDirection, localSide: ForgeDirection) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case screen: tileentity.Screen if screen.width > 1 || screen.height > 1 =>
|
||||
val right = screen.width - 1
|
||||
val bottom = screen.height - 1
|
||||
@ -222,7 +222,7 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
case _ => Icons.b2
|
||||
})
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
Icons.b = iconRegister.registerIcon(Settings.resourceDomain + ":screen/b")
|
||||
Icons.b2 = iconRegister.registerIcon(Settings.resourceDomain + ":screen/b2")
|
||||
Icons.bbl = iconRegister.registerIcon(Settings.resourceDomain + ":screen/bbl")
|
||||
@ -293,7 +293,7 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
override def rightClick(world: World, x: Int, y: Int, z: Int, player: EntityPlayer,
|
||||
side: ForgeDirection, hitX: Float, hitY: Float, hitZ: Float) =
|
||||
if (!player.isSneaking && !BuildCraft.holdsApplicableWrench(player, x, y, z)) {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case screen: tileentity.Screen if screen.hasKeyboard =>
|
||||
// Yep, this GUI is actually purely client side. We could skip this
|
||||
// if, but it is clearer this way (to trigger it from the server we
|
||||
@ -310,13 +310,13 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
else false
|
||||
|
||||
override def walk(world: World, x: Int, y: Int, z: Int, entity: Entity) =
|
||||
if (!world.isRemote) world.getBlockTileEntity(x, y, z) match {
|
||||
if (!world.isRemote) world.getTileEntity(x, y, z) match {
|
||||
case screen: tileentity.Screen if screen.tier > 0 && screen.facing == ForgeDirection.UP => screen.walk(entity)
|
||||
case _ =>
|
||||
}
|
||||
|
||||
override def collide(world: World, x: Int, y: Int, z: Int, entity: Entity) =
|
||||
if (!world.isRemote) (entity, world.getBlockTileEntity(x, y, z)) match {
|
||||
if (!world.isRemote) (entity, world.getTileEntity(x, y, z)) match {
|
||||
case (arrow: EntityArrow, screen: tileentity.Screen) if screen.tier > 0 =>
|
||||
val hitX = math.max(0, math.min(1, arrow.posX - x))
|
||||
val hitY = math.max(0, math.min(1, arrow.posY - y))
|
||||
@ -345,7 +345,7 @@ abstract class Screen(val parent: SimpleDelegator) extends RedstoneAware with Si
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def validRotations(world: World, x: Int, y: Int, z: Int) =
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case screen: tileentity.Screen =>
|
||||
if (screen.facing == ForgeDirection.UP || screen.facing == ForgeDirection.DOWN) ForgeDirection.VALID_DIRECTIONS
|
||||
else ForgeDirection.VALID_DIRECTIONS.filter {
|
||||
|
@ -4,7 +4,7 @@ import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.util.mods.StargateTech2
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -18,7 +18,7 @@ class AbstractBusCard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_abstract_bus")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class Acid(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":grog")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class ALU(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":alu")
|
||||
|
@ -1,17 +1,16 @@
|
||||
package li.cil.oc.common.item
|
||||
|
||||
import cpw.mods.fml.common.network.Player
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.api.network._
|
||||
import li.cil.oc.server.PacketSender
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.{EntityPlayerMP, EntityPlayer}
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.ChatMessageComponent
|
||||
import net.minecraft.util.ChatComponentTranslation
|
||||
import net.minecraft.world.World
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraftforge.common.util.ForgeDirection
|
||||
|
||||
class Analyzer(val parent: Delegator) extends Delegate {
|
||||
val unlocalizedName = "Analyzer"
|
||||
@ -23,7 +22,7 @@ class Analyzer(val parent: Delegator) extends Delegate {
|
||||
override def onItemUse(stack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float) = {
|
||||
player match {
|
||||
case realPlayer: EntityPlayerMP =>
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case analyzable: Analyzable =>
|
||||
if (!world.isRemote) {
|
||||
analyzeNodes(analyzable.onAnalyze(realPlayer, side, hitX, hitY, hitZ), realPlayer)
|
||||
@ -49,32 +48,32 @@ class Analyzer(val parent: Delegator) extends Delegate {
|
||||
node match {
|
||||
case connector: Connector =>
|
||||
if (connector.localBufferSize > 0) {
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(
|
||||
player.addChatMessage(new ChatComponentTranslation(
|
||||
Settings.namespace + "gui.Analyzer.StoredEnergy",
|
||||
"%.2f/%.2f".format(connector.localBuffer, connector.localBufferSize)))
|
||||
}
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(
|
||||
player.addChatMessage(new ChatComponentTranslation(
|
||||
Settings.namespace + "gui.Analyzer.TotalEnergy",
|
||||
"%.2f/%.2f".format(connector.globalBuffer, connector.globalBufferSize)))
|
||||
case _ =>
|
||||
}
|
||||
node match {
|
||||
case component: Component =>
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(
|
||||
player.addChatMessage(new ChatComponentTranslation(
|
||||
Settings.namespace + "gui.Analyzer.ComponentName",
|
||||
component.name))
|
||||
case _ =>
|
||||
}
|
||||
val address = node.address()
|
||||
if (address != null && !address.isEmpty) {
|
||||
player.sendChatToPlayer(ChatMessageComponent.createFromTranslationWithSubstitutions(
|
||||
player.addChatMessage(new ChatComponentTranslation(
|
||||
Settings.namespace + "gui.Analyzer.Address",
|
||||
address))
|
||||
}
|
||||
PacketSender.sendAnalyze(address, player)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":analyzer")
|
||||
|
@ -1,12 +1,12 @@
|
||||
package li.cil.oc.common.item
|
||||
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
|
||||
class ArrowKeys(val parent: Delegator) extends Delegate {
|
||||
val unlocalizedName = "ArrowKeys"
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":keys_arrow")
|
||||
|
@ -1,12 +1,12 @@
|
||||
package li.cil.oc.common.item
|
||||
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
|
||||
class ButtonGroup(val parent: Delegator) extends Delegate {
|
||||
val unlocalizedName = "ButtonGroup"
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":keys_group")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import scala.Array
|
||||
@ -19,7 +19,7 @@ class CPU(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":cpu" + tier)
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class CardBase(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class CircuitBoard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":circuit_board")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class ControlUnit(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":cu")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class CuttingWire(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":cutting_wire")
|
||||
|
@ -2,10 +2,10 @@ package li.cil.oc.common.item
|
||||
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
|
||||
trait Delegate {
|
||||
@ -17,7 +17,7 @@ trait Delegate {
|
||||
|
||||
val itemId = parent.add(this)
|
||||
|
||||
private var _icon: Option[Icon] = None
|
||||
private var _icon: Option[IIcon] = None
|
||||
|
||||
def maxStackSize = 64
|
||||
|
||||
@ -56,16 +56,16 @@ trait Delegate {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def icon: Option[Icon] = _icon
|
||||
def icon: Option[IIcon] = _icon
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected def icon_=(value: Icon) = _icon = Option(value)
|
||||
protected def icon_=(value: IIcon) = _icon = Option(value)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def icon(stack: ItemStack, pass: Int): Option[Icon] = icon
|
||||
def icon(stack: ItemStack, pass: Int): Option[IIcon] = icon
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
def registerIcons(iconRegister: IconRegister) {}
|
||||
def registerIcons(iconRegister: IIconRegister) {}
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
|
@ -4,16 +4,16 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import java.util
|
||||
import li.cil.oc.util.ItemCosts
|
||||
import li.cil.oc.{Settings, CreativeTab}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.creativetab.CreativeTabs
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack, Item}
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
import org.lwjgl.input
|
||||
import scala.collection.mutable
|
||||
|
||||
class Delegator(id: Int) extends Item(id) {
|
||||
class Delegator extends Item {
|
||||
setHasSubtypes(true)
|
||||
setCreativeTab(CreativeTab)
|
||||
|
||||
@ -47,7 +47,7 @@ class Delegator(id: Int) extends Item(id) {
|
||||
case _ => None
|
||||
}
|
||||
|
||||
override def getSubItems(itemId: Int, tab: CreativeTabs, list: util.List[_]) {
|
||||
override def getSubItems(item: Item, tab: CreativeTabs, list: util.List[_]) {
|
||||
// Workaround for MC's untyped lists...
|
||||
def add[T](list: util.List[T], value: Any) = list.add(value.asInstanceOf[T])
|
||||
(0 until subItems.length).filter(subItems(_).showInItemList).
|
||||
@ -97,13 +97,15 @@ class Delegator(id: Int) extends Item(id) {
|
||||
|
||||
// ----------------------------------------------------------------------- //
|
||||
|
||||
override def getItemDisplayName(stack: ItemStack) =
|
||||
def internalGetItemStackDisplayName(stack: ItemStack) = super.getItemStackDisplayName(stack)
|
||||
|
||||
override def getItemStackDisplayName(stack: ItemStack) =
|
||||
subItem(stack) match {
|
||||
case Some(subItem) => subItem.displayName(stack) match {
|
||||
case Some(name) => name
|
||||
case _ => super.getItemDisplayName(stack)
|
||||
case _ => super.getItemStackDisplayName(stack)
|
||||
}
|
||||
case _ => super.getItemDisplayName(stack)
|
||||
case _ => super.getItemStackDisplayName(stack)
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@ -129,7 +131,7 @@ class Delegator(id: Int) extends Item(id) {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def getIconFromDamage(damage: Int): Icon =
|
||||
override def getIconFromDamage(damage: Int): IIcon =
|
||||
subItem(damage) match {
|
||||
case Some(subItem) => subItem.icon match {
|
||||
case Some(icon) => icon
|
||||
@ -139,7 +141,7 @@ class Delegator(id: Int) extends Item(id) {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
subItems.foreach(_.registerIcons(iconRegister))
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class Disk(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":disk")
|
||||
|
@ -2,7 +2,7 @@ package li.cil.oc.common.item
|
||||
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -19,7 +19,7 @@ class FloppyDisk(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":disk_floppy")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.{Tooltip, PackedColor}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -26,7 +26,7 @@ class GraphicsCard(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_graphics" + tier)
|
||||
|
@ -2,7 +2,7 @@ package li.cil.oc.common.item
|
||||
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import scala.Array
|
||||
@ -36,7 +36,7 @@ class HardDiskDrive(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
}
|
||||
|
||||
override def displayName(stack: ItemStack) = {
|
||||
val localizedName = parent.getItemStackDisplayName(stack)
|
||||
val localizedName = parent.internalGetItemStackDisplayName(stack)
|
||||
Some(if (kiloBytes >= 1024) {
|
||||
localizedName + " (%dMB)".format(kiloBytes / 1024)
|
||||
}
|
||||
@ -45,7 +45,7 @@ class HardDiskDrive(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
})
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":disk_harddrive" + tier)
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class InternetCard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_internet")
|
||||
|
@ -4,7 +4,7 @@ import cpw.mods.fml.common.Loader
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -18,7 +18,7 @@ class IronNugget(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":iron_nugget")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import scala.Array
|
||||
@ -17,14 +17,14 @@ class Memory(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
override def rarity = Array(EnumRarity.common, EnumRarity.uncommon, EnumRarity.uncommon, EnumRarity.rare, EnumRarity.rare).apply(tier max 0 min 4)
|
||||
|
||||
override def displayName(stack: ItemStack) =
|
||||
Some(parent.getItemStackDisplayName(stack) + " (%dKB)".format(kiloBytes))
|
||||
Some(parent.internalGetItemStackDisplayName(stack) + " (%dKB)".format(kiloBytes))
|
||||
|
||||
override def tooltipLines(stack: ItemStack, player: EntityPlayer, tooltip: util.List[String], advanced: Boolean) {
|
||||
tooltip.addAll(Tooltip.get(baseName))
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":memory" + tier)
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{ItemStack, EnumRarity}
|
||||
import scala.Array
|
||||
@ -19,7 +19,7 @@ class Microchip(val parent: Delegator, val tier: Int) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":microchip" + tier)
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class NetworkCard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_lan")
|
||||
|
@ -1,12 +1,12 @@
|
||||
package li.cil.oc.common.item
|
||||
|
||||
import li.cil.oc.Settings
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
|
||||
class NumPad(val parent: Delegator) extends Delegate {
|
||||
val unlocalizedName = "NumPad"
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":keys_numpad")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class PrintedCircuitBoard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":circuit_board_printed")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class RawCircuitBoard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":circuit_board_raw")
|
||||
|
@ -4,7 +4,7 @@ import cpw.mods.fml.common.Loader
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -22,7 +22,7 @@ class RedstoneCard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_redstone")
|
||||
|
@ -5,7 +5,7 @@ import li.cil.oc.common.GuiType
|
||||
import li.cil.oc.common.inventory.ServerInventory
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{Settings, OpenComputers}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.world.World
|
||||
@ -38,7 +38,7 @@ class Server(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":server")
|
||||
|
@ -7,11 +7,11 @@ import li.cil.oc.common.{GuiType, tileentity}
|
||||
import li.cil.oc.server.{PacketSender => ServerPacketSender}
|
||||
import li.cil.oc.util.Tooltip
|
||||
import li.cil.oc.{OpenComputers, Settings}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraft.util.Icon
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.world.World
|
||||
|
||||
class Terminal(val parent: Delegator) extends Delegate {
|
||||
@ -19,8 +19,8 @@ class Terminal(val parent: Delegator) extends Delegate {
|
||||
|
||||
override def maxStackSize = 1
|
||||
|
||||
private var iconOn: Option[Icon] = None
|
||||
private var iconOff: Option[Icon] = None
|
||||
private var iconOn: Option[IIcon] = None
|
||||
private var iconOff: Option[IIcon] = None
|
||||
|
||||
def hasServer(stack: ItemStack) = stack.hasTagCompound && stack.getTagCompound.hasKey(Settings.namespace + "server")
|
||||
|
||||
@ -39,7 +39,7 @@ class Terminal(val parent: Delegator) extends Delegate {
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def icon(stack: ItemStack, pass: Int) = if (hasServer(stack)) iconOn else iconOff
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon_=(iconRegister.registerIcon(Settings.resourceDomain + ":terminal"))
|
||||
@ -49,7 +49,7 @@ class Terminal(val parent: Delegator) extends Delegate {
|
||||
}
|
||||
|
||||
override def onItemUse(stack: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float) = {
|
||||
world.getBlockTileEntity(x, y, z) match {
|
||||
world.getTileEntity(x, y, z) match {
|
||||
case rack: tileentity.Rack if side == rack.facing.ordinal() =>
|
||||
val l = 2 / 16.0
|
||||
val h = 14 / 16.0
|
||||
@ -59,14 +59,14 @@ class Terminal(val parent: Delegator) extends Delegate {
|
||||
rack.servers(slot) match {
|
||||
case Some(server) =>
|
||||
if (!stack.hasTagCompound) {
|
||||
stack.setTagCompound(new NBTTagCompound("tag"))
|
||||
stack.setTagCompound(new NBTTagCompound())
|
||||
}
|
||||
val key = UUID.randomUUID().toString
|
||||
rack.terminals(slot).key = Some(key)
|
||||
ServerPacketSender.sendServerState(rack, slot)
|
||||
stack.getTagCompound.setString(Settings.namespace + "key", key)
|
||||
stack.getTagCompound.setString(Settings.namespace + "server", server.machine.address)
|
||||
player.inventory.onInventoryChanged()
|
||||
player.inventory.markDirty()
|
||||
case _ => // Huh?
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
|
||||
@ -15,7 +15,7 @@ class Transistor(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) {
|
||||
override def registerIcons(iconRegister: IIconRegister) {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":transistor")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class UpgradeCrafting(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":upgrade_crafting")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class UpgradeGenerator(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":upgrade_generator")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class UpgradeNavigation(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":upgrade_navigation")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class UpgradeSign(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":upgrade_sign")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class UpgradeSolarGenerator(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":upgrade_solar_generator")
|
||||
|
@ -3,7 +3,7 @@ package li.cil.oc.common.item
|
||||
import java.util
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.Tooltip
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
|
||||
@ -17,7 +17,7 @@ class WirelessNetworkCard(val parent: Delegator) extends Delegate {
|
||||
super.tooltipLines(stack, player, tooltip, advanced)
|
||||
}
|
||||
|
||||
override def registerIcons(iconRegister: IconRegister) = {
|
||||
override def registerIcons(iconRegister: IIconRegister) = {
|
||||
super.registerIcons(iconRegister)
|
||||
|
||||
icon = iconRegister.registerIcon(Settings.resourceDomain + ":card_wlan")
|
||||
|
Loading…
x
Reference in New Issue
Block a user