-
Posts
444 -
Joined
-
Last visited
-
Days Won
5
Posts posted by kiou.23
-
-
Deferred Registers, well, defer the registration. so anytime before the common setup event, the object won't have been registered yet.
what you can do is, instead of giving the enum the item instance, give them a Supplier of the Item.
since the RegistryObject class implements Supplier, you can just pass the RegistryObject. then whenever you need the actual item, you call .get()
-
when are you calling ItemList.SHUKURYO.get()?
-
you use World#playSound
-
you can use a Layer Rendererer.
check the Elytra Layer for some reference
-
when you name an entity with a nametag, it has a name that shows up on top of the entity, that name is a text that always faces the player
if you look into the code for that, you'll see how to do it
-
could you post the obj, mtl and json files?
-
BlockItem#tryPlace to place a block item like a player would, note that you'll need a BlockItemUseContext
World#setBlockState to place any block, anywhere, which may be simpler. and you can get the block from the block item
-
20 minutes ago, lupicus said:
For #1 and #3 you can adjust position in json file (this looks about right):
{ "loader": "forge:obj", "model" : "dicehoard:models/dice/d_six.obj", "display": { "gui": { "translation": [ 10, 3, 5 ] }, "ground": { "translation": [ 9.6, 5, 8 ] } } }
yeah, I was just tinkering with the numbers
I'm still gonna need to fine tune the translation for some other dispalys, but this already helps!
-
47 minutes ago, lupicus said:
I should've mentioned that I only took assets and no code, sorry about that.
For #2, you have 2 texture U coordinates above 1.0 (the last 2 defined in OBJ file). Changing them to 1.0 makes it look correct.
Thank you!
the uv thing is odd, I got the files exported from vectary and it rendered fine in the viewer.
-
1 hour ago, idev said:
Alas, the EntityJoinWorldEvent event does not send me EntityPlayer. I think another event is needed here, but I do not know which one.
there may be a better event, but event should fire when a player joins the world
you just need to check if the entity is a player entity, I'd think
-
https://mcforge.readthedocs.io/en/latest/datastorage/capabilities/
Capabilities are a way to store additional data to certain objects, you can create a class that holds the data and behaviour that you want, then register it to the capability manager
- 1
-
I'm thinking you can use capabilities. create a clas that has what you want, then attach it to the player with a default value that indicates the player hasn't picked a class yet
next you can listen to the EntityJoinWorldEvent, check if the entity is a player and if the value is the default one, if it is send a packet to the client telling them to render this screen, then from the screen you can update the player capability
-
1 hour ago, lupicus said:
Beethoven92 is correct, you need to change map_Kd line to (map_Kd dicehoard:item/white). I put your files is a test project and the texture loads. (Note: I used your png file and not the jpg in model folder)
still won't work for me
I updated the repo with the suggestion, can you confirm that what I tried is the same as what worked for you?
EDIT: nervermind, it works, I'm dumbthe reason why I thought it wasn't working was due to ItemColors returning pure black
-
24 minutes ago, Beethoven92 said:
I haven't messed with OBJ models either but..don't you need to specify the texture path in the form modid:item/texture_name here: https://github.com/jvcmarcenes/dicehoard/blob/4e02044bec2bedceebf402ba875ecb9d73593da4/src/main/resources/assets/dicehoard/models/dice/d_six.mtl#L4? After relocating your texture file of course
I'll try that
I didn't think I'd need to since the .mtl and the texture are in the same folder
EDIT: did not solve it
-
still unsolved, I've looked at the code for hours and I have absolutelly no clue what I could do.
I'd appreciate some help
-
7 minutes ago, vanilla______ said:
kiuo.23 When you use i, it won't use a variable called i, it will create a new intiger because i is what a new intiger is called, it's just a throwaway, Capital I is not i, so it won't create a new variable and will use a variable that is called I.
that's highly incorrect, where did you learn this?
"i" is, in this case, a variable defined in the for loop, for each time the for loop runs, "i" will get incremented by one. it is a variable like any other, there's nothing special about it
-
13 minutes ago, vanilla______ said:
2 well I don't know what your saying then
Item Stacks and Items are different things
14 minutes ago, vanilla______ said:it seems like I'm doing what you said but I guess i'm not
correct, you're not, you're instantiating a new Item Stack and seeing if it is the same as another one, that's not the same as checking if the item from one item stack matches the static instance of the item that you want
15 minutes ago, vanilla______ said:could you go into a bit more detail thx, specifically wdym by "instances", thx.
I shouldn't have too, instance are basic OOP, which you are expected to know
in short: any time you use the keyword "new" to create a new variable, you are instantiating a class, therefore: an instance. what the player has in his inventory is an instance of the ItemStack class. what you want (and this is what I said), to check if the Item in the ItemStack is the Item that you're looking for
-
12 minutes ago, vanilla______ said:
1 let's just ignore the first point it doesn't matter
I'm trying to understand what's the difference between using i and I... i seems to accomplish the same thing that I does, logically
edit: and ooops, accidentally send it, so I'm going to have to reply point 2 in another message
-
5 minutes ago, vanilla______ said:
1 if I use i as an intiger, it create a new thing i bcs it's just what java does, if i use CAPITAL I it doesn't and I can use my custom variable
????
5 minutes ago, vanilla______ said:2 that's what it does (I think), it gets the stack in slot I, which will increase 9 times from 0-8, and then it sees if it's equal to "obi" aka new ItemStack(Blocks.OBSIDIAN)
that's not what I said, I explained why what you're doing won't work, and what you need to do
-
18 minutes ago, vanilla______ said:
(1) i is a generic integer, capital I is not, so I made an int I because it was simple and easy to remember
?????
18 minutes ago, vanilla______ said:(2) I know, I assume getSTACKinslot would use an itemstack, I made a new itemstack(Blocks.OBSIDIAN) and named it obi.
then the Item Stacks would never be the same, since they're different instances, get the item from the player's inventory item stack, and then check if it matches against the instance of the item you want
-
36 minutes ago, vemerion said:
I have never used an obj model before, but my guess is that you can still use the 'display' field in the item json model file to change the rotation/translation/scale of the item. Take a look at the Minecraft wiki article about it. That would solve issue 1 and 3 I think.
okay, seems like that should solve some of the problems (although the trial and errors to get the numbers right is going to be a headache...)
thanks!
-
I've got an obj model rendering on an item, however I'm facing three issues:
1- the model doesn't render correctly in the player inventory
2- the model has a face that is missing (the model looks fine in the 3d editor)
3- the model pivot point is weirdly placed when it is rotating on the ground
4- the texture doesn't load and the model just renders all black
here's a repo for the mod: https://github.com/jvcmarcenes/dicehoard
and here are some images of the problem:
-
-
you can't just decompile, zip it, and rename it to a jar... that's not how this works
if all that you want is to add recipes, you can use datapacks
(1.16.4/1.16.5) How can I put custom 3D items into the head slot of the player (Not with the replaceitem command.)?
in Modder Support
Posted
if you're on intelliJ, you can triple-shift iirc to open a search bar, then search for the Elytra Layer and you can see it's code. if anything you can just google how to search for files in your IDE
wdym? you should create your own layer renderer, and override the render method.
you "register" it by listening to the RenderPlayerEvent, and then adding a new instance of it to the player renderer