Skip to content

Commit

Permalink
Add biome return value for shipwrecks in isViableStructurePos
Browse files Browse the repository at this point in the history
  • Loading branch information
AeroAstroid authored Oct 28, 2023
1 parent 31f1892 commit b635194
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion finders.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,6 @@ int isViableStructurePos(int structureType, Generator *g, int x, int z, uint32_t
if (g->mc <= MC_1_19) goto L_not_viable;
goto L_feature;
case Ocean_Ruin:
case Shipwreck:
case Treasure:
if (g->mc <= MC_1_12) goto L_not_viable;
goto L_feature;
Expand Down Expand Up @@ -1289,6 +1288,28 @@ int isViableStructurePos(int structureType, Generator *g, int x, int z, uint32_t
goto L_not_viable;
goto L_viable;

case Shipwreck:
if (g->mc <= MC_1_12)
goto L_not_viable;
if (g->mc <= MC_1_15)
{
g->entry = &g->ls.layers[L_VORONOI_1];
sampleX = chunkX * 16 + 9;
sampleZ = chunkZ * 16 + 9;
}
else
{
if (g->mc <= MC_1_17)
g->entry = &g->ls.layers[L_RIVER_MIX_4];
sampleX = chunkX * 4 + 2;
sampleZ = chunkZ * 4 + 2;
}
id = getBiomeAt(g, 0, sampleX, 319>>2, sampleZ);
if (id < 0 || !isViableFeatureBiome(g->mc, structureType, id))
goto L_not_viable;
viable = id; // biome for further analysis
goto L_viable;

case Desert_Well:
if (g->mc <= MC_1_15)
{
Expand Down

0 comments on commit b635194

Please sign in to comment.