diff --git a/codechicken/microblock/BlockMicroMaterial.scala b/codechicken/microblock/BlockMicroMaterial.scala index 0b7ec4c..d5fbe0d 100644 --- a/codechicken/microblock/BlockMicroMaterial.scala +++ b/codechicken/microblock/BlockMicroMaterial.scala @@ -3,15 +3,12 @@ package codechicken.microblock import net.minecraft.block.Block import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial import net.minecraft.util.Icon -import codechicken.lib.vec.Cuboid6 import codechicken.lib.lighting.LC import codechicken.lib.lighting.LightMatrix import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side import codechicken.lib.render.MultiIconTransformation import codechicken.lib.render.IUVTransformation -import codechicken.microblock.MicroblockClassRegistry._ -import net.minecraft.item.Item import net.minecraft.item.ItemStack import codechicken.lib.vec.Vector3 import net.minecraft.entity.player.EntityPlayer @@ -20,9 +17,7 @@ import codechicken.lib.render.UV import net.minecraft.client.renderer.Tessellator import codechicken.lib.render.CCRenderState import codechicken.lib.vec.Rotation -import net.minecraft.tileentity.TileEntity import net.minecraftforge.common.MinecraftForge -import net.minecraft.client.renderer.RenderBlocks import codechicken.microblock.handler.MicroblockProxy /** @@ -36,7 +31,7 @@ class BlockMicroMaterial(val block:Block, val meta:Int = 0) extends IMicroMateri @SideOnly(Side.CLIENT) override def loadIcons() { - var iblock = Block.blocksList(block.blockID)//Reacquire the block instance incase a mod replaced it. + val iblock = Block.blocksList(block.blockID)//Reacquire the block instance incase a mod replaced it. val icons = new Array[Icon](6) if(iblock == null) diff --git a/codechicken/microblock/CommonMicroblock.scala b/codechicken/microblock/CommonMicroblock.scala index 443e455..1987014 100644 --- a/codechicken/microblock/CommonMicroblock.scala +++ b/codechicken/microblock/CommonMicroblock.scala @@ -2,7 +2,6 @@ package codechicken.microblock import net.minecraft.nbt.NBTTagCompound import codechicken.lib.lighting.LightMatrix -import codechicken.lib.packet.PacketCustom import codechicken.microblock.MicroMaterialRegistry._ import codechicken.lib.vec.BlockCoord import org.lwjgl.opengl.GL11 @@ -18,12 +17,9 @@ import codechicken.multipart.TCuboidPart import net.minecraft.util.MovingObjectPosition import net.minecraft.entity.player.EntityPlayer import codechicken.multipart.JPartialOcclusion -import codechicken.lib.vec.Rotation -import codechicken.multipart.TileMultipart import codechicken.lib.render.Vertex5 import net.minecraft.item.ItemStack import scala.collection.mutable.ListBuffer -import codechicken.multipart.TMultiPart import codechicken.lib.data.MCDataOutput import codechicken.lib.data.MCDataInput import codechicken.lib.render.RenderUtils @@ -48,7 +44,7 @@ object CommonMicroblock GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA) CCRenderState.reset() - TextureUtils.bindAtlas(0); + TextureUtils.bindAtlas(0) CCRenderState.useNormals(true) CCRenderState.setBrightness(world, pos.x, pos.y, pos.z) CCRenderState.setAlpha(80) @@ -81,9 +77,7 @@ object JMicroblockClient trait MicroblockClient extends Microblock with TIconHitEffects with IMicroMaterialRender { -import CommonMicroblock._ - - def getBrokenIcon(side:Int):Icon = + def getBrokenIcon(side:Int):Icon = { val mat = MicroMaterialRegistry.getMaterial(material) if(mat != null) @@ -122,13 +116,13 @@ abstract class Microblock(var shape:Byte = 0, var material:Int = 0) extends TCub def itemClassID:Int = -1 - override def getDrops() = + override def getDrops = { var size = getSize val items = ListBuffer[ItemStack]() for(s <- Seq(4, 2, 1)) { - var m = size/s + val m = size/s size-=m*s if(m > 0) items+=ItemMicroPart.create(m, s|itemClassID<<8, MicroMaterialRegistry.materialName(material)) @@ -199,7 +193,7 @@ trait CommonMicroblockClient extends CommonMicroblock with MicroblockClient with abstract class CommonMicroblock(shape$:Byte = 0, material$:Int = 0) extends Microblock(shape$, material$) with JPartialOcclusion with TMicroOcclusion with TSlottedPart { - def microClass():MicroblockClass + def microClass:MicroblockClass def getType = microClass.getName diff --git a/codechicken/microblock/ConfigContent.scala b/codechicken/microblock/ConfigContent.scala index 311852f..2c0ce57 100644 --- a/codechicken/microblock/ConfigContent.scala +++ b/codechicken/microblock/ConfigContent.scala @@ -59,7 +59,7 @@ object ConfigContent if(split1(0) == "") return - var split2 = split1(1).split(",") + val split2 = split1(1).split(",") val meta = split2.flatMap{s => if(s.contains("-")) { @@ -104,10 +104,9 @@ object ConfigContent } catch { - case e:Exception => { + case e:Exception => System.err.println("Invalid line in microblocks.cfg: "+s) System.err.println(e.getMessage) - } } } } @@ -129,7 +128,7 @@ object ConfigContent } else if(block != null) { - val name = block.getUnlocalizedName() + val name = block.getUnlocalizedName val value = nameMap.get(name) if(value.isDefined) { @@ -141,10 +140,9 @@ object ConfigContent catch { case e:IllegalStateException => System.err.println("Unable to register micro material: "+ materialKey(block, m)+"\n\t"+e.getMessage) - case e:Exception => { + case e:Exception => System.err.println("Unable to register micro material: "+materialKey(block, m)) e.printStackTrace() - } } } } diff --git a/codechicken/microblock/EdgeMicroblock.scala b/codechicken/microblock/EdgeMicroblock.scala index 03a7c0d..cd6ce85 100644 --- a/codechicken/microblock/EdgeMicroblock.scala +++ b/codechicken/microblock/EdgeMicroblock.scala @@ -11,13 +11,10 @@ import Rotation._ import codechicken.multipart.TMultiPart import codechicken.multipart.TNormalOcclusion import codechicken.multipart.JPartialOcclusion -import codechicken.multipart.NormalOcclusionTest import codechicken.multipart.TileMultipart import codechicken.multipart.MultiPartRegistry import codechicken.lib.lighting.LazyLightMatrix import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial -import cpw.mods.fml.relauncher.SideOnly -import cpw.mods.fml.relauncher.Side import codechicken.lib.raytracer.ExtendedMOP import codechicken.multipart.TEdgePart import scala.collection.JavaConversions._ @@ -36,7 +33,7 @@ object EdgePlacement extends PlacementProperties if(slot < 0)//custom placement return slot val e = slot-15 - return 15+(packEdgeBits(e, unpackEdgeBits(e)^(1<<(side>>1)))) + return 15+ packEdgeBits(e, unpackEdgeBits(e)^(1<<(side>>1))) } override def customPlacement(pmt:MicroblockPlacement):ExecutablePlacement = diff --git a/codechicken/microblock/FaceMicroblock.scala b/codechicken/microblock/FaceMicroblock.scala index 7b3682a..ec4a234 100644 --- a/codechicken/microblock/FaceMicroblock.scala +++ b/codechicken/microblock/FaceMicroblock.scala @@ -1,29 +1,10 @@ package codechicken.microblock -import codechicken.lib.packet.PacketCustom -import net.minecraft.nbt.NBTTagCompound -import net.minecraft.util.MovingObjectPosition -import net.minecraft.item.ItemStack import codechicken.lib.vec.Cuboid6 -import net.minecraft.entity.player.EntityPlayer -import codechicken.multipart.TCuboidPart import codechicken.multipart.TFacePart import codechicken.lib.vec.Vector3 import codechicken.lib.vec.Rotation -import codechicken.multipart.PartMap -import cpw.mods.fml.relauncher.SideOnly -import cpw.mods.fml.relauncher.Side -import codechicken.lib.lighting.CCRBModel -import net.minecraft.world.World -import codechicken.lib.vec.BlockCoord -import codechicken.multipart.MultipartRenderer -import codechicken.lib.render.CCModel -import codechicken.multipart.TileMultipart import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial -import net.minecraft.block.Block -import scala.collection.immutable.Vector -import scala.collection.mutable.ListBuffer -import codechicken.multipart.BlockMultipart import codechicken.lib.lighting.LazyLightMatrix import Rotation._ import Vector3._ @@ -43,7 +24,7 @@ object FacePlacement extends PlacementProperties object FaceMicroClass extends MicroblockClass { - var aBounds:Array[Cuboid6] = new Array(256); + var aBounds:Array[Cuboid6] = new Array(256) for(s <- 0 until 6) { diff --git a/codechicken/microblock/GrassMicroMaterial.scala b/codechicken/microblock/GrassMicroMaterial.scala index 8eacb6f..01b806c 100644 --- a/codechicken/microblock/GrassMicroMaterial.scala +++ b/codechicken/microblock/GrassMicroMaterial.scala @@ -1,9 +1,6 @@ package codechicken.microblock -import net.minecraft.util.Icon import codechicken.lib.vec.Vector3 -import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial -import net.minecraft.entity.player.EntityPlayer import net.minecraft.block.Block import codechicken.lib.render.Vertex5 import codechicken.lib.render.IconTransformation diff --git a/codechicken/microblock/HollowMicroblock.scala b/codechicken/microblock/HollowMicroblock.scala index b6c6c40..33cae4e 100644 --- a/codechicken/microblock/HollowMicroblock.scala +++ b/codechicken/microblock/HollowMicroblock.scala @@ -1,10 +1,8 @@ package codechicken.microblock -import net.minecraft.world.World import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.MovingObjectPosition import codechicken.multipart.TFacePart -import codechicken.lib.vec.BlockCoord import codechicken.lib.vec.Cuboid6 import codechicken.lib.vec.Rotation import codechicken.lib.vec.Vector3 @@ -20,7 +18,6 @@ import Rotation._ import Vector3._ import codechicken.lib.raytracer.IndexedCuboid6 import org.lwjgl.opengl.GL11 -import codechicken.multipart.TMultiPart object HollowPlacement extends PlacementProperties { @@ -129,20 +126,17 @@ class HollowMicroblockClient(shape$:Byte = 0, material$:Int = 0) extends HollowM getSlot match { case 0 | 1 => - { if(face) iMask = 0x3C f(pos, olm, mat, new Cuboid6(d1, y1, d2, d2, y2, z2), 0x3B|iMask)//-z internal f(pos, olm, mat, new Cuboid6(d1, y1, z1, d2, y2, d1), 0x37|iMask)//+z internal - + f(pos, olm, mat, new Cuboid6(d2, y1, d1, x2, y2, d2), faceMask&0x23|0xC|iMask)//-x internal -y+y+x external f(pos, olm, mat, new Cuboid6(x1, y1, d1, d1, y2, d2), faceMask&0x13|0xC|iMask)//+x internal -y+y-x external - + f(pos, olm, mat, new Cuboid6(x1, y1, d2, x2, y2, z2), faceMask&0x3B|4|iMask)//-y+y+z-x+x external f(pos, olm, mat, new Cuboid6(x1, y1, z1, x2, y2, d1), faceMask&0x37|8|iMask)//-y+y-z-x+x external - } case 2 | 3 => - { if(face) iMask = 0x33 f(pos, olm, mat, new Cuboid6(d2, d1, z1, x2, d2, z2), 0x2F|iMask)//-x internal @@ -153,9 +147,7 @@ class HollowMicroblockClient(shape$:Byte = 0, material$:Int = 0) extends HollowM f(pos, olm, mat, new Cuboid6(d2, y1, z1, x2, y2, z2), faceMask&0x2F|0x10|iMask)//-z+z+x-y+y external f(pos, olm, mat, new Cuboid6(x1, y1, z1, d1, y2, z2), faceMask&0x1F|0x20|iMask)//-z+z-x-y+y external - } - case 4 | 5 => - { + case 4 | 5 => if(face) iMask = 0xF f(pos, olm, mat, new Cuboid6(x1, d2, d1, x2, y2, d2), 0x3E|iMask)//-y internal @@ -166,7 +158,6 @@ class HollowMicroblockClient(shape$:Byte = 0, material$:Int = 0) extends HollowM f(pos, olm, mat, new Cuboid6(x1, d2, z1, x2, y2, z2), faceMask&0x3E|1|iMask)//-x+x+y-z+z external f(pos, olm, mat, new Cuboid6(x1, y1, z1, x2, d1, z2), faceMask&0x3D|2|iMask)//-x+x-y-z+z external - } } } @@ -236,26 +227,20 @@ class HollowMicroblock(shape$:Byte = 0, material$:Int = 0) extends CommonMicrobl getSlot match { case 0 | 1 => - { Seq(new Cuboid6(d2, y1, d1, x2, y2, d2), new Cuboid6(x1, y1, d1, d1, y2, d2), new Cuboid6(x1, y1, d2, x2, y2, z2), new Cuboid6(x1, y1, z1, x2, y2, d1)) - } case 2 | 3 => - { Seq(new Cuboid6(d1, d2, z1, d2, y2, z2), new Cuboid6(d1, y1, z1, d2, d1, z2), new Cuboid6(d2, y1, z1, x2, y2, z2), new Cuboid6(x1, y1, z1, d1, y2, z2)) - } - case 4 | 5 => - { + case 4 | 5 => Seq(new Cuboid6(x1, d1, d2, x2, d2, z2), new Cuboid6(x1, d1, z1, x2, d2, d1), new Cuboid6(x1, d2, z1, x2, y2, z2), new Cuboid6(x1, y1, z1, x2, d1, z2)) - } } } @@ -280,5 +265,5 @@ class HollowMicroblock(shape$:Byte = 0, material$:Int = 0) extends CommonMicrobl override def solid(side:Int) = false - override def redstoneConductionMap() = 0x10 + override def redstoneConductionMap = 0x10 } \ No newline at end of file diff --git a/codechicken/microblock/IMicroMaterialRender.scala b/codechicken/microblock/IMicroMaterialRender.scala index 19a8d59..9fb20a9 100644 --- a/codechicken/microblock/IMicroMaterialRender.scala +++ b/codechicken/microblock/IMicroMaterialRender.scala @@ -10,13 +10,13 @@ trait IMicroMaterialRender { /** * May be null for inventory rendering. */ - def world():World - def x():Int - def y():Int - def z():Int + def world:World + def x:Int + def y:Int + def z:Int /** * Return the bounds of the part for texture mapping side decals like grass */ - def getRenderBounds():Cuboid6 + def getRenderBounds:Cuboid6 } \ No newline at end of file diff --git a/codechicken/microblock/ItemMicroPart.scala b/codechicken/microblock/ItemMicroPart.scala index 9592ee3..4b2dd0d 100644 --- a/codechicken/microblock/ItemMicroPart.scala +++ b/codechicken/microblock/ItemMicroPart.scala @@ -9,7 +9,6 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType import net.minecraftforge.client.IItemRenderer.ItemRendererHelper import org.lwjgl.opengl.GL11 import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial -import net.minecraft.util.StatCollector import java.util.List import net.minecraft.creativetab.CreativeTabs import codechicken.microblock.MicroblockClassRegistry._ @@ -91,7 +90,7 @@ object ItemMicroPart { def checkTagCompound(stack:ItemStack) { - if(!stack.hasTagCompound()) + if(!stack.hasTagCompound) stack.setTagCompound(new NBTTagCompound("tag")) } @@ -103,26 +102,26 @@ object ItemMicroPart { val stack = new ItemStack(MicroblockProxy.itemMicro, amount, damage) checkTagCompound(stack) - stack.getTagCompound().setString("mat", material) + stack.getTagCompound.setString("mat", material) return stack } def getMaterial(stack:ItemStack):IMicroMaterial = { checkTagCompound(stack) - if(!stack.getTagCompound().hasKey("mat")) - return null; - - return MicroMaterialRegistry.getMaterial(stack.getTagCompound().getString("mat")) + if(!stack.getTagCompound.hasKey("mat")) + return null + + return MicroMaterialRegistry.getMaterial(stack.getTagCompound.getString("mat")) } def getMaterialID(stack:ItemStack):Int = { checkTagCompound(stack) - if(!stack.getTagCompound().hasKey("mat")) - return 0; - - return MicroMaterialRegistry.materialID(stack.getTagCompound().getString("mat")) + if(!stack.getTagCompound.hasKey("mat")) + return 0 + + return MicroMaterialRegistry.materialID(stack.getTagCompound.getString("mat")) } } @@ -147,7 +146,7 @@ object ItemMicroPartRenderer extends IItemRenderer GL11.glTranslatef(-0.5F, -0.5F, -0.5F) CCRenderState.reset() - TextureUtils.bindAtlas(0); + TextureUtils.bindAtlas(0) CCRenderState.useNormals(true) CCRenderState.useModelColours(true) CCRenderState.pullLightmap() diff --git a/codechicken/microblock/ItemSaw.scala b/codechicken/microblock/ItemSaw.scala index bcc29f6..b7cfaa1 100644 --- a/codechicken/microblock/ItemSaw.scala +++ b/codechicken/microblock/ItemSaw.scala @@ -10,7 +10,6 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType import net.minecraftforge.client.IItemRenderer.ItemRendererHelper import codechicken.lib.vec.SwapYZ import codechicken.lib.render.CCRenderState -import codechicken.lib.vec.Transformation import codechicken.lib.vec.TransformationList import codechicken.lib.vec.Translation import codechicken.lib.vec.Scale @@ -64,7 +63,7 @@ class ItemSaw(sawTag:ConfigTag, val harvestLevel:Int) extends Item(sawTag.getTag object ItemSawRenderer extends IItemRenderer { val models = CCModel.parseObjModels(new ResourceLocation("microblock", "models/saw.obj"), 7, new SwapYZ()) - val handle = models.get("Handle"); + val handle = models.get("Handle") val holder = models.get("BladeSupport") val blade = models.get("Blade") diff --git a/codechicken/microblock/MicroRecipe.scala b/codechicken/microblock/MicroRecipe.scala index 4d45285..1cfd37e 100644 --- a/codechicken/microblock/MicroRecipe.scala +++ b/codechicken/microblock/MicroRecipe.scala @@ -5,7 +5,6 @@ import net.minecraft.world.World import net.minecraft.inventory.InventoryCrafting import net.minecraft.item.ItemStack import codechicken.microblock.handler.MicroblockProxy._ -import codechicken.microblock.MicroMaterialRegistry object MicroRecipe extends IRecipe { @@ -67,7 +66,7 @@ object MicroRecipe extends IRecipe val size = microSize(first) val material = microMaterial(first) - for(i <- 1 to 8 if(i != 4)) + for(i <- 1 to 8 if i != 4) { val item = icraft.getStackInSlot(i) if(item == null || item.getItem != itemMicro || @@ -122,7 +121,7 @@ object MicroRecipe extends IRecipe case 4 => create(1, 0, smallest, material) case _ => null } - case 1|0 => { + case 1|0 => val base = Seq(1, 2, 4).find(s => (s&size) != 0) if(base.isEmpty) create(size/8, 0, 8, material) @@ -130,7 +129,6 @@ object MicroRecipe extends IRecipe null else create(size/base.get, mcrClass, base.get, material) - } case _ => null } } diff --git a/codechicken/microblock/MicroClass.scala b/codechicken/microblock/MicroblockClass.scala similarity index 79% rename from codechicken/microblock/MicroClass.scala rename to codechicken/microblock/MicroblockClass.scala index 3e1dee0..c9a249d 100644 --- a/codechicken/microblock/MicroClass.scala +++ b/codechicken/microblock/MicroblockClass.scala @@ -1,14 +1,9 @@ package codechicken.microblock -import codechicken.lib.lighting.CCRBModel import net.minecraft.util.MovingObjectPosition import net.minecraft.world.World -import codechicken.lib.vec.BlockCoord import codechicken.lib.vec.Vector3 -import codechicken.lib.render.CCModel -import codechicken.multipart.TMultiPart import net.minecraft.entity.player.EntityPlayer -import codechicken.multipart.TileMultipart import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side @@ -16,7 +11,7 @@ trait MicroblockClass { var classID:Int = _ - def itemSlot() = 3 + def itemSlot = 3 @SideOnly(Side.CLIENT) def renderHighlight(world:World, player:EntityPlayer, hit:MovingObjectPosition, size:Int, material:Int):Boolean = @@ -30,13 +25,13 @@ trait MicroblockClass return true } - def getName():String + def getName:String def create(client:Boolean):CommonMicroblock def create(size:Int, slot:Int, material:Int, client:Boolean):CommonMicroblock - def placementProperties():PlacementProperties + def placementProperties:PlacementProperties def register(id:Int) = MicroblockClassRegistry.registerMicroClass(this, id) } \ No newline at end of file diff --git a/codechicken/microblock/MicroClassRegistry.scala b/codechicken/microblock/MicroblockClassRegistry.scala similarity index 92% rename from codechicken/microblock/MicroClassRegistry.scala rename to codechicken/microblock/MicroblockClassRegistry.scala index 8095c65..984e447 100644 --- a/codechicken/microblock/MicroClassRegistry.scala +++ b/codechicken/microblock/MicroblockClassRegistry.scala @@ -1,7 +1,6 @@ package codechicken.microblock import codechicken.multipart.MultiPartRegistry -import codechicken.microblock.handler.MicroblockProxy object MicroblockClassRegistry { diff --git a/codechicken/microblock/MicroblockPlacement.scala b/codechicken/microblock/MicroblockPlacement.scala index b77df94..bfd6446 100644 --- a/codechicken/microblock/MicroblockPlacement.scala +++ b/codechicken/microblock/MicroblockPlacement.scala @@ -5,12 +5,9 @@ import net.minecraft.entity.player.EntityPlayer import net.minecraft.util.MovingObjectPosition import codechicken.lib.vec.Vector3 import codechicken.lib.vec.BlockCoord -import codechicken.multipart.TileMultipart import codechicken.lib.vec.Rotation import codechicken.multipart.ControlKeyModifer._ import net.minecraft.item.ItemStack -import codechicken.microblock.handler.MicroblockProxy -import codechicken.multipart.TMultiPart import codechicken.multipart.TileMultipart import codechicken.lib.raytracer.ExtendedMOP @@ -56,9 +53,9 @@ abstract class PlacementProperties def expand(slot:Int, side:Int) = true - def microClass():MicroblockClass + def microClass:MicroblockClass - def placementGrid():PlacementGrid + def placementGrid:PlacementGrid def customPlacement(pmt:MicroblockPlacement):ExecutablePlacement = null } diff --git a/codechicken/microblock/PlacementGrids.scala b/codechicken/microblock/PlacementGrids.scala index 46a0bd0..f25cf08 100644 --- a/codechicken/microblock/PlacementGrids.scala +++ b/codechicken/microblock/PlacementGrids.scala @@ -67,7 +67,7 @@ class FaceEdgeGrid(size:Double) extends PlacementGrid GL11.glVertex3d( size, 0,-size) GL11.glVertex3d(-size, 0,-size) - GL11.glEnd(); + GL11.glEnd() GL11.glPopMatrix() } @@ -116,7 +116,7 @@ object CornerPlacementGrid extends PlacementGrid GL11.glVertex3d(-0.5, 0, 0) GL11.glVertex3d( 0.5, 0, 0) - GL11.glEnd(); + GL11.glEnd() GL11.glPopMatrix() } diff --git a/codechicken/microblock/TMicroOcclusion.scala b/codechicken/microblock/TMicroOcclusion.scala index cb570b9..fa34990 100644 --- a/codechicken/microblock/TMicroOcclusion.scala +++ b/codechicken/microblock/TMicroOcclusion.scala @@ -2,9 +2,6 @@ package codechicken.microblock import codechicken.multipart.TMultiPart import codechicken.lib.vec.Cuboid6 -import cpw.mods.fml.relauncher.SideOnly -import cpw.mods.fml.relauncher.Side -import codechicken.multipart.TileMultipart import codechicken.multipart.PartMap._ /** @@ -160,11 +157,11 @@ object MicroOcclusion trait JMicroShrinkRender { - def getPriorityClass():Int - def getSlot():Int - def getSize():Int - def isTransparent():Boolean - def getBounds():Cuboid6 + def getPriorityClass:Int + def getSlot:Int + def getSize:Int + def isTransparent:Boolean + def getBounds:Cuboid6 } trait TMicroOcclusionClient extends TMicroOcclusion with JMicroShrinkRender @@ -197,10 +194,10 @@ trait TMicroOcclusion extends TMultiPart { import MicroOcclusion._ - def getSlot():Int - def getSize():Int - def getMaterial():Int - def getBounds():Cuboid6 + def getSlot:Int + def getSize:Int + def getMaterial:Int + def getBounds:Cuboid6 override def occlusionTest(npart:TMultiPart):Boolean = { diff --git a/codechicken/microblock/handler/eventhandler.scala b/codechicken/microblock/handler/MicroblockEventHandler.scala similarity index 100% rename from codechicken/microblock/handler/eventhandler.scala rename to codechicken/microblock/handler/MicroblockEventHandler.scala diff --git a/codechicken/microblock/handler/modcontainer.scala b/codechicken/microblock/handler/MicroblockMod.scala similarity index 90% rename from codechicken/microblock/handler/modcontainer.scala rename to codechicken/microblock/handler/MicroblockMod.scala index ae99328..6a6c06b 100644 --- a/codechicken/microblock/handler/modcontainer.scala +++ b/codechicken/microblock/handler/MicroblockMod.scala @@ -1,13 +1,10 @@ -package codechicken.microblock.handler; +package codechicken.microblock.handler import cpw.mods.fml.common.Mod import cpw.mods.fml.common.event.FMLInitializationEvent import cpw.mods.fml.common.event.FMLPreInitializationEvent -import cpw.mods.fml.common.SidedProxy import cpw.mods.fml.common.Mod.EventHandler import cpw.mods.fml.common.event.FMLServerAboutToStartEvent -import cpw.mods.fml.common.network.NetworkMod -import cpw.mods.fml.common.Mod.Instance import codechicken.microblock.MicroMaterialRegistry import codechicken.microblock.DefaultContent import cpw.mods.fml.common.event.FMLPostInitializationEvent diff --git a/codechicken/microblock/handler/proxies.scala b/codechicken/microblock/handler/proxies.scala index 12d2aea..853a4c4 100644 --- a/codechicken/microblock/handler/proxies.scala +++ b/codechicken/microblock/handler/proxies.scala @@ -2,10 +2,7 @@ package codechicken.microblock.handler import net.minecraftforge.common.MinecraftForge import codechicken.multipart.handler.MultipartProxy._ -import codechicken.multipart.TMultiPart -import codechicken.multipart.MultiPartRegistry import codechicken.microblock._ -import codechicken.microblock.MicroMaterialRegistry.IMicroMaterial import net.minecraftforge.client.MinecraftForgeClient import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side @@ -13,20 +10,15 @@ import net.minecraft.item.crafting.CraftingManager import net.minecraft.item.Item import net.minecraft.item.crafting.IRecipe import java.util.{List => JList} -import cpw.mods.fml.common.registry.LanguageRegistry -import codechicken.lib.config.ConfigTag import codechicken.lib.config.ConfigFile import net.minecraftforge.oredict.OreDictionary import net.minecraft.item.ItemStack import net.minecraftforge.oredict.ShapedOreRecipe import net.minecraft.block.Block -import codechicken.lib.lang.LangUtil -import net.minecraft.util.ResourceLocation import codechicken.lib.packet.PacketCustom -import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.GameRegistry import cpw.mods.fml.common.network.NetworkRegistry import net.minecraft.client.renderer.RenderBlocks -import java.io.File class MicroblockProxy_serverImpl { @@ -94,7 +86,7 @@ class MicroblockProxy_clientImpl extends MicroblockProxy_serverImpl @SideOnly(Side.CLIENT) private var _renderBlocks:RenderBlocks = _ @SideOnly(Side.CLIENT) - def renderBlocks() = + def renderBlocks = { if(_renderBlocks == null) _renderBlocks = new RenderBlocks diff --git a/codechicken/multipart/BlockMultipart.scala b/codechicken/multipart/BlockMultipart.scala index 62a6479..eb5902c 100644 --- a/codechicken/multipart/BlockMultipart.scala +++ b/codechicken/multipart/BlockMultipart.scala @@ -10,27 +10,18 @@ import net.minecraft.world.World import net.minecraftforge.common.ForgeDirection import net.minecraft.util.Vec3 import net.minecraft.util.MovingObjectPosition -import java.util.LinkedList -import codechicken.lib.raytracer.IndexedCuboid6 -import codechicken.lib.vec.Cuboid6 import codechicken.lib.raytracer.RayTracer -import codechicken.lib.vec.Vector3 -import codechicken.lib.vec.BlockCoord import net.minecraft.entity.player.EntityPlayer import java.util.Random import java.util.ArrayList import net.minecraft.item.ItemStack import net.minecraft.client.particle.EffectRenderer import net.minecraft.client.Minecraft -import net.minecraft.util.Icon import net.minecraft.client.renderer.texture.IconRegister -import codechicken.lib.render.TextureSpecial import codechicken.lib.render.TextureUtils import net.minecraft.world.IBlockAccess import codechicken.lib.raytracer.ExtendedMOP import scala.collection.JavaConversions._ -import java.util.Collections -import codechicken.multipart.scalatraits.TTileChangeTile object BlockMultipart { @@ -127,7 +118,7 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) val (index, mop) = reduceMOP(hit) if(world.isRemote) { - tile.partList(index).addDestroyEffects(mop, Minecraft.getMinecraft().effectRenderer) + tile.partList(index).addDestroyEffects(mop, Minecraft.getMinecraft.effectRenderer) return true } @@ -166,7 +157,7 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) if(tile != null) tile.partList.foreach(part => part.getCollisionBoxes.foreach{c => - val aabb = c.toAABB().offset(x, y, z) + val aabb = c.toAABB.offset(x, y, z) if(aabb.intersectsWith(ebb)) list.add(aabb) }) @@ -187,9 +178,9 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) override def renderAsNormalBlock() = false - override def isOpaqueCube() = false + override def isOpaqueCube = false - override def getRenderType() = TileMultipart.renderID + override def getRenderType = TileMultipart.renderID override def isAirBlock(world:World, x:Int, y:Int, z:Int):Boolean = { @@ -226,7 +217,7 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) val tile = getTile(world, x, y, z) if(hit != null && tile != null) { val (index, mop) = reduceMOP(hit) - return tile.partList(index).getStrength(mop, player)/30F; + return tile.partList(index).getStrength(mop, player)/30F } return 1/100F @@ -237,8 +228,8 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) */ override def registerIcons(register:IconRegister) { - val n = getUnlocalizedName(); - val icon = TextureUtils.getBlankIcon(16, register); + val n = getUnlocalizedName + val icon = TextureUtils.getBlankIcon(16, register) setTextureName(icon.getIconName) super.registerIcons(register) } @@ -259,7 +250,7 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) override def onBlockActivated(world:World, x:Int, y:Int, z:Int, player:EntityPlayer, side:Int, hitX:Float, hitY:Float, hitZ:Float):Boolean = { - val hit = RayTracer.retraceBlock(world, player, x, y, z); + val hit = RayTracer.retraceBlock(world, player, x, y, z) if(hit == null) return false @@ -273,7 +264,7 @@ class BlockMultipart(id:Int) extends Block(id, Material.rock) override def onBlockClicked(world:World, x:Int, y:Int, z:Int, player:EntityPlayer) { - val hit = RayTracer.retraceBlock(world, player, x, y, z); + val hit = RayTracer.retraceBlock(world, player, x, y, z) if(hit == null) return diff --git a/codechicken/multipart/ControlKeyModifier.scala b/codechicken/multipart/ControlKeyModifier.scala index 007087c..fb70bcb 100644 --- a/codechicken/multipart/ControlKeyModifier.scala +++ b/codechicken/multipart/ControlKeyModifier.scala @@ -21,7 +21,7 @@ object ControlKeyModifer class ControlKeyValue(p:EntityPlayer) { - def isControlDown() = map(p) + def isControlDown = map(p) } val map = HashMap[EntityPlayer, Boolean]().withDefaultValue(false) @@ -41,7 +41,7 @@ object ControlKeyHandler extends KeyHandler ( { import ControlKeyModifer._ - LanguageRegistry.instance.addStringLocalization("key.control", "Placement Modifier"); + LanguageRegistry.instance.addStringLocalization("key.control", "Placement Modifier") def keyDown(types:EnumSet[TickType], kb:KeyBinding, tickEnd:Boolean, isRepeat:Boolean) { @@ -65,7 +65,7 @@ object ControlKeyHandler extends KeyHandler ( } } - def getLabel() = "Control Key Modifer"; - - def ticks() = EnumSet.of(TickType.CLIENT) + def getLabel = "Control Key Modifer" + + def ticks = EnumSet.of(TickType.CLIENT) } \ No newline at end of file diff --git a/codechicken/multipart/IRedstonePart.scala b/codechicken/multipart/IRedstonePart.scala index 9bfb5c0..171fb0f 100644 --- a/codechicken/multipart/IRedstonePart.scala +++ b/codechicken/multipart/IRedstonePart.scala @@ -2,10 +2,8 @@ package codechicken.multipart import net.minecraft.world.World import net.minecraft.block.Block -import net.minecraft.block.BlockRedstoneWire import net.minecraft.world.IBlockAccess import net.minecraft.util.Direction -import PartMap._ import codechicken.lib.vec.Rotation._ /** @@ -38,7 +36,7 @@ trait IFaceRedstonePart extends IRedstonePart /** * Return the face to which this redstone part is attached */ - def getFace():Int + def getFace:Int } /** @@ -231,8 +229,8 @@ object RedstoneInteractions val vside = vanillaSideMap(side) if(block == Block.redstoneRepeaterActive || block == Block.redstoneRepeaterIdle)//stupid minecraft hardcodes { - val meta = world.getBlockMetadata(x, y, z); - if(vside == (meta & 3) || vside == Direction.rotateOpposite(meta & 3)) + val meta = world.getBlockMetadata(x, y, z) + if(vside == (meta & 3) || vside == Direction.rotateOpposite(meta & 3)) return 4 return 0 } diff --git a/codechicken/multipart/MultiPartRegistry.scala b/codechicken/multipart/MultiPartRegistry.scala index b8def54..1f19f3e 100644 --- a/codechicken/multipart/MultiPartRegistry.scala +++ b/codechicken/multipart/MultiPartRegistry.scala @@ -1,4 +1,4 @@ -package codechicken.multipart; +package codechicken.multipart import scala.collection.mutable.HashMap import codechicken.lib.packet.PacketCustom @@ -25,7 +25,7 @@ object MultiPartRegistry * Create a new instance of the part with the specified type name identifier * @param client If the part instance is for the client or the server */ - def createPart(name:String, client:Boolean):TMultiPart; + def createPart(name:String, client:Boolean):TMultiPart } /** @@ -60,7 +60,7 @@ object MultiPartRegistry */ def registerParts(partFactory:IPartFactory, types:Array[String]) { - registerParts(partFactory.createPart _, types:_*); + registerParts(partFactory.createPart _, types:_*) } /** @@ -78,9 +78,9 @@ object MultiPartRegistry types.foreach{s => if(typeMap.contains(s)) - throw new IllegalStateException("Part with id "+s+" is already registered."); - - typeMap.put(s, (c:Boolean) => partFactory(s, c)); + throw new IllegalStateException("Part with id "+s+" is already registered.") + + typeMap.put(s, (c:Boolean) => partFactory(s, c)) containers.put(s, container) } } @@ -99,7 +99,7 @@ object MultiPartRegistry { idMap = typeMap.toList.sortBy(_._1).toArray idWriter.setMax(idMap.length) - nameMap.clear + nameMap.clear() for(i <- 0 until idMap.length) nameMap.put(idMap(i)._1, i) } diff --git a/codechicken/multipart/MultipartGenerator.scala b/codechicken/multipart/MultipartGenerator.scala index f745b96..e48c82d 100644 --- a/codechicken/multipart/MultipartGenerator.scala +++ b/codechicken/multipart/MultipartGenerator.scala @@ -5,12 +5,8 @@ import scala.collection.immutable.Map import net.minecraft.world.World import codechicken.lib.vec.BlockCoord import codechicken.multipart.handler.MultipartProxy -import cpw.mods.fml.common.FMLCommonHandler -import cpw.mods.fml.relauncher.Side import codechicken.lib.packet.PacketCustom import net.minecraft.network.packet.Packet53BlockChange -import scala.collection.mutable.ListBuffer -import scala.collection.mutable.ListBuffer import codechicken.multipart.asm.IMultipartFactory import codechicken.multipart.asm.ASMMixinFactory @@ -109,7 +105,7 @@ object MultipartGenerator { val chunk = world.getChunkFromBlockCoords(pos.x, pos.z) if(chunk != null) - chunk.setChunkBlockTileEntity(pos.x & 15, pos.y, pos.z & 15, tile); + chunk.setChunkBlockTileEntity(pos.x & 15, pos.y, pos.z & 15, tile) } /** diff --git a/codechicken/multipart/MultipartHelper.scala b/codechicken/multipart/MultipartHelper.scala index 9a87e9c..47fdc41 100644 --- a/codechicken/multipart/MultipartHelper.scala +++ b/codechicken/multipart/MultipartHelper.scala @@ -8,9 +8,6 @@ import com.google.common.collect.LinkedListMultimap import scala.collection.JavaConversions._ import codechicken.multipart.handler.MultipartSPH import net.minecraft.world.WorldServer -import java.util.{List => JList} -import net.minecraft.entity.player.EntityPlayer -import net.minecraft.entity.player.EntityPlayerMP import java.util.Arrays import net.minecraft.server.management.PlayerInstance import codechicken.lib.asm.ObfMapping @@ -42,7 +39,7 @@ object MultipartHelper return null MultipartSaveLoad.loadingWorld = world - return TileMultipart.createFromNBT(tag); + return TileMultipart.createFromNBT(tag) } /** diff --git a/codechicken/multipart/MultipartRenderer.scala b/codechicken/multipart/MultipartRenderer.scala index 20537f4..c5251e4 100644 --- a/codechicken/multipart/MultipartRenderer.scala +++ b/codechicken/multipart/MultipartRenderer.scala @@ -1,8 +1,6 @@ package codechicken.multipart -import codechicken.lib.lighting.LightMatrix import codechicken.lib.render.CCRenderState -import codechicken.lib.vec.Cuboid6 import codechicken.lib.vec.Vector3 import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler import cpw.mods.fml.client.registry.RenderingRegistry @@ -11,9 +9,6 @@ import net.minecraft.client.renderer.RenderBlocks import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer import net.minecraft.tileentity.TileEntity import net.minecraft.world.IBlockAccess -import codechicken.lib.vec.BlockCoord -import net.minecraft.world.IWorldAccess -import net.minecraft.util.MovingObjectPosition import net.minecraft.client.Minecraft import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side diff --git a/codechicken/multipart/PacketScheduler.scala b/codechicken/multipart/PacketScheduler.scala index 486ecd1..d67ecc1 100644 --- a/codechicken/multipart/PacketScheduler.scala +++ b/codechicken/multipart/PacketScheduler.scala @@ -1,4 +1,5 @@ package codechicken.multipart + import scala.collection.mutable.{Map => MMap} import codechicken.lib.data.MCDataOutput import codechicken.lib.data.MCDataInput @@ -56,7 +57,7 @@ trait IScheduledPacketPart /** * Returns the width (in bytes) of the data type required to hold all valid mask bits. Valid values are 1, 2, 4 and 8 */ - def maskWidth():Int + def maskWidth:Int /** * Read data matching mask. Estiablishes a method for subclasses to override. This should be called from read diff --git a/codechicken/multipart/TCuboidPart.scala b/codechicken/multipart/TCuboidPart.scala index 38bbcde..bab44f6 100644 --- a/codechicken/multipart/TCuboidPart.scala +++ b/codechicken/multipart/TCuboidPart.scala @@ -5,7 +5,6 @@ import codechicken.lib.raytracer.IndexedCuboid6 import net.minecraft.client.renderer.RenderBlocks import codechicken.lib.render.CCRenderState import codechicken.lib.render.RenderUtils -import codechicken.lib.vec.Vector3 import codechicken.lib.render.IconTransformation import scala.collection.JavaConversions._ import java.lang.Iterable diff --git a/codechicken/multipart/TMultiPart.scala b/codechicken/multipart/TMultiPart.scala index 8c2823b..86bd0bb 100644 --- a/codechicken/multipart/TMultiPart.scala +++ b/codechicken/multipart/TMultiPart.scala @@ -10,14 +10,9 @@ import codechicken.lib.raytracer.IndexedCuboid6 import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side import net.minecraft.client.particle.EffectRenderer -import net.minecraft.util.Icon import net.minecraft.client.renderer.RenderBlocks -import codechicken.lib.render.RenderUtils -import codechicken.lib.render.IconTransformation import codechicken.lib.vec.BlockCoord -import net.minecraft.world.World import net.minecraft.tileentity.TileEntity -import codechicken.lib.render.CCRenderState import codechicken.lib.lighting.LazyLightMatrix import codechicken.lib.data.MCDataOutput import codechicken.lib.data.MCDataInput @@ -39,11 +34,11 @@ abstract class TMultiPart * Legacy helper function for getting the tile entity (from when TileMultipart was a trait). Use tile() now. */ @Deprecated - def getTile():TileEntity = tile + def getTile:TileEntity = tile /** * Getter for tile.worldObj */ - def world() = if(tile == null) null else tile.worldObj + def world = if(tile == null) null else tile.worldObj /** * Short getter for xCoord */ @@ -187,7 +182,7 @@ abstract class TMultiPart * Gets a MCDataOutput instance for writing update data to clients with this part loaded. * The write stream functions as a buffer which is flushed in a compressed databurst packet at the end of the tick. */ - def getWriteStream():MCDataOutput = tile.getWriteStream(this) + def getWriteStream:MCDataOutput = tile.getWriteStream(this) /** * Read and operate on data written to getWriteStream. Ensure all data this part wrote is read even if it's not going to be used. * The default implementation assumes a call to sendDescUpdate as the only use of getWriteStream. diff --git a/codechicken/multipart/TNormalOcclusion.scala b/codechicken/multipart/TNormalOcclusion.scala index bfb76c1..a6b2e5a 100644 --- a/codechicken/multipart/TNormalOcclusion.scala +++ b/codechicken/multipart/TNormalOcclusion.scala @@ -43,7 +43,7 @@ trait JNormalOcclusion /** * Return a list of normal occlusion boxes */ - def getOcclusionBoxes():Iterable[Cuboid6] + def getOcclusionBoxes:Iterable[Cuboid6] } /** diff --git a/codechicken/multipart/TPartialOcclusion.scala b/codechicken/multipart/TPartialOcclusion.scala index 8f8c484..c0b1c79 100644 --- a/codechicken/multipart/TPartialOcclusion.scala +++ b/codechicken/multipart/TPartialOcclusion.scala @@ -67,7 +67,7 @@ trait JPartialOcclusion /** * Return a list of partial occlusion boxes */ - def getPartialOcclusionBoxes():Iterable[Cuboid6] + def getPartialOcclusionBoxes:Iterable[Cuboid6] /** * Return true if this part may be completely obscured diff --git a/codechicken/multipart/TickScheduler.scala b/codechicken/multipart/TickScheduler.scala index 749eac4..62838f6 100644 --- a/codechicken/multipart/TickScheduler.scala +++ b/codechicken/multipart/TickScheduler.scala @@ -76,7 +76,7 @@ object TickScheduler extends WorldExtensionInstantiator schedTime+=1 } - def saveDir():File = + def saveDir:File = { if(world.provider.dimensionId == 0)//Calling DimensionManager.getCurrentSaveRootDirectory too early breaks game saves, we have a world reference, use it return world.getSaveHandler.asInstanceOf[SaveHandler].getWorldDirectory @@ -84,7 +84,7 @@ object TickScheduler extends WorldExtensionInstantiator return new File(DimensionManager.getCurrentSaveRootDirectory, world.provider.getSaveFolder) } - def saveFile():File = new File(saveDir, "multipart.dat") + def saveFile:File = new File(saveDir, "multipart.dat") override def load() { @@ -110,7 +110,7 @@ object TickScheduler extends WorldExtensionInstantiator schedTime = world.getTotalWorldTime } - def saveTag():NBTTagCompound = + def saveTag:NBTTagCompound = { val tag = new NBTTagCompound tag.setLong("schedTime", schedTime) @@ -124,9 +124,9 @@ object TickScheduler extends WorldExtensionInstantiator if(!file.exists) file.createNewFile() - val dout = new DataOutputStream(new FileOutputStream(file)); - CompressedStreamTools.writeCompressed(saveTag, dout); - dout.close(); + val dout = new DataOutputStream(new FileOutputStream(file)) + CompressedStreamTools.writeCompressed(saveTag, dout) + dout.close() } def nextRandomTick = world.rand.nextInt(800)+800 @@ -147,7 +147,7 @@ object TickScheduler extends WorldExtensionInstantiator val it = tickList.iterator while(it.hasNext) { - val e = it.next + val e = it.next() if(e.part == part) { if(e.random && !random)//only override an existing tick if we're going from random->scheduled @@ -167,7 +167,7 @@ object TickScheduler extends WorldExtensionInstantiator def processTicks():Boolean = { - tickList = tickList.filter(processTick(_)) + tickList = tickList.filter(processTick) return !tickList.isEmpty } diff --git a/codechicken/multipart/TileMultipart.scala b/codechicken/multipart/TileMultipart.scala index 1aeb078..2bf3019 100644 --- a/codechicken/multipart/TileMultipart.scala +++ b/codechicken/multipart/TileMultipart.scala @@ -2,38 +2,20 @@ package codechicken.multipart import net.minecraft.tileentity.TileEntity import scala.collection.mutable.ListBuffer -import net.minecraft.network.packet.Packet import codechicken.lib.packet.PacketCustom -import codechicken.multipart.handler.MultipartCPH import codechicken.lib.vec.BlockCoord import net.minecraft.world.World import java.util.List -import scala.collection.JavaConverters._ import net.minecraft.nbt.NBTTagCompound -import java.io.ByteArrayOutputStream -import java.io.DataOutputStream -import java.io.DataInputStream -import codechicken.lib.data.MCDataInputStream import codechicken.lib.data.MCDataOutput -import codechicken.lib.data.MCDataOutputStream -import net.minecraft.client.multiplayer.NetClientHandler -import codechicken.lib.vec.Cuboid6 -import scala.collection.mutable.HashSet import codechicken.multipart.handler.MultipartProxy import net.minecraft.block.Block import net.minecraft.item.ItemStack import codechicken.lib.vec.Vector3 import net.minecraft.nbt.NBTTagList -import net.minecraft.client.particle.EffectRenderer -import net.minecraft.util.MovingObjectPosition -import scala.collection.mutable.ArrayBuffer import java.util.Random -import cpw.mods.fml.relauncher.SideOnly -import cpw.mods.fml.relauncher.Side -import scala.collection.mutable.Queue import codechicken.multipart.handler.MultipartSPH import codechicken.lib.lighting.LazyLightMatrix -import net.minecraft.world.ChunkCoordIntPair import net.minecraft.entity.item.EntityItem import net.minecraft.entity.player.EntityPlayer import net.minecraft.entity.Entity @@ -42,7 +24,6 @@ import java.util.Collection import codechicken.lib.raytracer.ExtendedMOP import net.minecraft.util.Vec3 import java.lang.Iterable -import codechicken.multipart.handler.MultipartSaveLoad import scala.collection.mutable.{Map => MMap} import net.minecraft.util.AxisAlignedBB @@ -91,12 +72,12 @@ class TileMultipart extends TileEntity */ def jPartList():List[TMultiPart] = partList - override def canUpdate() = doesTick + override def canUpdate = doesTick def operate(f:(TMultiPart)=>Unit) { val it = partList.iterator while(it.hasNext) { - val p = it.next + val p = it.next() if(p.tile != null) f(p) } } @@ -167,7 +148,7 @@ class TileMultipart extends TileEntity */ def multiPartChange(parts:Collection[TMultiPart]) { - operate(p => if(!parts.contains(p)) parts.foreach(p.onPartChanged(_))) + operate(p => if(!parts.contains(p)) parts.foreach(p.onPartChanged)) } /** @@ -188,7 +169,7 @@ class TileMultipart extends TileEntity */ def onNeighborTileChange(tileX:Int, tileY:Int, tileZ:Int) {} - def getLightValue() = partList.foldLeft(0)((l, p) => Math.max(l, p.getLightValue)) + def getLightValue = partList.foldLeft(0)((l, p) => Math.max(l, p.getLightValue)) /** * Callback for parts to mark the chunk as needs saving @@ -436,10 +417,9 @@ class TileMultipart extends TileEntity var list = ListBuffer[ExtendedMOP]() for((p, i) <- partList.view.zipWithIndex) p.collisionRayTrace(start, end) match { - case mop:ExtendedMOP => { + case mop:ExtendedMOP => mop.data = (i, mop.data) list+=mop - } case _ => } @@ -525,7 +505,7 @@ class TileMultipartClient extends TileMultipart true } - override def getRenderBoundingBox() = AxisAlignedBB.getAABBPool.getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1) + override def getRenderBoundingBox = AxisAlignedBB.getAABBPool.getAABB(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1) } /** @@ -580,14 +560,12 @@ object TileMultipart /** * Gets the multipart tile instance at pos, or null if it doesn't exist or is not a multipart tile */ - def getTile(world:World, pos:BlockCoord):TileMultipart = - { - val t = world.getBlockTileEntity(pos.x, pos.y, pos.z) - if(t.isInstanceOf[TileMultipart]) - return t.asInstanceOf[TileMultipart] - return null - } - + def getTile(world:World, pos:BlockCoord) = + world.getBlockTileEntity(pos.x, pos.y, pos.z) match { + case t:TileMultipart => t + case _ => null + } + /** * Returns whether part can be added to the space at pos. Will do conversions as necessary. * This function is the recommended way to add parts to the world. @@ -595,7 +573,7 @@ object TileMultipart def canPlacePart(world:World, pos:BlockCoord, part:TMultiPart):Boolean = { part.getCollisionBoxes.foreach{b => - if(!world.checkNoEntityCollision(b.toAABB().offset(pos.x, pos.y, pos.z))) + if(!world.checkNoEntityCollision(b.toAABB.offset(pos.x, pos.y, pos.z))) return false } @@ -666,11 +644,10 @@ object TileMultipart i match { - case 253 => { + case 253 => val part = MultiPartRegistry.readPart(packet) part.readDesc(packet) MultipartGenerator.addPart(world, pos, part) - } case 254 => tilemp.remPart_impl(tilemp.partList(packet.readUByte)) case _ => tilemp.partList(i).read(packet) } diff --git a/codechicken/multipart/asm/ASMMixinCompiler.scala b/codechicken/multipart/asm/ASMMixinCompiler.scala index fc4c467..b5017ca 100644 --- a/codechicken/multipart/asm/ASMMixinCompiler.scala +++ b/codechicken/multipart/asm/ASMMixinCompiler.scala @@ -50,7 +50,7 @@ object DebugPrinter def defined(name:String, bytes:Array[Byte]) { if((permGenUsed+bytes.length)/16000 != permGenUsed/16000) - log((permGenUsed+bytes.length)+" bytes of permGen has been used by ASMMixinCompiler"); + log((permGenUsed+bytes.length)+" bytes of permGen has been used by ASMMixinCompiler") permGenUsed += bytes.length } @@ -95,7 +95,7 @@ object ASMMixinCompiler return null def useTransformers = f_transformerExceptions.get(cl).asInstanceOf[JSet[String]] - .find(jName.startsWith(_)).isEmpty + .find(jName.startsWith).isEmpty val obfName = FMLDeobfuscatingRemapper.INSTANCE.unmap(name).replace('/', '.') val bytes = cl.getClassBytes(obfName) @@ -182,7 +182,7 @@ object ASMMixinCompiler case class JMethodInfoSource(method:Method) extends MethodInfoSource { def name = method.getName - def desc = getType(method).getDescriptor() + def desc = getType(method).getDescriptor def isPrivate = Modifier.isPrivate(method.getModifiers) def isAbstract = Modifier.isAbstract(method.getModifiers) } @@ -208,7 +208,7 @@ object ASMMixinCompiler def superClass = Option(getNodeInfo(cnode.superName)) def interfaces = cnode.interfaces match { case null => Seq() - case v => v.map(getNodeInfo(_)) + case v => v.map(getNodeInfo) } def methods = cnode.methods.map(MethodNodeInfoSource(_)) } @@ -219,7 +219,7 @@ object ASMMixinCompiler val csym = sig.evalT(0):ClassSymbol override def superClass = Option(getNodeInfo(csym.jParent(sig))) - override def interfaces = csym.jInterfaces(sig).map(getNodeInfo(_)) + override def interfaces = csym.jInterfaces(sig).map(getNodeInfo) } def classInfo(name:String):ClassInfoSource = name match { diff --git a/codechicken/multipart/asm/ASMMixinFactory.scala b/codechicken/multipart/asm/ASMMixinFactory.scala index 79818cd..8f6c3a6 100644 --- a/codechicken/multipart/asm/ASMMixinFactory.scala +++ b/codechicken/multipart/asm/ASMMixinFactory.scala @@ -55,16 +55,16 @@ object ASMMixinFactory extends IMultipartFactory case _ => false } - override def hashCode() = set.hashCode + override def hashCode = set.hashCode() - def generate():TileMultipart = get.generate + def generate:TileMultipart = get.generate() - def get() = generatorMap.getOrElse(this, gen_sync) + def get = generatorMap.getOrElse(this, gen_sync()) def gen_sync():Constructor = ASMMixinFactory.synchronized { return generatorMap.getOrElse(this, { - var gen = generator + val gen = generator() generatorMap = generatorMap+(this->gen) gen }) @@ -125,8 +125,8 @@ object ASMMixinFactory extends IMultipartFactory val mv = cnode.visitMethod(ACC_PUBLIC, "copyFrom", "(Lcodechicken/multipart/TileMultipart;)V", null, null) mv.visitVarInsn(ALOAD, 0) mv.visitVarInsn(ALOAD, 1) - mv.visitMethodInsn(INVOKESPECIAL, "codechicken/multipart/TileMultipart", "copyFrom", "(Lcodechicken/multipart/TileMultipart;)V"); - + mv.visitMethodInsn(INVOKESPECIAL, "codechicken/multipart/TileMultipart", "copyFrom", "(Lcodechicken/multipart/TileMultipart;)V") + mv.visitVarInsn(ALOAD, 1) mv.visitTypeInsn(INSTANCEOF, cnode.name) val end = new Label() @@ -299,7 +299,7 @@ object ASMMixinFactory extends IMultipartFactory finishBridgeCall(mv, m.desc, INVOKEINTERFACE, iname, m.name, m.desc) } - methods(inode).values.foreach(generatePassThroughMethod(_)) + methods(inode).values.foreach(generatePassThroughMethod) cw.visitEnd() internalDefine(tname, cw.toByteArray) diff --git a/codechicken/multipart/asm/ScalaSignature.scala b/codechicken/multipart/asm/ScalaSignature.scala index 061df70..708a1eb 100644 --- a/codechicken/multipart/asm/ScalaSignature.scala +++ b/codechicken/multipart/asm/ScalaSignature.scala @@ -154,7 +154,7 @@ object ScalaSignature class SigEntry(val start:Int, val bytes:Bytes) { - def id() = bytes.bytes(start) + def id = bytes.bytes(start) def delete() { @@ -172,12 +172,11 @@ case class ScalaSignature(major:Int, minor:Int, table:Array[SigEntry], bytes:Byt { case 1|2 => bcr.readString(bc.len) case 3 => NoSymbol.full - case 9|10 => { + case 9|10 => var s = evalS(bcr.readNat) if(bc.pos+bc.len > bcr.pos) s = evalS(bcr.readNat)+"."+s s - } } } @@ -217,13 +216,13 @@ class ByteCodeReader(val bc:Bytes) { var pos = bc.pos - def more() = pos < bc.pos+bc.len + def more = pos < bc.pos+bc.len def readString(len:Int) = advance(len)(new String(bc.bytes drop pos take len)) - def readByte() = advance(1)(bc.bytes(pos)) + def readByte = advance(1)(bc.bytes(pos)) - def readNat():Int = + def readNat:Int = { var r = 0 var b = 0 @@ -244,7 +243,7 @@ class ByteCodeReader(val bc:Bytes) return r } - def readEntry() = + def readEntry = { val p = pos val tpe:Int = readByte @@ -252,7 +251,7 @@ class ByteCodeReader(val bc:Bytes) advance(len)(new SigEntry(p, new Bytes(bc.bytes, pos, len))) } - def readSig() = + def readSig = { val major = readByte val minor = readByte @@ -321,7 +320,7 @@ class ScalaSigSideTransformer { val m = it.next if(m.name == sym.name && m.desc == sym.jDesc(sig)) - it.remove + it.remove() } } } diff --git a/codechicken/multipart/asm/StackAnalyser.scala b/codechicken/multipart/asm/StackAnalyser.scala index db6bf1a..444e778 100644 --- a/codechicken/multipart/asm/StackAnalyser.scala +++ b/codechicken/multipart/asm/StackAnalyser.scala @@ -235,7 +235,7 @@ class StackAnalyser(val owner:Type, val m:MethodNode) case MONITORENTER|MONITOREXIT => pop() case _ => - + } case iinsn:IntInsnNode => ainsn.getOpcode match { @@ -289,13 +289,11 @@ class StackAnalyser(val owner:Type, val m:MethodNode) case CHECKCAST => push(Cast(pop(), getType(tinsn.desc))) case INSTANCEOF => push(UnaryOp(INSTANCEOF, pop())) } - case mainsn:MultiANewArrayInsnNode => - { + case mainsn:MultiANewArrayInsnNode => val sizes = new Array[StackEntry](mainsn.dims) for(i <- 0 until sizes.length) sizes(i) = pop() push(NewMultiArray(sizes, getType(mainsn.desc))) - } /*case fnode:FrameNode => fnode.`type` match { case F_NEW|F_FULL => println("reset stacks/locals") @@ -305,14 +303,11 @@ class StackAnalyser(val owner:Type, val m:MethodNode) case F_SAME1 => println("reset locals and all but bottom stack") }*/ case lnode:LabelNode => - { catchHandlers.get(lnode) match { case Some(tcblock) => push(CaughtException(Type.getType(tcblock.`type`))) case None => } - } - case _ => } } diff --git a/codechicken/multipart/handler/eventhandler.scala b/codechicken/multipart/handler/MultipartEventHandler.scala similarity index 97% rename from codechicken/multipart/handler/eventhandler.scala rename to codechicken/multipart/handler/MultipartEventHandler.scala index d3cccb0..93cdba7 100644 --- a/codechicken/multipart/handler/eventhandler.scala +++ b/codechicken/multipart/handler/MultipartEventHandler.scala @@ -1,6 +1,5 @@ package codechicken.multipart.handler -import net.minecraft.nbt.NBTTagCompound import codechicken.multipart.TileMultipart import net.minecraftforge.event.ForgeSubscribe import cpw.mods.fml.common.network.IConnectionHandler @@ -31,7 +30,7 @@ object MultipartEventHandler extends IConnectionHandler with ITickHandler @ForgeSubscribe(priority = EventPriority.HIGHEST) def tileEntityLoad(event:ChunkDataEvent.Load) { - MultipartSaveLoad.loadTiles(event.getChunk()) + MultipartSaveLoad.loadTiles(event.getChunk) } @ForgeSubscribe diff --git a/codechicken/multipart/handler/modcontainer.scala b/codechicken/multipart/handler/MultipartMod.scala similarity index 97% rename from codechicken/multipart/handler/modcontainer.scala rename to codechicken/multipart/handler/MultipartMod.scala index b24e043..50e0040 100644 --- a/codechicken/multipart/handler/modcontainer.scala +++ b/codechicken/multipart/handler/MultipartMod.scala @@ -8,7 +8,6 @@ import cpw.mods.fml.common.event.FMLInitializationEvent import cpw.mods.fml.common.Mod.EventHandler import cpw.mods.fml.common.event.FMLServerAboutToStartEvent import codechicken.multipart.MultiPartRegistry -import cpw.mods.fml.relauncher.SideOnly import codechicken.lib.packet.PacketCustom.CustomTinyPacketHandler @Mod(modid = "ForgeMultipart", acceptedMinecraftVersions = "[1.6.4]", diff --git a/codechicken/multipart/handler/MultipartSaveLoad.scala b/codechicken/multipart/handler/MultipartSaveLoad.scala index 23c8335..fbac812 100644 --- a/codechicken/multipart/handler/MultipartSaveLoad.scala +++ b/codechicken/multipart/handler/MultipartSaveLoad.scala @@ -43,7 +43,7 @@ object MultipartSaveLoad classToNameMap.put(t, "savedMultipart") } - def getClassToNameMap() = + def getClassToNameMap = { val field = classOf[TileEntity].getDeclaredField( new ObfMapping("net/minecraft/tileentity/TileEntity", "classToNameMap", "Ljava/util/Map;") @@ -65,11 +65,11 @@ object MultipartSaveLoad if(t != null) { t.setWorldObj(e.getValue.worldObj) - t.validate + t.validate() e.setValue(t) } else - iterator.remove + iterator.remove() } } } diff --git a/codechicken/multipart/handler/packethandlers.scala b/codechicken/multipart/handler/packethandlers.scala index fa8d9dd..853ba18 100644 --- a/codechicken/multipart/handler/packethandlers.scala +++ b/codechicken/multipart/handler/packethandlers.scala @@ -8,11 +8,8 @@ import net.minecraft.client.Minecraft import codechicken.multipart.MultiPartRegistry import net.minecraft.network.NetServerHandler import net.minecraft.entity.player.EntityPlayerMP -import codechicken.multipart.TileMultipart import codechicken.multipart.ControlKeyModifer -import codechicken.multipart.TileMultipart import net.minecraft.network.packet.Packet255KickDisconnect -import net.minecraft.server.MinecraftServer import net.minecraft.world.World import net.minecraft.world.chunk.Chunk import java.util.Map @@ -92,7 +89,7 @@ object MultipartSPH extends MultipartPH with IServerPacketHandler def handlePacket(packet:PacketCustom, netHandler:NetServerHandler, sender:EntityPlayerMP) { - packet.getType() match + packet.getType match { case 1 => ControlKeyModifer.map.put(sender, packet.readBoolean) } @@ -172,6 +169,6 @@ object MultipartSPH extends MultipartPH with IServerPacketHandler .writeShort(num) .writeByteArray(s.getBytes) } - return null; + return null } } diff --git a/codechicken/multipart/handler/proxies.scala b/codechicken/multipart/handler/proxies.scala index 04b0c18..6087595 100644 --- a/codechicken/multipart/handler/proxies.scala +++ b/codechicken/multipart/handler/proxies.scala @@ -1,22 +1,18 @@ package codechicken.multipart.handler import codechicken.multipart.BlockMultipart -import cpw.mods.fml.common.network.PacketDispatcher import cpw.mods.fml.client.registry.RenderingRegistry import cpw.mods.fml.client.registry.ClientRegistry import net.minecraft.tileentity.TileEntity import codechicken.lib.config.ConfigFile -import cpw.mods.fml.common.registry.GameRegistry import java.io.File import codechicken.multipart.handler.MultipartProxy._ import codechicken.multipart.MultipartRenderer -import java.util.HashMap import net.minecraftforge.common.MinecraftForge import codechicken.multipart.MultipartGenerator import cpw.mods.fml.relauncher.SideOnly import cpw.mods.fml.relauncher.Side import codechicken.lib.packet.PacketCustom -import codechicken.multipart.TileMultipart import cpw.mods.fml.client.registry.KeyBindingRegistry import codechicken.multipart.ControlKeyHandler import cpw.mods.fml.common.network.NetworkRegistry @@ -80,7 +76,7 @@ class MultipartProxy_clientImpl extends MultipartProxy_serverImpl override def postInit() { super.postInit() - RenderingRegistry.registerBlockHandler(MultipartRenderer); + RenderingRegistry.registerBlockHandler(MultipartRenderer) PacketCustom.assignHandler(MultipartCPH.channel, MultipartCPH) PacketCustom.assignHandler(MultipartCPH.registryChannel, 1, 127, MultipartCPH) KeyBindingRegistry.registerKeyBinding(ControlKeyHandler) diff --git a/codechicken/multipart/minecraft/McBlockPart.java b/codechicken/multipart/minecraft/McBlockPart.java index 9ea1cbb..17ded3d 100644 --- a/codechicken/multipart/minecraft/McBlockPart.java +++ b/codechicken/multipart/minecraft/McBlockPart.java @@ -38,7 +38,7 @@ public abstract class McBlockPart extends JCuboidPart implements JNormalOcclusio @Override public Iterable getCollisionBoxes() { - return Collections.EMPTY_LIST; + return Collections.emptyList(); } @Override @@ -79,7 +79,7 @@ public abstract class McBlockPart extends JCuboidPart implements JNormalOcclusio } @Override - public void addDestroyEffects(EffectRenderer effectRenderer) + public void addDestroyEffects(MovingObjectPosition hit, EffectRenderer effectRenderer) { IconHitEffects.addDestroyEffects(this, effectRenderer, false); } diff --git a/codechicken/multipart/scalatraits/TFluidHandlerTile.scala b/codechicken/multipart/scalatraits/TFluidHandlerTile.scala index 7afe88a..2d49b37 100644 --- a/codechicken/multipart/scalatraits/TFluidHandlerTile.scala +++ b/codechicken/multipart/scalatraits/TFluidHandlerTile.scala @@ -6,7 +6,6 @@ import codechicken.multipart.TMultiPart import codechicken.multipart.TileMultipart import net.minecraftforge.fluids.IFluidHandler import net.minecraftforge.fluids.FluidStack -import net.minecraftforge.fluids.IFluidTank import net.minecraftforge.fluids.FluidTankInfo import net.minecraftforge.fluids.Fluid diff --git a/codechicken/multipart/scalatraits/TRedstoneTile.scala b/codechicken/multipart/scalatraits/TRedstoneTile.scala index 21efa27..db619e6 100644 --- a/codechicken/multipart/scalatraits/TRedstoneTile.scala +++ b/codechicken/multipart/scalatraits/TRedstoneTile.scala @@ -1,6 +1,5 @@ package codechicken.multipart.scalatraits -import codechicken.multipart.IRedstoneConnector import codechicken.multipart.TileMultipart import codechicken.multipart.IRedstonePart import codechicken.multipart.RedstoneInteractions._ @@ -9,7 +8,6 @@ import codechicken.lib.vec.Rotation._ import codechicken.multipart.IRedstoneTile import codechicken.multipart.TFacePart import codechicken.multipart.TEdgePart -import codechicken.multipart.TEdgePart /** * Mixin trait implementation for IRedstonePart diff --git a/codechicken/multipart/scalatraits/TTileChangeTile.scala b/codechicken/multipart/scalatraits/TTileChangeTile.scala index a750613..76a93ea 100644 --- a/codechicken/multipart/scalatraits/TTileChangeTile.scala +++ b/codechicken/multipart/scalatraits/TTileChangeTile.scala @@ -35,9 +35,7 @@ trait TTileChangeTile extends TileMultipart { override def partRemoved(part:TMultiPart, p:Int) { super.partRemoved(part, p) - weakTileChanges = partList.find{p => - p.isInstanceOf[INeighborTileChange] && p.asInstanceOf[INeighborTileChange].weakTileChanges - }.isDefined + weakTileChanges = partList.exists(p => p.isInstanceOf[INeighborTileChange] && p.asInstanceOf[INeighborTileChange].weakTileChanges) } override def onNeighborTileChange(tileX:Int, tileY:Int, tileZ:Int)