Fixed try catch in Centrifuge, and attempted to fix gear placement issue

This commit is contained in:
Robert S 2014-10-07 19:01:08 -04:00
parent ac0b8b7796
commit 7531417f79
3 changed files with 28 additions and 35 deletions

View file

@ -120,18 +120,9 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
def read(data: ByteBuf, player: EntityPlayer, `type`: PacketType)
{
try
{
this.timer = data.readInt
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID, data.readInt))
}
catch
{
case e: Exception =>
{
e.printStackTrace
}
}
this.timer = data.readInt
this.gasTank.setFluid(new FluidStack(AtomicContent.FLUIDSTACK_URANIUM_HEXAFLOURIDE.fluidID, data.readInt))
}
override def getDescriptionPacket: Packet =

View file

@ -1,7 +1,7 @@
package resonantinduction.core
import codechicken.multipart.MultiPartRegistry.IPartFactory
import codechicken.multipart.{MultipartGenerator, MultiPartRegistry, TMultiPart}
import codechicken.multipart.{MultiPartRegistry, MultipartGenerator, TMultiPart}
import scala.collection.mutable
@ -10,29 +10,29 @@ import scala.collection.mutable
*/
object ResonantPartFactory extends IPartFactory
{
val prefix = Reference.prefix
private val partMap = mutable.Map.empty[String, Class[_ <: TMultiPart]]
val prefix = Reference.prefix
private val partMap = mutable.Map.empty[String, Class[_ <: TMultiPart]]
def register(part: Class[_ <: TMultiPart])
{
partMap += (prefix + part.getSimpleName -> part)
}
def register(part: Class[_ <: TMultiPart])
{
partMap += (prefix + part.getSimpleName -> part)
}
def create[C <: TMultiPart](part: Class[C]): C = MultiPartRegistry.createPart((partMap map (_.swap)).get(part).get, false).asInstanceOf[C]
def create[C <: TMultiPart](part: Class[C]): C = MultiPartRegistry.createPart((partMap map (_.swap)).get(part).get, false).asInstanceOf[C]
def init()
{
MultiPartRegistry.registerParts(this, partMap.keys.toArray)
def init()
{
MultiPartRegistry.registerParts(this, partMap.keys.toArray)
MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.pass.TNodeProvider")
MultipartGenerator.registerPassThroughInterface("net.minecraftforge.fluids.IFluidHandler")
}
MultipartGenerator.registerTrait("universalelectricity.api.core.grid.INodeProvider", "resonantinduction.core.prefab.pass.TNodeProvider")
MultipartGenerator.registerPassThroughInterface("net.minecraftforge.fluids.IFluidHandler")
}
def createPart(name: String, client: Boolean): TMultiPart =
{
if(partMap.contains(name))
return partMap(name).newInstance()
else
return null
}
def createPart(name: String, client: Boolean): TMultiPart =
{
if (partMap.contains(name))
return partMap(name).newInstance()
else
return null
}
}

View file

@ -4,13 +4,14 @@ import java.util.List
import codechicken.lib.vec.{BlockCoord, Vector3}
import codechicken.microblock.FacePlacementGrid
import codechicken.multipart.{JItemMultiPart, MultiPartRegistry, PartMap, TMultiPart, TileMultipart}
import codechicken.multipart.{JItemMultiPart, PartMap, TMultiPart, TileMultipart}
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.{Item, ItemStack}
import net.minecraft.tileentity.TileEntity
import net.minecraft.world.World
import resonant.lib.wrapper.WrapList._
import resonantinduction.core.ResonantPartFactory
import resonantinduction.core.prefab.part.IHighlight
import resonantinduction.mechanical.mech.gearshaft.PartGearShaft
@ -26,7 +27,8 @@ class ItemGear extends JItemMultiPart with IHighlight
override def newPart(itemStack: ItemStack, player: EntityPlayer, world: World, pos: BlockCoord, s: Int, hit: Vector3): TMultiPart =
{
val part: PartGear = MultiPartRegistry.createPart("resonant_induction_gear", false).asInstanceOf[PartGear]
val part: PartGear = ResonantPartFactory.create(classOf[PartGear])
var side: Int = FacePlacementGrid.getHitSlot(hit, s)
val tile: TileEntity = world.getTileEntity(pos.x, pos.y, pos.z)
if (tile.isInstanceOf[TileMultipart])