From 5a56c380d717451fabfe73ad328a60fc49d7afc6 Mon Sep 17 00:00:00 2001 From: Notenoughmail <78008321+Notenoughmail@users.noreply.github.com> Date: Sun, 19 May 2024 16:56:33 -0700 Subject: [PATCH] Cleanup - Address ChiefArug's comments --- .../client/KubeJSClientEventHandler.java | 5 +++++ .../mods/kubejs/client/SoundGenerator.java | 6 ++++++ .../core/mixin/common/ParticleEngineMixin.java | 18 ------------------ .../main/resources/kubejs-common.mixins.json | 1 - 4 files changed, 11 insertions(+), 19 deletions(-) delete mode 100644 common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ParticleEngineMixin.java diff --git a/common/src/main/java/dev/latvian/mods/kubejs/client/KubeJSClientEventHandler.java b/common/src/main/java/dev/latvian/mods/kubejs/client/KubeJSClientEventHandler.java index cd8759bda..c02b9470c 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/client/KubeJSClientEventHandler.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/client/KubeJSClientEventHandler.java @@ -58,6 +58,7 @@ public void init() { ClientGuiEvent.RENDER_POST.register(Painter.INSTANCE::guiScreenDraw); ClientGuiEvent.INIT_PRE.register(this::guiPreInit); ClientGuiEvent.INIT_POST.register(this::guiPostInit); + ClientLifecycleEvent.CLIENT_STARTED.register(this::clientStart); //ClientTextureStitchEvent.POST.register(this::postAtlasStitch); } @@ -171,6 +172,10 @@ private void guiPostInit(Screen screen, ScreenAccess access) { } } + private void clientStart(Minecraft mc) { + ClientEvents.PARTICLE_PROVIDER_REGISTRY.post(new ParticleProviderRegistryEventJS()); + } + /*private void postAtlasStitch(TextureAtlas atlas) { if (!ClientProperties.get().getExportAtlases()) { return; diff --git a/common/src/main/java/dev/latvian/mods/kubejs/client/SoundGenerator.java b/common/src/main/java/dev/latvian/mods/kubejs/client/SoundGenerator.java index 1c8d44e2e..510b35c9e 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/client/SoundGenerator.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/client/SoundGenerator.java @@ -46,6 +46,8 @@ public SoundEntry replace(boolean b) { return this; } + public SoundEntry replace() { return replace(true); } + public SoundEntry subtitle(String subtitle) { this.subtitle = subtitle; return this; @@ -120,6 +122,8 @@ public SoundInstance stream(boolean b) { return complex(); } + public SoundInstance stream() { return stream(true); } + public SoundInstance attenuationDistance(int i) { attenuationDistance = i; return complex(); @@ -130,6 +134,8 @@ public SoundInstance preload(boolean b) { return complex(); } + public SoundInstance preload() { return preload(true); } + public SoundInstance asReferenceToEvent() { isEventReference = true; return complex(); diff --git a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ParticleEngineMixin.java b/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ParticleEngineMixin.java deleted file mode 100644 index 21a4bdff3..000000000 --- a/common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/ParticleEngineMixin.java +++ /dev/null @@ -1,18 +0,0 @@ -package dev.latvian.mods.kubejs.core.mixin.common; - -import dev.latvian.mods.kubejs.bindings.event.ClientEvents; -import dev.latvian.mods.kubejs.client.ParticleProviderRegistryEventJS; -import net.minecraft.client.particle.ParticleEngine; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(ParticleEngine.class) -public abstract class ParticleEngineMixin { - - @Inject(method = "registerProviders", at = @At("RETURN")) - private void registerParticleProvidersKJS(CallbackInfo ci) { - ClientEvents.PARTICLE_PROVIDER_REGISTRY.post(new ParticleProviderRegistryEventJS()); - } -} diff --git a/common/src/main/resources/kubejs-common.mixins.json b/common/src/main/resources/kubejs-common.mixins.json index ee64c5076..176a78b95 100644 --- a/common/src/main/resources/kubejs-common.mixins.json +++ b/common/src/main/resources/kubejs-common.mixins.json @@ -55,7 +55,6 @@ "LocalPlayerMixin", "MinecraftClientMixin", "OptionsMixin", - "ParticleEngineMixin", "ScreenMixin", "WindowMixin", "WorldOpenFlowsMixin",