Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

So far i have been declaring my items like so

 

public static Item reinforcedStick;
public static Item reinforcedLeatherSquare;
public static Item reinforcedLeatherWing;
public static Item leatherHarness;
public static Item woodenElytra;

 

And i was wondering if it was possible to compress all of that down into an array like this or something similar.

 

item[] itemArray = {reinforcedStick, reinforcedLeatherSquare, ect.};

 

I messed around with it to try and get it to work but was unsuccessful.

So far i have been declaring my items like so

 

public static Item reinforcedStick;
public static Item reinforcedLeatherSquare;
public static Item reinforcedLeatherWing;
public static Item leatherHarness;
public static Item woodenElytra;

 

And i was wondering if it was possible to compress all of that down into an array like this or something similar.

 

item[] itemArray = {reinforcedStick, reinforcedLeatherSquare, ect.};

 

I messed around with it to try and get it to work but was unsuccessful.

What I like to do is add them to a List in a base classes constructor. Then loop through it for registry and model binding. Check out episode 1 or 2 of my tutorials for an example.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

And i was wondering if it was possible to compress all of that down into an array like this or something similar.

 

For being able to reference your stuff later, using an array isn't a good idea.  The only time you'd want it is if you were doing something with the whole collection.  Which a number of folks have done for their item registration, but you'd still have the public static properties.

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.

And i was wondering if it was possible to compress all of that down into an array like this or something similar.

 

For being able to reference your stuff later, using an array isn't a good idea.  The only time you'd want it is if you were doing something with the whole collection.  Which a number of folks have done for their item registration, but you'd still have the public static properties.

Yes, agreed you could also use a Reflection way to register IE loop through all of your fields and all instances of Block you register as a Block and all instances of Item you register as an Item.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Which I don't like (or the array for that matter) because it assumes that all of my blocks and all of my items are going to be registered in the same way.  Which they aren't.

 

Which is why I have a whole slew of helper methods for registration (six main methods: Block, Block + ItemBlock, Block + Custom ItemBlock, Block + Custom ItemBlock + Custom StateMapper, Item, Item w/ Variants).

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.

Which I don't like (or the array for that matter) because it assumes that all of my blocks and all of my items are going to be registered in the same way.  Which they aren't.

 

Which is why I have a whole slew of helper methods for registration (six main methods: Block, Block + ItemBlock, Block + Custom ItemBlock, Block + Custom ItemBlock + Custom StateMapper, Item, Item w/ Variants).

I can definately agree with what you are saying, but having an Interface such as I"Modid"Block that has custom methods such as createCustomStateMapper.

 

Or even just include them in the base block class.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Yes, I had to use an interface for the statemapper business. Couldn't find another clean way of handling it.

But no, still no loops other than looping over valid blockstates for registering item renderers.

 

		millstone = new BlockMillstone(); //create
	EasyRegistry.registerBlockWithItem(millstone, "millstone"); //register
	axel = new BlockAxel(); //create
	EasyRegistry.registerBlockWithItem(axel, "axel"); //register
//etc

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.

Yes, I had to use an interface for the statemapper business. Couldn't find another clean way of handling it.

But no, still no loops other than looping over valid blockstates for registering item renderers.

 

		millstone = new BlockMillstone(); //create
	EasyRegistry.registerBlockWithItem(millstone, "millstone"); //register
	axel = new BlockAxel(); //create
	EasyRegistry.registerBlockWithItem(axel, "axel"); //register
//etc

Yes, but that gets quite long and gets harder to find certain blocks. And then you have to specifically register them one by one instead of in mass, by I digress. We are "arguing" opinions not much of a reason to do that.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

I'm not sure a giant collection of "instanceof X? do Y" code blocks is going to be any less chaotic.  If anything it splits one logical operation ("Create this block and register it") out across several methods ("create this block" "register it with the game" "register an item block for it too" "register the block's renderer" "register the ItemBlock's renderer").

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.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.