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

Cubicoder's 1.12 Tutorials


Recommended Posts



These tutorials are meant to help others learn how to mod Minecraft using Forge, as well as learn the concepts behind the code. If you don’t know any Java, please go learn some and come back! There are lots of great Java tutorials online, and trying to mod Minecraft without a good understanding of Java is very confusing.


Any *constructive* feedback is welcome, as I'm trying to make these tutorials as accurate as possible to the "correct" way of doing things!


EDIT: Please note that the website has moved! I have decided to move to GitHub Pages as my host. All of the previous tutorials have been moved over.

The purpose of this change is to make it easier for people other than myself to contribute to these tutorials, as all it takes is a simple pull request to contribute a tutorial. I am open to contributions at this time; however please make sure you know what you’re talking about and explain the concepts thoroughly. Also, please keep tutorials to Minecraft versions 1.12.2 and above. More contributing guidelines should be available on the GitHub repo soon.

Edited by cubicoder
Changed website host

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

Some comments:



public static TutorialMod instance = new TutorialMod();

No. The point of @Instance is that it is filled in automatically by FML. Do not set it yourself. Also:


This isn’t strictly necessary, but it’s good practice to include.

No. It's not good practice. Use it if you need it. You probably don't.



Create four fields in your Reference class

Please at least explain why you have this class. I fail to see the point in it.



First, create a new package in src/main/java. This can be called anything you want.

No, it cannot: https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html



MODID: This is the internal ID of your mod.

Nothing about a mod ID is internal. It is a public identifier of the mod and should never be changed.



a client proxy, a server proxy, and a common proxy that will run code for both sides.

No. A "common proxy" is pointless. The point of proxies is to run side-specific code. Not common code. For common code you have your main mod class.

Also, do not use @EventHandler in your proxies, it only works in your main mod class.



The CommonProxy class should contain the Forge lifecycle methods, like the main class does.

No. This is completely missing the point and purpose of the proxy system.



To make life simpler later down the road, when we have many items to register, we’ll make an item “cache”

Nothing about this is a cache.



Finally, we need to register the models in our RegistryHandler class.

This completely defeats the mechanisms of @SidedProxy. You are referencing a client-only class (ModelRegistryEvent) in common code (RegistryHandler).

Also why are you clearing the "item cache" here? If you are not gonna use it for anything else, why not just use ForgeRegistries.ITEMS and filter by mod ID?



public TutorialTab() {



You should include your mod ID in your creative tab unlocalized names as well.


Edited by diesieben07
Link to comment
Share on other sites

Thanks for the feedback! Everything should be updated now to be a little more correct. This is why I wanted to make tutorials in the first place, because nobody ever tells new modders the correct way of doing things. They just have to figure it out for themselves, and usually they figure it out wrong. Hopefully, people will start learning things right now that I've gotten some help.

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

  • Now your ClientProxy extends ServerProxy. This makes even less sense. There should be an interface Proxy and two classes (ClientProxy, ServerProxy) that implement it.
  • You still have the empty ***Init methods in your proxy classes. Why?
  • @SideOnly is not needed in your ModelRegistryHandler. Instead use the value attribute of the @EventBusSubscriber annotation.
Link to comment
Share on other sites

Fixed (hopefully).


You know, maybe you should make your own tutorials. It seems like you're the only one around here that knows what you're doing. Looking at the source of mods like Tinker's Construct and Iron Chests, even those mods are doing things like using common proxies. I feel like there needs to be somewhere where people can look to find how to do this the right way, and the official Forge documentation just doesn't tell you that much.

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

You now just have a typo:


In the Reference class, add these two lines

There is no Reference class anymore.


And the I prefix for interfaces is stupid, but that is personal opinion (I guess).


41 minutes ago, cubicoder said:

You know, maybe you should make your own tutorials.

If only I had the time. Thing is, there is technically nothing wrong with these things. They work fine and they are not terrible game-breaking things. They are just bad practices that unnecessarily bloat your code and hide the true reason for things. There is a term for this: Cargo culting.


41 minutes ago, cubicoder said:

and the official Forge documentation just doesn't tell you that much.

That is why it's open source. Feel free to contribute.


Oh... and this:

2 hours ago, diesieben07 said:

You still have the empty ***Init methods in your proxy classes. Why?

Edited by diesieben07
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hello. If you want to make a list for 1.13 tutorials, I make a list.

- Development Environment

- Main Mod Class

- Proxies

- Custom Items

- Custom Blocks

- Language File

- Custom Creative Tab

- Custom Tools

- Custom Armors

- Crafting and Smelting Recipes

- Foods

- Crops

- Ore Gen

- Ore Dictionary

- Mobs(Standart Models)

- Mobs(Custom Models)

- Custom Workbench

- Custom Furnace

- Custom Chest

- Special Tools(for example, a sword that drops mob heads, an axe that drops trees completely, etc.)

- Special Armors(for example, a helmet that gives Night Vision, boots that gives Speed, etc.)

- Customizable Tools(like Tinkers' Construct)

My Mods:

More Strenghtened Tools Mod:


Link to comment
Share on other sites

  • 4 weeks later...

Yeah, there will be more eventually. I'd rather wait until 1.13 to make any new ones because of all the changes, but I might do a few more 1.12.2 tutorials because 1.13 is taking longer than I thought it would. Either way though, I'm really busy with school right now so I don't know when I'll have time to make more tutorials.

  • Thanks 1

Check out my tutorials at https://cubicoder.github.io/.

Link to comment
Share on other sites

  • 2 months later...

So your modding tutorial might be the only one that makes sense without over complicating things, explains everything well and uses the new registry system for 1.12. In short, thanks. It's been a big help in understanding the basics.


p.s. a bunch of the changes suggested by @diesieben07 also really helped.

Edited by profjb58
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Thanks for the help everybody! I tried this and although the block did register, the fluid just appears as a flat plane you can only see if you break the block under it. I tried debugging it as much as I could but alas I couldn't solve it Here is the code for my "fixed" liquidblock as suggested by Luis_ST: package com.hotmail.majdroaydi.minitech.blocks; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.sounds.SoundEvent; import net.minecraft.tags.FluidTags; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FlowingFluid; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import java.util.Optional; import java.util.function.Supplier; public class ForgeLiquidBlock extends LiquidBlock { public ForgeLiquidBlock(Supplier<? extends FlowingFluid> supplier, Properties properties) { super(supplier, properties); } @Override public VoxelShape getCollisionShape(BlockState p_54760_, BlockGetter p_54761_, BlockPos p_54762_, CollisionContext p_54763_) { return p_54763_.isAbove(STABLE_SHAPE, p_54762_, true) && p_54760_.getValue(LEVEL) == 0 && p_54763_.canStandOnFluid(p_54761_.getFluidState(p_54762_.above()), getFluid()) ? STABLE_SHAPE : Shapes.empty(); } @Override public boolean isPathfindable(BlockState p_54704_, BlockGetter p_54705_, BlockPos p_54706_, PathComputationType p_54707_) { return !getFluid().is(FluidTags.LAVA); } @Override public boolean skipRendering(BlockState p_54716_, BlockState p_54717_, Direction p_54718_) { return p_54717_.getFluidState().getType().isSame(getFluid()); } @Override public void onPlace(BlockState p_54754_, Level p_54755_, BlockPos p_54756_, BlockState p_54757_, boolean p_54758_) { if (this.shouldSpreadLiquid(p_54755_, p_54756_, p_54754_)) { p_54755_.getLiquidTicks().scheduleTick(p_54756_, p_54754_.getFluidState().getType(), getFluid().getTickDelay(p_54755_)); } } @Override public BlockState updateShape(BlockState p_54723_, Direction p_54724_, BlockState p_54725_, LevelAccessor p_54726_, BlockPos p_54727_, BlockPos p_54728_) { if (p_54723_.getFluidState().isSource() || p_54725_.getFluidState().isSource()) { p_54726_.getLiquidTicks().scheduleTick(p_54727_, p_54723_.getFluidState().getType(), getFluid().getTickDelay(p_54726_)); } //return super.updateShape(p_54723_, p_54724_, p_54725_, p_54726_, p_54727_, p_54728_); return p_54723_; // Calling super.updateShape will just call LiquidBlock's updateShape, not what we are looking for! Thankfully, Block.updateShape, simply enough, just returns the first parameter. } @Override public void neighborChanged(BlockState p_54709_, Level p_54710_, BlockPos p_54711_, Block p_54712_, BlockPos p_54713_, boolean p_54714_) { if (this.shouldSpreadLiquid(p_54710_, p_54711_, p_54709_)) { p_54710_.getLiquidTicks().scheduleTick(p_54711_, p_54709_.getFluidState().getType(), getFluid().getTickDelay(p_54710_)); } } private boolean shouldSpreadLiquid(Level p_54697_, BlockPos p_54698_, BlockState p_54699_) { if (getFluid().is(FluidTags.LAVA)) { boolean flag = p_54697_.getBlockState(p_54698_.below()).is(Blocks.SOUL_SOIL); for(Direction direction : POSSIBLE_FLOW_DIRECTIONS) { BlockPos blockpos = p_54698_.relative(direction.getOpposite()); if (p_54697_.getFluidState(blockpos).is(FluidTags.WATER)) { Block block = p_54697_.getFluidState(p_54698_).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, block.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } if (flag && p_54697_.getBlockState(blockpos).is(Blocks.BLUE_ICE)) { p_54697_.setBlockAndUpdate(p_54698_, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(p_54697_, p_54698_, p_54698_, Blocks.BASALT.defaultBlockState())); this.fizz(p_54697_, p_54698_); return false; } } } return true; } private void fizz(LevelAccessor p_54701_, BlockPos p_54702_) { p_54701_.levelEvent(1501, p_54702_, 0); } @Override public ItemStack pickupBlock(LevelAccessor p_153772_, BlockPos p_153773_, BlockState p_153774_) { if (p_153774_.getValue(LEVEL) == 0) { p_153772_.setBlock(p_153773_, Blocks.AIR.defaultBlockState(), 11); return new ItemStack(getFluid().getBucket()); } else { return ItemStack.EMPTY; } } @Override public Optional<SoundEvent> getPickupSound() { return getFluid().getPickupSound(); } } The code for my OilFluid can be found above.
    • Whoops! Sorry, my fault. But yes, a block entity (tile entity in 1.16-) *is* needed for storing data (i.e. furnace). But I think what OP is doing is making an item combiner, which doesn't need one
    • Looking to work with reliable Fabric & Forge developers to produce original mods for use on my YouTube channel! We'll be regularly working together and you'll be given a detailed brief for each commission that outlines exactly what I want. From there, you can give me a price that fits the scope of the project and we can get to work :thumbsup: Because these commissions are only for YouTube videos, you're essentially making vertical-slices / proof-of-concepts. They can have bugs, you can take shortcuts & we can use video editing to hide bugs & achieve some effects. With that in mind, turnaround speed depends on project complexity but for an average commission I'd expect delivery two days - five days Send me a email at either lmaololtbhhonest@gmail.com OR Business@tbhhonest.com if you're interested! preview of channel: https://imgur.com/a/bOVkiUo LINK:  https://www.youtube.com/channel/UCnwo3X3eCrUp7N1DZPc-MGQ  
    • If you want a tiny fraction of offset, use float.epsilon. 0.01 will actually be noticeable. It's about 1/6th of a texture pixel.
  • Topics

  • Who's Online (See full list)

  • Create New...

Important Information

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