updated to 1.15 mappings
This commit is contained in:
@@ -39,7 +39,7 @@ public class DecoratorCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializeBiomeStep(Biome biome, GenerationStep.Feature genStep) {
|
private void initializeBiomeStep(Biome biome, GenerationStep.Feature genStep) {
|
||||||
List<ConfiguredFeature<?>> features = biome.getFeaturesForStep(genStep);
|
List<ConfiguredFeature<?, ?>> features = biome.getFeaturesForStep(genStep);
|
||||||
|
|
||||||
for(int i = 0; i < features.size(); i++) {
|
for(int i = 0; i < features.size(); i++) {
|
||||||
FeatureConfig config = features.get(i).config;
|
FeatureConfig config = features.get(i).config;
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ public class StructureData {
|
|||||||
private int regionZ;
|
private int regionZ;
|
||||||
private int offsetX;
|
private int offsetX;
|
||||||
private int offsetZ;
|
private int offsetZ;
|
||||||
private Feature feature;
|
private FeatureType featureType;
|
||||||
|
|
||||||
public StructureData(ChunkPos chunkPos, Feature feature) {
|
public StructureData(ChunkPos chunkPos, FeatureType featureType) {
|
||||||
this.feature = feature;
|
this.featureType = featureType;
|
||||||
this.feature.build(this, chunkPos);
|
this.featureType.build(this, chunkPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRegionX() {
|
public int getRegionX() {
|
||||||
@@ -33,15 +33,15 @@ public class StructureData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSalt() {
|
public int getSalt() {
|
||||||
return this.feature.salt;
|
return this.featureType.salt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Feature getFeature() {
|
public FeatureType getFeatureType() {
|
||||||
return this.feature;
|
return this.featureType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean test(ChunkRandom rand) {
|
public boolean test(ChunkRandom rand) {
|
||||||
return this.feature.test(rand, this.offsetX, this.offsetZ);
|
return this.featureType.test(rand, this.offsetX, this.offsetZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,17 +50,17 @@ public class StructureData {
|
|||||||
|
|
||||||
if(obj instanceof StructureData) {
|
if(obj instanceof StructureData) {
|
||||||
StructureData structureData = ((StructureData)obj);
|
StructureData structureData = ((StructureData)obj);
|
||||||
return structureData.regionX == this.regionX && structureData.regionZ == this.regionZ && structureData.feature == this.feature;
|
return structureData.regionX == this.regionX && structureData.regionZ == this.regionZ && structureData.featureType == this.featureType;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract static class Feature {
|
public abstract static class FeatureType {
|
||||||
public final int salt;
|
public final int salt;
|
||||||
public final int distance;
|
public final int distance;
|
||||||
|
|
||||||
public Feature(int salt, int distance) {
|
public FeatureType(int salt, int distance) {
|
||||||
this.salt = salt;
|
this.salt = salt;
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
}
|
}
|
||||||
@@ -89,56 +89,56 @@ public class StructureData {
|
|||||||
public abstract boolean test(ChunkRandom rand, int x, int z);
|
public abstract boolean test(ChunkRandom rand, int x, int z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Feature DESERT_PYRAMID = new Feature(14357617, 32) {
|
public static final FeatureType DESERT_PYRAMID = new FeatureType(14357617, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature IGLOO = new Feature(14357618, 32) {
|
public static final FeatureType IGLOO = new FeatureType(14357618, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature JUNGLE_TEMPLE = new Feature(14357619, 32) {
|
public static final FeatureType JUNGLE_TEMPLE = new FeatureType(14357619, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature SWAMP_HUT = new Feature(14357620, 32) {
|
public static final FeatureType SWAMP_HUT = new FeatureType(14357620, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature OCEAN_RUIN = new Feature(14357621, 16) {
|
public static final FeatureType OCEAN_RUIN = new FeatureType(14357621, 16) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(8) == x && rand.nextInt(8) == z;
|
return rand.nextInt(8) == x && rand.nextInt(8) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature SHIPWRECK = new Feature(165745295, 16) {
|
public static final FeatureType SHIPWRECK = new FeatureType(165745295, 16) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(8) == x && rand.nextInt(8) == z;
|
return rand.nextInt(8) == x && rand.nextInt(8) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature PILLAGER_OUTPOST = new Feature(165745296, 32) {
|
public static final FeatureType PILLAGER_OUTPOST = new FeatureType(165745296, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
return rand.nextInt(24) == x && rand.nextInt(24) == z;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature END_CITY = new Feature(10387313, 20) {
|
public static final FeatureType END_CITY = new FeatureType(10387313, 20) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return (rand.nextInt(9) + rand.nextInt(9)) / 2 == x
|
return (rand.nextInt(9) + rand.nextInt(9)) / 2 == x
|
||||||
@@ -146,7 +146,7 @@ public class StructureData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature OCEAN_MONUMENT = new Feature(10387313, 32) {
|
public static final FeatureType OCEAN_MONUMENT = new FeatureType(10387313, 32) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return (rand.nextInt(27) + rand.nextInt(27)) / 2 == x
|
return (rand.nextInt(27) + rand.nextInt(27)) / 2 == x
|
||||||
@@ -154,14 +154,14 @@ public class StructureData {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature BURIED_TREASURE = new Feature(10387320, 1) {
|
public static final FeatureType BURIED_TREASURE = new FeatureType(10387320, 1) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return rand.nextFloat() < 0.1f;
|
return rand.nextFloat() < 0.01f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Feature WOODLAND_MANSION = new Feature(10387319, 80) {
|
public static final FeatureType WOODLAND_MANSION = new FeatureType(10387319, 80) {
|
||||||
@Override
|
@Override
|
||||||
public boolean test(ChunkRandom rand, int x, int z) {
|
public boolean test(ChunkRandom rand, int x, int z) {
|
||||||
return (rand.nextInt(60) + rand.nextInt(60)) / 2 == x
|
return (rand.nextInt(60) + rand.nextInt(60)) / 2 == x
|
||||||
|
|||||||
@@ -30,31 +30,25 @@ public class DungeonData extends PopulationData {
|
|||||||
@Override
|
@Override
|
||||||
public boolean testDecorator(long decoratorSeed) {
|
public boolean testDecorator(long decoratorSeed) {
|
||||||
if(this.starts.isEmpty())return true;
|
if(this.starts.isEmpty())return true;
|
||||||
|
Rand rand = new Rand(decoratorSeed, false);
|
||||||
|
|
||||||
//TODO: This currently only supports 1 dungeon per chunk.
|
//TODO: This currently only supports 1 dungeon per chunk.
|
||||||
BlockPos start = this.starts.get(0);
|
BlockPos start = this.starts.get(0);
|
||||||
|
|
||||||
long currentSeed = decoratorSeed;
|
|
||||||
boolean valid = false;
|
|
||||||
|
|
||||||
for(int i = 0; i < 8; i++) {
|
for(int i = 0; i < 8; i++) {
|
||||||
currentSeed = i == 0 ? Y_START_SKIP.nextSeed(currentSeed) : Y_SKIP.nextSeed(currentSeed);
|
int x = rand.nextInt(16);
|
||||||
|
int z = rand.nextInt(16);
|
||||||
|
int y = rand.nextInt(256);
|
||||||
|
|
||||||
if(currentSeed >> 40 == start.getY()) {
|
if(y == start.getY() && x == start.getX() && z == start.getZ()) {
|
||||||
valid = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rand.nextInt(2);
|
||||||
|
rand.nextInt(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!valid)return false;
|
return false;
|
||||||
|
|
||||||
int x = (int)(REVERSE_SKIP.nextSeed(currentSeed) >> 44);
|
|
||||||
if(x != start.getX())return false;
|
|
||||||
|
|
||||||
int z = (int)(Rand.JAVA_LCG.nextSeed(currentSeed) >> 44);
|
|
||||||
if(z != start.getZ())return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ public class EmeraldOreData extends PopulationData {
|
|||||||
|
|
||||||
for(int i = 0; i < b + 3; i++) {
|
for(int i = 0; i < b + 3; i++) {
|
||||||
int x = rand.nextInt(16);
|
int x = rand.nextInt(16);
|
||||||
int y = rand.nextInt(28) + 4;
|
|
||||||
int z = rand.nextInt(16);
|
int z = rand.nextInt(16);
|
||||||
|
int y = rand.nextInt(28) + 4;
|
||||||
|
|
||||||
if(y == start.getY() && x == start.getX() && z == start.getZ()) {
|
if(y == start.getY() && x == start.getX() && z == start.getZ()) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ public abstract class PopulationData {
|
|||||||
return new ChunkRandom(CACHE.get(biome));
|
return new ChunkRandom(CACHE.get(biome));
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ConfiguredFeature<?>> features = biome.getFeaturesForStep(this.genStep);
|
List<ConfiguredFeature<?, ?>> features = biome.getFeaturesForStep(this.genStep);
|
||||||
|
|
||||||
for(int i = 0; i < features.size(); i++) {
|
for(int i = 0; i < features.size(); i++) {
|
||||||
ConfiguredFeature<?> feature = features.get(i);
|
ConfiguredFeature<?, ?> feature = features.get(i);
|
||||||
if(!(feature.config instanceof DecoratedFeatureConfig))continue;
|
if(!(feature.config instanceof DecoratedFeatureConfig))continue;
|
||||||
ConfiguredDecorator<?> currentDecorator = ((DecoratedFeatureConfig)feature.config).decorator;
|
ConfiguredDecorator<?> currentDecorator = ((DecoratedFeatureConfig)feature.config).decorator;
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public abstract class BlockFinder extends Finder {
|
|||||||
|
|
||||||
public BlockFinder(World world, ChunkPos chunkPos, Block block) {
|
public BlockFinder(World world, ChunkPos chunkPos, Block block) {
|
||||||
super(world, chunkPos);
|
super(world, chunkPos);
|
||||||
this.targetBlockStates.addAll(block.getStateFactory().getStates());
|
this.targetBlockStates.addAll(block.getStateManager().getStates());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockFinder(World world, ChunkPos chunkPos, BlockState... blockStates) {
|
public BlockFinder(World world, ChunkPos chunkPos, BlockState... blockStates) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.util.Map;
|
|||||||
public class PieceFinder extends Finder {
|
public class PieceFinder extends Finder {
|
||||||
|
|
||||||
protected Map<BlockPos, BlockState> structure = new LinkedHashMap<>();
|
protected Map<BlockPos, BlockState> structure = new LinkedHashMap<>();
|
||||||
private MutableIntBoundingBox boundingBox;
|
private BlockBox boundingBox;
|
||||||
protected List<BlockPos> searchPositions = new ArrayList<>();
|
protected List<BlockPos> searchPositions = new ArrayList<>();
|
||||||
|
|
||||||
protected Direction facing;
|
protected Direction facing;
|
||||||
@@ -40,12 +40,12 @@ public class PieceFinder extends Finder {
|
|||||||
this.depth = size.getZ();
|
this.depth = size.getZ();
|
||||||
|
|
||||||
if(this.facing.getAxis() == Direction.Axis.Z) {
|
if(this.facing.getAxis() == Direction.Axis.Z) {
|
||||||
this.boundingBox = new MutableIntBoundingBox(
|
this.boundingBox = new BlockBox(
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
size.getX() - 1, size.getY() - 1, size.getZ() - 1
|
size.getX() - 1, size.getY() - 1, size.getZ() - 1
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.boundingBox = new MutableIntBoundingBox(
|
this.boundingBox = new BlockBox(
|
||||||
0, 0, 0,
|
0, 0, 0,
|
||||||
size.getZ() - 1, size.getY() - 1, size.getX() - 1
|
size.getZ() - 1, size.getY() - 1, size.getX() - 1
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user