Merge branch master-MC1.11 into master-MC1.12

This commit is contained in:
payonel 2018-02-18 02:03:56 -08:00
commit b4e9682d57
5 changed files with 29 additions and 13 deletions

View File

@ -949,7 +949,7 @@ opencomputers {
# 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
# 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.
# 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

View File

@ -556,7 +556,7 @@ getKeyBindHandler = function(code)
if type(keybinds) == "table" and keyBindHandlers[command] then
for _, keybind in ipairs(keybinds) do
if type(keybind) == "table" then
local alt, control, shift, key
local alt, control, shift, key = false, false, false
for _, value in ipairs(keybind) do
if value == "alt" then alt = true
elseif value == "control" then control = true
@ -564,9 +564,9 @@ getKeyBindHandler = function(code)
else key = value end
end
local keyboardAddress = term.keyboard()
if (not alt or keyboard.isAltDown(keyboardAddress)) and
(not control or keyboard.isControlDown(keyboardAddress)) and
(not shift or keyboard.isShiftDown(keyboardAddress)) and
if (alt == not not keyboard.isAltDown(keyboardAddress)) and
(control == not not keyboard.isControlDown(keyboardAddress)) and
(shift == not not keyboard.isShiftDown(keyboardAddress)) and
code == keyboard.keys[key] and
#keybind > resultWeight
then

View File

@ -45,8 +45,15 @@ object ChunkloaderUpgradeHandler extends LoadingCallback {
// 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
// has room for improvement.
restoredTickets.values.foreach(ticket => try ForgeChunkManager.releaseTicket(ticket) catch {
case _: Throwable => // Ignored.
restoredTickets.values.foreach(ticket => {
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()
}
@ -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
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)
}

View File

@ -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.""")
def getMetadata(context: Context, args: Arguments): Array[AnyRef] = {
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.""")

View File

@ -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}.")
}
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
})
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
@ -98,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, if (host.isInstanceOf[Entity]) ForgeChunkManager.Type.ENTITY else ForgeChunkManager.Type.NORMAL))
ticket = Option(ForgeChunkManager.requestTicket(OpenComputers, host.world, ForgeChunkManager.Type.NORMAL))
ChunkloaderUpgradeHandler.updateLoadedChunk(this)
}
else if (!enabled && ticket.isDefined) {