优化命令代码,添加望远镜判断条件
This commit is contained in:
parent
a1954cf16a
commit
3e2908a874
3 changed files with 2 additions and 4 deletions
|
@ -22,7 +22,7 @@ public class SpyglassRangeOverlay {
|
|||
int w = event.getWindow().getGuiScaledWidth();
|
||||
int h = event.getWindow().getGuiScaledHeight();
|
||||
Player player = Minecraft.getInstance().player;
|
||||
if (player != null && player.getMainHandItem().getItem() == Items.SPYGLASS) {
|
||||
if (player != null && player.getMainHandItem().getItem() == Items.SPYGLASS && player.isUsingItem()) {
|
||||
event.getGuiGraphics().drawString(
|
||||
Minecraft.getInstance().font,
|
||||
getDistanceString(player),
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.commands.CommandSourceStack;
|
|||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -15,7 +14,6 @@ import net.minecraft.world.phys.Vec3;
|
|||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class MediumExpCommand {
|
||||
|
|
|
@ -29,7 +29,7 @@ public class PVPModeCommand {
|
|||
mapVariables.syncData(world);
|
||||
|
||||
if (entity instanceof Player player && !player.level().isClientSide()) {
|
||||
player.displayClientMessage(Component.literal("PVPMODE:" + (mapVariables.pvpMode ? "ON" : "OFF")), false);
|
||||
player.displayClientMessage(Component.literal("PVP MODE: " + (mapVariables.pvpMode ? "ON" : "OFF")), false);
|
||||
}
|
||||
return 0;
|
||||
}));
|
||||
|
|
Loading…
Add table
Reference in a new issue