mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-25 14:05:39 -04:00
More formatting and organize imports.
This commit is contained in:
parent
a8de31b577
commit
1078cd9548
@ -212,7 +212,7 @@ object Items extends ItemAPI {
|
||||
stack.setTagCompound(nbt)
|
||||
|
||||
stack
|
||||
}
|
||||
}
|
||||
}, "openOS")
|
||||
|
||||
Recipes.addItem(new item.UpgradeInventoryController(multi), "inventoryControllerUpgrade", "oc:inventoryControllerUpgrade")
|
||||
@ -220,5 +220,5 @@ object Items extends ItemAPI {
|
||||
Recipes.addItem(new item.UpgradeBattery(multi, Tier.One), "batteryUpgrade1", "oc:batteryUpgrade1")
|
||||
Recipes.addItem(new item.UpgradeBattery(multi, Tier.Two), "batteryUpgrade2", "oc:batteryUpgrade2")
|
||||
Recipes.addItem(new item.UpgradeBattery(multi, Tier.Three), "batteryUpgrade3", "oc:batteryUpgrade3")
|
||||
}
|
||||
}
|
||||
}
|
@ -310,4 +310,5 @@ object Settings {
|
||||
|
||||
def apply(inetAddress: InetAddress, host: String) = validator(inetAddress, host)
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,6 @@ import li.cil.oc.common.tileentity._
|
||||
import li.cil.oc.common.tileentity.traits._
|
||||
import li.cil.oc.util.Audio
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.util.PackedColor
|
||||
import net.minecraft.client.gui.GuiScreen
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
@ -281,15 +280,15 @@ object PacketHandler extends CommonPacketHandler {
|
||||
def onTextBufferCopy(p: PacketParser) {
|
||||
ComponentTracker.get(p.readUTF()) match {
|
||||
case Some(buffer: component.TextBuffer) =>
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
val tx = p.readInt()
|
||||
val ty = p.readInt()
|
||||
buffer.copy(col, row, w, h, tx, ty)
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
val tx = p.readInt()
|
||||
val ty = p.readInt()
|
||||
buffer.copy(col, row, w, h, tx, ty)
|
||||
case _ => // Invalid packet.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def onTextBufferDepthChange(p: PacketParser) {
|
||||
@ -303,14 +302,14 @@ object PacketHandler extends CommonPacketHandler {
|
||||
def onTextBufferFill(p: PacketParser) {
|
||||
ComponentTracker.get(p.readUTF()) match {
|
||||
case Some(buffer: component.TextBuffer) =>
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
val c = p.readChar()
|
||||
buffer.fill(col, row, w, h, c)
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
val c = p.readChar()
|
||||
buffer.fill(col, row, w, h, c)
|
||||
case _ => // Invalid packet.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def onTextBufferPaletteChange(p: PacketParser) {
|
||||
@ -333,23 +332,23 @@ object PacketHandler extends CommonPacketHandler {
|
||||
def onTextBufferResolutionChange(p: PacketParser) {
|
||||
ComponentTracker.get(p.readUTF()) match {
|
||||
case Some(buffer: component.TextBuffer) =>
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
val w = p.readInt()
|
||||
val h = p.readInt()
|
||||
buffer.setResolution(w, h)
|
||||
case _ => // Invalid packet.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def onTextBufferSet(p: PacketParser) {
|
||||
ComponentTracker.get(p.readUTF()) match {
|
||||
case Some(buffer: component.TextBuffer) =>
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val s = p.readUTF()
|
||||
val col = p.readInt()
|
||||
val row = p.readInt()
|
||||
val s = p.readUTF()
|
||||
val vertical = p.readBoolean()
|
||||
buffer.set(col, row, s, vertical)
|
||||
case _ => // Invalid packet.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def onServerPresence(p: PacketParser) =
|
||||
|
@ -272,7 +272,7 @@ class Robot(playerInventory: InventoryPlayer, val robot: tileentity.Robot) exten
|
||||
val slot = robot.selectedSlot - robot.actualSlot(0) - inventoryOffset * 4
|
||||
if (slot >= 0 && slot < 16) {
|
||||
RenderState.makeItBlend()
|
||||
Minecraft.getMinecraft.renderEngine.bindTexture(Textures.guiRobotSelection)
|
||||
Minecraft.getMinecraft.renderEngine.bindTexture(Textures.guiRobotSelection)
|
||||
val now = System.currentTimeMillis() / 1000.0
|
||||
val offsetV = ((now - now.toInt) * selectionsStates).toInt * selectionStepV
|
||||
val x = guiLeft + inventoryX - 1 + (slot % 4) * (selectionSize - 2)
|
||||
|
@ -20,83 +20,83 @@ object WirelessNetworkDebugRenderer {
|
||||
|
||||
val world = ObfuscationReflectionHelper.getPrivateValue(classOf[net.minecraft.client.renderer.RenderGlobal], e.context, "theWorld", "field_72769_h", "r").asInstanceOf[World]
|
||||
WirelessNetwork.dimensions.get(world.provider.dimensionId) match {
|
||||
case Some(tree) =>
|
||||
val mc = Minecraft.getMinecraft
|
||||
val player = mc.thePlayer
|
||||
val px = player.lastTickPosX + (player.posX - player.lastTickPosX) * e.partialTicks
|
||||
val py = player.lastTickPosY + (player.posY - player.lastTickPosY) * e.partialTicks
|
||||
val pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * e.partialTicks
|
||||
case Some(tree) =>
|
||||
val mc = Minecraft.getMinecraft
|
||||
val player = mc.thePlayer
|
||||
val px = player.lastTickPosX + (player.posX - player.lastTickPosX) * e.partialTicks
|
||||
val py = player.lastTickPosY + (player.posY - player.lastTickPosY) * e.partialTicks
|
||||
val pz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * e.partialTicks
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS)
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(-px, -py, -pz)
|
||||
RenderState.makeItBlend()
|
||||
GL11.glDisable(GL11.GL_LIGHTING)
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D)
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST)
|
||||
GL11.glDisable(GL11.GL_CULL_FACE)
|
||||
GL11.glPushMatrix()
|
||||
GL11.glTranslated(-px, -py, -pz)
|
||||
RenderState.makeItBlend()
|
||||
GL11.glDisable(GL11.GL_LIGHTING)
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D)
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST)
|
||||
GL11.glDisable(GL11.GL_CULL_FACE)
|
||||
|
||||
def drawBox(minX: Double, minY: Double, minZ: Double, maxX: Double, maxY: Double, maxZ: Double) {
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
}
|
||||
def drawBox(minX: Double, minY: Double, minZ: Double, maxX: Double, maxY: Double, maxZ: Double) {
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(minX, minY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, minZ)
|
||||
GL11.glVertex3d(minX, maxY, maxZ)
|
||||
GL11.glVertex3d(minX, minY, maxZ)
|
||||
GL11.glEnd()
|
||||
GL11.glBegin(GL11.GL_QUADS)
|
||||
GL11.glVertex3d(maxX, minY, minZ)
|
||||
GL11.glVertex3d(maxX, minY, maxZ)
|
||||
GL11.glVertex3d(maxX, maxY, maxZ)
|
||||
GL11.glVertex3d(maxX, maxY, minZ)
|
||||
GL11.glEnd()
|
||||
}
|
||||
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE)
|
||||
for (((min, max), level) <- tree.allBounds) {
|
||||
val (minX, minY, minZ) = min
|
||||
val (maxX, maxY, maxZ) = max
|
||||
val color = colors(level % colors.length)
|
||||
GL11.glColor4f(
|
||||
((color >> 16) & 0xFF) / 255f,
|
||||
((color >> 8) & 0xFF) / 255f,
|
||||
((color >> 0) & 0xFF) / 255f,
|
||||
0.25f)
|
||||
val size = 0.5 - level * 0.05
|
||||
drawBox(minX - size, minY - size, minZ - size, maxX + size, maxY + size, maxZ + size)
|
||||
}
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL)
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE)
|
||||
for (((min, max), level) <- tree.allBounds) {
|
||||
val (minX, minY, minZ) = min
|
||||
val (maxX, maxY, maxZ) = max
|
||||
val color = colors(level % colors.length)
|
||||
GL11.glColor4f(
|
||||
((color >> 16) & 0xFF) / 255f,
|
||||
((color >> 8) & 0xFF) / 255f,
|
||||
((color >> 0) & 0xFF) / 255f,
|
||||
0.25f)
|
||||
val size = 0.5 - level * 0.05
|
||||
drawBox(minX - size, minY - size, minZ - size, maxX + size, maxY + size, maxZ + size)
|
||||
}
|
||||
GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL)
|
||||
|
||||
GL11.glPopMatrix()
|
||||
GL11.glPopAttrib()
|
||||
case _ =>
|
||||
}
|
||||
GL11.glPopMatrix()
|
||||
GL11.glPopAttrib()
|
||||
case _ =>
|
||||
}
|
||||
|
||||
RenderState.checkError(getClass.getName + ".onRenderWorldLastEvent: leaving")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ object BlockRenderer extends ISimpleBlockRenderingHandler {
|
||||
Tessellator.instance.draw()
|
||||
|
||||
RenderState.checkError(getClass.getName + ".renderInventoryBlock: standard block")
|
||||
}
|
||||
}
|
||||
GL11.glPopMatrix()
|
||||
|
||||
RenderState.checkError(getClass.getName + ".renderInventoryBlock: leaving")
|
||||
|
@ -7,7 +7,6 @@ import li.cil.oc.{Settings, api}
|
||||
import net.minecraft.client.gui.ScaledResolution
|
||||
import net.minecraft.client.Minecraft
|
||||
import net.minecraft.client.renderer.entity.{RenderManager, RenderItem}
|
||||
import net.minecraft.client.renderer.Tessellator
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.{EnumChatFormatting, AxisAlignedBB}
|
||||
import net.minecraftforge.client.IItemRenderer
|
||||
|
@ -1,6 +1,5 @@
|
||||
package li.cil.oc.client.renderer.tileentity
|
||||
|
||||
import li.cil.oc.client.Textures
|
||||
import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.RenderState
|
||||
import net.minecraft.client.renderer.Tessellator
|
||||
|
@ -173,7 +173,7 @@ object ScreenRenderer extends TileEntitySpecialRenderer {
|
||||
screen.buffer.renderText()
|
||||
|
||||
RenderState.checkError(getClass.getName + ".draw: text")
|
||||
}
|
||||
}
|
||||
|
||||
private def playerDistanceSq() = {
|
||||
val player = Minecraft.getMinecraft.thePlayer
|
||||
|
@ -73,6 +73,7 @@ abstract class Hologram(val parent: SpecialDelegator) extends SpecialDelegate {
|
||||
}
|
||||
|
||||
object Hologram {
|
||||
|
||||
class Tier1(parent: SpecialDelegator) extends Hologram(parent) {
|
||||
def tier = 0
|
||||
}
|
||||
@ -80,4 +81,5 @@ object Hologram {
|
||||
class Tier2(parent: SpecialDelegator) extends Hologram(parent) {
|
||||
def tier = 1
|
||||
}
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import li.cil.oc.common.tileentity
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import li.cil.oc.{Items, Settings}
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.nbt.{NBTTagString, NBTTagCompound}
|
||||
import net.minecraft.nbt.NBTTagCompound
|
||||
import net.minecraftforge.common.util.Constants.NBT
|
||||
import scala.collection.mutable
|
||||
|
||||
@ -36,7 +36,7 @@ class Terminal(val rack: tileentity.Rack, val number: Int) {
|
||||
}
|
||||
})
|
||||
keyboard
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer.node != null) {
|
||||
buffer.node.asInstanceOf[Component].setVisibility(Visibility.Neighbors)
|
||||
|
@ -8,7 +8,7 @@ import li.cil.oc.Settings
|
||||
import li.cil.oc.util.{Rarity, ItemCosts}
|
||||
import net.minecraft.client.renderer.texture.IIconRegister
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.{EnumRarity, ItemStack}
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.util.IIcon
|
||||
import net.minecraft.util.StatCollector
|
||||
import net.minecraft.world.World
|
||||
|
@ -3,7 +3,6 @@ package li.cil.oc.common.tileentity
|
||||
import li.cil.oc.api.Driver
|
||||
import li.cil.oc.api.driver.Slot
|
||||
import li.cil.oc.api.network.{Analyzable, Component, Visibility}
|
||||
import li.cil.oc.common.EventHandler
|
||||
import li.cil.oc.common.Sound
|
||||
import li.cil.oc.{api, Settings}
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
|
@ -11,7 +11,7 @@ import li.cil.oc.common
|
||||
import li.cil.oc.server.{PacketSender => ServerPacketSender, driver, component}
|
||||
import li.cil.oc.util.ExtendedNBT._
|
||||
import li.cil.oc.util.mods.Waila
|
||||
import li.cil.oc.{api, Items, Settings}
|
||||
import li.cil.oc.{api, Settings}
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.minecraft.nbt.{NBTTagString, NBTTagCompound}
|
||||
|
@ -8,7 +8,6 @@ import li.cil.oc.common.{PacketHandler => CommonPacketHandler}
|
||||
import li.cil.oc.common.PacketType
|
||||
import li.cil.oc.common.multipart.EventHandler
|
||||
import li.cil.oc.common.tileentity._
|
||||
import li.cil.oc.common.tileentity.traits.TileEntity
|
||||
import li.cil.oc.common.{PacketHandler => CommonPacketHandler}
|
||||
import li.cil.oc.Settings
|
||||
import li.cil.oc.common.tileentity.traits.{Computer, TileEntity}
|
||||
|
@ -95,7 +95,7 @@ class OSAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
|
||||
val year = getField("year", -1)
|
||||
|
||||
GameTimeFormatter.mktime(year, mon, mday, hour, min, sec) match {
|
||||
case Some(time) =>lua.pushNumber(time)
|
||||
case Some(time) => lua.pushNumber(time)
|
||||
case _ => lua.pushNil()
|
||||
}
|
||||
}
|
||||
|
@ -116,19 +116,19 @@ class TextBuffer(var width: Int, var height: Int, initialFormat: PackedColor.Col
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (row < 0 || row >= height) false
|
||||
else {
|
||||
var changed = false
|
||||
val line = buffer(row)
|
||||
val lineColor = color(row)
|
||||
for (x <- col until math.min(col + s.length, width)) if (x >= 0) {
|
||||
val c = s(x - col)
|
||||
changed = changed || (line(x) != c) || (lineColor(x) != packed)
|
||||
line(x) = c
|
||||
lineColor(x) = packed
|
||||
if (row < 0 || row >= height) false
|
||||
else {
|
||||
var changed = false
|
||||
val line = buffer(row)
|
||||
val lineColor = color(row)
|
||||
for (x <- col until math.min(col + s.length, width)) if (x >= 0) {
|
||||
val c = s(x - col)
|
||||
changed = changed || (line(x) != c) || (lineColor(x) != packed)
|
||||
line(x) = c
|
||||
lineColor(x) = packed
|
||||
}
|
||||
changed
|
||||
}
|
||||
changed
|
||||
}
|
||||
}
|
||||
|
||||
/** Fills an area of the buffer with the specified character. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user