Update laser content to use RI reference object

This commit is contained in:
Robert S 2014-08-13 10:17:56 -04:00
parent e522ddeb14
commit 5cd22a8dd0
18 changed files with 57 additions and 55 deletions

View file

@ -34,4 +34,5 @@ final object Reference
final val itemTextureDirectory: String = textureDirectory + "items/"
final val modelPath: String = "models/"
final val modelDirectory: String = assetDirectory + modelPath
final val FX_DIRECTORY = textureDirectory + "fx/"
}

View file

@ -2,14 +2,13 @@ package resonantinduction.electrical
import codechicken.multipart.{TMultiPart, TileMultipart}
import cpw.mods.fml.client.FMLClientHandler
import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
import cpw.mods.fml.client.registry.ClientRegistry
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.block.Block
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import resonantinduction.electrical.battery.{RenderBattery, TileBattery}
import resonantinduction.electrical.laser.BlockRenderingHandler
import resonantinduction.electrical.laser.fx.{EntityBlockParticleFX, EntityLaserFX, EntityScorchFX}
import resonantinduction.electrical.multimeter.{GuiMultimeter, PartMultimeter}
import resonantinduction.electrical.render.FXElectricBolt
@ -24,7 +23,7 @@ import universalelectricity.core.transform.vector.Vector3
}
override def init {
RenderingRegistry.registerBlockHandler(new BlockRenderingHandler.type)
//RenderingRegistry.registerBlockHandler(new BlockRenderingHandler.type)
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileLaserEmitter), RenderLaserEmitter)
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileMirror), RenderMirror)
//ClientRegistry.bindTileEntitySpecialRenderer(classOf(TileFocusCrystal), RenderFocusCrystal)

View file

@ -15,7 +15,7 @@ import resonant.lib.loadable.LoadableHandler
import resonantinduction.atomic.gate.ItemQuantumGlyph
import resonantinduction.core.resource.ItemResourcePart
import resonantinduction.core.{Reference, ResonantTab, Settings}
import resonantinduction.electrical.battery.{BlockBattery, ItemBlockBattery, TileBattery}
import resonantinduction.electrical.battery.{ItemBlockBattery, TileBattery}
import resonantinduction.electrical.generator.{TileMotor, TileSolarPanel, TileThermopile}
import resonantinduction.electrical.laser.emitter.BlockLaserEmitter
import resonantinduction.electrical.laser.focus.ItemFocusingMatrix
@ -75,7 +75,7 @@ object Electrical {
ElectricalContent.itemMultimeter = Electrical.contentRegistry.newItem(classOf[ItemMultimeter])
ElectricalContent.itemTransformer = Electrical.contentRegistry.newItem(classOf[ItemElectricTransformer])
ElectricalContent.blockTesla = Electrical.contentRegistry.newBlock(classOf[TileTesla])
ElectricalContent.blockBattery = Electrical.contentRegistry.newBlock(classOf[BlockBattery], classOf[ItemBlockBattery], classOf[TileBattery])
ElectricalContent.blockBattery = Electrical.contentRegistry.newBlock(classOf[TileBattery])
ElectricalContent.itemLevitator = Electrical.contentRegistry.newItem(classOf[ItemLevitator])
ElectricalContent.itemInsulation = Electrical.contentRegistry.newItem("insulation", classOf[ItemResourcePart])
ElectricalContent.blockSolarPanel = Electrical.contentRegistry.newBlock(classOf[TileSolarPanel])

View file

@ -10,7 +10,7 @@ import net.minecraft.item.ItemDye
import net.minecraft.tileentity.TileEntityFurnace
import net.minecraft.util.{DamageSource, MovingObjectPosition}
import net.minecraft.world.World
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.electrical.Electrical
import universalelectricity.core.transform.vector.Vector3
import scala.collection.mutable
@ -67,12 +67,12 @@ object Laser
{
if (!hitTile.asInstanceOf[ILaserHandler].onLaserHit(renderStart, direction, hit, color, energy))
{
ElectromagneticCoherence.proxy.renderLaser(world, renderStart, hitVec, color, energy)
Electrical.proxy.renderLaser(world, renderStart, hitVec, color, energy)
}
}
else if (hitBlock.getMaterial == Material.glass)
{
ElectromagneticCoherence.proxy.renderLaser(world, renderStart, hitVec, color, energy)
Electrical.proxy.renderLaser(world, renderStart, hitVec, color, energy)
var newColor = color
if (hitBlock.isInstanceOf[BlockStainedGlass] || hitBlock.isInstanceOf[BlockStainedGlassPane])
@ -168,13 +168,13 @@ object Laser
/**
* Render laser hit
*/
ElectromagneticCoherence.proxy.renderLaser(world, renderStart, hitVec, color, energy)
Electrical.proxy.renderLaser(world, renderStart, hitVec, color, energy)
/**
* Render scorch and particles
*/
ElectromagneticCoherence.proxy.renderScorch(world, hitVec - (direction * 0.02), hit.sideHit)
ElectromagneticCoherence.proxy.renderBlockParticle(world, hitVec, hitBlock, hit.sideHit)
Electrical.proxy.renderScorch(world, hitVec - (direction * 0.02), hit.sideHit)
Electrical.proxy.renderBlockParticle(world, hitVec, hitBlock, hit.sideHit)
}
}
else if (hit.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)
@ -190,13 +190,13 @@ object Laser
}
}
ElectromagneticCoherence.proxy.renderLaser(world, renderStart, new Vector3(hit.hitVec), color, energy)
Electrical.proxy.renderLaser(world, renderStart, new Vector3(hit.hitVec), color, energy)
}
return
}
ElectromagneticCoherence.proxy.renderLaser(world, renderStart, maxPos, color, energy)
Electrical.proxy.renderLaser(world, renderStart, maxPos, color, energy)
}
}

View file

@ -7,7 +7,7 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.{IBlockAccess, World}
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
import resonantinduction.electrical.laser.{BlockRenderingHandler, Laser}
/**
@ -15,7 +15,7 @@ import resonantinduction.electrical.laser.{BlockRenderingHandler, Laser}
*/
class BlockLaserEmitter extends BlockContainer(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "laserEmitter")
setBlockName(Reference.prefix + "laserEmitter")
setBlockTextureName("stone")
/**

View file

@ -9,7 +9,7 @@ import net.minecraftforge.client.model.AdvancedModelLoader
import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
/**
* @author Calclavia
@ -17,8 +17,8 @@ import resonantinduction.electrical.em.ElectromagneticCoherence
@SideOnly(Side.CLIENT)
object RenderLaserEmitter extends TileEntitySpecialRenderer
{
val model = AdvancedModelLoader.loadModel(new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "laserEmitter.tcn"))
val texture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "laserEmitter.png")
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelDirectory + "laserEmitter.tcn"))
val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "laserEmitter.png")
def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float)
{

View file

@ -6,8 +6,7 @@ import net.minecraft.item.{Item, ItemStack}
import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.{ChatComponentText, EnumChatFormatting}
import net.minecraft.world.World
import resonantinduction.core.ResonantTab
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.{Reference, ResonantTab}
import universalelectricity.core.transform.rotation.Quaternion
import universalelectricity.core.transform.vector.Vector3
@ -19,8 +18,8 @@ import scala.util.Random
*/
class ItemFocusingMatrix extends Item
{
setUnlocalizedName(ElectromagneticCoherence.PREFIX + "focusingMatrix")
setTextureName(ElectromagneticCoherence.PREFIX + "focusingMatrix")
setUnlocalizedName(Reference.prefix + "focusingMatrix")
setTextureName(Reference.prefix + "focusingMatrix")
setCreativeTab(ResonantTab)
/**

View file

@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.block.material.Material
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
import resonantinduction.electrical.laser.BlockRenderingHandler
import resonantinduction.electrical.laser.focus.BlockFocusBase
@ -13,7 +13,7 @@ import resonantinduction.electrical.laser.focus.BlockFocusBase
*/
class BlockFocusCrystal extends BlockFocusBase(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "focusCrystal")
setBlockName(Reference.prefix + "focusCrystal")
setBlockTextureName("glass")
override def createNewTileEntity(world: World, metadata: Int): TileEntity =

View file

@ -8,7 +8,7 @@ import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.AdvancedModelLoader
import org.lwjgl.opengl.GL11
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
/**
* @author Calclavia
@ -16,8 +16,8 @@ import resonantinduction.electrical.em.ElectromagneticCoherence
@SideOnly(Side.CLIENT)
object RenderFocusCrystal extends TileEntitySpecialRenderer
{
val model = AdvancedModelLoader.loadModel(new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "focusCrystal.tcn"))
val texture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "focusCrystal.png")
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelDirectory + "focusCrystal.tcn"))
val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "focusCrystal.png")
def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float)
{

View file

@ -5,7 +5,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity
import net.minecraft.network.{NetworkManager, Packet}
import net.minecraft.util.MovingObjectPosition
import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.electrical.Electrical
import resonantinduction.electrical.laser.focus.IFocus
import resonantinduction.electrical.laser.{ILaserHandler, Laser, TileBase}
import universalelectricity.core.transform.rotation.Quaternion
@ -66,7 +66,7 @@ class TileFocusCrystal extends TileBase with ILaserHandler with IFocus
override def onLaserHit(renderStart: Vector3, incidentDirection: Vector3, hit: MovingObjectPosition, color: Vector3, energy: Double): Boolean =
{
ElectromagneticCoherence.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
Electrical.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
this.energy += energy
this.color = (this.color + color) / 2
return true

View file

@ -4,8 +4,7 @@ import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.block.material.Material
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import resonantinduction.core.ResonantTab
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.{Reference, ResonantTab}
import resonantinduction.electrical.laser.BlockRenderingHandler
import resonantinduction.electrical.laser.focus.BlockFocusBase
@ -14,7 +13,7 @@ import resonantinduction.electrical.laser.focus.BlockFocusBase
*/
class BlockMirror extends BlockFocusBase(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "mirror")
setBlockName(Reference.prefix + "mirror")
setBlockTextureName("stone")
setCreativeTab(ResonantTab)

View file

@ -8,7 +8,7 @@ import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.AdvancedModelLoader
import org.lwjgl.opengl.GL11
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
/**
* @author Calclavia
@ -16,8 +16,8 @@ import resonantinduction.electrical.em.ElectromagneticCoherence
@SideOnly(Side.CLIENT)
object RenderMirror extends TileEntitySpecialRenderer
{
val model = AdvancedModelLoader.loadModel(new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "mirror.tcn"))
val texture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "mirror.png")
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "mirror.tcn"))
val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "mirror.png")
def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float)
{

View file

@ -5,7 +5,7 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity
import net.minecraft.network.{NetworkManager, Packet}
import net.minecraft.util.MovingObjectPosition
import net.minecraftforge.common.util.ForgeDirection
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.electrical.Electrical
import resonantinduction.electrical.laser.focus.IFocus
import resonantinduction.electrical.laser.{ILaserHandler, Laser, TileBase}
import universalelectricity.core.transform.rotation.Quaternion
@ -70,7 +70,7 @@ class TileMirror extends TileBase with ILaserHandler with IFocus
/**
* Render incoming laser
*/
ElectromagneticCoherence.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
Electrical.proxy.renderLaser(worldObj, renderStart, position + 0.5, color, energy)
/**
* Calculate Reflection

View file

@ -7,7 +7,8 @@ import net.minecraft.client.renderer.Tessellator
import net.minecraft.util.ResourceLocation
import net.minecraft.world.World
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
import resonantinduction.electrical.ElectricalContent
import resonantinduction.electrical.laser.Laser
import universalelectricity.core.transform.vector.Vector3
@ -17,10 +18,10 @@ import universalelectricity.core.transform.vector.Vector3
@SideOnly(Side.CLIENT)
class EntityLaserFX(par1World: World, start: Vector3, end: Vector3, color: Vector3, energy: Double) extends EntityFX(par1World, start.x, start.y, start.z)
{
val laserStartTexture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.FX_DIRECTORY + "laserStart.png")
val laserMiddleTexture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.FX_DIRECTORY + "laserMiddle.png")
val laserEndTexture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.FX_DIRECTORY + "laserEnd.png")
val laserNoiseTexture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.FX_DIRECTORY + "noise.png")
val laserStartTexture = new ResourceLocation(Reference.domain, Reference.FX_DIRECTORY + "laserStart.png")
val laserMiddleTexture = new ResourceLocation(Reference.domain, Reference.FX_DIRECTORY + "laserMiddle.png")
val laserEndTexture = new ResourceLocation(Reference.domain, Reference.FX_DIRECTORY + "laserEnd.png")
val laserNoiseTexture = new ResourceLocation(Reference.domain, Reference.FX_DIRECTORY + "noise.png")
val energyPercentage = Math.min(energy / Laser.maxEnergy, 1).toFloat
@ -187,7 +188,7 @@ class EntityLaserFX(par1World: World, start: Vector3, end: Vector3, color: Vecto
glPopMatrix()
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ElectromagneticCoherence.particleTextures)
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ElectricalContent.particleTextures)
tessellator.startDrawingQuads()
}

View file

@ -8,7 +8,8 @@ import net.minecraft.util.ResourceLocation
import net.minecraft.world.World
import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
import resonantinduction.electrical.ElectricalContent
import universalelectricity.core.transform.vector.Vector3
/**
@ -18,7 +19,7 @@ import universalelectricity.core.transform.vector.Vector3
@SideOnly(Side.CLIENT)
class EntityScorchFX(par1World: World, position: Vector3, side: Int) extends EntityFX(par1World, position.x, position.y, position.z)
{
val texture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.FX_DIRECTORY + "scorch.png")
val texture = new ResourceLocation(Reference.domain, Reference.FX_DIRECTORY + "scorch.png")
lastTickPosX = posX
lastTickPosY = posY
@ -101,7 +102,7 @@ class EntityScorchFX(par1World: World, position: Vector3, side: Int) extends Ent
glPopMatrix()
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ElectromagneticCoherence.particleTextures)
FMLClientHandler.instance().getClient().renderEngine.bindTexture(ElectricalContent.particleTextures)
tessellator.startDrawingQuads()
}

View file

@ -7,7 +7,7 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.item.ItemStack
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.{IBlockAccess, World}
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
import resonantinduction.electrical.laser.BlockRenderingHandler
/**
@ -15,7 +15,7 @@ import resonantinduction.electrical.laser.BlockRenderingHandler
*/
class BlockLaserReceiver extends BlockContainer(Material.rock)
{
setBlockName(ElectromagneticCoherence.PREFIX + "laserReceiver")
setBlockName(Reference.prefix + "laserReceiver")
setBlockTextureName("stone")
/**

View file

@ -9,7 +9,7 @@ import net.minecraftforge.client.model.AdvancedModelLoader
import net.minecraftforge.common.util.ForgeDirection
import org.lwjgl.opengl.GL11
import org.lwjgl.opengl.GL11._
import resonantinduction.electrical.em.ElectromagneticCoherence
import resonantinduction.core.Reference
/**
* @author Calclavia
@ -17,8 +17,8 @@ import resonantinduction.electrical.em.ElectromagneticCoherence
@SideOnly(Side.CLIENT)
object RenderLaserReceiver extends TileEntitySpecialRenderer
{
val model = AdvancedModelLoader.loadModel(new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "laserReceiver.tcn"))
val texture = new ResourceLocation(ElectromagneticCoherence.DOMAIN, ElectromagneticCoherence.MODEL_PATH_NAME + "laserReceiver.png")
val model = AdvancedModelLoader.loadModel(new ResourceLocation(Reference.domain, Reference.modelPath + "laserReceiver.tcn"))
val texture = new ResourceLocation(Reference.domain, Reference.modelPath + "laserReceiver.png")
def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, f: Float)
{

View file

@ -5,6 +5,8 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
@ -49,7 +51,7 @@ public class PartFlatSwitchWire extends PartFlatWire
TileMultipart tile = tile();
World w = world();
if (item.getItem().itemID == Block.lever.blockID)
if (item.getItem() == Item.getItemFromBlock(Blocks.lever))
{
if (!w.isRemote)
{
@ -63,7 +65,7 @@ public class PartFlatSwitchWire extends PartFlatWire
if (!player.capabilities.isCreativeMode)
{
tile.dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
tile.dropItems(Collections.singletonList(new ItemStack(Blocks.lever, 1)));
}
}
}
@ -78,7 +80,7 @@ public class PartFlatSwitchWire extends PartFlatWire
@Override
public void drop()
{
tile().dropItems(Collections.singletonList(new ItemStack(Block.lever, 1)));
tile().dropItems(Collections.singletonList(new ItemStack(Blocks.lever, 1)));
super.drop();
}
@ -86,7 +88,7 @@ public class PartFlatSwitchWire extends PartFlatWire
public Iterable<ItemStack> getDrops()
{
List<ItemStack> drops = (List<ItemStack>) super.getDrops();
drops.add(new ItemStack(Block.lever, 1));
drops.add(new ItemStack(Blocks.lever, 1));
return drops;
}