Converted two classes to scala
This commit is contained in:
parent
6ad354036f
commit
d6f22b8446
4 changed files with 62 additions and 76 deletions
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
|
@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue