Jump to content

Recommended Posts

Posted (edited)

Hello, 

 

I have a problem and I can't find the source.
I would like to create a block with a model but in game, I don't have a texture on the block but I have the texture on the item in the inventory and thrown it on the floor. As in the picture
 

  Reveal hidden contents

 

My code

  Reveal hidden contents

 

Edited by THEJean_Kevin
Solved
Posted (edited)

This is very confusing:

https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/block/ModBlock.java#L17

1) Class names should start with an upper case letter

2) You really should use the most general-case Type possible (e.g. Block mine0 = new Mine_Lv_0();) so that people reading your code can understand it better.

3) Then if you need to, you can cast (I don't like seeing createItemBlock() in a base block class that all your blocks extend, but it's not that terrible).

4) Even better, make your class names include the base class, e.g. BlockMine_Lv_0

 

Oh god this is disgusting:

https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/block/ModBlock.java#L31

You take a client-side-only event, call a piece of code that is not marked Side Only, then just forward the method call to your Proxy.

Just do Main.proxy.registerItemRenderer(Item.getItemFromBlock(mine0), 0, name);

 

https://github.com/THEJean-Kevin/goblin/blob/master/src/main/java/com/mineaurion/tjk/goblin/proxy/clientProxy.java#L23

Use item.getRegistryName() instead of References.modid+":"+name

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.

Posted

I'm sry for the basic mistakes like name class. 

 

It's my first mod and I try to understand how it work. I just follow some tutorials but I don't understand why it don't work for me?

 

I will change what do you sayed draco18s and I come back here if I have always this problem.

 

Thank you for taking the time for me

 
Posted
  On 11/12/2017 at 7:16 PM, THEJean_Kevin said:

I'm sry for the basic mistakes like name class.

Expand  

It's a Java convention thing, that. Static values are in all upper case, class names are UpperCamelCast, variables and function names are lowerCamelCase.

The BlockFoo and BlockBar and ItemBaz are an MCP naming convention, but one that I happen to like.

 

After that, making method calls that invoke more method calls is just ridiculous. The only reason to do that is if the method actually adds something from its scope context (that isn't accessible outside it).  For example, if I want to have items that define their model via NBT data I still want to register it as normal, but I need additional information from the class / class instance, so I have this method:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/item/ItemCastingMold.java#L89

Or this method, for custom IStateMapper implementations:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/flowers/block/BlockOreFlower1.java#L160

And when I need those functions I can just cast to the interface. Or use generic covariance magic:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L75

The cast here is actually unnecessary due to said magic (block is of Type T which is defined as block a Block and an IBlockWithMapper):

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L79

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

  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.