Skip to content

Commit

Permalink
Implement Falling Block Lifespan tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Mar 12, 2024
1 parent 169e3a2 commit b8581d1
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package mod.acgaming.universaltweaks.bugfixes.blocks.fallingblockdamage.mixin;
package mod.acgaming.universaltweaks.bugfixes.blocks.falling.mixin;

import java.util.ArrayList;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public List<String> 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");
Expand Down Expand Up @@ -192,6 +192,7 @@ public List<String> 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");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.blocks.falling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.blocks.falling.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTFallingBlockLifespanMixin"]
}

0 comments on commit b8581d1

Please sign in to comment.