generated from Fallen-Breath/fabric-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9cc34a
commit 2cb9109
Showing
6 changed files
with
60 additions
and
3 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
5 changes: 5 additions & 0 deletions
5
src/main/java/me/fallenbreath/tweakermore/config/TweakerMoreConfigs.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,8 +1,13 @@ | ||
package me.fallenbreath.tweakermore.config; | ||
|
||
import fi.dy.masa.malilib.config.options.ConfigBooleanHotkeyed; | ||
import fi.dy.masa.malilib.config.options.ConfigDouble; | ||
|
||
public class TweakerMoreConfigs | ||
{ | ||
// Generic | ||
public static final ConfigDouble NETHER_PORTAL_SOUND_CHANCE = new ConfigDouble("netherPortalSoundChance", 0.01D, 0.0D, 0.01D, "The chance for a nether portal block to play sound\nSet it to 0.001 or 0.0001 for less noisy portal"); | ||
|
||
// Disable | ||
public static final ConfigBooleanHotkeyed DISABLE_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableLightUpdates", false, "", "Yeets client-side light updates"); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/me/fallenbreath/tweakermore/mixins/core/GenericConfigsMixin.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package me.fallenbreath.tweakermore.mixins.core; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.google.common.collect.Lists; | ||
import fi.dy.masa.malilib.config.IConfigBase; | ||
import fi.dy.masa.tweakeroo.config.Configs; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Mutable; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
|
||
import java.util.List; | ||
|
||
@Mixin(Configs.Generic.class) | ||
public abstract class GenericConfigsMixin | ||
{ | ||
@Mutable | ||
@Shadow(remap = false) @Final public static ImmutableList<IConfigBase> OPTIONS; | ||
|
||
static | ||
{ | ||
List<IConfigBase> optionList = Lists.newArrayList(OPTIONS); | ||
optionList.add(me.fallenbreath.tweakermore.config.TweakerMoreConfigs.NETHER_PORTAL_SOUND_CHANCE); | ||
OPTIONS = ImmutableList.copyOf(optionList); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...va/me/fallenbreath/tweakermore/mixins/netherPortalSoundChance/NetherPortalBlockMixin.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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package me.fallenbreath.tweakermore.mixins.netherPortalSoundChance; | ||
|
||
import me.fallenbreath.tweakermore.config.TweakerMoreConfigs; | ||
import net.minecraft.block.NetherPortalBlock; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.Constant; | ||
import org.spongepowered.asm.mixin.injection.ModifyConstant; | ||
|
||
@Mixin(value = NetherPortalBlock.class, priority = 10000) | ||
public abstract class NetherPortalBlockMixin | ||
{ | ||
@ModifyConstant( | ||
method = "randomDisplayTick", | ||
constant = @Constant(intValue = 100), | ||
require = 0, | ||
allow = 1 | ||
) | ||
private int modifyPlaySoundChance(int vanillaChance) | ||
{ | ||
double value = TweakerMoreConfigs.NETHER_PORTAL_SOUND_CHANCE.getDoubleValue(); | ||
return value <= 0.0D ? Integer.MAX_VALUE : (int)(1.0D / value); | ||
} | ||
} |
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
2cb9109
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mod works on 1.16.5 btw.