补全没修改的配件效果
This commit is contained in:
parent
2cea1f38b5
commit
72cab16f45
3 changed files with 18 additions and 22 deletions
|
@ -13,6 +13,7 @@ import net.mcreator.superbwarfare.network.message.ShootMessage;
|
|||
import net.mcreator.superbwarfare.perk.AmmoPerk;
|
||||
import net.mcreator.superbwarfare.perk.Perk;
|
||||
import net.mcreator.superbwarfare.perk.PerkHelper;
|
||||
import net.mcreator.superbwarfare.tools.GunsTool;
|
||||
import net.mcreator.superbwarfare.tools.MillisTimer;
|
||||
import net.mcreator.superbwarfare.tools.SeekTool;
|
||||
import net.minecraft.client.CameraType;
|
||||
|
@ -613,21 +614,17 @@ public class ClientEventHandler {
|
|||
|
||||
CompoundTag tag = player.getMainHandItem().getOrCreateTag();
|
||||
float times = (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
||||
int barrelType = tag.getInt("barrel_type");
|
||||
int barrelType = GunsTool.getAttachmentType(player.getMainHandItem(), GunsTool.AttachmentType.BARREL);
|
||||
|
||||
double recoil = 1.8;
|
||||
|
||||
if (barrelType == 1) {
|
||||
recoil = 0.7;
|
||||
} else if (barrelType == 2) {
|
||||
recoil = 1;
|
||||
}
|
||||
double recoil = switch (barrelType) {
|
||||
case 1 -> 0.7;
|
||||
case 2 -> 1;
|
||||
default -> 1.8;
|
||||
};
|
||||
|
||||
|
||||
float gunRecoilX = (float) tag.getDouble("recoil_x") * 60;
|
||||
|
||||
|
||||
|
||||
if (recoilHorizon > 0) {
|
||||
recoilHorizon = recoilHorizon - Math.min(Math.pow(recoilHorizon, 2), 6) * times + recoilY;
|
||||
} else {
|
||||
|
|
|
@ -152,23 +152,24 @@ public class GunEventHandler {
|
|||
|
||||
float soundRadius = (float) (stack.getOrCreateTag().getDouble("SoundRadius") * stack.getOrCreateTag().getDouble("CustomSoundRadius"));
|
||||
|
||||
int barrelType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.BARREL);
|
||||
|
||||
SoundEvent sound1p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (stack.getOrCreateTag().getInt("barrel_type") == 2 ? "_fire_1p_s" : "_fire_1p")));
|
||||
SoundEvent sound1p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (barrelType == 2 ? "_fire_1p_s" : "_fire_1p")));
|
||||
if (sound1p != null && player instanceof ServerPlayer serverPlayer) {
|
||||
SoundTool.playLocalSound(serverPlayer, sound1p, 2f, 1f);
|
||||
}
|
||||
|
||||
SoundEvent sound3p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (stack.getOrCreateTag().getInt("barrel_type") == 2 ? "_fire_3p_s" : "_fire_3p")));
|
||||
SoundEvent sound3p = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (barrelType == 2 ? "_fire_3p_s" : "_fire_3p")));
|
||||
if (sound3p != null) {
|
||||
player.level().playSound(null, player.getOnPos(), sound3p, SoundSource.PLAYERS, soundRadius * 0.2f, 1f);
|
||||
}
|
||||
|
||||
SoundEvent soundFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (stack.getOrCreateTag().getInt("barrel_type") == 2 ? "_far_s" : "_far")));
|
||||
SoundEvent soundFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (barrelType == 2 ? "_far_s" : "_far")));
|
||||
if (soundFar != null) {
|
||||
player.level().playSound(null, player.getOnPos(), soundFar, SoundSource.PLAYERS, soundRadius * 0.5f, 1f);
|
||||
}
|
||||
|
||||
SoundEvent soundVeryFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (stack.getOrCreateTag().getInt("barrel_type") == 2 ? "_veryfar_s" : "_veryfar")));
|
||||
SoundEvent soundVeryFar = ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation(ModUtils.MODID, name + (barrelType == 2 ? "_veryfar_s" : "_veryfar")));
|
||||
if (soundVeryFar != null) {
|
||||
player.level().playSound(null, player.getOnPos(), soundVeryFar, SoundSource.PLAYERS, soundRadius, 1f);
|
||||
}
|
||||
|
|
|
@ -135,16 +135,14 @@ public class AK12Item extends GunItem implements GeoItem, AnimatedItem {
|
|||
|
||||
int scopeType = stack.getOrCreateTag().getInt("scope_type");
|
||||
int barrelType = stack.getOrCreateTag().getInt("barrel_type");
|
||||
int magType = stack.getOrCreateTag().getInt("magazine_type");
|
||||
int magType = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.MAGAZINE);
|
||||
int stockType = stack.getOrCreateTag().getInt("stock_type");
|
||||
|
||||
int customMag = 0;
|
||||
|
||||
if (magType == 1) {
|
||||
customMag = 15;
|
||||
} else if (magType == 2) {
|
||||
customMag = 45;
|
||||
}
|
||||
int customMag = switch (magType) {
|
||||
case 1 -> 15;
|
||||
case 2 -> 45;
|
||||
default -> 0;
|
||||
};
|
||||
|
||||
// if (scopeType == 1) {
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue