使准心在旁观者模式下隐藏
This commit is contained in:
parent
12c3515940
commit
7820caf7bc
2 changed files with 22 additions and 14 deletions
|
@ -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())
|
||||
&& Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue