
Ablaze
Members-
Posts
81 -
Joined
-
Last visited
Everything posted by Ablaze
-
[1.8.9] Set up build.gradle for drone.io and github integration
Ablaze replied to LogicTechCorp's topic in Modder Support
Yes. Also, which external storage would you recommend, and how would you implement it? Preferably free. -
[1.8.9] Set up build.gradle for drone.io and github integration
Ablaze replied to LogicTechCorp's topic in Modder Support
After the first build, shouldn't it be safe to remove "./gradlew setupCIWorkspace"? Actually, on hindsight, maybe not. It clones the repository every single time, thus resetting the workspace. Am I right? -
But if it is on multiplayer how does Minecraft know which player 'thePlayer' is referring to?
-
Cazzar and I came to the same exact conclusion on IRC. Sadly there is no ByteBuf.writePlayer() haha . Just one more thing - will this work on multiplayer? thePlayer sounds more 'single-player-ish' due to the usage of the word 'the'.
-
I send a message for the GUI on my screen to update (IExtendedEntityProperties), but it crashes with an NPE. But it isn't null! Stacktrace: http://pastebin.com/zsMV5K7A Code: Main file: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/main/LetsMod.java Class implementing ExtendedProperties (called manaplayer): https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/extendedproperty/ManaPlayer.java ExtendedPropertyMessage: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/message/ExtendedPropertyMessage.java ExtendedPropertyMessageHandler: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/message/ExtendedPropertyMessageHandler.java The two places where I send a message: FirstBlock: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/block/FirstBlock.java#L50 FirstItem: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/item/FirstItem.java#L34 Okay so, I want to consume mana when I place a block. (Look at consumeMana() in ManaPlayer.java). This works fine. But now I have a gui (a bar at the top) so I have to send values to the client as well. So in the onBlockPlacedBy() method of FirstBlock.java I send a message. But it gives me an NPE (NullPointerException) (see the stacktrace) on ManaPlayer.java line 28. So I go there and add a few checks - "Player is null" and "Mana is null". It outputs Player is null. But it can't be! I have proof that it isn't null!: The first two lines of the stacktrace are Yay! and Mana:35/50. This shows that 15 mana has been taken out. I initialize the ManaPlayer object on this line: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/block/FirstBlock.java#L48 . Over there you see I pass it an entity? Well, how could I have initialized the object if my player was null? P.S. If you want to see where the Yay! and Mana:35/50 lines are coming from, it is over here: https://github.com/greatblitz982/LetsMod_1.7/blob/master/src/main/java/com/github/greatblitz982/extendedproperty/ManaPlayer.java#L58 Please help me. This thread was a bit hard to explain so if you don't understand, or need some code, just tell me and I'll explain that bit of code or provide you with that code. All my code is available on that github. Regards, Ablaze.
-
Check out diesieben's tutorial here too: http://www.minecraftforge.net/forum/index.php/topic,20135.0.html SimpleNetworkWrapper and what it is SimpleNetworkWrapper is an FML wrapper around Messages and MessageHandlers, so that Netty can understand your messages and handlers. It is the new way to send packets to players. You could use Netty itself but as cpw said, it can cause lots of problems like memory leaks. Steps to use the SimpleNetworkWrapper 1. Register a SimpleNetworkWrapper and a message 2. Create an IMessage 3. Create an IMessageHandler 4. Send the message Register a SimpleNetworkWrapper This step is fairly simple. public static SimpleNetworkWrapper snw; in your preInit: snw = NetworkRegistry.INSTANCE.newSimpleChannel(modid); snw.registerMessage(TutorialMessageHandler.class, TutorialMessage.class, 0, Side.CLIENT); You need to give the wrapper a String to identify the wrapper. It is a good practice to give it your mod-id so that it is unique for every mod. The parameters for registerMessage() are - a message handler, a message, a discriminator byte (a unique identifier for your messages), the side the handler is on - client or server. Create an IMessage IMessage is a packet. Your class will be implementing IMessage, and will be implementing some methods. public class TutorialMessage implements IMessage{ public int extremelyImportantInteger; public TutorialMessage() {} public TutorialMessage(int a) { this.extremelyImportantInteger = a; } @Override public void toBytes(ByteBuf buf) { buf.writeInt(extremelyImportantInteger); } @Override public void fromBytes(ByteBuf buf) { this.extremelyImportantInteger = buf.readInt(); } } We will pretend that extremelyImportantInteger is an extremely important integer to be sent from the client to the server. Yes, you need two constructors. This one will be used by you to initialize your fields, while the other one will be used by Forge to create your packet. Your data will be sent through a ByteBuffer and so you must write your data to it using the write*** methods in the toBytes() method. To read from the buffer, use fromBytes(). You must read data IN THE SAME ORDER as you wrote it! And that is it for your message! Create an IMessageHandler The IMessageHandler will act as your packet handler. So make sure your class implements this class. public class TutorialMessageHandler implements IMessageHandler<TutorialMessage, IMessage> { @Override public IMessage onMessage(TutorialMessage message, MessageContext ctx) { System.out.println(message.extremelyImportantInteger); return null; } } IMessageHandler<> takes two type parameters - first is the packet you handle and the other one is the packet you return. The handler calls the onMessage() method when it receives the packet. That is it for your handler! Send the message We got it all working now. Launch Minecraft and it will work fine. But.. you never send a packet! So, wherever you want to send a packet, add this line: MainFile.snw.sendTo(new TutorialMessage(3), (EntityPlayerMP) entityPlayer); The sendTo() method takes a packet to be sent and an EntityPlayerMP. The SimpleNetworkWrapper class also has some more cool methods like sendToDimension() but I'll leave that to you for exploring. There you go! Give yourself a pat on the back because you successfully got it working! BONUS: Reading and writing strings to and from ByteBufs If you noticed, there is no ByteBuf.readString() or ByteBuf.writeString("") method. Not to worry! There is a class called ByteBufUtils which you can use to operate on much more complex stuff like ItemStacks and Strings! So, to write a String - ByteBufUtils.writeUTF8String(buf, ""); and to read String myString = ByteBufUtils.readUTF8String(buf); In writeUTF8String(), buf is your ByteBuffer and the other parameter should be obvious. readUTF8String should be quite obvious. buf is your buffer. Thanks to diesieben for telling me about ByteBufUtils. That is it folks! Hope you learnt something from this Regards, Ablaze.
-
Seriously? You don't see it? -.-
-
Are you a teacher or a professor or something? You explain very well! Thanks to your explanation I understood even though I'm only 13 Just one thing - your approach uses packets, while the one diesieben and pahimar show uses messages. Is there any difference?
-
Okay how do I send a message?
-
Thanks a lot for the explanation jabelar That isn't what bothers me, you see. The thing is I don't understand how to do it. Once I understand how to do it, I will do it no matter how much effort or how much typing it takes. I just want to understand how to do it. And that is what I'm unable to do. EDIT: Took a giant trip around the source of Forge and Minecraft and a bunch of other mods. All I want an explanation of is these three methods, and how to use them: fromBytes() toBytes() onMessage() Also, how would I use them in the context I provided?
-
I still don't quite get how this might help in the scenario I picture. This is the link I refer to - http://www.minecraftforum.net/topic/1952901-172164-eventhandler-and-iextendedentityproperties/ Over there, check out post #2 (iExtendedEntityProperties) and check Step 3.3. That is where I stumbled upon.
-
I was reading through the IExtendedEntityProperties tutorial by coolAlias, and wanted to see the Gui Overlay bit. I reached the packet handling subsection(because properties are handled on server side and and the mana bar drawing thing on the client). There is said the following: So I scrolled up, and saw this link - http://www.minecraftforge.net/wiki/Netty_Packet_Handling . I was about to use that, but what worries me is that it is full of screams - I have never used netty before, nor have I used packet handlers. Can someone guide me? coolAlias' tutorial - http://www.minecraftforum.net/topic/1952901-172164-eventhandler-and-iextendedentityproperties/ Regards, and I welcome myself back, Ablaze
-
Bump.
-
1. Is the 1.7 latest build stable yet? (by that I mean like obfuscated names and stuff) If yes, well I'll use that! If not, read on. 2. Okay so since it isn't stable, I want to use 1.6. Which build should I use? Will 964 work out? If yes, nice, read on! If no, which build? But still, read on. 3. Lets just say I do 1.6. Will this tutorial work? http://bit.ly/1jjTDQi
-
[1.6.4] Problems with ResourceLocation [coolAlias' tutorial]
Ablaze replied to Ablaze's topic in Modder Support
Is the launch config same in 1.6? I'm out of town now, and my internet connection is terribly slow. So I can't redownload forge. Can you explain the steps of converting my setup into Lex's setup? -
Title. I know nothing about tick handling, packet handling, NBT, tile entities etc. Will I need any of these to create my GUI? If so, can you link me to tutorials for (If I need them) Tick handling Packet handling NBT Tile Entities and most importantly - GUI If I need to learn more, please tell me.
-
[1.6.4] Problems with ResourceLocation [coolAlias' tutorial]
Ablaze replied to Ablaze's topic in Modder Support
New line of code private static final ResourceLocation texture = new ResourceLocation(KnowledgeMain.MODID, "textures/gui/knowledgebar.png"); Stacktrace My workspace location (extra info) Modding/forge_164_963 backup/eclipse My texture location Modding/forge_164_963 backup/src/main/resources/assets/knowledge/textures/gui/knowledgebar.png Please help. -
[1.6.4] Problems with ResourceLocation [coolAlias' tutorial]
Ablaze posted a topic in Modder Support
I was making a new bar, here is the code for my GuiKnowledgeBar which extends Gui. Here is the stack trace I got- Now I understand that it can't find the file. But what exactly should I use as the location? Where should I place my texture and what should I type here:- I was following coolAlias' tutorial. Keep in mind I'm using the Gradle system not the Python one. -
Alright, I'll keep this in mind while making a mob. I wanted to make a "Bookworm" boss mob, which spawns in my "Book" dimension. So I wanted those sway kind of motions, similar to a snake or a worm.
-
Firstly, what CoolAlias said - mainly use Gist or Pastebin. Next, the title "Noob question, hopefully an easy one." gives us no idea what your problem is. Last, I think you should create a new thread for a new problem. Just my personal opinion, no rule like this. I'll tell you why. If A creates a thread, "I can't solve problem EFG!" and asks for help, people answer his queries. Next, in the same thread, if A begins talking about problem HIJ (remember he doesn't make a new thread). Now, if B has a problem EFG, he googles it and finds A's thread and tries to find the solution. However, this gets confusing as there is discussion on both problems EFG and HIJ! So making a new thread will help others too.
-
Alright, lets say I subscribe to the RenderGameOverlayEvent. What do I do next? How do I give it properties like "when to reduce," "when to increase" etc? Can you give me an example? I have never done things like these so please don't mind my nooby questions.
-
Sorry, but bump.
-
The python system has been abandoned. Gradle is the new way forge works. Download version 964, not 965. Look up wuppy29's tutorials on how to set up gradle.