Open ghost opened 7 years ago
Hello Rokin4life7,
You are using forge-1.11-13 which is for minecraft 1.11. The book is based on forge 1.8 and minecraft 1.8.
Between the two version, the api has been changed. If you want to continue with forge-1.11 then you will have to adapt by exploring the API.
I can suggest the following approach:
event.getPlayer().sendMessage(new TextComponentString("You broke a block!"));
Reference: http://www.minecraftforge.net/forum/topic/44175-1112-send-local-clientside-chat-messages/
Thank you! Is there a way to get and use forge 1.8 and have minecraft revert to 1.8? How do I explore the API? What does that mean? I'm new to development so forgive my ignorance!n I took a core java course and am using this book to get familiar with an actual fun application of the language.
If you want to stick to 1.8, . You can go on forge download page https://files.minecraftforge.net/ You are there able to download forge 1.8. As describe in the book, you can start minecraft within Eclipse. It will automatically be in the same version as forge (hence 1.8).
Explore the API 1.11 You can find more resource on the web as https://mcforge.readthedocs.io/en/latest/ or youtube videos. You can also explore the code with Eclipse by using Eclipse autocompletion. Start typing the code and eclipse will suggest you some proposals : type in the sendMessage function the text 'event.g' and you see Eclipse will suggest you the end. Control+click on a code element you want to explore will open the source code and will allow you to explore all of forge code (api and implementation). The code is well documented and readable.
I hope it helps you.
@rokin4life7 The book is based on Forge 1.8. The current version is 1.11 and the APIs have introduced backwards incompatibility. We are in the process of updating the book to be compatible with 1.11, stay tuned.
Fantastic! Thank you everyone. I look forward to it Arun! I'm the meantime I'll try and download 1.8 and work with that. This community is so helpful. Thanks for the fast responses. I may have many more questions so thank you all for your patience with me!
Thank you for your work @arun-gupta, I have recently purchased the book and am also learning this with my son. Also big thanks to @sirhill, Control+click just opened up a new world for us, we will continue to play around with API 1.11, all part of the learning experience.
Cheers!
can you show me a screenshot of your launcher? If I know what launcher you are using, I can tell you how to change versions.
Just incase you can't find forge 1.8, here is the link.
Is it possible I performed the setup incorrectly? I already the the JDK installed. I went through the forge install and the build was successful. Here is the code and here are the errors displayed..
package org.devoxx4kids.forge.mods;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class BlockBreakMessage { @SubscribeEvent public void sendMessage(BreakEvent event) { event .getPlayer() .addChatMessage( new ChatComponentText(EnumChatFormatting.GOLD
Please help!