Fixed MicroblockHighlightHandler SubscribeEvent
This commit is contained in:
parent
6328ced137
commit
806c2cc0ef
3 changed files with 21 additions and 21 deletions
|
@ -15,7 +15,7 @@ import resonantinduction.archaic.ArchaicContent
|
|||
import resonantinduction.atomic.AtomicContent
|
||||
import resonantinduction.core.handler.TextureHookHandler
|
||||
import resonantinduction.electrical.ElectricalContent
|
||||
import resonantinduction.mechanical.MechanicalContent
|
||||
import resonantinduction.mechanical.{MechanicalContent, MicroblockHighlightHandler}
|
||||
|
||||
import scala.collection.convert.wrapAll._
|
||||
|
||||
|
@ -45,7 +45,8 @@ final object ResonantInduction
|
|||
Settings.config = new Configuration(evt.getSuggestedConfigurationFile)
|
||||
ConfigHandler.sync(Settings, Settings.config)
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new TextureHookHandler)
|
||||
MinecraftForge.EVENT_BUS.register(TextureHookHandler)
|
||||
MinecraftForge.EVENT_BUS.register(MicroblockHighlightHandler)
|
||||
|
||||
loadables.applyModule(proxy)
|
||||
loadables.applyModule(packetHandler)
|
||||
|
|
|
@ -10,9 +10,8 @@ import resonantinduction.core.Reference
|
|||
/** Event handler for texture events
|
||||
* @author Calclavia
|
||||
*/
|
||||
class TextureHookHandler
|
||||
object TextureHookHandler
|
||||
{
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
def preTextureHook(event: TextureStitchEvent.Pre)
|
||||
|
@ -40,7 +39,8 @@ class TextureHookHandler
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT) def postTextureHook(event: TextureStitchEvent.Post)
|
||||
@SideOnly(Side.CLIENT)
|
||||
def postTextureHook(event: TextureStitchEvent.Post)
|
||||
{
|
||||
AtomicContent.FLUID_URANIUM_HEXAFLOURIDE.setIcons(RenderUtility.loadedIconMap.get(Reference.prefix + "uraniumHexafluoride"))
|
||||
AtomicContent.FLUID_STEAM.setIcons(RenderUtility.loadedIconMap.get(Reference.prefix + "steam"))
|
||||
|
|
|
@ -1,38 +1,37 @@
|
|||
package resonantinduction.mechanical
|
||||
|
||||
import cpw.mods.fml.common.Mod
|
||||
import codechicken.lib.render.RenderUtils
|
||||
import codechicken.lib.vec.Vector3
|
||||
import codechicken.microblock.{CornerPlacementGrid, FacePlacementGrid}
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
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
|
||||
object MicroblockHighlightHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
@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)
|
||||
if (event.currentItem != null && event.currentItem.getItem.isInstanceOf[IHighlight] && event.target != null && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
|
||||
{
|
||||
GL11.glPushMatrix
|
||||
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)
|
||||
if (t == 0)
|
||||
{
|
||||
FacePlacementGrid.render(hit, event.target.sideHit)
|
||||
FacePlacementGrid.render(hit, event.target.sideHit)
|
||||
}
|
||||
if(t == 1)
|
||||
if (t == 1)
|
||||
{
|
||||
CornerPlacementGrid.render(hit, event.target.sideHit)
|
||||
CornerPlacementGrid.render(hit, event.target.sideHit)
|
||||
}
|
||||
event.setCanceled(true)
|
||||
GL11.glPopMatrix
|
||||
GL11.glPopMatrix()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue