Fixed accelerator & centrifuge packet write error, and added a temp dir side texture to accelerator

This commit is contained in:
Robert S 2014-10-22 14:49:47 -04:00
parent 1c867b2ce0
commit 6ece9c2367
4 changed files with 18 additions and 8 deletions

View file

@ -37,7 +37,7 @@ object EntityParticle
def canSpawnParticle(world: World, pos: Vector3): Boolean = def canSpawnParticle(world: World, pos: Vector3): Boolean =
{ {
val block: Block = pos.getBlock(world) val block: Block = pos.getBlock(world)
if (block != null && !block.isAir(world, pos.xi, pos.yi, pos.zi)) if (block == null || !block.isAir(world, pos.xi, pos.yi, pos.zi))
{ {
var electromagnetCount = 0 var electromagnetCount = 0
for (i <- 0 until 6) for (i <- 0 until 6)

View file

@ -16,8 +16,7 @@ class GuiAccelerator(player: EntityPlayer, tileEntity: TileAccelerator) extends
{ {
this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752) this.fontRendererObj.drawString("Accelerator", 40, 10, 4210752)
var status: String = "" var status: String = ""
val position: Vector3 = tileEntity.asVector3 val position: Vector3 = tileEntity.asVector3 + tileEntity.getDirection.getOpposite
position.add(this.tileEntity.getDirection.getOpposite)
if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position)) if (!EntityParticle.canSpawnParticle(this.tileEntity.world, position))
{ {
status = "\u00a74Fail to emit; try rotating." status = "\u00a74Fail to emit; try rotating."

View file

@ -1,11 +1,13 @@
package resonantinduction.atomic.machine.accelerator package resonantinduction.atomic.machine.accelerator
import cpw.mods.fml.relauncher.{Side, SideOnly}
import io.netty.buffer.ByteBuf import io.netty.buffer.ByteBuf
import net.minecraft.block.Block import net.minecraft.block.Block
import net.minecraft.block.material.Material import net.minecraft.block.material.Material
import net.minecraft.entity.player.EntityPlayer import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagCompound
import net.minecraft.util.IIcon
import net.minecraftforge.common.util.ForgeDirection import net.minecraftforge.common.util.ForgeDirection
import resonant.api.{IElectromagnet, IRotatable} import resonant.api.{IElectromagnet, IRotatable}
import resonant.lib.content.prefab.java.TileElectricInventory import resonant.lib.content.prefab.java.TileElectricInventory
@ -16,6 +18,7 @@ import resonantinduction.atomic.AtomicContent
import resonantinduction.atomic.items.ItemAntimatter import resonantinduction.atomic.items.ItemAntimatter
import resonantinduction.core.{Reference, ResonantInduction, Settings} import resonantinduction.core.{Reference, ResonantInduction, Settings}
import universalelectricity.core.transform.vector.Vector3 import universalelectricity.core.transform.vector.Vector3
import scala.collection.JavaConversions._ import scala.collection.JavaConversions._
class TileAccelerator extends TileElectricInventory(Material.iron) with IElectromagnet with IRotatable with TPacketIDReceiver class TileAccelerator extends TileElectricInventory(Material.iron) with IElectromagnet with IRotatable with TPacketIDReceiver
@ -225,7 +228,7 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
override def getDescPacket: PacketTile = override def getDescPacket: PacketTile =
{ {
return new PacketTile(xi, yi, zi, Array(DESC_PACKET_ID, velocity, totalEnergyConsumed, antimatter, energy.getEnergy)) return new PacketTile(xi, yi, zi, Array[Any](DESC_PACKET_ID, velocity, totalEnergyConsumed, antimatter, energy.getEnergy))
} }
///////////////////////////////////////// /////////////////////////////////////////
@ -303,4 +306,14 @@ class TileAccelerator extends TileElectricInventory(Material.iron) with IElectro
else else
return 0 return 0
} }
@SideOnly(Side.CLIENT)
override def getIcon(side: Int, meta: Int): IIcon =
{
if(side == getDirection.getOpposite.ordinal())
{
return AtomicContent.blockElectromagnet.getIcon(side, meta)
}
return getIcon
}
} }

View file

@ -6,11 +6,9 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.inventory.IInventory import net.minecraft.inventory.IInventory
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraft.nbt.NBTTagCompound import net.minecraft.nbt.NBTTagCompound
import net.minecraft.network.Packet
import net.minecraft.tileentity.TileEntity import net.minecraft.tileentity.TileEntity
import net.minecraftforge.common.util.ForgeDirection import net.minecraftforge.common.util.ForgeDirection
import net.minecraftforge.fluids._ import net.minecraftforge.fluids._
import resonant.engine.ResonantEngine
import resonant.lib.content.prefab.java.TileElectricInventory import resonant.lib.content.prefab.java.TileElectricInventory
import resonant.lib.network.discriminator.{PacketTile, PacketType} import resonant.lib.network.discriminator.{PacketTile, PacketType}
import resonant.lib.network.handle.IPacketReceiver import resonant.lib.network.handle.IPacketReceiver
@ -125,9 +123,9 @@ class TileCentrifuge extends TileElectricInventory(Material.iron) with IPacketRe
} }
override def getDescriptionPacket: Packet = override def getDescPacket: PacketTile =
{ {
return ResonantEngine.instance.packetHandler.toMCPacket(new PacketTile(xi, yi, zi, Array(this.timer, AtomicContent.getFluidAmount(this.gasTank.getFluid)))) return new PacketTile(xi, yi, zi, Array[Any](this.timer, AtomicContent.getFluidAmount(this.gasTank.getFluid)))
} }
/** /**