优化代码
This commit is contained in:
parent
81fc926b5a
commit
ea970a2097
2 changed files with 0 additions and 18 deletions
|
@ -268,16 +268,8 @@ public class ClientEventHandler {
|
|||
player.playSound(SoundEvents.PLAYER_ATTACK_SWEEP, 1f, 1);
|
||||
}
|
||||
if (gunMelee == 22) {
|
||||
|
||||
boolean lookAtEntity = false;
|
||||
|
||||
Entity lookingEntity = TraceTool.findMeleeEntity(player, player.getEntityReach());
|
||||
|
||||
if (lookingEntity != null) {
|
||||
lookAtEntity = true;
|
||||
}
|
||||
|
||||
if (lookAtEntity) {
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new MeleeAttackMessage(lookingEntity.getUUID()));
|
||||
}
|
||||
}
|
||||
|
@ -296,9 +288,6 @@ public class ClientEventHandler {
|
|||
}
|
||||
|
||||
if (stack.is(ModItems.LUNGE_MINE.get()) && ((lungeAttack >= 18 && lungeAttack <= 21) || lungeSprint > 0)) {
|
||||
|
||||
boolean lookAtEntity = false;
|
||||
|
||||
Entity lookingEntity = TraceTool.findLookingEntity(player, player.getEntityReach() + 1.5);
|
||||
|
||||
BlockHitResult result = player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(player.getBlockReach() + 1.5)),
|
||||
|
@ -308,10 +297,6 @@ public class ClientEventHandler {
|
|||
BlockState blockState = player.level().getBlockState(BlockPos.containing(looking.x(), looking.y(), looking.z()));
|
||||
|
||||
if (lookingEntity != null) {
|
||||
lookAtEntity = true;
|
||||
}
|
||||
|
||||
if (lookAtEntity) {
|
||||
ModUtils.PACKET_HANDLER.sendToServer(new LungeMineAttackMessage(0, lookingEntity.getUUID(), result));
|
||||
lungeSprint = 0;
|
||||
lungeAttack = 0;
|
||||
|
|
|
@ -14,7 +14,6 @@ public class MeleeAttackMessage {
|
|||
private final UUID uuid;
|
||||
|
||||
public MeleeAttackMessage(UUID uuid) {
|
||||
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
|
@ -40,6 +39,4 @@ public class MeleeAttackMessage {
|
|||
});
|
||||
context.setPacketHandled(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue