mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-16 10:51:55 -04:00
Merge branch master-MC1.11 into master-MC1.12
This commit is contained in:
commit
b4e9682d57
@ -949,7 +949,7 @@ opencomputers {
|
|||||||
|
|
||||||
# This is a list of blacklisted domain names. If an HTTP request is made
|
# This is a list of blacklisted domain names. If an HTTP request is made
|
||||||
# or a socket connection is opened the target address will be compared
|
# or a socket connection is opened the target address will be compared
|
||||||
# to the addresses / adress ranges in this list. It it is present in this
|
# to the addresses / address ranges in this list. It it is present in this
|
||||||
# list, the request will be denied.
|
# list, the request will be denied.
|
||||||
# Entries are either domain names (www.example.com) or IP addresses in
|
# Entries are either domain names (www.example.com) or IP addresses in
|
||||||
# string format (10.0.0.3), optionally in CIDR notation to make it easier
|
# string format (10.0.0.3), optionally in CIDR notation to make it easier
|
||||||
|
@ -556,7 +556,7 @@ getKeyBindHandler = function(code)
|
|||||||
if type(keybinds) == "table" and keyBindHandlers[command] then
|
if type(keybinds) == "table" and keyBindHandlers[command] then
|
||||||
for _, keybind in ipairs(keybinds) do
|
for _, keybind in ipairs(keybinds) do
|
||||||
if type(keybind) == "table" then
|
if type(keybind) == "table" then
|
||||||
local alt, control, shift, key
|
local alt, control, shift, key = false, false, false
|
||||||
for _, value in ipairs(keybind) do
|
for _, value in ipairs(keybind) do
|
||||||
if value == "alt" then alt = true
|
if value == "alt" then alt = true
|
||||||
elseif value == "control" then control = true
|
elseif value == "control" then control = true
|
||||||
@ -564,9 +564,9 @@ getKeyBindHandler = function(code)
|
|||||||
else key = value end
|
else key = value end
|
||||||
end
|
end
|
||||||
local keyboardAddress = term.keyboard()
|
local keyboardAddress = term.keyboard()
|
||||||
if (not alt or keyboard.isAltDown(keyboardAddress)) and
|
if (alt == not not keyboard.isAltDown(keyboardAddress)) and
|
||||||
(not control or keyboard.isControlDown(keyboardAddress)) and
|
(control == not not keyboard.isControlDown(keyboardAddress)) and
|
||||||
(not shift or keyboard.isShiftDown(keyboardAddress)) and
|
(shift == not not keyboard.isShiftDown(keyboardAddress)) and
|
||||||
code == keyboard.keys[key] and
|
code == keyboard.keys[key] and
|
||||||
#keybind > resultWeight
|
#keybind > resultWeight
|
||||||
then
|
then
|
||||||
|
@ -45,8 +45,15 @@ object ChunkloaderUpgradeHandler extends LoadingCallback {
|
|||||||
// so if the save is because the game is being quit the tickets aren't
|
// so if the save is because the game is being quit the tickets aren't
|
||||||
// actually being cleared. This will *usually* not be a problem, but it
|
// actually being cleared. This will *usually* not be a problem, but it
|
||||||
// has room for improvement.
|
// has room for improvement.
|
||||||
restoredTickets.values.foreach(ticket => try ForgeChunkManager.releaseTicket(ticket) catch {
|
restoredTickets.values.foreach(ticket => {
|
||||||
case _: Throwable => // Ignored.
|
try{
|
||||||
|
val data = ticket.getModData
|
||||||
|
OpenComputers.log.warn(s"A chunk loader ticket has been orphaned! Address: ${data.getString("address")}, position: (${data.getInteger("x")}, ${data.getInteger("z")}). Removing...")
|
||||||
|
ForgeChunkManager.releaseTicket(ticket)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
case _: Throwable => // Ignored.
|
||||||
|
}
|
||||||
})
|
})
|
||||||
restoredTickets.clear()
|
restoredTickets.clear()
|
||||||
}
|
}
|
||||||
@ -73,9 +80,6 @@ object ChunkloaderUpgradeHandler extends LoadingCallback {
|
|||||||
val robotChunks = (for (x <- -1 to 1; z <- -1 to 1) yield new ChunkPos(centerChunk.x + x, centerChunk.z + z)).toSet
|
val robotChunks = (for (x <- -1 to 1; z <- -1 to 1) yield new ChunkPos(centerChunk.x + x, centerChunk.z + z)).toSet
|
||||||
|
|
||||||
loader.ticket.foreach(ticket => {
|
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 {
|
ticket.getChunkList.collect {
|
||||||
case chunk: ChunkPos if !robotChunks.contains(chunk) => ForgeChunkManager.unforceChunk(ticket, chunk)
|
case chunk: ChunkPos if !robotChunks.contains(chunk) => ForgeChunkManager.unforceChunk(ticket, chunk)
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,19 @@ object DebugCard {
|
|||||||
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the metadata of the block at the specified coordinates.""")
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Get the metadata of the block at the specified coordinates.""")
|
||||||
def getMetadata(context: Context, args: Arguments): Array[AnyRef] = {
|
def getMetadata(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
checkAccess()
|
checkAccess()
|
||||||
result(world.getBlockState(new BlockPos(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))))
|
val state = world.getBlockState(new BlockPos(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2)))
|
||||||
|
result(state.getBlock.getMetaFromState(state))
|
||||||
|
}
|
||||||
|
|
||||||
|
@Callback(doc = """function(x:number, y:number, z:number[, actualState:boolean=false]) - gets the block state for the block at the specified position, optionally getting additional display related data""")
|
||||||
|
def getBlockState(context: Context, args: Arguments): Array[AnyRef] = {
|
||||||
|
checkAccess()
|
||||||
|
val pos = new BlockPos(args.checkInteger(0), args.checkInteger(1), args.checkInteger(2))
|
||||||
|
var state = world.getBlockState(pos)
|
||||||
|
if (args.optBoolean(3, false)) {
|
||||||
|
state = state.getActualState(world, pos)
|
||||||
|
}
|
||||||
|
result(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Callback(doc = """function(x:number, y:number, z:number):number -- Check whether the block at the specified coordinates is loaded.""")
|
@Callback(doc = """function(x:number, y:number, z:number):number -- Check whether the block at the specified coordinates is loaded.""")
|
||||||
|
@ -69,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}.")
|
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 {
|
ticket = ChunkloaderUpgradeHandler.restoredTickets.remove(node.address).orElse(host match {
|
||||||
case context: Context if context.isRunning => Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, if (host.isInstanceOf[Entity]) ForgeChunkManager.Type.ENTITY else ForgeChunkManager.Type.NORMAL))
|
case context: Context if context.isRunning => Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, ForgeChunkManager.Type.NORMAL))
|
||||||
case _ => None
|
case _ => None
|
||||||
})
|
})
|
||||||
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
||||||
@ -98,7 +98,7 @@ class UpgradeChunkloader(val host: EnvironmentHost) extends AbstractManagedEnvir
|
|||||||
|
|
||||||
private def setActive(enabled: Boolean) = {
|
private def setActive(enabled: Boolean) = {
|
||||||
if (enabled && ticket.isEmpty) {
|
if (enabled && ticket.isEmpty) {
|
||||||
ticket = Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, if (host.isInstanceOf[Entity]) ForgeChunkManager.Type.ENTITY else ForgeChunkManager.Type.NORMAL))
|
ticket = Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, ForgeChunkManager.Type.NORMAL))
|
||||||
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
|
||||||
}
|
}
|
||||||
else if (!enabled && ticket.isDefined) {
|
else if (!enabled && ticket.isDefined) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user