调整overlay
This commit is contained in:
parent
8d3d7e3269
commit
661dd7e106
1 changed files with 15 additions and 8 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.atsuishio.superbwarfare.client.overlay;
|
package com.atsuishio.superbwarfare.client.overlay;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.Mod;
|
import com.atsuishio.superbwarfare.Mod;
|
||||||
|
import com.atsuishio.superbwarfare.item.gun.GunItem;
|
||||||
import net.minecraft.client.DeltaTracker;
|
import net.minecraft.client.DeltaTracker;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiGraphics;
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
@ -8,11 +9,16 @@ import net.minecraft.client.gui.LayeredDraw;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemDisplayContext;
|
import net.minecraft.world.item.ItemDisplayContext;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.api.distmarker.OnlyIn;
|
import net.neoforged.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这个类的作用是在看不见的地方渲染一个第三人称的武器模型,别管为啥这么干
|
||||||
|
* 反正删了这个绝对会出事
|
||||||
|
*/
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class ItemRendererFixOverlay implements LayeredDraw.Layer {
|
public class ItemRendererFixOverlay implements LayeredDraw.Layer {
|
||||||
|
|
||||||
|
@ -22,14 +28,15 @@ public class ItemRendererFixOverlay implements LayeredDraw.Layer {
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public void render(GuiGraphics guiGraphics, DeltaTracker deltaTracker) {
|
public void render(GuiGraphics guiGraphics, DeltaTracker deltaTracker) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
Player entity = mc.player;
|
Player player = mc.player;
|
||||||
|
if (player == null) return;
|
||||||
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
if (!(stack.getItem() instanceof GunItem)) return;
|
||||||
|
|
||||||
if (entity != null) {
|
guiGraphics.pose().pushPose();
|
||||||
guiGraphics.pose().pushPose();
|
guiGraphics.pose().translate(-1145.0D, 0.0D, 0.0D);
|
||||||
guiGraphics.pose().translate(-1145.0D, 0.0D, 0.0D);
|
mc.gameRenderer.itemInHandRenderer.renderItem(player, stack,
|
||||||
mc.gameRenderer.itemInHandRenderer.renderItem(entity, entity.getMainHandItem(),
|
ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, false, guiGraphics.pose(), guiGraphics.bufferSource(), 0);
|
||||||
ItemDisplayContext.THIRD_PERSON_RIGHT_HAND, false, guiGraphics.pose(), guiGraphics.bufferSource(), 0);
|
guiGraphics.pose().popPose();
|
||||||
guiGraphics.pose().popPose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue