Skip to content

Commit

Permalink
Implement Explosion Block Drop Chance tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Mar 12, 2024
1 parent 24678b3 commit 169e3a2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ All changes are toggleable via config files.
* **Disable Wither Targeting AI:** Disables withers targeting animals
* **Easy Breeding:** Enables easy breeding of animals by tossing food on the ground
* **End Portal Parallax:** Re-implements parallax rendering of the end portal from 1.11 and older
* **Explosion Block Drop Chance:** Determines the numerator of the block drop formula on explosions
* **Fast Dye Blending:** Replaces color lookup for sheep to check a predefined table rather than querying the recipe registry
* **Fast Leaf Decay:** Makes leaves decay faster when trees are chopped
* **Fast Prefix Checking:** Optimizes Forge's ID prefix checking and removes prefix warnings impacting load time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ public static class BlocksCategory
@Config.Comment("Determines how tall cacti can grow")
public int utCactusSize = 3;

@Config.RequiresMcRestart
@Config.Name("Explosion Block Drop Chance")
@Config.Comment
({
"Determines the numerator of the block drop formula on explosions",
"Formula: chance ÷ explosionSize"
})
public double utExplosionDropChance = 1.0D;

@Config.RequiresMcRestart
@Config.Name("Fast Leaf Decay")
@Config.Comment("Makes leaves decay faster when trees are chopped")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.bugfixes.world.witchhuts.json");
configs.add("mixins.tweaks.blocks.bedobstruction.json");
configs.add("mixins.tweaks.blocks.breakablebedrock.json");
configs.add("mixins.tweaks.blocks.explosion.json");
configs.add("mixins.tweaks.blocks.growthsize.json");
configs.add("mixins.tweaks.blocks.hitdelay.json");
configs.add("mixins.tweaks.blocks.leafdecay.json");
Expand Down Expand Up @@ -423,6 +424,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigTweaks.BLOCKS.utBedObstructionToggle;
case "mixins.tweaks.blocks.breakablebedrock.json":
return UTConfigTweaks.BLOCKS.BREAKABLE_BEDROCK.utBreakableBedrockToggle;
case "mixins.tweaks.blocks.explosion.json":
return UTConfigTweaks.BLOCKS.utExplosionDropChance != 1.0D;
case "mixins.tweaks.blocks.growthsize.json":
return UTConfigTweaks.BLOCKS.utCactusSize != 3 && UTConfigTweaks.BLOCKS.utSugarCaneSize != 3 && UTConfigTweaks.BLOCKS.utVineSize != 0;
case "mixins.tweaks.blocks.hitdelay.json":
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package mod.acgaming.universaltweaks.tweaks.blocks.explosion.mixin;

import net.minecraft.world.Explosion;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(Explosion.class)
public class UTExplosionBlockDropMixin
{
@ModifyConstant(method = "doExplosionB", constant = @Constant(floatValue = 1.0F, ordinal = 1))
public float utExplosionBlockDropChance(float constant)
{
return (float) UTConfigTweaks.BLOCKS.utExplosionDropChance;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.blocks.explosion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.blocks.explosion.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTExplosionBlockDropMixin"]
}

0 comments on commit 169e3a2

Please sign in to comment.