mirror of
https://github.com/KAMKEEL/CustomNPC-Gecko-Addon.git
synced 2026-11-13 06:37:35 +00:00
Made tint work with custom modeled entities
This commit is contained in:
1 parent
015ff5c96e
commit
4d6f7cb41c
3 files changed
+26
-3
No files matched your search
@@ -85,12 +85,32 @@ public class RenderCustomModel extends GeoEntityRenderer<EntityCustomModel> {
|
||||
|
||||
public Color getRenderColor(EntityCustomModel animatable, float partialTicks) {
|
||||
if(animatable.hurtTime>0 || animatable.deathTime > 0){
|
||||
if(animatable.tintData!=null && animatable.tintData.isTintEnabled() && animatable.tintData.isHurtTintEnabled()){
|
||||
int hurtTint = animatable.tintData.getHurtTint();
|
||||
int r = (int) ((float)(hurtTint >> 16 & 255));
|
||||
int g = (int) ((float)(hurtTint >> 8 & 255));
|
||||
int b = (int) ((float)(hurtTint & 255));
|
||||
return Color.ofRGBA(r,g,b, 255);
|
||||
}
|
||||
return Color.ofRGBA(255, 153, 153, 255);
|
||||
}else{
|
||||
if(animatable.isSemiVisible){
|
||||
return Color.ofRGBA(255, 255, 255, 100);
|
||||
int r = 255;
|
||||
int g = 255;
|
||||
int b = 255;
|
||||
if(animatable.tintData!=null && animatable.tintData.isTintEnabled() && animatable.tintData.isGeneralTintEnabled()){
|
||||
int hurtTint = animatable.tintData.getGeneralTint();
|
||||
int tintR = (int) ((float)(hurtTint >> 16 & 255));
|
||||
int tintG = (int) ((float)(hurtTint >> 8 & 255));
|
||||
int tintB = (int) ((float)(hurtTint & 255));
|
||||
double alpha = ((double)animatable.tintData.getGeneralAlpha() / 100.0);
|
||||
r = (int) (alpha*tintR + r*(1-alpha));
|
||||
g = (int) (alpha*tintG + g*(1-alpha));
|
||||
b = (int) (alpha*tintB + b*(1-alpha));
|
||||
}
|
||||
return Color.ofRGBA(255, 255, 255, 255);
|
||||
if(animatable.isSemiVisible){
|
||||
return Color.ofRGBA(r, g, b, 100);
|
||||
}
|
||||
return Color.ofRGBA(r, g, b, 255);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.controllers.data.TintData;
|
||||
import software.bernie.geckolib3.core.AnimationState;
|
||||
import software.bernie.geckolib3.core.IAnimatable;
|
||||
import software.bernie.geckolib3.core.IAnimationTickable;
|
||||
@@ -33,6 +34,7 @@ public class EntityCustomModel extends EntityCreature implements IAnimatable, IA
|
||||
public AnimationBuilder hurtAnim = null;
|
||||
public ItemStack leftHeldItem;
|
||||
public boolean isSemiVisible = false;
|
||||
public TintData tintData;
|
||||
|
||||
private <E extends IAnimatable> PlayState predicateMovement(AnimationEvent<E> event) {
|
||||
if (manualAnim != null) {
|
||||
|
||||
@@ -38,6 +38,7 @@ public class MixinGeckoAddon {
|
||||
modelEntity.leftHeldItem = npc.inventory.getOffHand();
|
||||
modelEntity.hurtTime = npc.hurtTime;
|
||||
modelEntity.deathTime = npc.deathTime;
|
||||
modelEntity.tintData = npc.display.tintData;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user