Skip to content

Commit

Permalink
3.2.2 village fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ammoore00 committed Nov 6, 2023
1 parent 4fd8ffe commit 104b973
Show file tree
Hide file tree
Showing 14 changed files with 260 additions and 90 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Version 3.X.0
[*]Changed black stone to be able to spawn nether mobs.
[/list]

Version 3.2.2
- Fixed an issue where villages were not generating properly.
- Fixed an issue where difficulty selection at world creation was not being respected.

Version 3.2.1
- Changed grassy clay to behave like regular grass blocks. It can spread grass, grass can spread to dirt clay blocks, and animals can eat grassy clay.
- Changed how grassy clay renders to only render clay in the dirt instead of in the grass as well.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ minecraft_version = 1.5.2
yarn_mappings = 1.5.2+build.202201092137
loader_version = 1.0.0

mod_version = 3.2.1
mod_version = 3.2.2
maven_group = betterterrain
archives_base_name = Better-Terrain-Addon

Expand Down
2 changes: 1 addition & 1 deletion run/.mixin.out/audit/mixin_implementation_report.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Mixin Implementation Report generated on 2023-05-12 15:14:07
Mixin Implementation Report generated on 2023-11-05 21:42:25
Binary file modified run/logs/debug-1.log.gz
Binary file not shown.
193 changes: 125 additions & 68 deletions run/logs/debug.log

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions run/logs/latest.log
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[15:14:07] [main/INFO] (FabricLoader) Loading for game Minecraft 1.5.2
[15:14:07] [main/INFO] (Fabric|Loader) [FabricLoaderImpl] Loading 4 mods: minecraft@1.5.2, betterterrain@3.2.1, java@8, fabricloader@1.0.0
[15:14:07] [main/INFO] (mixin) SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/C:/Users/abiga/.gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.9.2+mixin.0.8.2/12c437eebf031967eaa7daad861e115932772cc7/sponge-mixin-0.9.2+mixin.0.8.2.jar Service=Knot/Fabric Env=CLIENT
[15:14:07] [main/INFO] (Fabric|MixinBootstrap) Loaded Fabric development mappings for mixin remapper!
[21:42:24] [main/INFO] (FabricLoader) Loading for game Minecraft 1.5.2
[21:42:24] [main/INFO] (Fabric|Loader) [FabricLoaderImpl] Loading 5 mods: minecraft@1.5.2, betterterrain@3.2.1, java@8, fabricloader@1.0.0, decoaddon@4.1.0
[21:42:24] [main/INFO] (mixin) SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/C:/Users/abiga/.gradle/caches/modules-2/files-2.1/net.fabricmc/sponge-mixin/0.9.2+mixin.0.8.2/12c437eebf031967eaa7daad861e115932772cc7/sponge-mixin-0.9.2+mixin.0.8.2.jar Service=Knot/Fabric Env=CLIENT
[21:42:24] [main/INFO] (Fabric|MixinBootstrap) Loaded Fabric development mappings for mixin remapper!
[21:42:25] [main/WARN] (mixin) @Mixin target net/minecraft/src/SlotRepair is public in decoaddon.inventory.mixins.json:SlotRepairMixin and should be specified in value
3 changes: 2 additions & 1 deletion src/main/java/betterbiomes/BetterBiomesMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ public class BetterBiomesMod extends BTAAddon {
public static final AddonVersion V3_1_0 = new AddonVersion(3, 1, 0, getInstance());
public static final AddonVersion V3_2_0 = new AddonVersion(3, 2, 0, getInstance());
public static final AddonVersion V3_2_1 = new AddonVersion(3, 2, 1, getInstance());
public static final AddonVersion V3_2_2 = new AddonVersion(3, 2, 2, getInstance());

private BetterBiomesMod() {
super("Better Biomes", "betterbiomes", "3.2.1", "BB");
super("Better Biomes", "betterbiomes", "3.2.2", "BB");
}

@Override
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/betterterrain/BTAMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import btw.block.BTWBlocks;
import net.minecraft.src.*;

import java.util.ArrayList;

public class BTAMod extends BTWAddon {
private static BTAMod instance;

Expand All @@ -28,7 +30,7 @@ public class BTAMod extends BTWAddon {
public static Material netherSand;

private BTAMod() {
super("Better Terrain", "3.2.1", "BTA");
super("Better Terrain", "3.2.2", "BTA");
this.currentVersion = BTAVersion.fromString(this.getVersionString());
}

Expand All @@ -44,6 +46,10 @@ public void initialize() {
Block.blockNetherQuartz.setBlockMaterial(BTWBlocks.netherRockMaterial);
Block.slowSand.setBlockMaterial(netherSand);

MapGenVillage.villageSpawnBiomes = new ArrayList<>();
MapGenVillage.villageSpawnBiomes.add(BiomeGenBase.plains);
MapGenVillage.villageSpawnBiomes.add(BiomeGenBase.desert);

for (BTWAddon mod : AddonHandler.modList.values()) {
if (mod instanceof BTAAddon) {
BTAAddon addon = (BTAAddon) mod;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/betterterrain/BTAVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public enum BTAVersion {
V3_1_0(3, 1, 0),

V3_2_0(3, 2, 0),
V3_2_1(3, 2, 1);
V3_2_1(3, 2, 1),
V3_2_2(3, 2, 2);

private final int major;
private final int minor;
Expand Down
7 changes: 2 additions & 5 deletions src/main/java/betterterrain/biome/BTABiome.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package betterterrain.biome;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
import java.util.*;
import java.util.function.ToDoubleFunction;

import betterterrain.BTAVersion;
Expand Down Expand Up @@ -603,7 +600,7 @@ public boolean isBeach() {
private boolean canSpawnStronghold = true;

public BTABiome setSpawnsVillages(boolean isDesert) {
BTAMapGenVillage.villageSpawnBiomes.add(this);
MapGenVillage.villageSpawnBiomes.add(this);

if (isDesert) {
ComponentVillageStartPiece.addDesertBiome(this);
Expand Down
103 changes: 103 additions & 0 deletions src/main/java/betterterrain/mixins/StructureVillagePiecesMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package betterterrain.mixins;

import betterterrain.structure.mapgen.BTAMapGenVillage;
import betterterrain.world.BTAWorldChunkManager;
import net.minecraft.src.*;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Mixin(StructureVillagePieces.class)
public abstract class StructureVillagePiecesMixin {
/**
* @author Dawnraider00 / TheLadyDawn
* @reason Changing of conditional statement which would otherwise require complicated mixin in order to preserve determinism in world generation
*/
@Overwrite
private static StructureComponent getNextVillageStructureComponent(ComponentVillageStartPiece componentVillageStartPiece, List list, Random rand, int par3, int par4, int par5, int par6, int par7) {
if (par7 > 50) {
return null;
} else if (Math.abs(par3 - componentVillageStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par5 - componentVillageStartPiece.getBoundingBox().minZ) <= 112) {
ComponentVillage var8 = getNextVillageComponent(componentVillageStartPiece, list, rand, par3, par4, par5, par6, par7 + 1);

if (var8 != null) {
int var9 = (var8.getBoundingBox().minX + var8.getBoundingBox().maxX) / 2;
int var10 = (var8.getBoundingBox().minZ + var8.getBoundingBox().maxZ) / 2;
int var11 = var8.getBoundingBox().maxX - var8.getBoundingBox().minX;
int var12 = var8.getBoundingBox().maxZ - var8.getBoundingBox().minZ;
int var13 = var11 > var12 ? var11 : var12;

List villageSpawnBiomesList;

if (componentVillageStartPiece.getWorldChunkManager() instanceof BTAWorldChunkManager) {
System.out.println("BTAWorld");
villageSpawnBiomesList = MapGenVillage.villageSpawnBiomes;
} else {
System.out.println("Regular World");
villageSpawnBiomesList = MapGenVillage.villageSpawnBiomes;
}

if (componentVillageStartPiece.getWorldChunkManager().areBiomesViable(var9, var10, var13 / 2 + 4, villageSpawnBiomesList)) {
list.add(var8);
componentVillageStartPiece.field_74932_i.add(var8);
return var8;
}
}

return null;
} else {
return null;
}
}

/**
* @author Dawnraider00 / TheLadyDawn
* @reason Changing of conditional statement which would otherwise require complicated mixin in order to preserve determinism in world generation
*/
@Overwrite
private static StructureComponent getNextComponentVillagePath(ComponentVillageStartPiece componentVillageStartPiece, List list, Random rand, int par3, int par4, int par5, int par6, int par7) {
if (par7 > 3 + componentVillageStartPiece.terrainType) {
return null;
} else if (Math.abs(par3 - componentVillageStartPiece.getBoundingBox().minX) <= 112 && Math.abs(par5 - componentVillageStartPiece.getBoundingBox().minZ) <= 112) {
StructureBoundingBox var8 = ComponentVillagePathGen.func_74933_a(componentVillageStartPiece, list, rand, par3, par4, par5, par6);

if (var8 != null && var8.minY > 10) {
ComponentVillagePathGen var9 = new ComponentVillagePathGen(componentVillageStartPiece, par7, rand, var8, par6);
int var10 = (var9.getBoundingBox().minX + var9.getBoundingBox().maxX) / 2;
int var11 = (var9.getBoundingBox().minZ + var9.getBoundingBox().maxZ) / 2;
int var12 = var9.getBoundingBox().maxX - var9.getBoundingBox().minX;
int var13 = var9.getBoundingBox().maxZ - var9.getBoundingBox().minZ;
int var14 = var12 > var13 ? var12 : var13;

List villageSpawnBiomesList;

if (componentVillageStartPiece.getWorldChunkManager() instanceof BTAWorldChunkManager) {
System.out.println("BTAWorld");
villageSpawnBiomesList = MapGenVillage.villageSpawnBiomes;
} else {
System.out.println("Regular World");
villageSpawnBiomesList = MapGenVillage.villageSpawnBiomes;
}

if (componentVillageStartPiece.getWorldChunkManager().areBiomesViable(var10, var11, var14 / 2 + 4, villageSpawnBiomesList)) {
list.add(var9);
componentVillageStartPiece.field_74930_j.add(var9);
return var9;
}
}

return null;
} else {
return null;
}
}

@Shadow
private static ComponentVillage getNextVillageComponent(ComponentVillageStartPiece par0ComponentVillageStartPiece, List par1List, Random par2Random, int par3, int par4, int par5, int par6, int par7) {
throw new IllegalStateException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

public class BTAMapGenVillage extends BTAMapGenStructure
{
public static final ArrayList<BiomeGenBase> villageSpawnBiomes = new ArrayList<BiomeGenBase>(Arrays.asList(new BiomeGenBase[] {BiomeGenBase.plains, BiomeGenBase.desert}));

/** World terrain type, 0 for normal, 1 for flat map */
private int terrainType;
private int field_82665_g;
Expand Down Expand Up @@ -66,7 +64,7 @@ public boolean canSpawnStructureAtCoords(int par1, int par2)

if (var3 == var5 && var4 == var6)
{
boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, villageSpawnBiomes);
boolean var8 = this.worldObj.getWorldChunkManager().areBiomesViable(var3 * 16 + 8, var4 * 16 + 8, 0, MapGenVillage.villageSpawnBiomes);

if (var8)
{
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/betterterrain.accesswidener
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ accessWidener v1 named
extendable class net/minecraft/src/WorldType
extendable class net/minecraft/src/ComponentScatteredFeature

accessible class net/minecraft/src/ComponentVillage
accessible class net/minecraft/src/StructureNetherBridgeStart
accessible class net/minecraft/src/StructureStrongholdStart
accessible class net/minecraft/src/StructureVillageStart
accessible class net/minecraft/src/StructureVillageStart

mutable field net/minecraft/src/MapGenVillage villageSpawnBiomes Ljava.util.List;
7 changes: 3 additions & 4 deletions src/main/resources/betterterrain.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
"package": "betterterrain.mixins",
"compatibilityLevel": "JAVA_8",
"mixins": [
"BiomeDecoratorAccessor",
"ClayBlockMixin",
"GenLayerAccessor",
"NetherGrothSporesItemMixin",
"SoulSandPileItemMixin",

"BiomeDecoratorAccessor",
"GenLayerAccessor",
"StructureScatteredFeatureStartMixin",
"WorldProviderMixin",
"WorldProviderEndMixin",
"WorldProviderHellMixin",
"WorldProviderMixin",
"WorldTypeAccessor",
"WorldTypeMixin"
],
Expand Down

0 comments on commit 104b973

Please sign in to comment.