为子弹添加rgb字段

This commit is contained in:
17146 2024-08-08 15:41:51 +08:00
parent 20e700d469
commit c63c768651
3 changed files with 25 additions and 9 deletions

View file

@ -85,6 +85,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
private float bypassArmorRate = 0.0f;
private float undeadMultiple = 1.0f;
public float[] rgb = {1, 222 / 255f, 39 / 255f};
public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) {
super(p_i50159_1_, p_i50159_2_);
}
@ -679,4 +681,9 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
this.undeadMultiple = undeadMultiple;
return this;
}
public ProjectileEntity rgb(float[] rgb) {
this.rgb = rgb;
return this;
}
}

View file

@ -19,9 +19,12 @@ public class ProjectileEntityLayer extends GeoRenderLayer<ProjectileEntity> {
super(entityRenderer);
}
// TODO 实现更合理的layer渲染
@Override
public void render(PoseStack poseStack, ProjectileEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
RenderType glowRenderType = RenderType.eyes(LAYER);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType),
partialTick, packedLight, OverlayTexture.NO_OVERLAY,
animatable.rgb[0], animatable.rgb[1], animatable.rgb[2], 0.8f);
}
}

View file

@ -4,6 +4,7 @@ import net.minecraft.util.Mth;
public class AmmoPerk extends Perk {
public float bypassArmorRate = 0.0f;
public float[] rgb = {1, 222 / 255f, 39 / 255f};
public AmmoPerk(String descriptionId, Type type) {
super(descriptionId, type);
@ -13,4 +14,9 @@ public class AmmoPerk extends Perk {
super(descriptionId, type);
this.bypassArmorRate = Mth.clamp(bypassArmorRate, -1, 1);
}
public AmmoPerk rgb(float[] rgb) {
this.rgb = rgb;
return this;
}
}