mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-24 05:54:25 +00:00
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.
72 lines
2.4 KiB
Java
72 lines
2.4 KiB
Java
package codechicken.microblock;
|
|
|
|
import net.minecraft.block.BlockGrass;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import codechicken.lib.render.BlockRenderer.BlockFace;
|
|
import codechicken.lib.render.CCRenderState;
|
|
import codechicken.lib.render.EntityDigIconFX;
|
|
import codechicken.lib.render.uv.IconTransformation;
|
|
import codechicken.lib.render.uv.UVTransformation;
|
|
import codechicken.lib.render.uv.UVTranslation;
|
|
import codechicken.lib.vec.Cuboid6;
|
|
import codechicken.lib.vec.Vector3;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
public class GrassMicroMaterial extends BlockMicroMaterial {
|
|
|
|
private IconTransformation sideIconT;
|
|
|
|
public GrassMicroMaterial() {
|
|
super(Blocks.grass, 0);
|
|
}
|
|
|
|
public IconTransformation sideIconT() {
|
|
return sideIconT;
|
|
}
|
|
|
|
public void sideIconT_$eq(IconTransformation sideIconT) {
|
|
this.sideIconT = sideIconT;
|
|
}
|
|
|
|
@Override
|
|
public void loadIcons() {
|
|
super.loadIcons();
|
|
sideIconT_$eq(new IconTransformation(BlockGrass.getIconSideOverlay()));
|
|
}
|
|
|
|
/**
|
|
* Only grass_top is greyscale and needs the biome tint. Side 0 is dirt and sides 2-5 are grass_side, both already
|
|
* coloured, so tinting them would double up. Matches the carve-out in vanilla EntityDiggingFX.
|
|
*/
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public int getBreakingColour(int side, IBlockAccess world, int x, int y, int z) {
|
|
return side == 1 ? super.getBreakingColour(side, world, x, y, z) : EntityDigIconFX.NO_TINT;
|
|
}
|
|
|
|
@Override
|
|
public void renderMicroFace(Vector3 pos, int pass, Cuboid6 bounds) {
|
|
BlockFace face = (BlockFace) CCRenderState.instance().model;
|
|
if (pass != -1) {
|
|
face.computeLightCoords();
|
|
}
|
|
|
|
if (face.side == 1) {
|
|
MaterialRenderHelper$.MODULE$.start(pos, pass, icont()).blockColour(getColour(pass)).lighting()
|
|
.blockAndMeta(block(), meta()).render();
|
|
} else {
|
|
MaterialRenderHelper$.MODULE$.start(pos, pass, icont()).lighting().render();
|
|
}
|
|
|
|
if (face.side > 1) {
|
|
UVTransformation overlay = (UVTransformation) new UVTranslation(0, bounds.max.y - 1)
|
|
.$plus$plus(sideIconT());
|
|
MaterialRenderHelper$.MODULE$.start(pos, pass, overlay).blockColour(getColour(pass)).lighting()
|
|
.blockAndMeta(block(), meta()).render();
|
|
}
|
|
}
|
|
}
|