diff --git a/README.md b/README.md index 45f88f02..fdbf4e4f 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ All changes are toggleable via config files. * **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 +* **Falling Block Lifespan:** Determines how long falling blocks remain in ticks until they are dropped under normal circumstances * **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/bugfixes/blocks/fallingblockdamage/mixin/UTFallingBlockDamageMixin.java b/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/falling/mixin/UTFallingBlockDamageMixin.java similarity index 94% rename from src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/fallingblockdamage/mixin/UTFallingBlockDamageMixin.java rename to src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/falling/mixin/UTFallingBlockDamageMixin.java index 1e7ce5d7..cb342951 100644 --- a/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/fallingblockdamage/mixin/UTFallingBlockDamageMixin.java +++ b/src/main/java/mod/acgaming/universaltweaks/bugfixes/blocks/falling/mixin/UTFallingBlockDamageMixin.java @@ -1,4 +1,4 @@ -package mod.acgaming.universaltweaks.bugfixes.blocks.fallingblockdamage.mixin; +package mod.acgaming.universaltweaks.bugfixes.blocks.falling.mixin; import java.util.ArrayList; diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index 9906eb51..ef0c2af7 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -133,6 +133,11 @@ public static class BlocksCategory }) public double utExplosionDropChance = 1.0D; + @Config.RequiresMcRestart + @Config.Name("Falling Block Lifespan") + @Config.Comment("Determines how long falling blocks remain in ticks until they are dropped under normal circumstances") + public int utFallingBlockLifespan = 600; + @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 de633e31..3ce9bbe8 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -153,7 +153,7 @@ public List getMixinConfigs() // COMMON configs.add("mixins.bugfixes.blocks.bed.json"); configs.add("mixins.bugfixes.blocks.comparatortiming.json"); - configs.add("mixins.bugfixes.blocks.fallingblockdamage.json"); + configs.add("mixins.bugfixes.blocks.falling.json"); configs.add("mixins.bugfixes.blocks.hopper.boundingbox.json"); configs.add("mixins.bugfixes.blocks.hopper.tile.json"); configs.add("mixins.bugfixes.blocks.itemframevoid.json"); @@ -192,6 +192,7 @@ public List getMixinConfigs() 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.falling.json"); configs.add("mixins.tweaks.blocks.growthsize.json"); configs.add("mixins.tweaks.blocks.hitdelay.json"); configs.add("mixins.tweaks.blocks.leafdecay.json"); @@ -346,7 +347,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig) { case "mixins.bugfixes.blocks.comparatortiming.json": return UTConfigBugfixes.BLOCKS.utComparatorTimingToggle; - case "mixins.bugfixes.blocks.fallingblockdamage.json": + case "mixins.bugfixes.blocks.falling.json": return UTConfigBugfixes.BLOCKS.utFallingBlockDamageToggle; case "mixins.bugfixes.blocks.hopper.boundingbox.json": return UTConfigBugfixes.BLOCKS.utDietHopperToggle; @@ -426,6 +427,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigTweaks.BLOCKS.BREAKABLE_BEDROCK.utBreakableBedrockToggle; case "mixins.tweaks.blocks.explosion.json": return UTConfigTweaks.BLOCKS.utExplosionDropChance != 1.0D; + case "mixins.tweaks.blocks.falling.json": + return UTConfigTweaks.BLOCKS.utFallingBlockLifespan != 600; 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/falling/mixin/UTFallingBlockLifespanMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/falling/mixin/UTFallingBlockLifespanMixin.java new file mode 100644 index 00000000..3402a922 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/falling/mixin/UTFallingBlockLifespanMixin.java @@ -0,0 +1,18 @@ +package mod.acgaming.universaltweaks.tweaks.blocks.falling.mixin; + +import net.minecraft.entity.item.EntityFallingBlock; + +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(EntityFallingBlock.class) +public class UTFallingBlockLifespanMixin +{ + @ModifyConstant(method = "onUpdate", constant = @Constant(intValue = 600)) + public int utFallingBlockLifespan(int constant) + { + return UTConfigTweaks.BLOCKS.utFallingBlockLifespan; + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.bugfixes.blocks.fallingblockdamage.json b/src/main/resources/mixins.bugfixes.blocks.falling.json similarity index 90% rename from src/main/resources/mixins.bugfixes.blocks.fallingblockdamage.json rename to src/main/resources/mixins.bugfixes.blocks.falling.json index b74b0fb2..1a9aa188 100644 --- a/src/main/resources/mixins.bugfixes.blocks.fallingblockdamage.json +++ b/src/main/resources/mixins.bugfixes.blocks.falling.json @@ -1,5 +1,5 @@ { - "package": "mod.acgaming.universaltweaks.bugfixes.blocks.fallingblockdamage.mixin", + "package": "mod.acgaming.universaltweaks.bugfixes.blocks.falling.mixin", "refmap": "universaltweaks.refmap.json", "minVersion": "0.8", "compatibilityLevel": "JAVA_8", diff --git a/src/main/resources/mixins.tweaks.blocks.falling.json b/src/main/resources/mixins.tweaks.blocks.falling.json new file mode 100644 index 00000000..b5e76874 --- /dev/null +++ b/src/main/resources/mixins.tweaks.blocks.falling.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.blocks.falling.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": ["UTFallingBlockLifespanMixin"] +} \ No newline at end of file