Skip to content

Commit

Permalink
netherPortalSoundChance
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed May 21, 2021
1 parent f9cc34a commit 2cb9109
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

An addon of masa's [tweakeroo](https://github.com/maruohon/tweakeroo) mod using epic mixin hack

New Disable tweaks:
New tweaks:

- disableLightUpdates
- netherPortalSoundChance (Generic)
- disableLightUpdates (Disable)
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.10.3+build.211

# Mod Properties
mod_version = 1.0.1
mod_version = 1.1.0
maven_group = tweakermore
archives_base_name = tweakermore

Expand Down
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");
}
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);
}
}
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);
}
}
2 changes: 2 additions & 0 deletions src/main/resources/tweakermore.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"package": "me.fallenbreath.tweakermore.mixins",
"compatibilityLevel": "JAVA_8",
"mixins": [
"core.GenericConfigsMixin",
"netherPortalSoundChance.NetherPortalBlockMixin"
],
"client": [
"core.DisableConfigsMixin",
Expand Down

1 comment on commit 2cb9109

@DragonEggBedrockBreaking

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.

Please sign in to comment.