营业妨碍COD的动态准星
This commit is contained in:
parent
a7ca9e07e2
commit
ae317597cf
2 changed files with 32 additions and 31 deletions
|
@ -39,7 +39,7 @@ public class CrossHairOverlay {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
double spread = ClientEventHandler.gunSpread;
|
double spread = ClientEventHandler.gunSpread + 3 * ClientEventHandler.firePos;
|
||||||
|
|
||||||
RenderSystem.disableDepthTest();
|
RenderSystem.disableDepthTest();
|
||||||
RenderSystem.depthMask(false);
|
RenderSystem.depthMask(false);
|
||||||
|
@ -48,31 +48,36 @@ public class CrossHairOverlay {
|
||||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||||
|
|
||||||
|
float moveX = (float) (-6 * ClientEventHandler.turnRot[1] - (player.isSprinting() ? 10 : 6) * ClientEventHandler.movePosX);
|
||||||
|
float moveY = (float) (-6 * ClientEventHandler.turnRot[0] + 6 * (float)ClientEventHandler.velocityY - (player.isSprinting() ? 10 : 6) * ClientEventHandler.movePosY - 2 * ClientEventHandler.firePos);
|
||||||
|
|
||||||
if (shouldRenderCrossHair(player) || stack.is(ModItems.MINIGUN.get()) || (stack.is(ModItems.BOCEK.get()) && stack.getOrCreateTag().getBoolean("HoloHidden"))) {
|
if (shouldRenderCrossHair(player) || stack.is(ModItems.MINIGUN.get()) || (stack.is(ModItems.BOCEK.get()) && stack.getOrCreateTag().getBoolean("HoloHidden"))) {
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/point.png"), w / 2f - 7.5f, h / 2f - 7.5f, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/point.png"), w / 2f - 7.5f + moveX, h / 2f - 7.5f + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), (float) (w / 2f - 13.5f - 2.8f * spread), h / 2f - 7.5f, 0, 0, 16, 16, 16, 16);
|
if (!player.isSprinting()) {
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), (float) (w / 2f - 2.5f + 2.8f * spread), h / 2f - 7.5f, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), (float) (w / 2f - 13.5f - 2.8f * spread) + moveX, h / 2f - 7.5f + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f, (float) (h / 2f - 2.5f + 2.8f * spread), 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexheng.png"), (float) (w / 2f - 2.5f + 2.8f * spread) + moveX, h / 2f - 7.5f + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f, (float) (h / 2f - 13.5f - 2.8f * spread), 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f + moveX, (float) (h / 2f - 2.5f + 2.8f * spread) + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/rexshu.png"), w / 2f - 7.5f + moveX, (float) (h / 2f - 13.5f - 2.8f * spread) + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float ww = w / 2f - 7.5f + (float) (2 * (Math.random() - 0.5f));
|
float ww = w / 2f - 7.5f + (float) (2 * (Math.random() - 0.5f));
|
||||||
float hh = h / 2f - 8 + (float) (2 * (Math.random() - 0.5f));
|
float hh = h / 2f - 7.5f + (float) (2 * (Math.random() - 0.5f));
|
||||||
float m = (40 - KILL_INDICATOR * 5) / 5.5f;
|
float m = (40 - KILL_INDICATOR * 5) / 5.5f;
|
||||||
|
|
||||||
if (HIT_INDICATOR > 0) {
|
if (HIT_INDICATOR > 0) {
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/hit_marker.png"), ww, hh, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/hit_marker.png"), ww + moveX, hh + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (HEAD_INDICATOR > 0) {
|
if (HEAD_INDICATOR > 0) {
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/headshotmark.png"), ww, hh, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/headshotmark.png"), ww + moveX, hh + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KILL_INDICATOR > 0) {
|
if (KILL_INDICATOR > 0) {
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark1.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark1.png"), w / 2f - 7.5f - 2 + m + moveX, h / 2f - 7.5f - 2 + m + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark2.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 - 2 + m, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark2.png"), w / 2f - 7.5f + 2 - m + moveX, h / 2f - 7.5f - 2 + m + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark3.png"), w / 2f - 7.5f - 2 + m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark3.png"), w / 2f - 7.5f - 2 + m + moveX, h / 2f - 7.5f + 2 - m + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark4.png"), w / 2f - 7.5f + 2 - m, h / 2f - 8 + 2 - m, 0, 0, 16, 16, 16, 16);
|
preciseBlit(event.getGuiGraphics(), new ResourceLocation(ModUtils.MODID, "textures/screens/kill_mark4.png"), w / 2f - 7.5f + 2 - m + moveX, h / 2f - 7.5f + 2 - m + moveY, 0, 0, 16, 16, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderSystem.depthMask(true);
|
RenderSystem.depthMask(true);
|
||||||
|
|
|
@ -107,10 +107,13 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isMove() {
|
private static boolean isMove() {
|
||||||
return Minecraft.getInstance().options.keyLeft.isDown()
|
Player player = Minecraft.getInstance().player;
|
||||||
|| Minecraft.getInstance().options.keyRight.isDown()
|
return Minecraft.getInstance().options.keyLeft.isDown()
|
||||||
|| Minecraft.getInstance().options.keyUp.isDown()
|
|| Minecraft.getInstance().options.keyRight.isDown()
|
||||||
|| Minecraft.getInstance().options.keyDown.isDown();
|
|| Minecraft.getInstance().options.keyUp.isDown()
|
||||||
|
|| Minecraft.getInstance().options.keyDown.isDown()
|
||||||
|
|| (player != null && player.isSprinting());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
|
@ -128,15 +131,15 @@ public class ClientEventHandler {
|
||||||
|
|
||||||
double basicDev = stack.getOrCreateTag().getDouble("spread");
|
double basicDev = stack.getOrCreateTag().getDouble("spread");
|
||||||
|
|
||||||
double walk = isMove() ? 0.75 * basicDev : 0;
|
double walk = isMove() ? 0.15 * basicDev : 0;
|
||||||
|
|
||||||
double sprint = player.isSprinting() ? 1.25 * basicDev : 0;
|
double sprint = player.isSprinting() ? 0.25 * basicDev : 0;
|
||||||
|
|
||||||
double crouching = player.isCrouching() ? -0.15 * basicDev : 0;
|
double crouching = player.isCrouching() ? -0.15 * basicDev : 0;
|
||||||
|
|
||||||
double prone = isProne(player) ? -0.3 * basicDev : 0;
|
double prone = isProne(player) ? -0.3 * basicDev : 0;
|
||||||
|
|
||||||
double jump = player.onGround() ? 0 * basicDev : 1.5 * basicDev;
|
double jump = player.onGround() ? 0 * basicDev : 0.35 * basicDev;
|
||||||
|
|
||||||
double ride = player.onGround() ? -0.25 * basicDev : 0;
|
double ride = player.onGround() ? -0.25 * basicDev : 0;
|
||||||
|
|
||||||
|
@ -151,7 +154,7 @@ public class ClientEventHandler {
|
||||||
zoomSpread = 1 - (0.9 * zoomTime);
|
zoomSpread = 1 - (0.9 * zoomTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
double spread = stack.is(ModTags.Items.SHOTGUN) || stack.is(ModItems.MINIGUN.get()) ? 1.2 * zoomSpread * (basicDev + 0.2 * (walk + sprint + crouching + prone + jump + ride) + fireSpread) : zoomSpread * (0.4 * basicDev + walk + sprint + crouching + prone + jump + ride + 0.6 * fireSpread);
|
double spread = stack.is(ModTags.Items.SHOTGUN) || stack.is(ModItems.MINIGUN.get()) ? 1.2 * zoomSpread * (basicDev + 0.2 * (walk + sprint + crouching + prone + jump + ride) + fireSpread) : zoomSpread * (0.7 * basicDev + walk + sprint + crouching + prone + jump + ride + 0.8 * fireSpread);
|
||||||
|
|
||||||
if (gunSpread < spread) {
|
if (gunSpread < spread) {
|
||||||
gunSpread += 0.07 * Math.pow(spread - gunSpread, 2) * times;
|
gunSpread += 0.07 * Math.pow(spread - gunSpread, 2) * times;
|
||||||
|
@ -283,7 +286,6 @@ public class ClientEventHandler {
|
||||||
if (entity.getMainHandItem().is(ModTags.Items.GUN)) {
|
if (entity.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||||
float times = 2 * Minecraft.getInstance().getDeltaFrameTime();
|
float times = 2 * Minecraft.getInstance().getDeltaFrameTime();
|
||||||
double pose;
|
double pose;
|
||||||
var data = entity.getPersistentData();
|
|
||||||
|
|
||||||
if (entity.isShiftKeyDown() && entity.getBbHeight() >= 1 && isProne((Player) entity)) {
|
if (entity.isShiftKeyDown() && entity.getBbHeight() >= 1 && isProne((Player) entity)) {
|
||||||
pose = 0.85;
|
pose = 0.85;
|
||||||
|
@ -306,7 +308,7 @@ public class ClientEventHandler {
|
||||||
double on_ground;
|
double on_ground;
|
||||||
if (entity.onGround()) {
|
if (entity.onGround()) {
|
||||||
if (entity.isSprinting()) {
|
if (entity.isSprinting()) {
|
||||||
on_ground = 1.0;
|
on_ground = 1.35;
|
||||||
} else {
|
} else {
|
||||||
on_ground = 2.0;
|
on_ground = 2.0;
|
||||||
}
|
}
|
||||||
|
@ -411,16 +413,10 @@ public class ClientEventHandler {
|
||||||
firePosTimer = 0.001;
|
firePosTimer = 0.001;
|
||||||
fireRotTimer = 0.001;
|
fireRotTimer = 0.001;
|
||||||
firePosZ = 0.1;
|
firePosZ = 0.1;
|
||||||
fireSpread += 10;
|
fireSpread += 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
fireSpread = Mth.clamp(fireSpread - 0.2 * (Math.pow(fireSpread, 2) * times), 0 ,100);
|
fireSpread = Mth.clamp(fireSpread - 0.1 * (Math.pow(fireSpread, 2) * times), 0 ,100);
|
||||||
|
|
||||||
// Player player = Minecraft.getInstance().player;
|
|
||||||
// if (player != null) {
|
|
||||||
// player.displayClientMessage(Component.literal(new java.text.DecimalFormat("####").format(fireSpread)), true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
firePosZ = Mth.clamp(firePosZ - 0.01 * times, 0, 0.6);
|
firePosZ = Mth.clamp(firePosZ - 0.01 * times, 0, 0.6);
|
||||||
|
|
||||||
if (0 < firePosTimer) {
|
if (0 < firePosTimer) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue