Jump to content

[1.7.10] BlockRenderer vs TileEntitySpecialRenderer


Recommended Posts

Posted

Hello,

I just started modding and cannot grasp some concepts yet. I've been using these documentations as a basis in combination with the vanilla code and big mods from github. However, the vanilla code has obfuscated method/variable names and the big mods use many custom libraries, making them harder to follow.

 

For starters, I wanted to created a sloped block like this: Super-Slopes-Mod-3.png

The slope block should be rendered as a 3D item in world and the inventory.

The Block should be a tile entity later on but for now I just wanted it to render like this.

 

1. In many projects I saw a BlockRenderer and a TileEntitySpecialRenderer implemented. Why do I need two renderers for the same block, even if the TileEntity is an empty class for now?

2. Isn't it possible to use the block's renderer to created a scaled item version? Do I really need to implement a new ItemRenderer?

3. Are there good documented tutorials/minimal examples for 1.7.10 I am missing? 

 

Thank you!

 

http://greyminecraftcoder.blogspot.de/2013/08/rendering-inventory-items.html

http://www.minecraftforge.net/wiki/Tile_entity_special_renderer

http://bedrockminer.jimdo.com/modding-tutorials/basic-modding-1-7/metadata-blocks-and-items/

Posted

In a nutshell: ISBRH is cached for efficiency and is called infrequently, TESR is not and gets called every frame.

 

in ISBRH you are already in a context of Tessellator.startDrawing(GL_QUADS). All you can do is specific quad geometries to the tessellator. The ISBRH represents a huge global draw call, where the draw call is sent once for every block in the world (or the blocks needed for render update). This is done only when world render state needs to update. (e.g. light state chagned).

 

in TESR you send out draw calls by yourself, and they get called every frame. This allows rendering of *dynamic* effects and complex geometries, also enables you to do transformation using ``GL11.glTranslate`` and ``glRotate``. However because that each TESR call needs at least one draw call, it is generally slower.

 

So, use TESR only when it's necessary.

 

NOTE: Those conclusion comes from reading the source code and might be somehow inaccurate. Feel free to correct me >.<

 

 

Posted
  On 11/13/2015 at 10:23 AM, WeAthFolD said:

NOTE: Those conclusion comes from reading the source code and might be somehow inaccurate. Feel free to correct me >.<

 

AFAIK that is an accurate statement.

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

Great, thank you!

 

So, I created the BlockRenderer and the corners look fine now. I am using setBlockBoundsBasedOnState to set the bounds to the corner slab for now.

1. When looking at the block, the inventory item changes according to the orientation, though always being the corner piece of the BlockBounds. Do I have to add a completely new renderer or is it possible to use the scaled model version of a certain block direction? What is the performance solution here?

 

2. How can set the BlockBounds to prevent an entity to stand inside the block, while allowing it to walk it like stairs? The corner block does not seem like a good solution. The borders should be customary rendered on the block. Is it enough to use addCollisionBoxesToList? (this thread was a dead end: http://www.minecraftforge.net/forum/index.php?topic=22129.0)

 

	@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
	int meta = world.getBlockMetadata(x, y, z);
	if (meta == LibRef.DIRECTION.NORTH) {
		setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 0.5F);
	}
	if (meta == LibRef.DIRECTION.EAST) {
		setBlockBounds(0.5F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
	}
	if (meta == LibRef.DIRECTION.SOUTH) {
		setBlockBounds(0.0F, 0.0F, 0.5F, 1.0F, 0.5F, 1.0F);
	}
	if (meta == LibRef.DIRECTION.WEST) {
		setBlockBounds(0.0F, 0.0F, 0.0F, 0.5F, 0.5F, 1.0F);
	}
}

 

width=180 height=105http://s8.postimg.org/ei3ccoc4h/Screen_Shot_2015_11_14_at_18_18_49.jpg[/img]

Posted

Update to 1.8, this becomes infinitely more simple as you don't have to do any GL crap and can just use a sloped model.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

I started with 1.8 but jumped back to 1.7.10 because major mods are not ported yet and might never be. I plan to use Thermal Foundation and AppleCore among others later on.

Posted

That's not an excuse, update. You're going to have to do this anyways so do it.

Stop feeding the 'chicken-egg' cycle.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Then you will receive no help here.

And that link you posted is 100% FLAT OUT WRONG.

It's nothing but spreading FUD.

Any mod that says they can not update is wrong and are just being lazy.

This has been proven many many times. Every time someone comes along and says "ITS IMPOSSIBLE!" We come back and show them it's not.

But retards like you only see the bitching and don't think for yourself or try for yourself.

So ya, you're not going to get any help here.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Betafort Recovery has emerged as a prominent figure in the realm of cryptocurrency recovery, gaining a reputation for their exceptional ability to retrieve lost Bitcoin (BTC) and other cryptocurrencies. Their expertise and track record have made them a beacon of hope for individuals facing the distressing situation of lost or inaccessible crypto assets.  
    • When you name a method like that, with no return value, it is a constructor. The constructor must have the same name as the class it constructs, in this case, ModItems. I would strongly advise reading up on some basic Java tutorials, because you will definitely be running into a lot more issues as you go along without the basics. *I should also add that the Forge documentation is a reference, not a tutorial. Even following tutorials, you should know Java basics, otherwise the smallest of mistakes will trip you up as you copy someone elses code.
    • so, I'm starting modding and I'm following the official documantation for forge: https://docs.minecraftforge.net, but in the registries part it is not working as it is in the docs:   public class ModItems { private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, DarkStarvation.MOD_ID); public static final RegistryObject<Item> TEST_ITEM = ITEMS.register("test_item", () -> new Item(new Item.Properties())); public DarkStarvation(FMLJavaModLoadingContext context) { ITEMS.register(context.getModEventBus()); } } in 'public DarkStarvation(...' the DarkStarvation has this error: Invalid method declaration; return type required and the getModEventBus(): Cannot resolve method 'getModEventBus' in 'FMLJavaModLoadingContext' please help, I asked gpt but it is saying that I'm using an old method, but I'm following the latest version of Forge Docs???
    • I merged your second post with the original , there is no need to post a new thread asking for an answer. If someone sees your post and can help, they will reply. If you are seeking a quicker response, you could try asking in the Minecraft Forge diacord.
    • Create a new instance and start with cobblemon - if this works, add the rest of your mods in groups   Maybe another mod is conflicting - like Sodium/Iris or Radical Cobblemon Trainers
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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