-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'zeta120' of https://github.com/VazkiiMods/Quark into ze…
…ta120
- Loading branch information
Showing
7 changed files
with
65 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 8 additions & 13 deletions
21
src/main/java/org/violetmoon/quark/mixin/mixins/client/MinecartSoundInstanceMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
package org.violetmoon.quark.mixin.mixins.client; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyExpressionValue; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.Operation; | ||
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; | ||
import net.minecraft.client.resources.sounds.MinecartSoundInstance; | ||
import net.minecraft.world.entity.vehicle.AbstractMinecart; | ||
import org.objectweb.asm.Opcodes; | ||
import org.spongepowered.asm.mixin.Final; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.violetmoon.quark.content.client.module.WoolShutsUpMinecartsModule; | ||
|
||
@Mixin(MinecartSoundInstance.class) | ||
public class MinecartSoundInstanceMixin { | ||
|
||
@Shadow | ||
@Final | ||
private AbstractMinecart minecart; | ||
|
||
@ModifyExpressionValue(method = "tick()V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/resources/sounds/MinecartSoundInstance;volume:F", opcode = Opcodes.PUTFIELD)) | ||
public float muteIfOnWool(float volumeToSet) { | ||
if (volumeToSet > 0 && !WoolShutsUpMinecartsModule.canPlay(minecart)) | ||
return 0; | ||
return volumeToSet; | ||
@WrapOperation(method = "tick()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/vehicle/AbstractMinecart;getDeltaMovement()Lnet/minecraft/world/phys/Vec3;")) | ||
public Vec3 pretendThereIsNoMovementIfMuted(AbstractMinecart minecart, Operation<Vec3> original) { | ||
if (!WoolShutsUpMinecartsModule.canPlay(minecart)) | ||
return Vec3.ZERO; | ||
return original.call(minecart); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Thanks for your interest in maintaining a Quark addon into 1.20. Please pardon our dust and let us know if there's something we missed. | ||
|
||
## Repackaging | ||
|
||
The source code has moved under the `org.violetmoon` organization. | ||
|
||
## all this "zeta" stuff? | ||
|
||
Zeta is a platform-agnostic modding platform. We are working on a Forge implementation of Zeta, and we are working on implementing Quark in terms of Zeta in order to achieve our goal of creating a Fabric port of Quark. | ||
|
||
Zeta aims to be a big framework for writing configurable mods. It ships with a config system and config GUI system, and its event bus is designed with configurability in mind (enabling/disabling modules is baked into the "load bus"/"play bus" distinction). Most of the useful stuff that was in AutoRegLib has moved to Zeta, too. | ||
|
||
Zeta is big, but intentionally avoids as much `static` as possible as a way of supporting multiple mods using the library simultaneously. You will not find many singletons in Zeta, and each mod is expected to create and manage their own instances of it. Quark's are under `Quark.ZETA` and `QuarkClient.ZETA_CLIENT`. | ||
|
||
## Constructing Quark's blocks | ||
|
||
Much like in the AutoRegLib days, Zeta leverages constructor registration for its blocks and items. This is now much more closely tied to the Zeta systems, but you can now pass `null` for any registry-name/module parameters, and Zeta just won't try to register them. | ||
|
||
## Dealing with events | ||
|
||
If Quark moves away from Forge, obviously we can't use its event bus. Most of the relevant Forge events have been reimplemented. | ||
|
||
Events fired into Zeta mods are handled with code at the bottom of `ForgeZeta` that temporarily translates them into Zeta's event system. | ||
|
||
If you want to listen to an event fired *from* a Zeta mod, you have two options: | ||
|
||
* Engage with the Zeta event bus. You can find this in `Quark.ZETA.loadBus`/`playBus`. | ||
* The event bus itself is very basic and doesn't require you to write "a Zeta mod". | ||
* Zeta's `@LoadEvent` and `@PlayEvent` are the analogs of Forge's `@SubscribeEvent`. | ||
* Subscribing to the event bus works the same as Forge, where passing a `.class` subscribes static methods, and passing an instance of something subscribes non-static methods. | ||
* Certain events get also fired as platform-specific events. See `ForgeZeta.fireExternalEvent`. | ||
* Usually events corresponding to a "public api" go here. | ||
* Listen to these events using the regular platform-specific event bus system. |