修复小鸟大陀螺,修复victor放大倍率错误,修复波塞克
This commit is contained in:
parent
1336c66699
commit
9402c35894
8 changed files with 40 additions and 36 deletions
|
@ -336,7 +336,6 @@ public class ClickHandler {
|
|||
if (!stack.is(ModItems.BOCEK.get())) {
|
||||
player.playSound(ModSounds.TRIGGER_CLICK.get(), 1, 1);
|
||||
} else {
|
||||
player.playSound(ModSounds.BOCEK_PULL_1P.get(), 1, 1);
|
||||
handTimer = 0;
|
||||
}
|
||||
|
||||
|
@ -367,13 +366,13 @@ public class ClickHandler {
|
|||
|
||||
public static void handleWeaponFireRelease() {
|
||||
PacketDistributor.sendToServer(new FireMessage(1, handTimer, zoom));
|
||||
ClientEventHandler.holdFire = false;
|
||||
ClientEventHandler.holdFireVehicle = false;
|
||||
ClientEventHandler.customRpm = 0;
|
||||
bowPull = false;
|
||||
holdFire = false;
|
||||
holdFireVehicle = false;
|
||||
customRpm = 0;
|
||||
}
|
||||
|
||||
public static void handleWeaponZoomPress(Player player, ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof GunItem)) return;
|
||||
PacketDistributor.sendToServer(new ZoomMessage(0));
|
||||
|
||||
if (player.getVehicle() instanceof VehicleEntity pVehicle && player.getVehicle() instanceof WeaponVehicleEntity iVehicle && iVehicle.hasWeapon(pVehicle.getSeatIndex(player)) && iVehicle.banHand(player)) {
|
||||
|
|
|
@ -45,22 +45,16 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
|||
private static int getGunAmmoCount(Player player) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
// TODO 替换为直接使用背包弹药判断
|
||||
if (stack.getItem() == ModItems.MINIGUN.get()) {
|
||||
return GunData.from(stack).countAmmo(player);
|
||||
}
|
||||
|
||||
if (stack.getItem() == ModItems.BOCEK.get()) {
|
||||
return GunData.from(stack).countAmmo(player);
|
||||
}
|
||||
|
||||
return GunData.from(stack).ammo.get();
|
||||
}
|
||||
|
||||
private static String getPlayerAmmoCount(Player player) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
|
||||
if (stack.getItem() == ModItems.MINIGUN.get() || stack.getItem() == ModItems.BOCEK.get()) {
|
||||
if (stack.getItem() == ModItems.MINIGUN.get()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -180,7 +174,7 @@ public class AmmoBarOverlay implements LayeredDraw.Layer {
|
|||
poseStack.pushPose();
|
||||
poseStack.scale(1.5f, 1.5f, 1f);
|
||||
|
||||
if ((stack.getItem() == ModItems.MINIGUN.get() || stack.getItem() == ModItems.BOCEK.get()) && hasCreativeAmmo()) {
|
||||
if (stack.getItem() == ModItems.MINIGUN.get() && hasCreativeAmmo()) {
|
||||
guiGraphics.drawString(
|
||||
Minecraft.getInstance().font,
|
||||
"∞",
|
||||
|
|
|
@ -87,11 +87,12 @@ public class BocekItemRenderer extends GeoItemRenderer<BocekItem> {
|
|||
}
|
||||
|
||||
if (name.equals("arrow")) {
|
||||
bone.setHidden(GunsTool.getGunIntTag(tag, "ArrowEmpty") > 0);
|
||||
bone.setHidden(GunsTool.getGunIntTag(tag, "ArrowEmpty") > 1);
|
||||
}
|
||||
|
||||
if (name.equals("jian")) {
|
||||
bone.setHidden(!GunData.from(itemStack).hasAmmo(player));
|
||||
var data = GunData.from(itemStack);
|
||||
bone.setHidden(data.ammo.get() == 0);
|
||||
}
|
||||
|
||||
if (renderingArms) {
|
||||
|
|
|
@ -319,7 +319,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
|||
engineStartOver = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if (!onGround() && engineStartOver) {
|
||||
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.0003f, 0.01f));
|
||||
destroyRot += 0.15f;
|
||||
|
||||
|
|
|
@ -121,6 +121,7 @@ public class ClientEventHandler {
|
|||
public static MillisTimer clientTimerVehicle = new MillisTimer();
|
||||
|
||||
public static boolean holdFire = false;
|
||||
public static boolean bowPull = false;
|
||||
|
||||
public static boolean zoom = false;
|
||||
public static boolean breath = false;
|
||||
|
@ -1454,7 +1455,14 @@ public class ClientEventHandler {
|
|||
private static void handleBowPullAnimation(LivingEntity entity, ItemStack stack) {
|
||||
float times = 4 * (float) Math.min(Minecraft.getInstance().getTimer().getRealtimeDeltaTicks(), 0.8);
|
||||
|
||||
if (holdFire && entity instanceof Player player && !player.getCooldowns().isOnCooldown(stack.getItem())) {
|
||||
var data = GunData.from(stack);
|
||||
|
||||
if (holdFire && data.ammo.get() > 0 && !bowPull && stack.is(ModItems.BOCEK.get())) {
|
||||
entity.playSound(ModSounds.BOCEK_PULL_1P.get(), 1, 1);
|
||||
bowPull = true;
|
||||
}
|
||||
|
||||
if (bowPull) {
|
||||
pullTimer = Math.min(pullTimer + 0.024 * times, 1.4);
|
||||
bowTimer = Math.min(bowTimer + 0.018 * times, 1);
|
||||
handTimer = Math.min(handTimer + 0.018 * times, 1);
|
||||
|
|
|
@ -130,7 +130,7 @@ public class VectorItem extends GunItem implements GeoItem {
|
|||
@Override
|
||||
public double getCustomZoom(ItemStack stack) {
|
||||
int scopeType = GunData.from(stack).attachment.get(AttachmentType.SCOPE);
|
||||
return scopeType == 2 ? (NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 2.75) : 0;
|
||||
return scopeType == 2 ? (NBTTool.getTag(stack).getBoolean("ScopeAlt") ? 0 : 0.75) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -94,19 +94,22 @@ public class BocekItem extends GunItem implements GeoItem, ReleaseSpecialWeapon
|
|||
public void inventoryTick(ItemStack stack, Level world, Entity entity, int slot, boolean selected) {
|
||||
super.inventoryTick(stack, world, entity, slot, selected);
|
||||
var data = GunData.from(stack);
|
||||
final var tag = data.tag();
|
||||
|
||||
if (GunsTool.getGunIntTag(tag, "ArrowEmpty") > 0) {
|
||||
GunsTool.setGunIntTag(tag, "ArrowEmpty", GunsTool.getGunIntTag(tag, "ArrowEmpty") - 1);
|
||||
if (entity instanceof Player player) {
|
||||
if (GunsTool.getGunIntTag(GunData.from(stack).tag, "ArrowEmpty") > 0) {
|
||||
GunsTool.setGunIntTag(GunData.from(stack).tag, "ArrowEmpty", GunsTool.getGunIntTag(GunData.from(stack).tag, "ArrowEmpty") - 1);
|
||||
}
|
||||
|
||||
if (GunsTool.getGunIntTag(GunData.from(stack).tag, "ArrowEmpty") == 0 && data.ammo.get() == 0 && (data.countAmmo(player) > 0 || InventoryTool.hasCreativeAmmoBox(player))) {
|
||||
if (!InventoryTool.hasCreativeAmmoBox(player)) {
|
||||
data.consumeAmmo(player, 1);
|
||||
}
|
||||
data.ammo.set(1);
|
||||
}
|
||||
data.save();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO 替换硬编码判断
|
||||
protected static boolean check(ItemStack stack) {
|
||||
return stack.getItem() == Items.ARROW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getGunIcon() {
|
||||
return Mod.loc("textures/gun_icon/bocek_icon.png");
|
||||
|
@ -145,16 +148,17 @@ public class BocekItem extends GunItem implements GeoItem, ReleaseSpecialWeapon
|
|||
public void fireOnRelease(Player player, final GunData data, double power, boolean zoom) {
|
||||
if (player.level().isClientSide()) return;
|
||||
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
var perk = data.perk.get(Perk.Type.AMMO);
|
||||
|
||||
if (data.ammo.get() == 0) return;
|
||||
|
||||
if (player instanceof ServerPlayer serverPlayer) {
|
||||
SoundTool.stopSound(serverPlayer, ModSounds.BOCEK_PULL_1P.getId(), SoundSource.PLAYERS);
|
||||
SoundTool.stopSound(serverPlayer, ModSounds.BOCEK_PULL_3P.getId(), SoundSource.PLAYERS);
|
||||
PacketDistributor.sendToPlayer(serverPlayer, new ShootClientMessage(10));
|
||||
}
|
||||
|
||||
var tag = data.tag();
|
||||
var stack = data.stack();
|
||||
var perk = data.perk.get(Perk.Type.AMMO);
|
||||
|
||||
if (power * 12 >= 6) {
|
||||
if (zoom) {
|
||||
spawnBullet(player, power, true);
|
||||
|
@ -178,12 +182,9 @@ public class BocekItem extends GunItem implements GeoItem, ReleaseSpecialWeapon
|
|||
}
|
||||
}
|
||||
|
||||
player.getCooldowns().addCooldown(stack.getItem(), 7);
|
||||
GunsTool.setGunIntTag(tag, "ArrowEmpty", 7);
|
||||
|
||||
if (!InventoryTool.hasCreativeAmmoBox(player)) {
|
||||
data.consumeAmmo(player, 1);
|
||||
}
|
||||
GunsTool.setGunIntTag(GunData.from(stack).tag, "ArrowEmpty", 7);
|
||||
data.ammo.set(data.ammo.get() - 1);
|
||||
data.save();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,5 +5,6 @@
|
|||
"Damage": 48,
|
||||
"Weight": 3,
|
||||
"BypassesArmor": 0.25,
|
||||
"Magazine": 1,
|
||||
"AmmoType": "minecraft:arrow"
|
||||
}
|
Loading…
Add table
Reference in a new issue