Jump to content

Recommended Posts

Posted

I use something like that:

In Main Class

@Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
public static class RegistryEvents
{
    @SubscribeEvent
    public static void onItemsRegistry(final RegistryEvent.Register<Item> itemsRegistryEvent)
    {
    itemsRegistryEvent.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
    LOGGER.info("HELLO from Register ITEM");
    }
}

In ModItems Class

public class ModItems
{
    public static final List<Item> ITEMS = new ArrayList<>();

    public static final Item REDSTONEPASTE = new ItemBase("redstone_paste");
}

In ItemBase Class

public class ItemBase extends Item
{
    public ItemBase(String name)
    {
        super(new Item.Properties().group(ItemGroup.MISC));
        setRegistryName(Reference.MOD_ID, name);
        ModItems.ITEMS.add(this);
    }
}

In Resources/assets/(MOD_ID)/models/item/

{
  "parent": "item/generated",
  "textures": {
    "layer0": "(MOD_ID):items/redstone_paste"
  }
}

 

Posted (edited)
  On 3/2/2019 at 1:56 PM, DcZipPL said:

ItemBase

Expand  

1. Stop using ItemBase.

 

  On 3/2/2019 at 1:56 PM, DcZipPL said:

public static final Item REDSTONEPASTE = new ItemBase("redstone_paste");

Expand  

2. Stop using static initializers. Also, you only need to store one reference to your item (you are currently storing it in the itemList and as a variable).

 

  On 3/2/2019 at 1:56 PM, DcZipPL said:

public static final List<Item> ITEMS = new ArrayList<>();

Expand  

3. Specify the type when constructing the ArrayList.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 3/2/2019 at 3:26 PM, DavidM said:

3. Specify the type when constructing the ArrayList.

Expand  

You don't have to with Java 8+.

 

@DcZipPL don't provide copy/paste code like that. He doesn't learn anything from it and it's actually wrong in multiple places.

@TheHex create your Items in a RegistryEvent.Register<Item> event handler instead of a static initializer.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
  On 3/2/2019 at 2:08 PM, TheHex said:

help

Expand  

This post in no way allows us to help you. This is a forum, not a chat room.

 

In order to help you, you need to provide all of the information necessary. In this case, that means, you code pasted as text, not an image.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 3/7/2019 at 7:48 PM, sunsigne said:

this video is still a good start

Expand  

Umm, no.

I remember seeing this guy asking around here WHILE he was making this tutorial...

(Read as: "He was making the tutorial WHILE he learned the material, not after he had already learned it")

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted (edited)

So what ? We learn everyday. And you can't pretend you already know how forge 1.13 works while it just pop out.

 

Not everybody need to be a pro to learn how to cook pasta. And if i don't know how to cook pasta i'm happy to find a tutorial of someone which show me how to cook pasta while he is unable to cook a pizza because it's too complicated for him. 

Edited by sunsigne
Posted

If you make a tutorial while you are still making basic mistakes you inevitably pass these mistakes down to those who follow your tutorial, often resulting in Cargo Cult Programming.

  • Like 1

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

If you feel like writing code that

- is 3 times longer than the neccesary amount

- stops Forge from being able to dynamically reload mods at runtime

- can cause unexplainable crashes

- breaks well made mods that do everything right

- is 5 years out of date

- is not neccesary anymore

among many other things, feel free. But don’t expect not to get critisised for it, especially on these forums. And don’t go and create a tutorial (a tutorial is supposed to teach the best way of doing things) with your bad code, as it will create more mods and modders with the same problems and limitations. Forge 1.13 has been out for more than half a year, and parts of it have been out for almost 2 years. This rewrite has been going on for a long time, there are people who are defiantly familiar with it and know how it works.

  • Like 1

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted (edited)
  On 3/7/2019 at 7:48 PM, sunsigne said:

As lons as it works

Expand  

No. That is not a fair judgement to make.

Optimizations, data structures and algorithms exist for a reason.

 

  On 3/7/2019 at 8:22 PM, sunsigne said:

2nd time on this forum a person talk me about cult as argument after 2 comments.

Expand  

"Cargo cult proogramming" is one phrase; you are misinterpreting the meaning of it.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted
  On 3/7/2019 at 8:22 PM, sunsigne said:

2nd time on this forum a person talk me about cult as argument after 2 comments. Don'ty take prommaming that seriously guys

Expand  

https://en.m.wikipedia.org/wiki/Cargo_cult_programming

Doing things because someone else said "just do this, it works for me!" is not how programming works. 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
  On 3/7/2019 at 11:11 PM, Cadiboo said:

If you feel like writing code that

- is 3 times longer than the neccesary amount

- stops Forge from being able to dynamically reload mods at runtime

- can cause unexplainable crashes

- breaks well made mods that do everything right

- is 5 years out of date

- is not neccesary anymore

among many other things, feel free. But don’t expect not to get critisised for it, especially on these forums. And don’t go and create a tutorial (a tutorial is supposed to teach the best way of doing things) with your bad code, as it will create more mods and modders with the same problems and limitations. Forge 1.13 has been out for more than half a year, and parts of it have been out for almost 2 years. This rewrite has been going on for a long time, there are people who are defiantly familiar with it and know how it works.

Expand  

 

Yes. But for the moment there are really few tutorial videos for modding in 1.13 if you think you can do better videos (what is surely true, i don't doubt about that), well .. just do it instead of whimpering because it doesn't exist !

 

I'm not telling you can't give argue why this video is bad, the very part i can't agree is you tends to say this video shoudn't be "allowed" to exist. But fact is without this video, a lot of people just couldn't create basic mods in 1.13 today. As this video doesn't concern you (because it's made by a beginner, for begginers), you can give your opinion but you can't say it's not a good start. Because actually, it's the only start we currently have (pedagogically, it's a lot more difficult to learn by reading alone than being explained orally buy someone, that's why we have teachers).

 

 

 

  On 3/8/2019 at 1:19 AM, DavidM said:

No. That is not a fair judgement to make.

Optimizations, data structures and algorithms exist for a reason.

 

"Cargo cult proogramming" is one phrase; you are misinterpreting the meaning of it.

Expand  

 

It's not like programming a whole video game, it's just an item. I'm not sure the tutorial he made can occur any crash. If you find one, you win  the argue. His code IS obviously a big MESS (even me can see it, while i'm a beginner), but not falty.

You are probably true for the second part, i already read the link and I get the methaphor. I even understand your apprehension about those kind of thing because i read A LOT of times on this forum "don't use ItemBase, don't use IIventory, don't use (dramatic music) IHasModel", and when people have bad habbit, it's hard to disassemble it.

But we (begginers) aren't all lazy guys who want you to vomit good the good codes in the mouth (there are some, i saw that), some of us (me) try really hard to understand WHAT you do and WHY you do this :) but we still need a start point to begin. And without this video, some of us just don't have one (as I said, there are really few videos of modding on youtube)

 

 

  On 3/8/2019 at 8:57 PM, Draco18s said:

https://en.m.wikipedia.org/wiki/Cargo_cult_programming

Doing things because someone else said "just do this, it works for me!" is not how programming works. 

Expand  

 

As I tried to say. It might be a start point : you write first, then you try to understand why things are like that. It's not the best start for sure, but it's the fastest, and if you just need to implement 2 or 3 simple items in your favorite video game, you don't need to learn ALL the programming part first.

 

Didn't you ever wonder why multiplication is communitative ? why 3*5 == 5*3 ? While division isn't ( 3/2 != 2/3 ) You just do this naturally because people told you "just do this, it works for me!" while you NEVER wondered why. The main answer for multiplication is because simple numbers are 1 by 1 matrixes, but usually, matrixes aren't communitative at all ! Did you learn what was a matrix before "communitatives" numbers in a mutliplication like you might do everyday ? I don't think so.

 

Did you already made an real experiment by yourself to be SURE the earth is round or flat or aren't you just repeating what you've been told all along and judging other people which doesn't think like you ?

Why do you say "hello" to people ? Why do you double click on your mouse instead of clicking once ? Why do you use shoes instead of walking without it, are you a dermatolog yourself to be SURE it's better ? Why do you vaccine ? Why do you cook meat isn't of eating i raw ?

 

There are A LOOOOOOOT of things we do without wondering WHY we do them. Because you are a doctor doesn't mean you are allowed judge people dumb because they don't know why they vaccinate, while you do know why. All of them don't want to become doctor either and DON'T NEED to spend weeks and weeks to understand why they need to do it, even sick people. You can't refuse vaccinating someone which refuse to know/learn/undertstand why they should do it. Maybe this person is a baker and he will refuse tommorow to sell to you his fresh bread because you don't want to know how to correcly cook it (i'm not talking about me, i don't refuse to learn code, it's an exemple)

 

Edited by sunsigne
Posted

You are comparing learning programming and the conventions of a framework that can be done for free if you just devote some time, to studies that are funded by major corporations.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted
  On 3/10/2019 at 5:34 PM, sunsigne said:

Yes. But for the moment there are really few tutorial videos for modding in 1.13 if you think you can do better videos (what is surely true, i don't doubt about that), well .. just do it instead of whimpering because it doesn't exist !

Expand  

Forge for 1.13 isn't even out of beta yet. Hold your horses.

 

  26 minutes ago, sunsigne said:

(because it's made by a beginner, for begginers)

Expand  

"And this video is for the blind about how to lead the blind."

 

  26 minutes ago, sunsigne said:

matrixes aren't communitative at all ! 

Expand  

And now your post is impossible to read.

 

And oh yeah. Octonion aren't associative or commutative. Sedenions are even weirder.

 

Your point is?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

shoudn't be "allowed" to exist

Expand  

It teaches the wrong thing, and therefore, is misleading. The author should think twice before uploading a video as such.

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

The main answer for multiplication is because simple numbers are 1 by 1 matrixes,

Expand  

No... You are very ill-informed on how mathematics, number theory, and linear algebra works. False cause.

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

"just do this, it works for me!" while you NEVER wondered why

Expand  

Of course I wondered why.

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

Did you already made an real experiment by yourself to be SURE the earth is round or flat or aren't you just repeating what you've been told all along and judging other people which doesn't think like you ?

Expand  

Simple physics. Learn about gravity. You can easily prove it yourself.

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

And without this video, some of us just don't have one (as I said, there are really few videos of modding on youtube)

Expand  

Why do you have to start with videos? There are plenty of good text-based tutorials.

 

  On 3/10/2019 at 5:34 PM, sunsigne said:

and if you just need to implement 2 or 3 simple items in your favorite video game, you don't need to learn ALL the programming part first.

Expand  

Modding is programming. If you cannot program, you cannot make a mod. So either learning to program properly or don't make a mod.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.