OpenModularTurretsTeam / OpenModularTurrets

Repo for OpenModularTurrets.
https://minecraft.curseforge.com/projects/openmodularturrets
Other
51 stars 35 forks source link

Camo Functionality in 1.10.2 #248

Closed Keridos closed 7 years ago

Keridos commented 7 years ago

From gigaherz in IRC (Thanks to him):

ghz|afk Keridos: you'll want the block to have a TE, in this TE, you'll want to keep the IBlockState of the other block
ghz|afk then
ghz|afk in the block, you'll want an IUnlistedProperty, of a class that will hold an immutable copy of the data needed for rendering
ghz|afk in your case, just a field with this IBlockState
ghz|afk then
ghz|afk in createBlocksTate you'll return the ExtendedBlockState container with the unlisted property
ghz|afk and in getExtendedState, you'll want to cast the state to IExtendedState, and use .withProperty with your unlisted property, and using the immutable data as a value
ghz|afk then
ghz|afk you'll want to use a custom IBakedModel
ghz|afk and in this IBakedModel's getQuads method
ghz|afk you'll cast the IBlockState to IExtendedBlockState
ghz|afk and query the value of the unlisted property
ghz|afk so that youcan finally reach the IBlockState for the block you are mirroring
ghz|afk and then you can get the IBakedModel that corresponds to this IBlockState
ghz|afk from the block model "registry"
ghz|afk (can't remember which class that is)
ghz|afk and finally, you'll want to call getQuads on that other baked model
ghz|afk with the same args that were passed to yours, xcept the IBlockState
ghz|afk where you'll use the one you just obtained from your data
ghz|afk I don't have a copypaste-worthy example
ghz|afk but I hope this will be enough for you to figure it out
ghz|afk the same description applies to anything where you need custom models with per-block data
ghz|afk the only difference is you won't be passing an IBlockState to it
Verniel commented 7 years ago

While I'm busy with the rendering fixes ill have a look at this too.

Verniel commented 7 years ago

This is taking too long to implement, I will put this on the backburner for now until all other base functionality works.

Keridos commented 7 years ago

Ok, then we just disable it for the time being, I have begun working on bugreports mostly as well.