alex thanks nice tutorial.
maybe typo in creative-tabs-and-enuslang.html
public static CreativeTabs tabBlocks = new CreativeTabs("tut_blocks"){
public static CreativeTabs tabBlocks = new CreativeTabs("tab_blocks"){
1
alex thanks nice tutorial.
maybe typo in creative-tabs-and-enuslang.html
public static CreativeTabs tabBlocks = new CreativeTabs("tut_blocks"){
public static CreativeTabs tabBlocks = new CreativeTabs("tab_blocks"){
1
Also FYI I also helped fix the exact same issue recently here using a slightly different method:
1
None of the cases of the switch block in WorldGenMod#generate have a break statement in them, so each one falls through to the next. Add break statements to each case to prevent this.
Side note: Always annotate override methods with @Override so you get a compilation error if they don't actually override/implement a super method.
1
If a property doesn't affect the model and you don't want to handle it in the blockstates file, register an IStateMapper for the Block.
The easiest way to do this is to create a StateMap.Builder, call StateMap.Builder#ignore to ignore the properties and then call StateMap.Builder#build to create the StateMap (which is an implementation of IStateMapper).
Register the IStateMapper by calling ModelLoader.setCustomStateMapper in preInit.
Like all other model-related classes, these are client-only and can only be referenced on the physical client side.
1
LythrmTreeGen needs to call Block#canSustainPlant with your sapling Block, not the vanilla one.
BlockLythrmDirt and BlockLythrmGrass also need to override this to return true for any plant types that they should support (e.g. your saplings)
1
event.setCanceled(true);
where 'event' is what ever event you have subscribed into your method. If the method is not cancel able, simply kill the entity with .setDead()
2
You need to add loot by subscribing to the LootTableLoadEvent and if the name of the event matches the loot table you want to add to, you add your entries to the LootPool.
I have a good example which works for me in a mod here
Just don't forget to register your event class.
1
Look at the world info. World#getWorldInfo() and then there are ways to update the world nbt tags.
2
A while ago I created a tutorial on setting up a forge workspace with kotlin and explaining some things about kotlin and why you should use kotlin for making mods. I explain it all here. If you have any questions, don't hesitate to ask me. Not just me but anybody else can answer. If I made a mistake then please let me know. This is too long for me to just put here, admins. That's why this is so short. Please don't doc me. I'm a good noodle!
1
You need to set the drop item of the leaves to be a chance of dropping your custom apple by using an if on a random number and if it matches a certain number or range of numbers then drop the apples (with amount if desired)
//getItemDropped method
return ModItems.CUSTOM_APPLE
//quantityDropped method
return random.nextInt(5);
This is in 1.12.2 btw, so I don't know what version you're in. It could be slightly different for you but relatively the same.
1
I am currently working on an API that is showing how you can do things in forge, done as an API in case anybody wants to use it, and doing it very simply and, yes, done in Kotlin. Right now, all that there is are easier item effects. The project is currently named Easier Effects but that'll change once there is more content to it. You can create effects and apply them to items. This is mostly targeted towards people that are new to modding and would like to be guided through doing things with items. These effects can be applied currently to armor and held items. This will be extended to blocks and entity AI's, and anything else suggested. If you wanna see how it looks right now and more information, there's a readme at the github repo here: https://github.com/AlexCouch/easier-effects-educational
This is to solve the complication that a lot of good mod projects have when being used as examples. If you would like to contribute, then let me know. You can use java in it if you want, it works all the same!
No, this is not really meant to be used in practical situations, mostly to guide people into creating things by creating tests of how to use the simplified features of this API.
While writing this just a bit ago, I realized that I can do a lot more by simplifying a lot of things in modding for newer people. So I have decided to rename the project to Rated E for Everybody API. This way, if someone wants to learn how to do certain things in minecraft forge, then they can use this api to guide them along with whatever they are wanting to do. Do chat related stuff, events, entities, AI, capabilities, items, itemstack related stuff, subitems, blockstates, etc. There is librarian lib but that's for practicality. This is for pure educational purposes.
The repo is here: https://github.com/AlexCouch/Rated-E-For-Everybody-API
1
I think I see your problem. You're trying to give metadata to a class (aka, an annotation) using constants that are constructed in said class, and I'm not sure if the annotation is applied during or after class construction. It's always good to have those constants outside of said class. I use kotlin to construct my mods and it's literally like 3 or 4 lines of code depending on what you're doing. But I digress. You should definitely create a second class outside of the main mod class and put those constants like the name, modid, version, proxy locations, etc into said class.
1
Check in the console. There should be something about it loading. Check at the top for references to your mod name.
1
That means you're doing something wrong. Besides, less and less people are using eclipse because well IntelliJ is a thing. It's super fast, easy to set up, easy on the eyes and works great. It has some fancy features too. It's really great at java development and plus you can install plugins for other languages easily too. I have a rust plugin installed cause I wanna learn rust at some point. It also has a really good handle on gradle, maven, ant, vcs (git, mercurial, etc), also, it comes with a pretty good decompiler too. It's, like I said, really fast. Faster than eclipse. It loads up super fast. It takes like 5 seconds on an average pc. It takes like a second or two on my 16gb memory, 500gb storage, quad-core i7 2.7ghz macbook pro. When I was on my 8gb memory 1tb storage 2.7gh processor computer, Eclipse would load up in like 10 seconds. Trust me, everybody is starting to use IntelliJ.
Oh, and another thing, if you're having problems with *1.7.10 tutorials*, you're gonna get the same answers: search for already existing discussions. You're not going to get anything for 1.7.10. You either have to know how to code and do it on your own, or just move on to 1.11+ like the rest of us. There are lots and lots of tutorials out there for 1.11+. Don't be afraid to move on. And I know what you're gonna say, "but all my favorite mods are in 1.7.10" yeah? So are mine. But there are lots of great mods out for 1.10+. Go look at a list of mods out right now for 1.10+ and you'll see that there are lots of really great mods. Mods that have been around for years. Mods from 1.7.10 onward. A few from the 1.4.2 era as well iirc. And try out the newer mods too. You can't stay trapped in the past. It's very unhealthy. How weird, you just got life advice from some guy on a minecraft forums website.
4
There are no tutorials for this at all whatsoever. If you have no experience with gradle, then you're gonna be very lost. Considering that the docs only cover the basics, I couldn't navigate my way through the docs. I've had some help with a couple of friends, primarily UpcraftLP as well as just seeing how gradle scripts are structured in other mods, and some googling around and the use of stackoverflow really helped me out greatly. Here are some things you need to know before you start getting into this tutorial:
Who This Is For:
What This Is For:
What Do I Need To Start:
Now, let's begin.
This is gonna be a bit lengthy but just incase you're looking for specific parts of the tutorial, all the different parts of the tutorial will be in spoilers for easy navigation.
What is Gradle?
Gradle is a build scripting framework that allows you to effectively and efficiently run a script with certain commands called "Tasks" that allow you to set up and even distribute your project in some way. This is useful for projects that run specifically on a certain API. An example of this is the Minecraft Forge API. The API is required to make an effective and cross-mod-compatible mod that works on both client and server. The Forge gods decided to use Gradle due to the fact that it can download other libraries from either github or maven repositories (and others as well) and includes them into your project's external libraries. This way you don't have to configure everything yourself and spend like half an hour trying to get things to work. Another thing that Gradle allows you to do is to set up a project necessary for developing applications (or mods in this case) that run off of the API in question (Forge in this case). The API developers that are enabling Gradle have to write some Groovy scripts in order to tell Gradle exactly what to do with the setup. In this case, Forge is decompiling the Minecraft runnable jar into viewable code alongside the Forge Source jar, which are both bundled together. It is also retrieving all the necessary dependencies needed to run Minecraft and Forge (such as guava, gson, LWJGL, OpenAL, some Mojang libs for authentication and realms related functionality, etc. This way, anybody that is needing to set up a Forge mod project can just run a few tasks (or commands) to set up and they'll be good to go. Before setting up, some would want to add some dependencies (like Just Enough Items) before actually starting their project. Sometimes, even after you set up your project, you decide that there is a library/mod that you need, so you add the dependency to your Gradle script, update your Gradle project, and you're good to go. Gradle is a powerful tool, but maybe it has too much power?
What are dependencies?
There are two different kinds of dependencies with Forge: soft dependencies and hard dependencies. Soft dependencies are dependencies that really are not required at all, but if you do have it installed into your client along with the mod in question, then there can be some extra stuff added to it, but again, not required. A hard dependency is just as it sounds, after reading what a soft dependency is. It's literally the opposite. It's a dependency that is required to run the mod in question. I'll show you some examples of the use in an actual project in the future, but for now, we gotta stick to the basics.
How do I add a soft dependency?
To add in a soft dependency, you will need to use the Forge Mod Loader plugin. We will showcase the Baubles mod.
This checks to see if the Baubles mod is loaded into forge. Forge will load all the mods in the mods folder first before starting them up. So using this member function is crucial if you want a soft dependency.
How do I use a hard dependency?
I'll show just the inclusion of a hard dependency. A hard dependency is specified by your main mod class that the mod should not be loaded up unless the specified mod is also loaded.
To add in a hard dependency, you're gonna need to go into your main mod class, and at the top of your class, you need to do something along the lines of this (I am going to be showing the inclusion of Baubles again):
If you do not have Baubles included in your libraries, then forge will not continue to load your mod, and you will be presented with a screen just like this:
Now the thing about adding in hard dependencies like this is you have make sure that you're doing it right. I literally spent like since last night trying to figure out why this wasn't working, mainly because I don't ever use hard dependencies. I only do gradle dependencies.
Now I know how to specify a dependency during forge load up, how do I actually get the dependency into my project so that I can do stuff with it?
There are actually two main different ways of doing this. you can either have gradle handle the dependency, or you can include it in a folder in your project root. Forge looks for a folder called "libs". If you create that folder and place your dependency jars in there, then forge will load them up for you. However, in order to actually work with a hard dependency, you have to include the mod in your root folder's run/mods folder, otherwise, you'll get the error screen as displayed in the last section.
There is also a way to get a dependency remotely. We will use Just Enough Items. There are different ways to specify how gradle includes the dependency in your project. You can either compile it or include it at runtime. When you compile it, then you get access to its source code just like you would with the Forge API, or Gson, or Guava, and even the standard library (which should always be included in your project, otherwise I have no idea how you're even making mods). When you include it at runtime, then it just downloads the library and uses it for runtime use only, which is when it is used during the start and running of the actual project.
The first script we will use is a runtime dependency script for Just Enough Items (or jei).
As you can see, we specify the word "runtime" so that gradle knows that it should only be used at runtime. However, a lot of times, you won't be able to just get the dependency on demand. You have to make sure there is a repo for it. The most common ways to do so is to find a maven repo for the dependency. So we need to go into our "repositories" block, or make one if you don't have it, and tell gradle to look for a certain maven repo host.
If you run your project now with everything we've done up to now, you should get 7 mods installed, and both baubles and jei should be in your Mods GUI in the main menu. Now if you wanna use jei to add stuff to it like your items and blocks and whatnot, then you need to compile the api. The script looks a bit like this:
Now you just need to refresh your gradle project and look into your external libraries and it should be in there, and you're good to go.
That is all I am doing for now. If you want more, which I can do more, then let me know. If you have any tips or if you wanna add stuff to this, then please do so in the comments. If I've missed something or explained something wrong then please let me know.
1
Disclaimer: This is not for bukkit nor spigot plugin development.
Disclaimer: You MUST know Java, or at least the basics of Java, in order to request help. We do not teach Java, we help with making mods in Java. Please bare that in mind.
The Mod-Dev Cafe modding server is a discord server created by modders, managed by modders, so that you can come in and share your projects, collab with others, ask help for a certain problem you may have, and even just chill and talk programming, talk minecraft, talk life, talk about whatever you want (as long as its appropriate and civil). If this sounds like a place you'd like to visit or a place you need to go to for help with your mod, and not bukkit nor spigot plugins then come on in. Show us what you're working on, ask us for help with your mod, help others with their mods, etc.
Here is the invite link:
https://discord.gg/ZZRZwpk
Disclaimer: This is not for bukkit nor spigot plugin development.
Disclaimer: You MUST know Java, or at least the basics of Java, in order to request help. We do not teach Java, we help with making mods in Java. Please bare that in mind.
1
Try running through the tutorial again, and check everything that you've done. Besides, this tutorial is gonna get a complete redo and makeover soon once I find some time. They'll be videos and different than your usual tutorials. Can't say when so for now I'm gonna point you to some more updated and more accurate tutorials than mine.
https://shadowfacts.net/tutorials/
It'll run you through the blocks and items stuff better than I did it, and probably better code exemplified, too