Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED][1.7.10]Cancelling Crafting?


deadrecon98
 Share

Recommended Posts

Show your ClientPacketManager class.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Show your ClientPacketManager class.

 

I've fixed everything now but here you go.

 

package com.Cyphereion.RunesOfAltura.Manager;

import net.minecraft.client.Minecraft;

import com.Cyphereion.RunesOfAltura.RunesOfAltura;
import com.Cyphereion.RunesOfAltura.Data.EntityPlayerExtended;

import io.netty.buffer.ByteBuf;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;

public class ClientPacketManager implements IMessage {
    
    private String text;
    private static LogManager log = RunesOfAltura.instance.log;

    public ClientPacketManager() { }

    public ClientPacketManager(String text) {
        this.text = text;
    }

    @Override
    public void fromBytes(ByteBuf buf) {
        text = ByteBufUtils.readUTF8String(buf);
    }

    @Override
    public void toBytes(ByteBuf buf) {
        ByteBufUtils.writeUTF8String(buf, text);
    }

    public static class Handler implements IMessageHandler<ClientPacketManager, IMessage> {      
        @Override
        public IMessage onMessage(ClientPacketManager message, MessageContext ctx){
        	String[] args = message.text.split(":");
        	EntityPlayerExtended player = EntityPlayerExtended.get(Minecraft.getMinecraft().thePlayer);
        	player.magicXP = Integer.parseInt(args[0]);
        	player.magicLevel = Integer.parseInt(args[1]);
        	log.debug(String.format("Received %s from " + Minecraft.getMinecraft().thePlayer.getDisplayName(), message.text));
            return null;
        }
    }
}

Link to comment
Share on other sites

You are still sending a String. Why?

Also: That will crash on a dedicated server.

 

Okay, you still haven't explained to me how I can send multiple data types in one packet. As for it crashing on a dedicated server, how in the friggin world am I supposed to fix that?

Link to comment
Share on other sites

Writing:

 

buf.writeInt(someInt);
buf.writeByte(someByte);
buf.writeString(someString);

 

Reading:

 

someInt = buf.readInt();
someByte = buf.readByte();
someString = buf.readString();

 

You just need to read and write in the same order.

 

To access the client player in a safe way, make a method in your proxies that returns Minecraft#thePlayer in the ClientProxy and throws an exception (it will never be called) on the ServerProxy.

Link to comment
Share on other sites

Writing:

 

buf.writeInt(someInt);
buf.writeByte(someByte);
buf.writeString(someString);

 

Reading:

 

someInt = buf.readInt();
someByte = buf.readByte();
someString = buf.readString();

 

You just need to read and write in the same order.

 

To access the client player in a safe way, make a method in your proxies that returns Minecraft#thePlayer in the ClientProxy and throws an exception (it will never be called) on the ServerProxy.

 

Ok, I see where you were talking about thePlayer issue and fixed that. Would I also need to put the new packet code into the ServerPacketManager as well?

Link to comment
Share on other sites

Wat... Why do you even have a "ServerPacketManager" in the first place? That's a horrible name by the way. The thing is a packet, not a manager.

You are sending one packet to the client, right? That packet updates the IEEP data. So, name it "PacketUpdateClientIEEPData".

 

Your joking? I followed YOUR tutorial and it said that you needed both a Server-side packet and a Client-side packet. So what is it, do I need one or not?

Link to comment
Share on other sites

Where in the world does my tutorial say you need both?

Please try to understand what packets actually are. It's really fucking simple.

 

I do understand what packets are but like I have said before. You barely explained what was what in your tutorial. In 1.5.2 you needed to send it through a manager for the server and then grab it again for the client in another manager. I am completely confused as to what you are trying to explain here.

Link to comment
Share on other sites

In 1.5.2 you needed to send it through a manager for the server and then grab it again for the client in another manager.

This is bullshit.

In 1.5.2 you created a Packet250CustomPayload manually by whatever means and then send that manually. To client or server.

Then you had ONE packet handler for both which received all your packets.

Most people then sent a packetID as the first byte in the packet data and had humongous switch statements on that packetID containing all their packet handling code in ONE method.

 

Now you have one IMessage + IMessageHandler for each of those packetIDs. Each packet has a defined direction (from client to server or the other way around). The IMessage encapsulates the data you want to send. The IMessageHandler then does something with that data.

Link to comment
Share on other sites

In 1.5.2 you needed to send it through a manager for the server and then grab it again for the client in another manager.

This is bullshit.

In 1.5.2 you created a Packet250CustomPayload manually by whatever means and then send that manually. To client or server.

Then you had ONE packet handler for both which received all your packets.

Most people then sent a packetID as the first byte in the packet data and had humongous switch statements on that packetID containing all their packet handling code in ONE method.

 

Now you have one IMessage + IMessageHandler for each of those packetIDs. Each packet has a defined direction (from client to server or the other way around). The IMessage encapsulates the data you want to send. The IMessageHandler then does something with that data.

 

I'm here to get help on something that I am not very proficient at. I do not need you to sit here and insult me. If you are going to be rude then please butt out. I am glad that you have helped me thus far but I will not tolerate being treated this way. I am doing everything that I can to understand what you are saying. I wouldn't say that's cause to be rude, would you?

Link to comment
Share on other sites

So... what are you trying to tell me now?

 

I'm saying that if I couldn't handle being proved wrong I wouldn't be here. All you have done is prove me wrong. Not that I mean it in a bad way, that is the only way to show me what I am doing wrong. I just don't like it when you take up an attitude with me. You're not the only one here agitated.

Link to comment
Share on other sites

No. Instead of saying, "That is not correct."; he said what he said. Not a big deal. And not anything to be insulted about. Ive been told things like that a few times by him. cheesy.gif. I didnt really get insulted at all.

Also to the topic, things change from version to version. So even if you had two managers in 1.5.2, you might only have one in 1.7.10. Though Im pretty sure, its only one manager back in 1.5.

 

I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!

Link to comment
Share on other sites

Or can we lock the thread? This has moved way beyond the initial issue (which is solved).

 

@OP If you have a new problem (such as dealing with packets), it's better for everyone if you start a new thread.

 

I was planning on that but peeps keep replying. It might be best if you did lock it. ;P

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share




  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • thats exactly what i did, didnt work
    • performance problems?, i saw that the pumpkin overlay's size is 256x256, then how it draws in full screen?
    • ---- Minecraft Crash Report ---- // I bet Cylons wouldn't have this problem. Time: 1/25/22 3:30 PM Description: Rendering overlay net.minecraftforge.fml.config.ConfigFileTypeHandler$ConfigLoadingException: Failed loading config file forge-common.toml of type COMMON for modid forge     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigFileTypeHandler$$Lambda$4733/78604773.apply(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:104) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker$$Lambda$4732/324662817.accept(Unknown Source) ~[?:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_51] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:209) ~[?:?] {re:classloading}     at net.minecraftforge.fml.client.ClientModLoader.lambda$startModLoading$7(ClientModLoader.java:132) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$4722/1128558020.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2917/1825071442.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.startModLoading(ClientModLoader.java:132) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader.lambda$onResourceReload$2(ClientModLoader.java:114) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$4719/1991615833.run(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:123) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2917/1825071442.run(Unknown Source) ~[?:?] {}     at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1618) ~[?:1.8.0_51] {}     at java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1610) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1689) ~[?:1.8.0_51] {}     at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) ~[?:1.8.0_51] {} Caused by: com.electronwill.nightconfig.core.io.ParsingException: Not enough data available     at com.electronwill.nightconfig.core.io.ParsingException.notEnoughData(ParsingException.java:22) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ReaderInput.directReadChar(ReaderInput.java:36) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readChar(AbstractInput.java:49) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.AbstractInput.readCharsUntil(AbstractInput.java:123) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseKey(TableParser.java:166) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseDottedKey(TableParser.java:145) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TableParser.parseNormal(TableParser.java:55) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:44) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.toml.TomlParser.parse(TomlParser.java:37) ~[toml-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:113) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:219) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.io.ConfigParser.parse(ConfigParser.java:202) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.WriteSyncFileConfig.load(WriteSyncFileConfig.java:73) ~[core-3.6.3.jar:?] {}     at com.electronwill.nightconfig.core.file.AutosaveCommentedFileConfig.load(AutosaveCommentedFileConfig.java:85) ~[core-3.6.3.jar:?] {}     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:57) ~[?:?] {re:classloading}     ... 23 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace:     at net.minecraftforge.fml.config.ConfigFileTypeHandler.lambda$reader$1(ConfigFileTypeHandler.java:61) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigFileTypeHandler$$Lambda$4733/78604773.apply(Unknown Source) ~[?:?] {}     at net.minecraftforge.fml.config.ConfigTracker.openConfig(ConfigTracker.java:104) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker.lambda$loadConfigs$1(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.config.ConfigTracker$$Lambda$4732/324662817.accept(Unknown Source) ~[?:?] {}     at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_51] {}     at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2062) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.config.ConfigTracker.loadConfigs(ConfigTracker.java:83) ~[?:?] {re:classloading}     at net.minecraftforge.fml.ModLoader.loadMods(ModLoader.java:209) ~[?:?] {re:classloading} -- Overlay render details -- Details:     Overlay name: net.minecraft.client.gui.ResourceLoadProgressGui Stacktrace:     at net.minecraft.client.renderer.GameRenderer.func_195458_a(GameRenderer.java:484) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_195542_b(Minecraft.java:977) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:607) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}     at net.minecraft.client.main.Main.main(Main.java:184) [?:?] {re:classloading,pl:runtimedistcleaner:A}     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51] {}     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51] {}     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51] {}     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:51) [forge-1.16.5-36.2.22.jar:36.2] {}     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$459/1573125303.call(Unknown Source) [forge-1.16.5-36.2.22.jar:36.2] {}     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.0.9.jar:?] {}     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.0.9.jar:?] {}  
    • "Required" in the sense that it's the correct way to do things to maintain mod compatibility. But loot tables are still loot tables and can still be overridden with data packs. Forge won't stop you from doing it.
    • Hi all, First post here. I have tried to solve this myself but I can't identify the problem. I used to use version 1.16.3 and in the console I was able to press up and down to access commands in the history and tab for auto completion of the command. Now I upgraded to version 1.17.1 and I these keys don't work anymore. How can I enable auto complete? Thanks. System info: MinecraftForge version 37.1.1 Minecraft 1.17.1 with MCP 20210706. OS: Ubuntu 20.04.3 openjdk 17.0.1 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-120.04)
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.