修复加特林和莫名其妙的视角摇晃
This commit is contained in:
parent
dbfddf7440
commit
18ebf6c308
4 changed files with 25 additions and 25 deletions
|
@ -24,7 +24,7 @@ public class ProjectileEntityModel extends GeoModel<ProjectileEntity> {
|
|||
return new ResourceLocation(ModUtils.MODID, "geo/projectile_entity2.geo.json");
|
||||
}
|
||||
|
||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS
|
||||
if ((GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS && !player.getMainHandItem().is(ModItems.MINIGUN.get()))
|
||||
|| player.getMainHandItem().is(ModItems.GLOCK_17.get())
|
||||
|| player.getMainHandItem().is(ModItems.GLOCK_18.get())
|
||||
|| player.getMainHandItem().is(ModItems.BOCEK.get())) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.client.CameraType;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
@ -139,7 +138,7 @@ public class ClientEventHandler {
|
|||
clientTimer.setProgress((long) (clientTimer.getProgress() - cooldown));
|
||||
}
|
||||
|
||||
player.displayClientMessage(Component.literal(new java.text.DecimalFormat("####").format(clientTimer.getProgress())), true);
|
||||
// player.displayClientMessage(Component.literal(new java.text.DecimalFormat("####").format(clientTimer.getProgress())), true);
|
||||
} else {
|
||||
clientTimer.stop();
|
||||
}
|
||||
|
@ -205,23 +204,6 @@ public class ClientEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private static void handleCannonScreen(LivingEntity entity) {
|
||||
if (entity.level().isClientSide() && entity instanceof Player player) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
DroneEntity drone = entity.level().getEntitiesOfClass(DroneEntity.class, entity.getBoundingBox().inflate(512))
|
||||
.stream().filter(e -> e.getStringUUID().equals(stack.getOrCreateTag().getString("LinkedDrone"))).findFirst().orElse(null);
|
||||
|
||||
if ((drone != null && player.getMainHandItem().is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using"))
|
||||
|| (player.isPassenger() && player.getVehicle() instanceof ICannonEntity && GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS && !stack.is(ModTags.Items.GUN))) {
|
||||
if (Minecraft.getInstance().gameRenderer.currentEffect() == null) {
|
||||
Minecraft.getInstance().gameRenderer.loadEffect(new ResourceLocation("minecraft:shaders/post/scan_pincushion.json"));
|
||||
}
|
||||
} else {
|
||||
Minecraft.getInstance().gameRenderer.shutdownEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderHand(RenderHandEvent event) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
@ -436,9 +418,18 @@ public class ClientEventHandler {
|
|||
}
|
||||
|
||||
public static void shake(double boneRotX, double boneRotY, double boneRotZ) {
|
||||
cameraRot[0] = boneRotX;
|
||||
cameraRot[1] = boneRotY;
|
||||
cameraRot[2] = boneRotZ;
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if (player != null) {
|
||||
if (player.getMainHandItem().is(ModTags.Items.GUN) || (player.getVehicle() != null && (player.getVehicle() instanceof ICannonEntity))) {
|
||||
cameraRot[0] = boneRotX;
|
||||
cameraRot[1] = boneRotY;
|
||||
cameraRot[2] = boneRotZ;
|
||||
} else {
|
||||
cameraRot[0] = 0;
|
||||
cameraRot[1] = 0;
|
||||
cameraRot[2] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handlePlayerCameraShake(ViewportEvent.ComputeCameraAngles event) {
|
||||
|
|
|
@ -211,7 +211,7 @@ public class GunEventHandler {
|
|||
|
||||
if (tag.getDouble("overheat") == 0
|
||||
&& (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).rifleAmmo > 0
|
||||
&& !(player.getCooldowns().isOnCooldown(stack.getItem())) && tag.getDouble("minigun_rotation") >= 10 && player.getPersistentData().getBoolean("firing")) {
|
||||
&& !(player.getCooldowns().isOnCooldown(stack.getItem())) && tag.getDouble("minigun_rotation") >= 10 && player.getPersistentData().getBoolean("holdFire")) {
|
||||
tag.putDouble("heat", (tag.getDouble("heat") + 0.5));
|
||||
if (tag.getDouble("heat") >= 50.5) {
|
||||
tag.putDouble("overheat", 40);
|
||||
|
|
|
@ -122,17 +122,26 @@ public class ShootMessage {
|
|||
stack.getOrCreateTag().putDouble("chamber_rot", 20);
|
||||
}
|
||||
|
||||
int actionInterval = 0;
|
||||
|
||||
if (stack.getItem() == ModItems.MARLIN.get() || stack.getItem() == ModItems.M_870.get()) {
|
||||
actionInterval = stack.getOrCreateTag().getInt("fire_interval");
|
||||
}
|
||||
|
||||
int customCoolDown = 0;
|
||||
|
||||
if (stack.getItem() == ModItems.MARLIN.get()) {
|
||||
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
||||
stack.getOrCreateTag().putDouble("marlin_animation_time", 15);
|
||||
stack.getOrCreateTag().putBoolean("fastfiring", false);
|
||||
customCoolDown = 5;
|
||||
} else {
|
||||
stack.getOrCreateTag().putDouble("marlin_animation_time", 10);
|
||||
stack.getOrCreateTag().putBoolean("fastfiring", true);
|
||||
}
|
||||
}
|
||||
|
||||
int cooldown = burstCooldown;
|
||||
int cooldown = burstCooldown + actionInterval + customCoolDown;
|
||||
player.getCooldowns().addCooldown(stack.getItem(), cooldown);
|
||||
|
||||
for (int index0 = 0; index0 < (int) stack.getOrCreateTag().getDouble("projectile_amount"); index0++) {
|
||||
|
|
Loading…
Add table
Reference in a new issue