38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
package net.minecraft.client.renderer.entity.state;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
import net.minecraft.util.ARGB;
|
|
import net.minecraft.util.Mth;
|
|
import net.minecraft.world.entity.animal.sheep.Sheep;
|
|
import net.minecraft.world.item.DyeColor;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public class SheepRenderState extends LivingEntityRenderState {
|
|
public float headEatPositionScale;
|
|
public float headEatAngleScale;
|
|
public boolean isSheared;
|
|
public DyeColor woolColor = DyeColor.WHITE;
|
|
public int id;
|
|
|
|
public int getWoolColor() {
|
|
if (this.isJebSheep()) {
|
|
int i = 25;
|
|
int j = Mth.floor(this.ageInTicks);
|
|
int k = j / 25 + this.id;
|
|
int l = DyeColor.values().length;
|
|
int m = k % l;
|
|
int n = (k + 1) % l;
|
|
float f = (j % 25 + Mth.frac(this.ageInTicks)) / 25.0F;
|
|
int o = Sheep.getColor(DyeColor.byId(m));
|
|
int p = Sheep.getColor(DyeColor.byId(n));
|
|
return ARGB.lerp(f, o, p);
|
|
} else {
|
|
return Sheep.getColor(this.woolColor);
|
|
}
|
|
}
|
|
|
|
public boolean isJebSheep() {
|
|
return this.customName != null && "jeb_".equals(this.customName.getString());
|
|
}
|
|
}
|