mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-27 23:33:10 +00:00
- Fixed multiple saplings with the same ID not working in the Planter
- Fixed crash when using /mt hand on a dedicated server - Fixed crash in /mt recipes in some cases
This commit is contained in:
1 parent
59ef38877f
commit
7d886a3ce3
37 files changed
+500
-99
No files matched your search
+14
-1
@@ -11,6 +11,9 @@ import net.minecraft.network.packet.Packet250CustomPayload;
|
||||
import cpw.mods.fml.common.network.IPacketHandler;
|
||||
import cpw.mods.fml.common.network.Player;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -26,6 +29,7 @@ public class MCPacketHandler implements IPacketHandler {
|
||||
|
||||
public static final String CHANNEL_SERVERSCRIPT = "MTServerScript";
|
||||
public static final String CHANNEL_OPENBROWSER = "MTOpenBrowser";
|
||||
public static final String CHANNEL_COPYTOCLIPBOARD = "MTCopyToClipboard";
|
||||
|
||||
@Override
|
||||
public void onPacketData(INetworkManager manager,
|
||||
@@ -44,7 +48,8 @@ public class MCPacketHandler implements IPacketHandler {
|
||||
}
|
||||
} else if (packet.channel.equals(CHANNEL_OPENBROWSER)) {
|
||||
String url = UTF8.decode(ByteBuffer.wrap(packet.data)).toString().trim();
|
||||
if(Desktop.isDesktopSupported()){
|
||||
|
||||
if (Desktop.isDesktopSupported()){
|
||||
Desktop desktop = Desktop.getDesktop();
|
||||
try {
|
||||
desktop.browse(new URI(url));
|
||||
@@ -52,6 +57,14 @@ public class MCPacketHandler implements IPacketHandler {
|
||||
} catch (URISyntaxException e) {
|
||||
}
|
||||
}
|
||||
} else if (packet.channel.equals(CHANNEL_COPYTOCLIPBOARD)) {
|
||||
String message = UTF8.decode(ByteBuffer.wrap(packet.data)).toString().trim();
|
||||
|
||||
if (Desktop.isDesktopSupported()) {
|
||||
StringSelection stringSelection = new StringSelection(message);
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
clipboard.setContents(stringSelection, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user