diff --git a/README.md b/README.md index 4028bdb0..45f88f02 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index f163829e..9906eb51 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -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") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index 37bb7f66..de633e31 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -191,6 +191,7 @@ public List 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"); @@ -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": diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/explosion/mixin/UTExplosionBlockDropMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/explosion/mixin/UTExplosionBlockDropMixin.java new file mode 100644 index 00000000..251095cd --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/explosion/mixin/UTExplosionBlockDropMixin.java @@ -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; + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.blocks.explosion.json b/src/main/resources/mixins.tweaks.blocks.explosion.json new file mode 100644 index 00000000..46405d76 --- /dev/null +++ b/src/main/resources/mixins.tweaks.blocks.explosion.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.blocks.explosion.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTExplosionBlockDropMixin"] +} \ No newline at end of file