Jump to content

[1.12.2] Entity hands not rendering via an inventory


Issac29

Recommended Posts

For reference, that list came from here:

https://blogs.msdn.microsoft.com/ericlippert/2008/09/10/vexing-exceptions/

Note that Vexing is for things like int.Parse(str) that throws an exception when str isn't a valid integer (so use int.TryToParse(str) instead), but Java doesn't have a non-exception throwing version, hence, vexing.

 

Someone, somewhere, made a design decision to throw an exception and now you have to deal with it.

 

1 hour ago, Issac29 said:

1. what about runtime, null pointer, arraystore, array out of index, and index out of bounds.

Null check first, you bonehead.

Check your types first, you bonehead.

Check your bounds first, you bonehead.

Quote

...these are all problems that you could have prevented very easily in the first place, so prevent the mess in the first place rather than trying to clean it up.

 

Edited by Draco18s

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.

Link to comment
Share on other sites

1 hour ago, Issac29 said:

So try and catch isn't reliable.

There is simply no need for try and catch. Try and catch should not be used as a fix for bad coding.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

10 hours ago, diesieben07 said:

Absolutely not true. If you tell Java to catch an exception, it will be caught. What we said above has nothing to do with reliability of try-catch.

Well for the useless number 4 exceptions. also known as the unnecessary exceptions which doesn't throw a compile error, unlike IO exceptions which do throw a compile unless there is a try and catch or a "throws" statement.

18 hours ago, DavidM said:

There is simply no need for try and catch. Try and catch should not be used as a fix for bad coding.

Well not true.

 

Well this is getting well off topic.

Link to comment
Share on other sites

1 hour ago, Issac29 said:

Well not true.

In program design in languages like Java, try and catch should be avoided "at all costs".

To illustrate, this:

if (foo instanceof Bar) {
	Bar baz = (Bar) foo;
}

is much and always superior to this:

try {
	Bar baz = (Bar) foo;
} catch (ClassCatchException e) {
	// Do stuff.
}

both performance-wise and readability-wise.

Unlike some dynamic languages nowadays which greatly encourage try-catch over anything else (*cough* python *cough*), try-catch carries special connotation in languages like Java, and should not be used to 1) silence an unexpected error 2) fix bad coding.

Your usage of try and catch fall under both of those category, so in your case, there is no need for try and catch.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

2 hours ago, Issac29 said:

Well not true.

Very much true.

I have first hand experience on just how costly a try-catch block is. I had code at one point that had the possibility of generating an error (a Vexing type) and wrapped it in a try-catch--because that was the right things to do. And the code was called so often that it ground Minecraft to a halt. We're talking two minutes per tick levels of slow for what was a few tens of thousands of calls.

 

Performing bounds-checks and null-checks on the other hand takes nano seconds, virtually zero time.

 

 I ended up just letting the exception be thrown and bypassing the compiler's check for exception handling, as it was an exception that could never occur unless something went very wrong indeed (better to let the game crash than catch the exception).

 

Code correctly and don't catch boneheaded exceptions. Boneheaded exceptions are the result of bugs. Don't intentionally hide bugs in your code.

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.

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