Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading api in BlockRenderLayerMap #2925

Closed
SHsuperCM opened this issue Feb 23, 2023 · 1 comment
Closed

Misleading api in BlockRenderLayerMap #2925

SHsuperCM opened this issue Feb 23, 2023 · 1 comment

Comments

@SHsuperCM
Copy link
Contributor

Although it is very clear that BlockRenderLayerMap only handles the render layers of blocks, it contains both api and javadocs that imply that the same map could handle items extending the general Item class.

/**
* Map (or re-map) an item with a render layer. Re-mapping is not recommended but if done, last one in wins.
* Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer.
*
* @param item Identifies item to be mapped.
* @param renderLayer Render layer. Should be one of the layers used for entity rendering.
*/
void putItem(Item item, RenderLayer renderLayer);
/**
* Map (or re-map) multiple items with a render layer. Re-mapping is not recommended but if done, last one in wins.
* Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer.
*
* @param renderLayer Render layer. Should be one of the layers used for entity rendering.
* @param items Identifies items to be mapped.
*/
void putItems(RenderLayer renderLayer, Item... items);

It would be much clearer if the arguments for these methods took BlockItems instead and their javadocs should clearly state that this affects only items extending BlockItem.

Technici4n added a commit to Technici4n/fabric that referenced this issue Feb 23, 2023
@Technici4n
Copy link
Member

Technici4n commented Feb 23, 2023

Thank you for the issue! I think deprecating the methods entirely is the best course of action. See #2930.

modmuss50 pushed a commit that referenced this issue Feb 24, 2023
modmuss50 pushed a commit that referenced this issue Feb 24, 2023
(cherry picked from commit c2e6f67)
(cherry picked from commit 928d44d)
ix0rai pushed a commit to ix0rai/quilted-fabric-api that referenced this issue Feb 25, 2023
EnnuiL pushed a commit to QuiltMC/quilted-fabric-api that referenced this issue Mar 1, 2023
* Indigo shade related fixes and other changes (FabricMC#2898)

* Apply disabled shade from vanilla quads directly to material

- Remove QuadViewImpl.shade

* Fix enhanced AO calculation and respect non-terrain culling state

- Fix AoCalculator using AO face data computed with a potentially different shade state
- Move non-cached computation code to separate method in AoCalculator
- Turn AoCalculator's brightnessFunc and aoFunc into abstract methods
- Do not check null check world in non-terrain AO calculation since it cannot be null
- Pass through lightFace and shade state as method arguments in AoCalculator methods to prevent additional lookups
- Do not check for the axis aligned flag in AbstractQuadRenderer.shadeFlatQuad
- Respect cull parameter passed to non-terrain rendering by merging TerrainBlockRenderInfo into BlockRenderInfo
- Use reusable search pos when calling Block.shouldDrawSide to prevent additional BlockPos allocation
- Change BlockRenderContext.render and TerrainRenderContext.tessellateBlock to return void since return value is no longer used
- Remove QuadViewImpl.vertexStart since it is unused

* Add suggestions

- Mark Direction parameter to BlockRenderInfo.shouldDrawFace as Nullable
- Reuse MaterialFinder in FrameBakedModel

(cherry picked from commit 3a95925)

* Bump version

* Fix FabricMC#2925: deprecate item functions in BlockRenderLayerMap (FabricMC#2930)

(cherry picked from commit c2e6f67)
(cherry picked from commit 928d44d)

* Bump version

---------

Co-authored-by: PepperCode1 <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
Co-authored-by: Technici4n <[email protected]>
EnnuiL pushed a commit to QuiltMC/quilted-fabric-api that referenced this issue Mar 26, 2023
* Indigo shade related fixes and other changes (FabricMC#2898)

* Apply disabled shade from vanilla quads directly to material

- Remove QuadViewImpl.shade

* Fix enhanced AO calculation and respect non-terrain culling state

- Fix AoCalculator using AO face data computed with a potentially different shade state
- Move non-cached computation code to separate method in AoCalculator
- Turn AoCalculator's brightnessFunc and aoFunc into abstract methods
- Do not check null check world in non-terrain AO calculation since it cannot be null
- Pass through lightFace and shade state as method arguments in AoCalculator methods to prevent additional lookups
- Do not check for the axis aligned flag in AbstractQuadRenderer.shadeFlatQuad
- Respect cull parameter passed to non-terrain rendering by merging TerrainBlockRenderInfo into BlockRenderInfo
- Use reusable search pos when calling Block.shouldDrawSide to prevent additional BlockPos allocation
- Change BlockRenderContext.render and TerrainRenderContext.tessellateBlock to return void since return value is no longer used
- Remove QuadViewImpl.vertexStart since it is unused

* Add suggestions

- Mark Direction parameter to BlockRenderInfo.shouldDrawFace as Nullable
- Reuse MaterialFinder in FrameBakedModel

(cherry picked from commit 3a95925)

* Bump version

* Fix FabricMC#2925: deprecate item functions in BlockRenderLayerMap (FabricMC#2930)

(cherry picked from commit c2e6f67)
(cherry picked from commit 928d44d)

* Bump version

* Update et_ee.json (FabricMC#2894)

(cherry picked from commit 09aba06)

* Add 'Windswept Hills' biome convention tag (FabricMC#2878)

* add windswept biome tag

* change windswept tag to windswept hills

* list out biomes and revert name change

(cherry picked from commit 1b66477)

* Fixed end biome source injection (FabricMC#2940)

(cherry picked from commit 348a9c6)

(cherry picked from commit f1c68e5)

* EquipmentSlotProvider: Add javadoc link to getPreferredEquipmentSlot (FabricMC#2935)

(cherry picked from commit 09a3510)
(cherry picked from commit 71b8257)

* Conventional Biome Tags tweaks (FabricMC#2955)

* Birch Forest Tag FabricMC#2330

* Fix FabricMC#2649

* Run datagen

(cherry picked from commit 315602f)
(cherry picked from commit 521b5c5)

* Update pl_pl.json (FabricMC#2929)

(cherry picked from commit 36d2fcc)
(cherry picked from commit 8368a8b)

* Update ko_kr.json (FabricMC#2927) (FabricMC#2941)

* Update ko_kr.json

* fix typo

(cherry picked from commit 930b8d4)
(cherry picked from commit eeb6cf3)

* Create zh_cn.json (FabricMC#2945)

(cherry picked from commit 9af20fd)
(cherry picked from commit 93582b9)

* Fix Programmer Art resource pack injection support (FabricMC#2956)

* Bump version

---------

Co-authored-by: PepperCode1 <[email protected]>
Co-authored-by: modmuss50 <[email protected]>
Co-authored-by: Technici4n <[email protected]>
Co-authored-by: Madis Otenurm <[email protected]>
Co-authored-by: Michael <[email protected]>
Co-authored-by: TelepathicGrunt <[email protected]>
Co-authored-by: Juuz <[email protected]>
Co-authored-by: Maity <[email protected]>
Co-authored-by: Yoosk <[email protected]>
Co-authored-by: Alpha <[email protected]>
Co-authored-by: RawDiamondMC <[email protected]>
Co-authored-by: Julian Burner <[email protected]>
Co-authored-by: Amirhan-Taipovjan-Greatest-I <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants