use of tonius.simplyjetpacks.client.audio.SoundJetpack in project SimplyJetpacks by Tonius.
the class ClientTickHandler method tickEnd.
private static void tickEnd() {
if (mc.thePlayer == null || mc.theWorld == null) {
return;
}
if (!mc.isGamePaused()) {
Iterator<Integer> itr = SyncHandler.getJetpackStates().keySet().iterator();
int currentEntity;
while (itr.hasNext()) {
currentEntity = itr.next();
Entity entity = mc.theWorld.getEntityByID(currentEntity);
if (entity == null || !(entity instanceof EntityLivingBase) || entity.dimension != mc.thePlayer.dimension) {
itr.remove();
} else {
ParticleType particle = SyncHandler.getJetpackStates().get(currentEntity);
if (particle != null) {
if (entity.isInWater() && particle != ParticleType.NONE) {
particle = ParticleType.BUBBLE;
}
SimplyJetpacks.proxy.showJetpackParticles(mc.theWorld, (EntityLivingBase) entity, particle);
if (Config.jetpackSounds && !SoundJetpack.isPlayingFor(entity.getEntityId())) {
Minecraft.getMinecraft().getSoundHandler().playSound(new SoundJetpack((EntityLivingBase) entity));
}
} else {
itr.remove();
}
}
}
}
if (sprintKeyCheck && mc.thePlayer.movementInput.moveForward < 1.0F) {
sprintKeyCheck = false;
}
if (!Config.doubleTapSprintInAir || !wearingJetpack || mc.thePlayer.onGround || mc.thePlayer.isSprinting() || mc.thePlayer.isUsingItem() || mc.thePlayer.isPotionActive(Potion.blindness)) {
return;
}
if (!sprintKeyCheck && mc.thePlayer.movementInput.moveForward >= 1.0F && !mc.thePlayer.isCollidedHorizontally && (mc.thePlayer.getFoodStats().getFoodLevel() > 6.0F || mc.thePlayer.capabilities.allowFlying)) {
if (mc.thePlayer.sprintToggleTimer <= 0 && !mc.gameSettings.keyBindSprint.getIsKeyPressed()) {
mc.thePlayer.sprintToggleTimer = 7;
sprintKeyCheck = true;
} else {
mc.thePlayer.setSprinting(true);
}
}
}
Aggregations