-
Recently Browsing
No registered users viewing this page.
-
Posts
-
Regarding the Oredict question above: NonNullList<ItemStack> seed = OreDictionary.getOres("seed");
-
By Carbonx_09 · Posted
Hey guys, you should definitely join our discord server! We're going to be releasing in one week! https://discord.gg/vUEAanV -
@Override public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { // [...] String separator = getSeparator(); String scriptName = nbtTagCompound.getString("scriptName"); String scriptPath = "pythontool" + separator + scriptName; proxy.runPython(world, player, scriptPath); // [...] } ^^^ This is how I refactored onItemRightClick(). The runPython() method does nothing on the dedicated server, while on the client: public class ClientOnlyProxy extends CommonProxy { // [...] @Override public void runPython(World world, EntityPlayer player, String scriptPath) { super.runPython(world, player, scriptPath); if (world.isRemote) { // client side if (!Minecraft.getMinecraft().isSingleplayer()) { // client talks to dedicated server (multiplayer game) ClientCommandHandler.instance.executeCommand(player, "/lpython " + scriptPath); } } else { // server side if (player.isSneaking()) { // shift pressed. Run new parallel script Minecraft.getMinecraft().thePlayer.getServer().getCommandManager().executeCommand(player, "/apy " + scriptPath); } else { // shift not pressed. Cancel previous scripts and run new script world.getMinecraftServer().getCommandManager().executeCommand(player, "/python " + scriptPath); } } } } I still need to figure out why they used two different approaches to execute commands on the integrated server--Minecraft.getMinecraft().thePlayer.getServer().getCommandManager().executeCommand() vs. world.getMinecraftServer().getCommandManager().executeCommand(). public abstract class CommonProxy { // [...] public void runPython(World world, EntityPlayer player, String scriptPath) {} } public class PythonTool { // [...] @SidedProxy(clientSide="pythontool.ClientOnlyProxy", serverSide="pythontool.DedicatedServerProxy") public static CommonProxy proxy; // [...] } Are still there significant mistakes? Thanks again!
-
By salvestrom · Posted
Please show your render class. And please use the <> function in the reply box to copy and paste your class. Don't just use screenshots.
-
Topics
-
Who's Online (See full list)