Lantern color correction
This commit is contained in:
parent
5da6976158
commit
dad2064486
69 changed files with 420 additions and 2 deletions
|
@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import net.minecraft.client.color.block.BlockColorProvider;
|
||||
import net.minecraft.client.color.item.ItemColorProvider;
|
||||
import ru.betterend.interfaces.IColorProvider;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
||||
public class BulbVineLanternColoredBlock extends BulbVineLanternBlock implements IColorProvider {
|
||||
public BulbVineLanternColoredBlock(FabricBlockSettings settings) {
|
||||
|
@ -13,17 +14,26 @@ public class BulbVineLanternColoredBlock extends BulbVineLanternBlock implements
|
|||
@Override
|
||||
public BlockColorProvider getProvider() {
|
||||
return (state, world, pos, tintIndex) -> {
|
||||
return this.getDefaultMaterialColor().color;
|
||||
return getColor();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemColorProvider getItemProvider() {
|
||||
return (stack, tintIndex) -> {
|
||||
return this.getDefaultMaterialColor().color;
|
||||
return getColor();
|
||||
};
|
||||
}
|
||||
|
||||
private int getColor() {
|
||||
int color = this.getDefaultMaterialColor().color;
|
||||
int b = (color & 255);
|
||||
int g = ((color >> 8) & 255);
|
||||
int r = ((color >> 16) & 255);
|
||||
float[] hsv = MHelper.fromRGBtoHSB(r, g, b);
|
||||
return MHelper.fromHSBtoRGB(hsv[0], hsv[1], hsv[1] > 0.2 ? 1 : hsv[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getGlowTexture() {
|
||||
return "bulb_vine_lantern_overlay";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue