Skip to content

Commit

Permalink
Implement village distance tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Feb 15, 2024
1 parent ba80db1 commit 015b732
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ All changes are toggleable via config files.
* **Undead Horses**
* **Burning:** Lets untamed undead horses burn in daylight
* **Taming:** Allows taming of undead horses
* **Village Distance:** Sets the village generation distance in chunks
* **Water Fall Damage:** Re-implements an improved version of pre-1.4 fall damage in water
* **XP Bottle Amount:** Sets the amount of experience spawned by bottles o' enchanting
* **XP Level Cap:** Sets the maximum experience level players can reach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,15 @@ public static class WorldCategory
@Config.Comment("Tidies newly generated chunks by removing scattered item entities")
public boolean utTidyChunkToggle = false;

@Config.RequiresMcRestart
@Config.Name("Village Distance")
@Config.Comment
({
"Sets the village generation distance in chunks",
"Vanilla default is 32"
})
public int utVillageDistance = 32;

public static class ChunkGenLimitCategory
{
@Config.RequiresMcRestart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public List<String> getMixinConfigs()
configs.add("mixins.tweaks.world.chunks.gen.json");
configs.add("mixins.tweaks.world.loading.server.json");
configs.add("mixins.tweaks.world.sealevel.json");
configs.add("mixins.tweaks.world.village.json");
return configs;
}

Expand All @@ -255,10 +256,7 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
if (isDev)
{
// Causes crashes in dev env only
if (mixinConfig.equals("mixins.tweaks.misc.armorcurve.json"))
{
return false;
}
if (mixinConfig.equals("mixins.tweaks.misc.armorcurve.json")) return false;
return true;
}
if (isClient)
Expand Down Expand Up @@ -530,6 +528,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig)
return UTConfigTweaks.PERFORMANCE.utWorldLoadingToggle;
case "mixins.tweaks.world.sealevel.json":
return UTConfigTweaks.WORLD.utSeaLevel != 63;
case "mixins.tweaks.world.village.json":
return UTConfigTweaks.WORLD.utVillageDistance != 32;
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package mod.acgaming.universaltweaks.tweaks.world.village.mixin;

import net.minecraft.world.gen.structure.MapGenVillage;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MapGenVillage.class)
public class UTVillageDistanceMixin
{
@Shadow
private int distance;

@Inject(method = "<init>()V", at = @At("TAIL"))
public void utVillageDistance(CallbackInfo ci)
{
this.distance = UTConfigTweaks.WORLD.utVillageDistance;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.world.village.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.world.village.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": ["UTVillageDistanceMixin"]
}

0 comments on commit 015b732

Please sign in to comment.