mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 04:27:59 +01:00
Preserve the render layer used by item glints
This commit is contained in:
parent
b38c8530f8
commit
3aabd80e5b
2 changed files with 11 additions and 7 deletions
|
@ -42,6 +42,6 @@ abstract class MixinHeldItemRenderer {
|
|||
VertexConsumerProvider renderContext,
|
||||
@Nullable World world,
|
||||
int lightUv, int overlayUv, int posLong) {
|
||||
PonyRenderDispatcher.getInstance().getMagicRenderer().renderItemInFirstPerson(target, entity, item, transform, left, stack, renderContext, world, lightUv, posLong);
|
||||
PonyRenderDispatcher.getInstance().getMagicRenderer().renderItem(target, entity, item, transform, left, stack, renderContext, world, lightUv, posLong);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@ import com.minelittlepony.client.util.render.RenderLayerUtil;
|
|||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.item.ItemRenderer;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
@ -16,22 +15,27 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.CrossbowItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.screen.PlayerScreenHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.UseAction;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class LevitatingItemRenderer {
|
||||
private VertexConsumerProvider getProvider(IPony pony, VertexConsumerProvider renderContext) {
|
||||
final int color = pony.metadata().getGlowColor();
|
||||
final int color = (pony.metadata().getGlowColor() * 0) + 0x0000FF00;
|
||||
return layer -> {
|
||||
return renderContext.getBuffer(MagicGlow.getColoured(RenderLayerUtil.getTexture(layer).orElse(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE), color));
|
||||
Identifier texture = RenderLayerUtil.getTexture(layer).orElse(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE);
|
||||
if (texture == ItemRenderer.ENTITY_ENCHANTMENT_GLINT || texture == ItemRenderer.ITEM_ENCHANTMENT_GLINT) {
|
||||
return renderContext.getBuffer(layer);
|
||||
}
|
||||
return renderContext.getBuffer(MagicGlow.getColoured(texture, color));
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders an item in first person optionally with a magical overlay.
|
||||
* Renders an item with a magical overlay.
|
||||
*/
|
||||
public void renderItemInFirstPerson(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformationMode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) {
|
||||
public void renderItem(ItemRenderer itemRenderer, @Nullable LivingEntity entity, ItemStack stack, ModelTransformationMode mode, boolean left, MatrixStack matrix, VertexConsumerProvider renderContext, @Nullable World world, int lightUv, int posLong) {
|
||||
|
||||
if (entity instanceof PlayerEntity && (mode.isFirstPerson() || mode == ModelTransformationMode.THIRD_PERSON_LEFT_HAND || mode == ModelTransformationMode.THIRD_PERSON_RIGHT_HAND)) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue