diff --git a/src/main/java/net/mcreator/superbwarfare/block/ReforgingTableBlock.java b/src/main/java/net/mcreator/superbwarfare/block/ReforgingTableBlock.java new file mode 100644 index 000000000..d35749424 --- /dev/null +++ b/src/main/java/net/mcreator/superbwarfare/block/ReforgingTableBlock.java @@ -0,0 +1,21 @@ +package net.mcreator.superbwarfare.block; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.jetbrains.annotations.Nullable; + +public class ReforgingTableBlock extends Block implements EntityBlock { + + public ReforgingTableBlock(Properties pProperties) { + super(pProperties); + } + + @Nullable + @Override + public BlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { + return null; + } +} diff --git a/src/main/java/net/mcreator/superbwarfare/client/ClickHandler.java b/src/main/java/net/mcreator/superbwarfare/client/ClickHandler.java index 62566fa6f..c3d5409ab 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/ClickHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/client/ClickHandler.java @@ -61,6 +61,9 @@ public class ClickHandler { Player player = Minecraft.getInstance().player; if (player == null) return; + + if (player.isSpectator()) return; + ItemStack stack = player.getMainHandItem(); int button = event.getButton(); @@ -160,8 +163,6 @@ public class ClickHandler { } setKeyState(event.getKey(), clicked ? 1 : 0); - - } } \ No newline at end of file diff --git a/src/main/java/net/mcreator/superbwarfare/client/screens/AmmoBarOverlay.java b/src/main/java/net/mcreator/superbwarfare/client/screens/AmmoBarOverlay.java index e03ba78a5..ccf048a63 100644 --- a/src/main/java/net/mcreator/superbwarfare/client/screens/AmmoBarOverlay.java +++ b/src/main/java/net/mcreator/superbwarfare/client/screens/AmmoBarOverlay.java @@ -19,7 +19,6 @@ import net.minecraftforge.fml.common.Mod; @Mod.EventBusSubscriber(value = Dist.CLIENT) public class AmmoBarOverlay { - // private static final ResourceLocation BUTTON = new ResourceLocation(TargetMod.MODID, "textures/gun_icon/fire_mode/button.png"); private static final ResourceLocation LINE = new ResourceLocation(ModUtils.MODID, "textures/gun_icon/fire_mode/line.png"); private static final ResourceLocation SEMI = new ResourceLocation(ModUtils.MODID, "textures/gun_icon/fire_mode/semi.png"); private static final ResourceLocation BURST = new ResourceLocation(ModUtils.MODID, "textures/gun_icon/fire_mode/burst.png"); @@ -35,6 +34,10 @@ public class AmmoBarOverlay { return; } + if (player.isSpectator()) { + return; + } + ItemStack stack = player.getMainHandItem(); if (stack.getItem() instanceof GunItem gunItem) { PoseStack poseStack = event.getGuiGraphics().pose(); @@ -51,16 +54,6 @@ public class AmmoBarOverlay { 16); // 渲染开火模式切换按键 -// event.getGuiGraphics().blit(BUTTON, -// w - 115, -// h - 20, -// 0, -// 0, -// 10, -// 10, -// 10, -// 10); - event.getGuiGraphics().drawString( Minecraft.getInstance().font, "[" + ModKeyMappings.FIRE_MODE.getKey().getDisplayName().getString() + "]", @@ -93,7 +86,6 @@ public class AmmoBarOverlay { 8, 8); - // 渲染当前弹药量 poseStack.pushPose(); poseStack.scale(1.5f, 1.5f, 1f); diff --git a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java index 721db5883..bf8c4d871 100644 --- a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java @@ -93,24 +93,22 @@ public class ClientEventHandler { if (drone != null) { if (data.getDouble("droneRotZ") > drone.getEntityData().get(ROT_Z)) { - data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") - 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2),drone.getEntityData().get(ROT_Z),Double.POSITIVE_INFINITY)); + data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") - 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2), drone.getEntityData().get(ROT_Z), Double.POSITIVE_INFINITY)); } else { - data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") + 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROT_Z))); + data.putDouble("droneRotZ", Mth.clamp(data.getDouble("droneRotZ") + 0.3 * Math.pow(drone.getEntityData().get(ROT_Z) - data.getDouble("droneRotZ"), 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_Z))); } if (data.getDouble("droneRotX") > drone.getEntityData().get(ROT_X)) { - data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") - 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2),drone.getEntityData().get(ROT_X),Double.POSITIVE_INFINITY)); + data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") - 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2), drone.getEntityData().get(ROT_X), Double.POSITIVE_INFINITY)); } else { - data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROT_X))); + data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROT_X) - data.getDouble("droneRotX"), 2), Double.NEGATIVE_INFINITY, drone.getEntityData().get(ROT_X))); } event.setPitch((float) (pitch + data.getDouble("droneCameraRotX") - 0.15f * Mth.RAD_TO_DEG * data.getDouble("droneRotZ"))); event.setRoll((float) (roll + data.getDouble("droneCameraRotY") - 0.5f * Mth.RAD_TO_DEG * data.getDouble("droneRotX"))); } - - - } + private static void handleCannonCamera(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) { var data = entity.getPersistentData(); double yaw = event.getYaw(); @@ -120,7 +118,6 @@ public class ClientEventHandler { event.setPitch((float) (pitch + 1 * data.getDouble("Cannon_xRot") + data.getDouble("cannon_camera_rot_x"))); event.setYaw((float) (yaw + 1 * data.getDouble("Cannon_yRot") + data.getDouble("cannon_camera_rot_y"))); event.setRoll((float) (roll + data.getDouble("cannon_camera_rot_z"))); - } @SubscribeEvent @@ -159,7 +156,7 @@ public class ClientEventHandler { double spread = stack.getOrCreateTag().getDouble("spread"); double zoomSpread = stack.getOrCreateTag().getDouble("zoomSpread"); - double gunSpread = (float) (zoom? zoomSpread : spread); + double gunSpread = (float) (zoom ? zoomSpread : spread); if (data.getDouble("crosshair") > gunSpread) { data.putDouble("crosshair", data.getDouble("crosshair") - 0.05 * Math.pow(gunSpread - data.getDouble("crosshair"), 2) * times); diff --git a/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java b/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java index 633798fde..5cb773b2c 100644 --- a/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java @@ -30,7 +30,6 @@ import net.minecraftforge.network.PacketDistributor; import java.text.DecimalFormat; - @Mod.EventBusSubscriber public class PlayerEventHandler { @@ -41,9 +40,8 @@ public class PlayerEventHandler { if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using")) { stack.getOrCreateTag().putBoolean("Using", false); } - } - + @SubscribeEvent public static void onPlayerRespawned(PlayerEvent.PlayerRespawnEvent event) { Player player = event.getEntity(); @@ -142,14 +140,14 @@ public class PlayerEventHandler { if (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).tacticalSprint) { player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { - capability.tacticalSprintTime = Mth.clamp(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).tacticalSprintTime - sprint_cost,0,600); + capability.tacticalSprintTime = Mth.clamp(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).tacticalSprintTime - sprint_cost, 0, 600); capability.syncPlayerVariables(player); }); player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 2, 0, false, false)); } else { player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { - capability.tacticalSprintTime = Mth.clamp(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).tacticalSprintTime + 5,0,600); + capability.tacticalSprintTime = Mth.clamp(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables()).tacticalSprintTime + 5, 0, 600); capability.syncPlayerVariables(player); }); } diff --git a/src/main/java/net/mcreator/superbwarfare/network/message/FireMessage.java b/src/main/java/net/mcreator/superbwarfare/network/message/FireMessage.java index f41f3f04d..a5e9350eb 100644 --- a/src/main/java/net/mcreator/superbwarfare/network/message/FireMessage.java +++ b/src/main/java/net/mcreator/superbwarfare/network/message/FireMessage.java @@ -84,7 +84,6 @@ public class FireMessage { var tag = handItem.getOrCreateTag(); - if (handItem.getItem() == ModItems.TASER.get()) { handleTaserFire(player); }