From d6f22b844691912287f76847cb3f48bce23100d1 Mon Sep 17 00:00:00 2001 From: Robert S Date: Tue, 23 Sep 2014 08:51:46 -0400 Subject: [PATCH] Converted two classes to scala --- .../mechanical/CommonProxy.java | 34 --------------- .../mechanical/CommonProxy.scala | 24 +++++++++++ .../MicroblockHighlightHandler.java | 42 ------------------- .../MicroblockHighlightHandler.scala | 38 +++++++++++++++++ 4 files changed, 62 insertions(+), 76 deletions(-) delete mode 100644 src/main/scala/resonantinduction/mechanical/CommonProxy.java create mode 100644 src/main/scala/resonantinduction/mechanical/CommonProxy.scala delete mode 100644 src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.java create mode 100644 src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.scala diff --git a/src/main/scala/resonantinduction/mechanical/CommonProxy.java b/src/main/scala/resonantinduction/mechanical/CommonProxy.java deleted file mode 100644 index 9b567f4e6..000000000 --- a/src/main/scala/resonantinduction/mechanical/CommonProxy.java +++ /dev/null @@ -1,34 +0,0 @@ -package resonantinduction.mechanical; - - -import cpw.mods.fml.common.network.IGuiHandler; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public class CommonProxy implements IGuiHandler -{ - public void preInit() - { - - } - - public void init() - { - - } - - public void postInit() - { - - } - - @Override - public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return null; - } - - @Override - public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { - return null; - } -} diff --git a/src/main/scala/resonantinduction/mechanical/CommonProxy.scala b/src/main/scala/resonantinduction/mechanical/CommonProxy.scala new file mode 100644 index 000000000..9a7d6b156 --- /dev/null +++ b/src/main/scala/resonantinduction/mechanical/CommonProxy.scala @@ -0,0 +1,24 @@ +package resonantinduction.mechanical + +import cpw.mods.fml.common.network.IGuiHandler +import net.minecraft.entity.player.EntityPlayer +import net.minecraft.world.World + +class CommonProxy extends IGuiHandler { + def preInit { + } + + def init { + } + + def postInit { + } + + def getServerGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): AnyRef = { + return null + } + + def getClientGuiElement(ID: Int, player: EntityPlayer, world: World, x: Int, y: Int, z: Int): AnyRef = { + return null + } +} \ No newline at end of file diff --git a/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.java b/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.java deleted file mode 100644 index 7c6306693..000000000 --- a/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.java +++ /dev/null @@ -1,42 +0,0 @@ -package resonantinduction.mechanical; - -import cpw.mods.fml.common.Mod; -import net.minecraft.util.MovingObjectPosition; -import net.minecraftforge.client.event.DrawBlockHighlightEvent; - -import org.lwjgl.opengl.GL11; - -import resonantinduction.core.prefab.part.IHighlight; -import codechicken.lib.render.RenderUtils; -import codechicken.lib.vec.Vector3; -import codechicken.microblock.CornerPlacementGrid$; -import codechicken.microblock.FacePlacementGrid$; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class MicroblockHighlightHandler -{ - @Mod.EventHandler - @SideOnly(Side.CLIENT) - public void drawBlockHighlight(DrawBlockHighlightEvent event) - { - if (event.currentItem != null && (event.currentItem.getItem() instanceof IHighlight) && event.target != null && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - GL11.glPushMatrix(); - RenderUtils.translateToWorldCoords(event.player, event.partialTicks); - Vector3 hit = new Vector3(event.target.hitVec); - - switch (((IHighlight) event.currentItem.getItem()).getHighlightType()) - { - case 0: - FacePlacementGrid$.MODULE$.render(hit, event.target.sideHit); - break; - case 1: - CornerPlacementGrid$.MODULE$.render(hit, event.target.sideHit); - } - - event.setCanceled(true); - GL11.glPopMatrix(); - } - } -} diff --git a/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.scala b/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.scala new file mode 100644 index 000000000..71bbece2e --- /dev/null +++ b/src/main/scala/resonantinduction/mechanical/MicroblockHighlightHandler.scala @@ -0,0 +1,38 @@ +package resonantinduction.mechanical + +import cpw.mods.fml.common.Mod +import net.minecraft.util.MovingObjectPosition +import net.minecraftforge.client.event.DrawBlockHighlightEvent +import org.lwjgl.opengl.GL11 +import resonantinduction.core.prefab.part.IHighlight +import codechicken.lib.render.RenderUtils +import codechicken.lib.vec.Vector3 +import codechicken.microblock.CornerPlacementGrid +import codechicken.microblock.FacePlacementGrid +import cpw.mods.fml.relauncher.Side +import cpw.mods.fml.relauncher.SideOnly + +class MicroblockHighlightHandler { + @Mod.EventHandler + @SideOnly(Side.CLIENT) + def drawBlockHighlight(event: DrawBlockHighlightEvent) + { + if (event.currentItem != null && (event.currentItem.getItem.isInstanceOf[IHighlight]) && event.target != null && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + { + GL11.glPushMatrix + RenderUtils.translateToWorldCoords(event.player, event.partialTicks) + val hit: Vector3 = new Vector3(event.target.hitVec) + val t = event.currentItem.getItem.asInstanceOf[IHighlight].getHighlightType + if(t == 0) + { + FacePlacementGrid.render(hit, event.target.sideHit) + } + if(t == 1) + { + CornerPlacementGrid.render(hit, event.target.sideHit) + } + event.setCanceled(true) + GL11.glPopMatrix + } + } +} \ No newline at end of file