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

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