Jump to content

Recommended Posts

Posted

I am currently working on a new item that will be related to a vanilla item. I want to make around 50 of my new item for about 50 vanilla blocks, then I want to have 3 levels of each of my item, making around 150 total new items that I am adding.

 

With this, I want to have a frame and a background relating to my item, then fill in the rest of the texture with the vanilla item texture that it is related to. So for the one relating to cobblestone, it would have my frame, and inside the frame the texture would be filled with that portion of the cobblestone texture.

 

One way to make these textures work is to make 150 textures, one for each of my items.

The way I would like to do it is to make 3 frame textures: one for each level I plan to have, then cut out the appropriate filling from the related vanilla block and layer it over top of my textures. So with the cobblestone example, I would have my frame texture, then this process I want would take the center portion of the cobblestone texture and visually paste it on top of my own texture.

This would greatly cut down on the amount of icons I would need to make and store to have this item display the way I want.

 

Has anyone done something like this or know how I might try to approach it?

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Posted

I've been doing something similar, but the way I did it was to yoink the relevant block texture, render it, then render a second quad with my overlay on it, a very tiny fraction of a pixel above* the first quad.  Just enough offset so there's no z-fighting, but too small to see.  1F/256 is good.

 

I have, however, been having a devil of a time getting block brightness to be calculated correctly.  Think I thought of a solution, and that's a faux block that gets rendered using the normal renderer after rendering the base material block in the same manner.

 

*relative to the block face

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

Believe me, I can render blocks in the world. I have a blast playing with that and I have some models that I specifically designed to make a viewer uncomfortable and I have a hard time looking at them myself even without finalized textures - which is exactly what I wanted.

 

My problem is item rendering, in the hand and in the inventory. I just want a 2d panel like most items have where the texture is mixed. So I probably need to know how to set up a custom rendering for an item (I know how to do one for a block, which includes holding it hand, but I don't know how for an item) or I need to find a different way of layering the texture.

I don't know if it would be a bigger hit on overall performance to just have an extra 150 textures, or to go through the extra processing to draw in custom rendering of a couple textures

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Posted
  On 6/13/2013 at 1:29 AM, redria7 said:
My problem is item rendering, in the hand and in the inventory. I just want a 2d panel like most items have where the texture is mixed.

 

Ahhh.

Yeah, I was having that problem too, and rather than doing quads like in the world I created a fake block and told the renderer to render that instead (which is what I'm thinking about doing to get things in-world too, in order to fix the lighting issue).

 

Might be a tad trickier on your end though, I only had two textures to deal with: while my block will camouflage itself when placed, I just used a fixed texture for the inventory render.  Picked a block, pulled the original texture, applied the overlay, saved as an icon, registered it with the fake block.

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

HA!

public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
	int wid = world.getBlockId(x, y, z);
	renderer.renderBlockByRenderType(Block.blocksList[wid], x, y, z);
	renderer.renderBlockUsingTexture(Block.blocksList[wid], x, y, z, block.getIcon(0, 0));
	return false;
}

 

And there's no z-fighting.  I have no idea why.  But it totally works.

 

The only downside is that the "overlay" texture can't be partially transparent.  It'll get rendered as binary transparency (each pixel is either fully solid or fully transparent).  No idea why.

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 6/13/2013 at 6:43 PM, Draco18s said:

The only downside is that the "overlay" texture can't be partially transparent.  It'll get rendered as binary transparency (each pixel is either fully solid or fully transparent).  No idea why.

 

glEnable(GL_BLEND)

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

renderOverlay(...)

glDisable(GL_BLEND)

 

This should work (warning: pseudocode)

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted
  On 6/13/2013 at 11:53 PM, SanAndreasP said:

glEnable(GL_BLEND)

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

renderOverlay(...)

glDisable(GL_BLEND)

 

This should work (warning: pseudocode)

 

Didn't help.

(And yes, I converted it to proper code).

 

Keep in mind this is how I'm doing it:

 

renderer.renderBlockUsingTexture(Block.stone, x, y, z, camo);
switch(metadata) {
		case 0:
			renderer.renderFaceYNeg(Block.blocksList[wid], (double)x, (double)y, (double)z, self);
[...etc...]
}

 

Where camo is the block icon of the block adjacent to my block (checks for nulls, self, etc. with a fallback default) and self is my block's own icon (the overlay texture).

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

hm, can I see your code with my answer included?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Posted

renderer.renderBlockUsingTexture(Block.stone, x, y, z, camo);
[code]GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
switch(metadata) {
		case 0:
			renderer.renderFaceYNeg(Block.blocksList[wid], (double)x, (double)y, (double)z, self);
[...etc...]
}
GL11.glDisable(GL11.GL_BLEND);

 

In any case, I figured out what my problem was:

 

return false

 

Go go auto-constructed code supplying a return type where what that returned boolean does is undocumented (roughly speaking if the return is false, the game stops rendering stuff because it thinks its done).

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
    • Necro'ing that thread to ask if you found a solution ? I'm encountering the same crash on loading the world. I created the world in Creative to test my MP, went into survival to test combat, died, crashed on respawn and since then crash on loading the world. Deactivating Oculus isn't fixing it either, and I don't have Optifine (Twilight forest is incompatible)
  • Topics

×
×
  • Create New...

Important Information

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