diff --git a/li/cil/oc/common/tileentity/AbstractBusAware.scala b/li/cil/oc/common/tileentity/AbstractBusAware.scala index 17026375f..2a4220b1a 100644 --- a/li/cil/oc/common/tileentity/AbstractBusAware.scala +++ b/li/cil/oc/common/tileentity/AbstractBusAware.scala @@ -25,7 +25,7 @@ trait AbstractBusAware extends TileEntity with ComponentInventory with IBusDevic def getZCoord = z protected def hasAbstractBusCard = components exists { - case abstractBus: component.AbstractBus => true + case _: component.AbstractBus => true } override protected def onItemAdded(slot: Int, stack: ItemStack) { @@ -57,13 +57,8 @@ trait AbstractBusAware extends TileEntity with ComponentInventory with IBusDevic addAbstractBus() } - override def onChunkUnload() { - super.onChunkUnload() - removeAbstractBus() - } - - override def invalidate() { - super.onChunkUnload() + abstract override def onDisconnect(node: Node) { + super.onDisconnect(node) removeAbstractBus() } diff --git a/li/cil/oc/server/component/AbstractBus.scala b/li/cil/oc/server/component/AbstractBus.scala index 1ab8268f5..fba5c5dc6 100644 --- a/li/cil/oc/server/component/AbstractBus.scala +++ b/li/cil/oc/server/component/AbstractBus.scala @@ -28,8 +28,7 @@ class AbstractBus(val owner: tileentity.Computer) extends ManagedComponent with def handlePacket(packet: BusPacket) { val lip = packet.getPlainText val data = Map(lip.getEntryList.map(key => (key, lip.get(key))): _*) - // TODO do we want to push metadata, too? - val metadata = Map("mod" -> "", "device" -> "", "player" -> "") + val metadata = Map("mod" -> lip.getMetadata.modID, "device" -> lip.getMetadata.deviceName, "player" -> lip.getMetadata.playerName) owner.signal("bus_message", Int.box(packet.getProtocolID), Int.box(packet.getSender), Int.box(packet.getTarget), data, metadata) } diff --git a/stargatetech2/api/bus/BusPacketLIP.java b/stargatetech2/api/bus/BusPacketLIP.java index f1237aba1..063d19b89 100644 --- a/stargatetech2/api/bus/BusPacketLIP.java +++ b/stargatetech2/api/bus/BusPacketLIP.java @@ -59,6 +59,13 @@ public final class BusPacketLIP extends BusPacket { this.metadata = metadata; } } + + /** + * @return The LIPMetadata object on this object. May be null. + */ + public LIPMetadata getMetadata(){ + return metadata; + } @Override // We don't need this. At all. protected void fillPlainText(BusPacketLIP lip){} diff --git a/stargatetech2/api/stargate/Address.java b/stargatetech2/api/stargate/Address.java index 516902c17..5f7caa404 100644 --- a/stargatetech2/api/stargate/Address.java +++ b/stargatetech2/api/stargate/Address.java @@ -6,8 +6,8 @@ public class Address { public static Address create(Symbol[] symbols){ try{ boolean used[] = new boolean[40]; - if(symbols.length < 7) throw new Exception("Address too short."); - if(symbols.length > 9) throw new Exception("Address too long."); + if(symbols.length < 7) throw new Exception("Address too short: " + symbols.length); + if(symbols.length > 9) throw new Exception("Address too long: " + symbols.length); for(int i = 0; i < used.length; i++){ used[i] = (i == 0); } @@ -74,4 +74,9 @@ public class Address { } return false; } + + @Override + public int hashCode(){ + return length(); + } } \ No newline at end of file