From f4258aa7197a765daa08c71a49bccad01417079f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 12 Nov 2014 11:08:13 +0100 Subject: [PATCH] Housekeeping (typos, formatting, ...) --- src/main/scala/li/cil/oc/client/Proxy.scala | 2 +- .../scala/li/cil/oc/client/Textures.scala | 2 +- .../oc/client/renderer/block/Assembler.scala | 4 +- ...Renderer.scala => AssemblerRenderer.scala} | 8 +-- .../li/cil/oc/common/block/Assembler.scala | 6 +-- .../li/cil/oc/common/component/package.scala | 2 + .../cofh/transport/DriverEnderEnergy.java | 4 +- .../cofh/transport/DriverEnderFluid.java | 4 +- .../cofh/transport/DriverEnderItem.java | 4 +- .../oc/integration/vanilla/DriverBeacon.java | 2 +- .../integration/vanilla/DriverInventory.java | 20 ++++---- .../vanilla/DriverRecordPlayer.java | 2 +- .../li/cil/oc/server/component/package.scala | 2 + .../li/cil/oc/util/ExtendedArguments.scala | 2 +- .../li/cil/oc/util/ExtendedLuaState.scala | 2 +- .../scala/li/cil/oc/util/ExtendedNBT.scala | 50 +++++++++---------- .../scala/li/cil/oc/util/ExtendedWorld.scala | 6 ++- src/main/scala/li/cil/oc/util/RTree.scala | 2 +- .../scala/li/cil/oc/util/ScalaClosure.scala | 4 +- 19 files changed, 67 insertions(+), 61 deletions(-) rename src/main/scala/li/cil/oc/client/renderer/tileentity/{RobotAssemblerRenderer.scala => AssemblerRenderer.scala} (90%) diff --git a/src/main/scala/li/cil/oc/client/Proxy.scala b/src/main/scala/li/cil/oc/client/Proxy.scala index d04b36501..b727dd4a9 100644 --- a/src/main/scala/li/cil/oc/client/Proxy.scala +++ b/src/main/scala/li/cil/oc/client/Proxy.scala @@ -55,7 +55,7 @@ private[oc] class Proxy extends CommonProxy { ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Hologram], HologramRenderer) ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.PowerDistributor], PowerDistributorRenderer) ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.ServerRack], ServerRackRenderer) - ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Assembler], RobotAssemblerRenderer) + ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Assembler], AssemblerRenderer) ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.Switch], SwitchRenderer) ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.AccessPoint], SwitchRenderer) ClientRegistry.bindTileEntitySpecialRenderer(classOf[tileentity.RobotProxy], RobotRenderer) diff --git a/src/main/scala/li/cil/oc/client/Textures.scala b/src/main/scala/li/cil/oc/client/Textures.scala index 95f0e9066..d1a59cf00 100644 --- a/src/main/scala/li/cil/oc/client/Textures.scala +++ b/src/main/scala/li/cil/oc/client/Textures.scala @@ -72,7 +72,7 @@ object Textures { val icons = Array.fill[IIcon](6)(null) } - object RobotAssembler { + object Assembler { var iconSideAssembling: IIcon = _ var iconSideOn: IIcon = _ var iconTopOn: IIcon = _ diff --git a/src/main/scala/li/cil/oc/client/renderer/block/Assembler.scala b/src/main/scala/li/cil/oc/client/renderer/block/Assembler.scala index 70af9cdeb..c2509c521 100644 --- a/src/main/scala/li/cil/oc/client/renderer/block/Assembler.scala +++ b/src/main/scala/li/cil/oc/client/renderer/block/Assembler.scala @@ -57,11 +57,11 @@ object Assembler { RenderState.makeItBlend() RenderState.disableLighting() - renderer.setOverrideBlockTexture(Textures.RobotAssembler.iconTopOn) + renderer.setOverrideBlockTexture(Textures.Assembler.iconTopOn) renderer.setRenderBounds(0, 0, 0, 1, 1.05, 1) BlockRenderer.renderFaceYPos(block, metadata, renderer) - renderer.setOverrideBlockTexture(Textures.RobotAssembler.iconSideOn) + renderer.setOverrideBlockTexture(Textures.Assembler.iconSideOn) renderer.setRenderBounds(-0.005, 0, 0, 1.005, 1, 1) BlockRenderer.renderFaceXPos(block, metadata, renderer) BlockRenderer.renderFaceXNeg(block, metadata, renderer) diff --git a/src/main/scala/li/cil/oc/client/renderer/tileentity/RobotAssemblerRenderer.scala b/src/main/scala/li/cil/oc/client/renderer/tileentity/AssemblerRenderer.scala similarity index 90% rename from src/main/scala/li/cil/oc/client/renderer/tileentity/RobotAssemblerRenderer.scala rename to src/main/scala/li/cil/oc/client/renderer/tileentity/AssemblerRenderer.scala index e7a00094e..1acd25e0b 100644 --- a/src/main/scala/li/cil/oc/client/renderer/tileentity/RobotAssemblerRenderer.scala +++ b/src/main/scala/li/cil/oc/client/renderer/tileentity/AssemblerRenderer.scala @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer import net.minecraft.tileentity.TileEntity import org.lwjgl.opengl.GL11 -object RobotAssemblerRenderer extends TileEntitySpecialRenderer { +object AssemblerRenderer extends TileEntitySpecialRenderer { override def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float) { RenderState.checkError(getClass.getName + ".renderTileEntityAt: entering (aka: wasntme)") @@ -29,7 +29,7 @@ object RobotAssemblerRenderer extends TileEntitySpecialRenderer { t.startDrawingQuads() { - val icon = Textures.RobotAssembler.iconTopOn + val icon = Textures.Assembler.iconTopOn t.addVertexWithUV(-0.5, 0.55, 0.5, icon.getMinU, icon.getMaxV) t.addVertexWithUV(0.5, 0.55, 0.5, icon.getMaxU, icon.getMaxV) t.addVertexWithUV(0.5, 0.55, -0.5, icon.getMaxU, icon.getMinV) @@ -43,7 +43,7 @@ object RobotAssemblerRenderer extends TileEntitySpecialRenderer { t.startDrawingQuads() if (assembler.isAssembling) { - val icon = Textures.RobotAssembler.iconSideAssembling + val icon = Textures.Assembler.iconSideAssembling t.addVertexWithUV(indent, 0.5, -indent, icon.getInterpolatedU((0.5 - indent) * 16), icon.getMaxV) t.addVertexWithUV(indent, 0.5, indent, icon.getInterpolatedU((0.5 + indent) * 16), icon.getMaxV) t.addVertexWithUV(indent, -0.5, indent, icon.getInterpolatedU((0.5 + indent) * 16), icon.getMinV) @@ -51,7 +51,7 @@ object RobotAssemblerRenderer extends TileEntitySpecialRenderer { } { - val icon = Textures.RobotAssembler.iconSideOn + val icon = Textures.Assembler.iconSideOn t.addVertexWithUV(0.5005, 0.5, -0.5, icon.getMinU, icon.getMaxV) t.addVertexWithUV(0.5005, 0.5, 0.5, icon.getMaxU, icon.getMaxV) t.addVertexWithUV(0.5005, -0.5, 0.5, icon.getMaxU, icon.getMinV) diff --git a/src/main/scala/li/cil/oc/common/block/Assembler.scala b/src/main/scala/li/cil/oc/common/block/Assembler.scala index 639ae90bf..53bf957d9 100644 --- a/src/main/scala/li/cil/oc/common/block/Assembler.scala +++ b/src/main/scala/li/cil/oc/common/block/Assembler.scala @@ -25,9 +25,9 @@ class Assembler extends SimpleBlock with traits.SpecialBlock with traits.PowerAc override def registerBlockIcons(iconRegister: IIconRegister) = { super.registerBlockIcons(iconRegister) - Textures.RobotAssembler.iconSideAssembling = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerSideAssembling") - Textures.RobotAssembler.iconSideOn = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerSideOn") - Textures.RobotAssembler.iconTopOn = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerTopOn") + Textures.Assembler.iconSideAssembling = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerSideAssembling") + Textures.Assembler.iconSideOn = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerSideOn") + Textures.Assembler.iconTopOn = iconRegister.registerIcon(Settings.resourceDomain + ":AssemblerTopOn") } override def isBlockSolid(world: IBlockAccess, x: Int, y: Int, z: Int, side: ForgeDirection) = side == ForgeDirection.DOWN || side == ForgeDirection.UP diff --git a/src/main/scala/li/cil/oc/common/component/package.scala b/src/main/scala/li/cil/oc/common/component/package.scala index a03922fe7..9e546da59 100644 --- a/src/main/scala/li/cil/oc/common/component/package.scala +++ b/src/main/scala/li/cil/oc/common/component/package.scala @@ -1,5 +1,7 @@ package li.cil.oc.common +import scala.language.implicitConversions + package object component { implicit def result(args: Any*): Array[AnyRef] = li.cil.oc.util.ResultWrapper.result(args: _*) } diff --git a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderEnergy.java b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderEnergy.java index b582d20f4..4c704bdfe 100644 --- a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderEnergy.java +++ b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderEnergy.java @@ -25,12 +25,12 @@ public final class DriverEnderEnergy extends DriverTileEntity { super(tileEntity, "ender_energy"); } - @Callback(doc = "function():boolean -- Returns whether the tileentity can receive energy.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can receive energy.") public Object[] canReceiveEnergy(final Context context, final Arguments args) { return new Object[]{tileEntity.canReceiveEnergy()}; } - @Callback(doc = "function():boolean -- Returns whether the tileentity can send energy.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can send energy.") public Object[] canSendEnergy(final Context context, final Arguments args) { return new Object[]{tileEntity.canSendEnergy()}; } diff --git a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderFluid.java b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderFluid.java index 885082460..a38f0da5d 100644 --- a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderFluid.java +++ b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderFluid.java @@ -25,12 +25,12 @@ public final class DriverEnderFluid extends DriverTileEntity { super(tileEntity, "ender_fluid"); } - @Callback(doc = "function():boolean -- Returns whether the tileentity can receive fluids.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can receive fluids.") public Object[] canReceiveFluid(final Context context, final Arguments args) { return new Object[]{tileEntity.canReceiveFluid()}; } - @Callback(doc = "function():boolean -- Returns whether the tileentity can send fluids.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can send fluids.") public Object[] canSendFluid(final Context context, final Arguments args) { return new Object[]{tileEntity.canSendFluid()}; } diff --git a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderItem.java b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderItem.java index 524f347d4..5115dc064 100644 --- a/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderItem.java +++ b/src/main/scala/li/cil/oc/integration/cofh/transport/DriverEnderItem.java @@ -25,12 +25,12 @@ public final class DriverEnderItem extends DriverTileEntity { super(tileEntity, "ender_item"); } - @Callback(doc = "function():boolean -- Returns whether the tileentity can receive items.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can receive items.") public Object[] canReceiveItems(final Context context, final Arguments args) { return new Object[]{tileEntity.canReceiveItems()}; } - @Callback(doc = "function():boolean -- Returns whether the tileentity can send items.") + @Callback(doc = "function():boolean -- Returns whether the tile entity can send items.") public Object[] canSendItems(final Context context, final Arguments args) { return new Object[]{tileEntity.canSendItems()}; } diff --git a/src/main/scala/li/cil/oc/integration/vanilla/DriverBeacon.java b/src/main/scala/li/cil/oc/integration/vanilla/DriverBeacon.java index e53d1d7af..60cb6aa69 100644 --- a/src/main/scala/li/cil/oc/integration/vanilla/DriverBeacon.java +++ b/src/main/scala/li/cil/oc/integration/vanilla/DriverBeacon.java @@ -59,7 +59,7 @@ public final class DriverBeacon extends DriverTileEntity implements EnvironmentA } @Callback(doc = "function():string -- Get the name of the active secondary effect.") - public Object[] getSecondayEffect(final Context context, final Arguments args) { + public Object[] getSecondaryEffect(final Context context, final Arguments args) { return new Object[]{getEffectName(tileEntity.getSecondaryEffect())}; } } diff --git a/src/main/scala/li/cil/oc/integration/vanilla/DriverInventory.java b/src/main/scala/li/cil/oc/integration/vanilla/DriverInventory.java index 6af06ce0e..4431fc8b6 100644 --- a/src/main/scala/li/cil/oc/integration/vanilla/DriverInventory.java +++ b/src/main/scala/li/cil/oc/integration/vanilla/DriverInventory.java @@ -39,19 +39,19 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function():string -- Get the name of this inventory.") public Object[] getInventoryName(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; return new Object[]{tileEntity.getInventoryName()}; } @Callback(doc = "function():number -- Get the number of slots in this inventory.") public Object[] getInventorySize(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; return new Object[]{tileEntity.getSizeInventory()}; } @Callback(doc = "function(slot:number):number -- Get the stack size of the item stack in the specified slot.") public Object[] getSlotStackSize(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; final int slot = checkSlot(args, 0); final ItemStack stack = tileEntity.getStackInSlot(slot); if (stack != null) { @@ -63,7 +63,7 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function(slot:number):number -- Get the maximum stack size of the item stack in the specified slot.") public Object[] getSlotMaxStackSize(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; final int slot = checkSlot(args, 0); final ItemStack stack = tileEntity.getStackInSlot(slot); if (stack != null) { @@ -75,7 +75,7 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function(slotA:number, slotB:number):boolean -- Compare the two item stacks in the specified slots for equality.") public Object[] compareStacks(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; final int slotA = checkSlot(args, 0); final int slotB = checkSlot(args, 1); if (slotA == slotB) { @@ -94,7 +94,7 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function(slotA:number, slotB:number[, count:number=math.huge]):boolean -- Move up to the specified number of items from the first specified slot to the second.") public Object[] transferStack(final Context context, final Arguments args) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; final int slotA = checkSlot(args, 0); final int slotB = checkSlot(args, 1); final int count = Math.max(0, Math.min(args.count() > 2 && args.checkAny(2) != null ? args.checkInteger(2) : 64, tileEntity.getInventoryStackLimit())); @@ -137,7 +137,7 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function(slot:number):table -- Get a description of the item stack in the specified slot.") public Object[] getStackInSlot(final Context context, final Arguments args) { if (Settings.get().allowItemStackInspection()) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; return new Object[]{tileEntity.getStackInSlot(checkSlot(args, 0))}; } else { return new Object[]{null, "not enabled in config"}; @@ -147,7 +147,7 @@ public final class DriverInventory extends DriverTileEntity { @Callback(doc = "function():table -- Get a list of descriptions for all item stacks in this inventory.") public Object[] getAllStacks(final Context context, final Arguments args) { if (Settings.get().allowItemStackInspection()) { - if (!checkPermission()) return new Object[]{null, "permission denied"}; + if (notPermitted()) return new Object[]{null, "permission denied"}; ItemStack[] allStacks = new ItemStack[tileEntity.getSizeInventory()]; for (int i = 0; i < tileEntity.getSizeInventory(); i++) { allStacks[i] = tileEntity.getStackInSlot(i); @@ -170,10 +170,10 @@ public final class DriverInventory extends DriverTileEntity { return stackA.getItem().equals(stackB.getItem()) && !stackA.getHasSubtypes() || stackA.getItemDamage() == stackB.getItemDamage(); } - private boolean checkPermission() { + private boolean notPermitted() { synchronized (fakePlayer) { fakePlayer.setPosition(position.xCoord, position.yCoord, position.zCoord); - return tileEntity.isUseableByPlayer(fakePlayer); + return !tileEntity.isUseableByPlayer(fakePlayer); } } } diff --git a/src/main/scala/li/cil/oc/integration/vanilla/DriverRecordPlayer.java b/src/main/scala/li/cil/oc/integration/vanilla/DriverRecordPlayer.java index 275011fd2..f058ac891 100644 --- a/src/main/scala/li/cil/oc/integration/vanilla/DriverRecordPlayer.java +++ b/src/main/scala/li/cil/oc/integration/vanilla/DriverRecordPlayer.java @@ -48,7 +48,7 @@ public final class DriverRecordPlayer extends DriverTileEntity implements Enviro return 0; } - @Callback(doc = "function():string -- Get the title of the record currently in the juke box.") + @Callback(doc = "function():string -- Get the title of the record currently in the jukebox.") public Object[] getRecord(final Context context, final Arguments args) { final ItemStack record = tileEntity.func_145856_a(); if (record == null || !(record.getItem() instanceof ItemRecord)) { diff --git a/src/main/scala/li/cil/oc/server/component/package.scala b/src/main/scala/li/cil/oc/server/component/package.scala index 7c13f729b..2cb46e931 100644 --- a/src/main/scala/li/cil/oc/server/component/package.scala +++ b/src/main/scala/li/cil/oc/server/component/package.scala @@ -1,5 +1,7 @@ package li.cil.oc.server +import scala.language.implicitConversions + package object component { implicit def result(args: Any*): Array[AnyRef] = li.cil.oc.util.ResultWrapper.result(args: _*) } diff --git a/src/main/scala/li/cil/oc/util/ExtendedArguments.scala b/src/main/scala/li/cil/oc/util/ExtendedArguments.scala index 71b9e3f62..5889618cf 100644 --- a/src/main/scala/li/cil/oc/util/ExtendedArguments.scala +++ b/src/main/scala/li/cil/oc/util/ExtendedArguments.scala @@ -9,7 +9,7 @@ import scala.language.implicitConversions object ExtendedArguments { - implicit def extendedArguments(args: Arguments) = new ExtendedArguments(args) + implicit def extendedArguments(args: Arguments): ExtendedArguments = new ExtendedArguments(args) class ExtendedArguments(val args: Arguments) { def optionalItemCount(n: Int) = diff --git a/src/main/scala/li/cil/oc/util/ExtendedLuaState.scala b/src/main/scala/li/cil/oc/util/ExtendedLuaState.scala index 2a4ae85ac..2a1ab719b 100644 --- a/src/main/scala/li/cil/oc/util/ExtendedLuaState.scala +++ b/src/main/scala/li/cil/oc/util/ExtendedLuaState.scala @@ -17,7 +17,7 @@ import scala.runtime.BoxedUnit object ExtendedLuaState { - implicit def extendLuaState(state: LuaState) = new ExtendedLuaState(state) + implicit def extendLuaState(state: LuaState): ExtendedLuaState = new ExtendedLuaState(state) class ExtendedLuaState(val lua: LuaState) { def pushScalaFunction(f: (LuaState) => Int) = lua.pushJavaFunction(new JavaFunction { diff --git a/src/main/scala/li/cil/oc/util/ExtendedNBT.scala b/src/main/scala/li/cil/oc/util/ExtendedNBT.scala index c5a79aa79..78a2b6755 100644 --- a/src/main/scala/li/cil/oc/util/ExtendedNBT.scala +++ b/src/main/scala/li/cil/oc/util/ExtendedNBT.scala @@ -3,35 +3,35 @@ package li.cil.oc.util import net.minecraft.item.ItemStack import net.minecraft.nbt._ -import scala.language.implicitConversions +import scala.language.{implicitConversions, reflectiveCalls} object ExtendedNBT { - implicit def toNbt(value: Byte) = new NBTTagByte(value) + implicit def toNbt(value: Byte): NBTTagByte = new NBTTagByte(value) - implicit def toNbt(value: Short) = new NBTTagShort(value) + implicit def toNbt(value: Short): NBTTagShort = new NBTTagShort(value) - implicit def toNbt(value: Int) = new NBTTagInt(value) + implicit def toNbt(value: Int): NBTTagInt = new NBTTagInt(value) - implicit def toNbt(value: Array[Int]) = new NBTTagIntArray(value) + implicit def toNbt(value: Array[Int]): NBTTagIntArray = new NBTTagIntArray(value) - implicit def toNbt(value: Long) = new NBTTagLong(value) + implicit def toNbt(value: Long): NBTTagLong = new NBTTagLong(value) - implicit def toNbt(value: Float) = new NBTTagFloat(value) + implicit def toNbt(value: Float): NBTTagFloat = new NBTTagFloat(value) - implicit def toNbt(value: Double) = new NBTTagDouble(value) + implicit def toNbt(value: Double): NBTTagDouble = new NBTTagDouble(value) - implicit def toNbt(value: Array[Byte]) = new NBTTagByteArray(value) + implicit def toNbt(value: Array[Byte]): NBTTagByteArray = new NBTTagByteArray(value) - implicit def toNbt(value: String) = new NBTTagString(value) + implicit def toNbt(value: String): NBTTagString = new NBTTagString(value) - implicit def toNbt(value: {def writeToNBT(nbt: NBTTagCompound): Unit}) = { + implicit def toNbt(value: {def writeToNBT(nbt: NBTTagCompound): Unit}): NBTTagCompound = { val nbt = new NBTTagCompound() value.writeToNBT(nbt) nbt } - implicit def toNbt(value: ItemStack) = { + implicit def toNbt(value: ItemStack): NBTTagCompound = { val nbt = new NBTTagCompound() if (value != null) { value.writeToNBT(nbt) @@ -57,31 +57,31 @@ object ExtendedNBT { nbt } - implicit def byteIterableToNbt(value: Iterable[Byte]) = value.map(toNbt) + implicit def byteIterableToNbt(value: Iterable[Byte]): Iterable[NBTTagByte] = value.map(toNbt) - implicit def shortIterableToNbt(value: Iterable[Short]) = value.map(toNbt) + implicit def shortIterableToNbt(value: Iterable[Short]): Iterable[NBTTagShort] = value.map(toNbt) - implicit def intIterableToNbt(value: Iterable[Int]) = value.map(toNbt) + implicit def intIterableToNbt(value: Iterable[Int]): Iterable[NBTTagInt] = value.map(toNbt) - implicit def intArrayIterableToNbt(value: Iterable[Array[Int]]) = value.map(toNbt) + implicit def intArrayIterableToNbt(value: Iterable[Array[Int]]): Iterable[NBTTagIntArray] = value.map(toNbt) - implicit def longIterableToNbt(value: Iterable[Long]) = value.map(toNbt) + implicit def longIterableToNbt(value: Iterable[Long]): Iterable[NBTTagLong] = value.map(toNbt) - implicit def floatIterableToNbt(value: Iterable[Float]) = value.map(toNbt) + implicit def floatIterableToNbt(value: Iterable[Float]): Iterable[NBTTagFloat] = value.map(toNbt) - implicit def doubleIterableToNbt(value: Iterable[Double]) = value.map(toNbt) + implicit def doubleIterableToNbt(value: Iterable[Double]): Iterable[NBTTagDouble] = value.map(toNbt) - implicit def byteArrayIterableToNbt(value: Iterable[Array[Byte]]) = value.map(toNbt) + implicit def byteArrayIterableToNbt(value: Iterable[Array[Byte]]): Iterable[NBTTagByteArray] = value.map(toNbt) - implicit def stringIterableToNbt(value: Iterable[String]) = value.map(toNbt) + implicit def stringIterableToNbt(value: Iterable[String]): Iterable[NBTTagString] = value.map(toNbt) - implicit def writableIterableToNbt(value: Iterable[ {def writeToNBT(nbt: NBTTagCompound): Unit}]) = value.map(toNbt) + implicit def writableIterableToNbt(value: Iterable[ {def writeToNBT(nbt: NBTTagCompound): Unit}]): Iterable[NBTTagCompound] = value.map(toNbt) - implicit def itemStackIterableToNbt(value: Iterable[ItemStack]) = value.map(toNbt) + implicit def itemStackIterableToNbt(value: Iterable[ItemStack]): Iterable[NBTTagCompound] = value.map(toNbt) - implicit def extendNBTTagCompound(nbt: NBTTagCompound) = new ExtendedNBTTagCompound(nbt) + implicit def extendNBTTagCompound(nbt: NBTTagCompound): ExtendedNBTTagCompound = new ExtendedNBTTagCompound(nbt) - implicit def extendNBTTagList(nbt: NBTTagList) = new ExtendedNBTTagList(nbt) + implicit def extendNBTTagList(nbt: NBTTagList): ExtendedNBTTagList = new ExtendedNBTTagList(nbt) class ExtendedNBTTagCompound(val nbt: NBTTagCompound) { def setNewCompoundTag(name: String, f: (NBTTagCompound) => Any) = { diff --git a/src/main/scala/li/cil/oc/util/ExtendedWorld.scala b/src/main/scala/li/cil/oc/util/ExtendedWorld.scala index fdea888c9..9eb935250 100644 --- a/src/main/scala/li/cil/oc/util/ExtendedWorld.scala +++ b/src/main/scala/li/cil/oc/util/ExtendedWorld.scala @@ -5,11 +5,13 @@ import net.minecraft.tileentity.TileEntity import net.minecraft.world.IBlockAccess import net.minecraft.world.World +import scala.language.implicitConversions + object ExtendedWorld { - implicit def extendedBlockAccess(world: IBlockAccess) = new ExtendedBlockAccess(world) + implicit def extendedBlockAccess(world: IBlockAccess): ExtendedBlockAccess = new ExtendedBlockAccess(world) - implicit def extendedWorld(world: World) = new ExtendedWorld(world) + implicit def extendedWorld(world: World): ExtendedWorld = new ExtendedWorld(world) class ExtendedBlockAccess(val world: IBlockAccess) { def getBlock(position: BlockPosition) = world.getBlock(position.x, position.y, position.z) diff --git a/src/main/scala/li/cil/oc/util/RTree.scala b/src/main/scala/li/cil/oc/util/RTree.scala index 50e9d003f..ca865b711 100644 --- a/src/main/scala/li/cil/oc/util/RTree.scala +++ b/src/main/scala/li/cil/oc/util/RTree.scala @@ -197,7 +197,7 @@ class RTree[Data](private val M: Int)(implicit val coordinate: Data => (Double, val list = mutable.Set.empty ++ values list -= s1 list -= s2 - while (!list.isEmpty) { + while (list.nonEmpty) { if (m - r1.set.size >= list.size) { list.foreach(r1.add) list.clear() diff --git a/src/main/scala/li/cil/oc/util/ScalaClosure.scala b/src/main/scala/li/cil/oc/util/ScalaClosure.scala index 3a3d8544c..ce157b358 100644 --- a/src/main/scala/li/cil/oc/util/ScalaClosure.scala +++ b/src/main/scala/li/cil/oc/util/ScalaClosure.scala @@ -18,13 +18,13 @@ class ScalaClosure(val f: (Varargs) => Varargs) extends VarArgFunction { } object ScalaClosure { - implicit def wrapClosure(f: (Varargs) => LuaValue) = new ScalaClosure(args => f(args) match { + implicit def wrapClosure(f: (Varargs) => LuaValue): ScalaClosure = new ScalaClosure(args => f(args) match { case varargs: Varargs => varargs case LuaValue.NONE => LuaValue.NONE case result => LuaValue.varargsOf(Array(result)) }) - implicit def wrapVarArgClosure(f: (Varargs) => Varargs) = new ScalaClosure(f) + implicit def wrapVarArgClosure(f: (Varargs) => Varargs): ScalaClosure = new ScalaClosure(f) def toLuaValue(value: Any): LuaValue = { (value match {