feat: Tint microblock breaking particles by material colour

Covers whose texture is greyscale and coloured at render time broke into
grey particles. A grass cover hit on the top face gave stone coloured
particles while its sides and bottom looked right, and a leaves cover was
wrong on every face. The cover itself rendered correctly, because
BlockMicroMaterial.renderMicroFace already feeds colorMultiplier to the
face renderer, but nothing carried that tint through to the particles.

Add getBreakingColour to IMicroMaterial, defaulting to no tint.
BlockMicroMaterial returns the block colour multiplier and
GrassMicroMaterial restricts it to the top face, since grass_side and
dirt are already coloured, matching the carve out in vanilla
EntityDiggingFX. JIconHitEffects gains matching getBreakingColour and
getBrokenColour defaults, IconHitEffects passes them to the colour aware
EntityDigIconFX overloads, and McBlockPart uses the colour multiplier of
the block it wraps.

Microblock carries the part level override rather than the
MicroblockClient trait. A new Scala trait member is abstract on the
compiled interface, so mixins built against older FMP would fail with
AbstractMethodError, which the frozen ReferenceScalaMicroblockTraits
fixture caught. A concrete method on the class is inherited by those
mixins instead, and still wins over the interface default.

Characterization expectations are updated for the added signatures and
for the hit effect evaluation order, which now reads the colour from the
material right after the icon for the same side.

Needs the CodeChickenCore build that adds the colour aware
EntityDigIconFX overloads.
This commit is contained in:
Algent committed 2026-09-14 11:28:11 +02:00
1 parent 367ecac68c
commit f86a31d908
17 files changed
+299 -9

No files matched your search

@@ -7,6 +7,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.uv.MultiIconTransformation;
@@ -163,6 +164,17 @@ public class BlockMicroMaterial implements IMicroMaterial {
return block().getIcon(side, meta());
}
/**
* Resolves the block tint with this material's block and metadata at the particle origin. Neighbor and biome
* lookups still use the supplied world; the multipart host's metadata must not select the material's colour.
*/
@Override
@SideOnly(Side.CLIENT)
public int getBreakingColour(int side, IBlockAccess world, int x, int y, int z) {
Block materialBlock = block();
return materialBlock.colorMultiplier(new MaterialBlockAccess(world, materialBlock, meta(), x, y, z), x, y, z);
}
@Override
public ItemStack getItem() {
return new ItemStack(block(), 1, meta());