使准心在旁观者模式下隐藏

This commit is contained in:
Light_Quanta 2024-05-09 21:52:20 +08:00
parent 12c3515940
commit 7820caf7bc
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 22 additions and 14 deletions

View file

@ -6,16 +6,21 @@ import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
public class CrosshairXianShiYouXiNeiDieJiaCengProcedure {
public static boolean execute(Entity entity) {
if (entity == null)
return false;
return (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).is(ItemTags.create(new ResourceLocation("target:gun")))
&& entity.getPersistentData().getDouble("zoom_time") < 7
&& !((entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == TargetModItems.M_79.get())
if (entity == null) return false;
if (entity instanceof Player player) {
if (player.isSpectator()) return false;
if (!player.getMainHandItem().is(ItemTags.create(new ResourceLocation("target:gun")))
|| !(entity.getPersistentData().getDouble("zoom_time") < 7)
) return false;
return !(player.getMainHandItem().getItem() == TargetModItems.M_79.get())
&& Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON;
}
return false;
}
}

View file

@ -5,14 +5,17 @@ import net.mcreator.target.network.TargetModVariables;
import net.minecraft.client.CameraType;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.entity.player.Player;
public class M79uiXianShiYouXiNeiDieJiaCengProcedure {
public static boolean execute(Entity entity) {
if (entity == null)
if (entity == null) return false;
if (entity instanceof Player player) {
return !player.isSpectator()
&& player.getMainHandItem().getItem() == TargetModItems.M_79.get()
&& Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON
&& !entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables()).zooming;
}
return false;
return (entity instanceof LivingEntity _livEnt ? _livEnt.getMainHandItem() : ItemStack.EMPTY).getItem() == TargetModItems.M_79.get() && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON
&& !(entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming;
}
}