Skip to content

Commit

Permalink
v2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Apehum authored Oct 22, 2024
2 parents a786187 + 4982c28 commit 9e4bea6
Show file tree
Hide file tree
Showing 34 changed files with 390 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/prerelease-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: Apehum/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
github-generate-changelog: true
github-generate-changelog: false
github-prerelease: true

- name: Build dokka
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public interface DeviceManager {
void setInputDevice(@Nullable InputDevice device);

/**
* Removes the output and input devices.
* Closes and removes the output and input devices.
*/
default void clear() {
getOutputDevice().ifPresent(OutputDevice::close);
setOutputDevice(null);
getInputDevice().ifPresent(InputDevice::close);
setInputDevice(null);
}

Expand Down
Empty file added client/1.19.3-fabric/.gitkeep
Empty file.
Empty file added client/1.19.3-forge/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions client/1.21.2-fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
essential.defaults.loom.minecraft=com.mojang:minecraft:1.21.2
1 change: 1 addition & 0 deletions client/1.21.2-neoforge/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
essential.defaults.loom.neoForge=net.neoforged:neoforge:21.2.0-beta
59 changes: 49 additions & 10 deletions client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,24 @@ dependencies {
11701 -> "0.46.1+1.17"
11802 -> "0.76.0+1.18.2"
11902 -> "0.73.2+1.19.2"
11903 -> "0.76.1+1.19.3"
11904 -> "0.87.1+1.19.4"
12001 -> "0.84.0+1.20.1"
12004 -> "0.95.4+1.20.4"
12006 -> "0.97.7+1.20.6"
12100 -> "0.100.4+1.21"
12102 -> "0.105.3+1.21.2"
else -> throw GradleException("Unsupported platform $platform")
}

modImplementation("net.fabricmc.fabric-api:fabric-api:${fabricApiVersion}")
"include"("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")

if (platform.mcVersion >= 12102) {
// https://github.com/lucko/fabric-permissions-api/pull/26
"include"("com.github.sakura-ryoko:fabric-permissions-api:b43d33efb8")
} else {
"include"("me.lucko:fabric-permissions-api:0.2-SNAPSHOT")
}
}

val includedProjects = listOf(
Expand Down Expand Up @@ -234,21 +242,52 @@ tasks {
data class VersionInfo(
val neoForgeVersion: String,
val forgeVersion: String,
val mcVersions: List<String>
val mcVersions: String
) {

// "${mcVersions}" -> "[1.20,1.20.1]"
val forgeMcVersions
get() =
if (mcVersions[0].startsWith(">=")) {
"[${mcVersions[0].substringAfter(">=")},)"
val forgeMcVersions: String
get() {
val split = mcVersions.split(" ")

fun versionBounds(version: String): Triple<String, String, String>? =
when {
version.startsWith(">=") -> Triple(
"[", version.substringAfter(">="), ",)"
)
version.startsWith(">") -> Triple(
"(", version.substringAfter(">"), ",)"
)
version.startsWith("<=") -> Triple(
"(,", version.substringAfter("<="), "]"
)
version.startsWith("<") -> Triple(
"(,", version.substringAfter("<"), ")"
)
else -> null
}

if (split.size == 1) {
val version = split.first()
val bounds = versionBounds(version)

return if (bounds == null) {
"[$version]"
} else {
"${bounds.first}${bounds.second}${bounds.third}"
}
} else if (split.size == 2) {
val bounds = split.map { versionBounds(it)!! }
val first = bounds[0]
val second = bounds[1]

return "${first.first}${first.second},${second.second}${second.third}"
} else {
"[${mcVersions.joinToString(",")}]"
throw IllegalStateException("Invalid version")
}
}

// ["${mcVersions}"] -> ["1.20", "1.20.1"]
val fabricMcVersions
get() = mcVersions.joinToString("\", \"")
get() = mcVersions
}

fun readVersionInfo(): VersionInfo = Toml()
Expand Down
43 changes: 9 additions & 34 deletions client/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,12 @@ If you encounter any issues, please report them on Discord: https://discord.gg/u
Versions 2.0.x and 2.1.x are protocol-compatible,
so there’s no need to worry if the server hasn't been updated to 2.1.x.

### Main Changes
- Backports to 1.18.2, 1.17.1, and 1.16.5.
- New open source [Opus](https://github.com/plasmoapp/opus-jni-rust) and [RNNoise](https://github.com/plasmoapp/rnnoise-jni-rust) binaries, related to [#319](https://github.com/plasmoapp/plasmo-voice/issues/319) [#375](https://github.com/plasmoapp/plasmo-voice/issues/375) [#382](https://github.com/plasmoapp/plasmo-voice/issues/382).
- NeoForge support for 1.21+.
- Forge support for 1.20.4+.
- Client now sends server ip and server port in the first ping packet, which is used for a connection establishment. This is useful for building reverse proxies. You can find an example here: https://github.com/Apehum/pv-reverse-proxy.
- Server now sends a request info packet to any player joining the server. This was introduced due to differences in how various mod loaders handle the mod channel list, and I just can't figure out how to make it work on Forge/NeoForge 1.20.2+.
- Server now checks if a player has voice disabled or microphone muted before sending or receiving the audio.
- "Open to LAN" now restarts the UDP server with the published port if `host.port` is set to 0.
- Fixed "GUI Icon remains visible when GUI is hidden with F1" ([#407](https://github.com/plasmoapp/plasmo-voice/issues/407)).
- Push-To-Talk is now disabled in chat and sign menus ([#414](https://github.com/plasmoapp/plasmo-voice/pull/414)).
- Fade-in/fade-out effects before and after an audio stream, fixing glitches that occurred when the audio source starts or stops playing audio.
- Languages now support [MiniMessage format](https://docs.advntr.dev/minimessage/index.html).
- Network jitter buffer.
- ...and many more internal changes and fixes.

### Breaking API Changes
There have been breaking changes to the API, meaning you'll need to update your addons:
#### Client Addons
- [pv-addon-soundphysics](https://modrinth.com/mod/pv-addon-soundphysics/version/1.1.0)
- [pv-addon-replaymod 1.16.5-1.21](https://modrinth.com/mod/pv-addon-replaymod/version/1.16.5-2.1.0)
- [pv-addon-replaymod 1.21+](https://modrinth.com/mod/pv-addon-replaymod/version/1.21-2.1.0)
### Server Addons
- [pv-addon-groups](https://modrinth.com/plugin/pv-addon-groups/version/1.1.0)
- [pv-addon-sculk](https://modrinth.com/plugin/pv-addon-sculk/version/1.1.0)
- [pv-addon-broadcast](https://modrinth.com/plugin/pv-addon-broadcast/version/1.1.0)
- [pv-addon-spectator](https://modrinth.com/plugin/pv-addon-spectator/version/1.1.0)
- [pv-addon-whisper](https://modrinth.com/plugin/pv-addon-whisper/version/1.1.0)
- [pv-addon-priority](https://modrinth.com/plugin/pv-addon-priority/version/1.1.0)

The API documentation is now available: https://plasmovoice.com/docs/api.
It's still a work in progress, so feedback is appreciated.
You can provide feedback on our Discord: https://discord.gg/uueEqzwCJJ.

### Changes in 2.1.1
- Build for 1.19.3 was reintroduced.
- Soften Minecraft version bounds:
- 1.20.4 now allows 1.20.2, 1.20.3 and 1.20.4
- 1.19.2 now allows 1.19, 1.19.1 and 1.19.2
- Updated to 1.21.2.
- Updated [slib](https://github.com/plasmoapp/mc-slib) to fix crash with EssentialAddons on world join.
- Fixed audio sources causing a high CPU load. [#421](https://github.com/plasmoapp/plasmo-voice/issues/421)
- Attempt to fix "Cannot measure distance between worlds" exception, see [#422](https://github.com/plasmoapp/plasmo-voice/issues/422).
16 changes: 14 additions & 2 deletions client/root.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ group = "$group.client-root"

preprocess {

val neoForge12102 = createNode("1.21.2-neoforge", 12102, "official")
val fabric12102 = createNode("1.21.2-fabric", 12102, "official")

val neoForge12100 = createNode("1.21-neoforge", 12100, "official")
val fabric12100 = createNode("1.21-fabric", 12100, "official")
val forge12100 = createNode("1.21-forge", 12100, "official")
Expand All @@ -19,6 +22,9 @@ preprocess {
val forge11904 = createNode("1.19.4-forge", 11904, "official")
val fabric11904 = createNode("1.19.4-fabric", 11904, "official")

val forge11903 = createNode("1.19.3-forge", 11903, "official")
val fabric11903 = createNode("1.19.3-fabric", 11903, "official")

val forge11902 = createNode("1.19.2-forge", 11902, "official")
val fabric11902 = createNode("1.19.2-fabric", 11902, "official")

Expand All @@ -31,6 +37,9 @@ preprocess {
val forge11605 = createNode("1.16.5-forge", 11605, "official")
val fabric11605 = createNode("1.16.5-fabric", 11605, "official")

fabric12102.link(fabric12100)
neoForge12102.link(neoForge12100)

neoForge12100.link(fabric12100)
fabric12100.link(fabric12004, file("1.21-1.20.6.txt"))
forge12100.link(forge12004, file("1.21-1.20.6.txt"))
Expand All @@ -44,8 +53,11 @@ preprocess {
// fabric 1.19.4 main project
forge11904.link(fabric11904)

fabric11902.link(fabric11904, file("1.19.2-1.19.3.txt"))
forge11902.link(forge11904, file("1.19.2-1.19.3.txt"))
fabric11903.link(fabric11904)
forge11903.link(forge11904)

fabric11902.link(fabric11903, file("1.19.2-1.19.3.txt"))
forge11902.link(forge11903, file("1.19.2-1.19.3.txt"))

fabric11802.link(fabric11902)
forge11802.link(forge11902, file("1.18.2-1.19.2.txt"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public static void sendChatMessage(@NonNull McTextComponent text) {
public static void sendChatMessage(@NonNull Component message) {
LocalPlayer player = Minecraft.getInstance().player;

//#if MC>=11900
//#if MC>=12102
//$$ player.displayClientMessage(message, false);
//#elseif MC>=11900
player.sendSystemMessage(message);
//#elseif MC>=11602
//$$ player.sendMessage(message, null);
Expand Down
28 changes: 25 additions & 3 deletions client/src/main/java/su/plo/lib/mod/client/render/RenderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
import net.minecraft.client.renderer.ShaderInstance;
//#endif

//#if MC>=12102
//$$ import net.minecraft.client.renderer.CoreShaders;
//$$ import net.minecraft.client.renderer.ShaderProgram;
//#endif

@UtilityClass
public class RenderUtil {

Expand Down Expand Up @@ -74,6 +79,18 @@ public static void disableScissor() {
//#if MC>=11700
// Note: Needs to be an Identity hash map because VertexFormat's equals method is broken (compares via its
// component Map but order very much matters for VertexFormat) as of 1.17
//#if MC>=12102
//$$ private static final Map<VertexFormat, ShaderProgram> DEFAULT_SHADERS = new IdentityHashMap<>();
//$$ static {
//$$
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.PARTICLE, CoreShaders.PARTICLE);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION, CoreShaders.POSITION);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_COLOR, CoreShaders.POSITION_COLOR);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_COLOR_LIGHTMAP, CoreShaders.POSITION_COLOR_LIGHTMAP);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_TEX, CoreShaders.POSITION_TEX);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_TEX_COLOR, CoreShaders.POSITION_TEX_COLOR);
//$$ DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP, CoreShaders.POSITION_COLOR_TEX_LIGHTMAP);
//#else
private static final Map<VertexFormat, Supplier<ShaderInstance>> DEFAULT_SHADERS = new IdentityHashMap<>();
static {
DEFAULT_SHADERS.put(DefaultVertexFormat.PARTICLE, GameRenderer::getParticleShader);
Expand All @@ -83,6 +100,7 @@ public static void disableScissor() {
DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_TEX, GameRenderer::getPositionTexShader);
DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_TEX_COLOR, GameRenderer::getPositionTexColorShader);
DEFAULT_SHADERS.put(DefaultVertexFormat.POSITION_COLOR_TEX_LIGHTMAP, GameRenderer::getPositionColorTexLightmapShader);
//#endif
//#if MC>=12100
//$$ // Shaders for these formats are no longer provided.
//#else
Expand All @@ -100,12 +118,16 @@ public static void disableScissor() {

public static @NotNull BufferBuilder beginBufferWithDefaultShader(@NotNull VertexFormatMode mode, @NotNull VertexFormat format) {
//#if MC>=11700
Supplier<ShaderInstance> supplier = DEFAULT_SHADERS.get(format);
if (supplier == null) {
//#if MC>=12102
//$$ ShaderProgram shader = DEFAULT_SHADERS.get(format);
//#else
Supplier<ShaderInstance> shader = DEFAULT_SHADERS.get(format);
//#endif
if (shader == null) {
throw new IllegalArgumentException("No default shader for " + format + ". Bind your own and use beginBufferWithActiveShader instead.");
}

RenderSystem.setShader(supplier);
RenderSystem.setShader(shader);
//#endif

return beginBufferWithActiveShader(mode, format);
Expand Down
6 changes: 1 addition & 5 deletions client/src/main/java/su/plo/voice/client/ModVoiceClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.minecraft.client.Minecraft;
import org.lwjgl.glfw.GLFW;
import su.plo.slib.api.logging.McLoggerFactory;
import su.plo.slib.mod.channel.ModChannelManager;
import su.plo.slib.mod.logging.Log4jLogger;
import su.plo.voice.client.gui.settings.VoiceScreens;
import lombok.Getter;
Expand All @@ -19,7 +18,6 @@
import su.plo.voice.client.audio.device.JavaxInputDeviceFactory;
import su.plo.voice.client.connection.ModClientChannelHandler;
import su.plo.voice.client.event.key.KeyPressedEvent;
import su.plo.voice.client.render.ModEntityRenderer;
import su.plo.voice.client.render.ModHudRenderer;
import su.plo.voice.client.render.ModLevelRenderer;
import su.plo.voice.util.version.ModrinthLoader;
Expand Down Expand Up @@ -71,6 +69,7 @@

//#elseif NEOFORGE

//$$ import su.plo.slib.mod.channel.ModChannelManager;
//$$ import su.plo.voice.server.ModVoiceServer;
//$$ import net.neoforged.api.distmarker.Dist;
//$$ import net.neoforged.bus.api.SubscribeEvent;
Expand Down Expand Up @@ -108,8 +107,6 @@ public final class ModVoiceClient extends BaseVoiceClient
private final ModHudRenderer hudRenderer;
@Getter
private final ModLevelRenderer levelRenderer;
@Getter
private final ModEntityRenderer entityRenderer;

private final ModClientChannelHandler handler = new ModClientChannelHandler(this);

Expand All @@ -133,7 +130,6 @@ public ModVoiceClient() {

this.hudRenderer = new ModHudRenderer(this);
this.levelRenderer = new ModLevelRenderer(this);
this.entityRenderer = new ModEntityRenderer(this);

INSTANCE = this;
RenderUtil.getTextConverter().setLanguageSupplier(createLanguageSupplier());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public static double getOccludedPercent(Level world, Vec3 sound, Vec3 listener)
if (i <= 1) continue;

BlockState state = world.getBlockState(prevSoundPos);
//#if MC>=12000
//#if MC>=12102
//$$ boolean isSolid = state.isSolidRender();
//#elseif MC>=12000
//$$ boolean isSolid = state.isSolidRender(world, prevSoundPos);
//#else
boolean isSolid = state.getMaterial().isSolid();
Expand Down

This file was deleted.

Loading

0 comments on commit 9e4bea6

Please sign in to comment.