mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10
Conflicts: src/main/scala/li/cil/oc/client/PacketSender.scala
This commit is contained in:
commit
e751a6a116
@ -378,7 +378,7 @@ while running do
|
||||
local blink = true
|
||||
if event == "key_down" then
|
||||
onKeyDown(arg1, arg2)
|
||||
elseif event == "clipboard" then
|
||||
elseif event == "clipboard" and not readonly then
|
||||
onClipboard(arg1)
|
||||
elseif event == "touch" or event == "drag" then
|
||||
onClick(arg1, arg2)
|
||||
|
@ -45,19 +45,21 @@ object PacketSender {
|
||||
|
||||
def sendClipboard(address: String, value: String) {
|
||||
if (value != null && !value.isEmpty) {
|
||||
if (System.currentTimeMillis() < clipboardCooldown) {
|
||||
if (value.length > 64 * 1024 || System.currentTimeMillis() < clipboardCooldown) {
|
||||
val player = Minecraft.getMinecraft.thePlayer
|
||||
val handler = Minecraft.getMinecraft.getSoundHandler
|
||||
handler.playSound(new PositionedSoundRecord(new ResourceLocation("note.harp"), 1, 1, player.posX.toFloat, player.posY.toFloat, player.posZ.toFloat))
|
||||
}
|
||||
else {
|
||||
clipboardCooldown = System.currentTimeMillis() + value.length / 10
|
||||
val pb = new CompressedPacketBuilder(PacketType.Clipboard)
|
||||
for (part <- value.grouped(16 * 1024)) {
|
||||
val pb = new CompressedPacketBuilder(PacketType.Clipboard)
|
||||
|
||||
pb.writeUTF(address)
|
||||
pb.writeUTF(value.substring(0, math.min(value.length, 64 * 1024)))
|
||||
pb.writeUTF(address)
|
||||
pb.writeUTF(part)
|
||||
|
||||
pb.sendToServer()
|
||||
pb.sendToServer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user