mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-15 02:12:42 -04:00
Merge branch master-MC1.10 into master-MC1.11
#removed src/main/scala/li/cil/oc/common/asm/ClassTransformer.scala from merge #673facee9077454b8401b1bb018f626e02bf3802
This commit is contained in:
parent
f074f17e2a
commit
ef97a06305
@ -88,7 +88,7 @@ object GuiHandler extends CommonGuiHandler {
|
||||
item.Tablet.get(stack, player).components.collect {
|
||||
case Some(buffer: api.internal.TextBuffer) => buffer
|
||||
}.headOption match {
|
||||
case Some(buffer: api.internal.TextBuffer) => new gui.Screen(buffer, true, () => true, () => true)
|
||||
case Some(buffer: api.internal.TextBuffer) => new gui.Screen(buffer, true, () => true, () => buffer.isRenderingEnabled)
|
||||
case _ => null
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import net.minecraftforge.common.ForgeChunkManager.LoadingCallback
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket
|
||||
import net.minecraftforge.event.world.WorldEvent
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraft.entity.Entity
|
||||
|
||||
import scala.collection.convert.WrapAsScala._
|
||||
import scala.collection.mutable
|
||||
@ -72,6 +73,9 @@ object ChunkloaderUpgradeHandler extends LoadingCallback {
|
||||
val robotChunks = (for (x <- -1 to 1; z <- -1 to 1) yield new ChunkPos(centerChunk.chunkXPos + x, centerChunk.chunkZPos + z)).toSet
|
||||
|
||||
loader.ticket.foreach(ticket => {
|
||||
if (ticket.getType() == ForgeChunkManager.Type.ENTITY && ticket.getEntity() == null && loader.host.isInstanceOf[Entity])
|
||||
ticket.bindEntity(loader.host.asInstanceOf[Entity])
|
||||
|
||||
ticket.getChunkList.collect {
|
||||
case chunk: ChunkPos if !robotChunks.contains(chunk) => ForgeChunkManager.unforceChunk(ticket, chunk)
|
||||
}
|
||||
|
@ -427,6 +427,13 @@ class TabletWrapper(var stack: ItemStack, var player: EntityPlayer) extends Comp
|
||||
if (lastRunning != machine.isRunning) {
|
||||
lastRunning = machine.isRunning
|
||||
markDirty()
|
||||
|
||||
if (machine.isRunning) {
|
||||
components collect {
|
||||
case Some(buffer: api.internal.TextBuffer) =>
|
||||
buffer.setPowerState(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import li.cil.oc.api.prefab.AbstractManagedEnvironment
|
||||
import li.cil.oc.common.event.ChunkloaderUpgradeHandler
|
||||
import net.minecraftforge.common.ForgeChunkManager
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket
|
||||
import net.minecraft.entity.Entity
|
||||
|
||||
import scala.collection.convert.WrapAsJava._
|
||||
|
||||
@ -50,6 +51,8 @@ class UpgradeChunkloader(val host: EnvironmentHost) extends AbstractManagedEnvir
|
||||
})
|
||||
ticket = None
|
||||
}
|
||||
else if (host.isInstanceOf[Entity]) // Robot move events are not fired for entities (drones)
|
||||
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +69,7 @@ class UpgradeChunkloader(val host: EnvironmentHost) extends AbstractManagedEnvir
|
||||
OpenComputers.log.info(s"Reclaiming chunk loader ticket at (${host.xPosition()}, ${host.yPosition()}, ${host.zPosition()}) in dimension ${host.world().provider.getDimension}.")
|
||||
}
|
||||
ticket = ChunkloaderUpgradeHandler.restoredTickets.remove(node.address).orElse(host match {
|
||||
case context: Context if context.isRunning => Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, ForgeChunkManager.Type.NORMAL))
|
||||
case context: Context if context.isRunning => Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, if (host.isInstanceOf[Entity]) ForgeChunkManager.Type.ENTITY else ForgeChunkManager.Type.NORMAL))
|
||||
case _ => None
|
||||
})
|
||||
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
||||
@ -95,7 +98,7 @@ class UpgradeChunkloader(val host: EnvironmentHost) extends AbstractManagedEnvir
|
||||
|
||||
private def setActive(enabled: Boolean) = {
|
||||
if (enabled && ticket.isEmpty) {
|
||||
ticket = Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, ForgeChunkManager.Type.NORMAL))
|
||||
ticket = Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, if (host.isInstanceOf[Entity]) ForgeChunkManager.Type.ENTITY else ForgeChunkManager.Type.NORMAL))
|
||||
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
||||
}
|
||||
else if (!enabled && ticket.isDefined) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user