cadiboo / example-mod Goto Github PK
View Code? Open in Web Editor NEWAn example mod created to try and get new modders to use good code practices
License: GNU Lesser General Public License v3.0
An example mod created to try and get new modders to use good code practices
License: GNU Lesser General Public License v3.0
Updating the tutorial to 1.16.3 would be nice as forge now has
a recommended release for it. Some stuff in forge 1.16.3 has changed.
Or if the 1.15.2 tutorial works for 1.16.3 as well please let me know.
Example-Mod/src/main/java/cadiboo/examplemod/util/ModUtil.java
Lines 19 to 25 in 6a1ba10
Since you have the referenced classes already imported for the class, you don't need to fully qualify the classes
Can you also make tutorial(s) and example mod code for generating custom structures? I think that there aren't many tutorials and examples of structure-generating mods (at least for latest Minecraft/Forge versions), so this would be quite nice addition.
Things that I would like to see in such tutorial:
Configuration:
Locating structure with /locate
command. If the structure is bigger also where exactly should /locate
point to.
Generation:
Bigger structures:
I know this is quite a lot of things, but at least some could be added for start, and other could be added later.
Update: I found TelepathicGrunt/StructureTutorialMod which seems pretty good example mod. Then, you don't really need to create whole new mod for structures, but you could include some things in tutorial, link that existing mod and/or contribute some features that aren't ready yet (like jigsaw block, more advanced generation, spawning configuration...).
Example-Mod/src/main/java/cadiboo/examplemod/EventSubscriber.java
Lines 92 to 104 in 6a1ba10
Was having trouble not using IHasModel
, got linked to your example mod. When using the ModCreativeTabs
i get an error from intelliJ like this:
Class 'Anonymous class derived from CustomCreativeTab' must either be declared abstract or implement abstract method 'getTabIconItem()' in 'CreativeTabs'
Here:
public static final CustomCreativeTab CREATIVE_TAB = new CustomCreativeTab(MOD_ID, true) {
@Override
public ItemStack createIcon() {
return TAB_ICON_ITEMSTACK;
}
};
Also get an error further down the code like this:
Method does not override method from its superclass
Here:
@SideOnly(Side.CLIENT)
@Override
abstract public ItemStack createIcon();
Link to my class: Github
In modern forge there is an option to render TileEntities in batch with only one draw call greatly reducing the performance impact on the game. However most modders are either not aware of this ability or don't know how to use it which is a real shame since it really helps with the performance of the game. I would like to propose an inclusion of a FastTESR example in this example mod to help beginners understand how it works, maybe with some helper methods. I could make one and submit a PR if you want. Feel free to close this issue if you don't think your example mod needs an example of a FastTESR :)
I know this is too general a question but using IntelliJ and your example mod code for some reason the block example is not working for me. If there is something simple you have heard about this issue. The items work fine.
Sorry about how non-specific this is.
Thank you, Peter
I don't know if this is the right place to post this or not, but I'm trying to follow the tutorials, and haven't even gotten past the "importing into workspace" part, because of a series of many issues. This is the most recent one, which has recurred in several different forms, and I have no idea how to fix it.
Line should be "arrowWidth, 17" (vHeight 17)
Would you be able to add an example of populating the world with example_ore?
Forge has a specific annotation for packages that are supposed to hold your API, it's the net.minecraftforge.fml.common.API one. A package annotated with this annotation tells forge that everything within that package is a part of a public API provided by a specific mod. It is used internally in forge when for example deciding whether to remove methods annotated with @optional and it is also used in sorting the mod list. It also provides some information to the addonmakers such as the version of the API. To annotate a package create a package-info.java file in your api package and annotate the package line in it with the annotation. This is not strictly necessarry but is generally a good practice.
Adding example custom keybinds to the example mod would be helpful :D
I really appreciate Cadiboo made the example mode and tutorial, but this project hasn't been updated for a year by now.
Just asking if we can see the full tutorial one day for me and all the noobs.
Would you be willing to do example of connected textures?
Include when the modid has uppercase letters
Love this example mod. Nice design. I've just refactored my mod to incorporate some of your ideas. However, using your registration code in my mod, I noticed that none of the blocks I'm registering appear in my mod's custom creative tab. I finally figured out why. You're setting the creative tab on the block's ItemBlock (when you register the ItemBlock) when really I think you need to be setting it for the Block - inside the Block's constructor, for example. This is corroborated by the fact that if you call getCreativeTab for any ItemBlock, it goes and gets it from the Block.
Multiplication instead of bit shifting, add some comments about why you DONT have to offset cords by 8, and when you would
Example-Mod/src/main/java/cadiboo/examplemod/EventSubscriber.java
Lines 30 to 43 in 6a1ba10
When using the @Mod.EventBusSubscriber it subscribes the class to the bus on both sides. You can however specify the side it is subscribed on using the value property of the annotation(example). Without specifying it the class will be subscribed on both sides which may lead to issues. While ClientEventSubscriber in your case doesn't load any client-only classes when loaded it gives modmakers a false impression that it will only be loaded on the client(because of the name). They may then decide to expose client-only classes in it(by making their methods return/take them as parameters, or by specifying fields of those types) and thus crashing the server. I recommend you specify the side in your EventBusSubscriber annotation to avoid those issues.
Edit: The same appies to the ServerEventSubscriber class actually.
Can I please just download /gradle.properties alone? if not, I can't do anything about coding with this website.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.