Continue mapping migration
This commit is contained in:
parent
99ade39404
commit
f03fd03bd0
499 changed files with 12567 additions and 12723 deletions
|
@ -2,16 +2,14 @@ package ru.betterend.integration.byg.features;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.MHelper;
|
||||
|
@ -23,7 +21,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("ether_log");
|
||||
|
@ -33,7 +31,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
|
||||
|
@ -51,7 +49,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> branch = SplineHelper.makeSpline(0, 0, 0, length, 0, 0, points < 2 ? 2 : points);
|
||||
SplineHelper.powerOffset(branch, length, 2F);
|
||||
int rotCount = MHelper.randRange(5, 7, random);
|
||||
// float startRad = Mth.lerp(splinePos, 2.3F, 0.8F) * 0.8F;
|
||||
// float startRad = MathHelper.lerp(splinePos, 2.3F, 0.8F) * 0.8F;
|
||||
Vector3f start = SplineHelper.getPos(trunk, splinePos * (trunk.size() - 1));
|
||||
for (int j = 0; j < rotCount; j++) {
|
||||
float angle = startAngle + (float) j / rotCount * MHelper.PI2;
|
||||
|
@ -65,7 +63,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
}
|
||||
|
||||
sdf.setReplaceFunction((state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
}).addPostProcess((info) -> {
|
||||
if (info.getState().equals(log) && (!info.getStateUp().equals(log) || !info.getStateDown().equals(log))) {
|
||||
|
@ -77,7 +75,7 @@ public class BigEtherTreeFeature extends DefaultFeature {
|
|||
return true;
|
||||
}
|
||||
|
||||
// private void makeLeavesSphere(WorldGenLevel world, BlockPos pos,
|
||||
// private void makeLeavesSphere(StructureWorldAccess world, BlockPos pos,
|
||||
// BlockState leaves, Function<BlockState, Boolean> ignore) {
|
||||
//
|
||||
// }
|
||||
|
|
|
@ -2,21 +2,19 @@ package ru.betterend.integration.byg.features;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -37,20 +35,20 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
|
||||
BlockState wood = Integrations.BYG.getDefaultState("nightshade_wood");
|
||||
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves").with(LeavesBlock.DISTANCE, 1);
|
||||
BlockState leaves = Integrations.BYG.getDefaultState("nightshade_leaves").setValue(LeavesBlock.DISTANCE, 1);
|
||||
BlockState leaves_flower = Integrations.BYG.getDefaultState("flowering_nightshade_leaves")
|
||||
.with(LeavesBlock.DISTANCE, 1);
|
||||
.setValue(LeavesBlock.DISTANCE, 1);
|
||||
|
||||
Function<BlockPos, BlockState> splinePlacer = (bpos) -> {
|
||||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
Function<PosInfo, BlockState> post = (info) -> {
|
||||
|
@ -78,7 +76,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
for (int i = 0; i < count; i++) {
|
||||
float scale = (float) (count - i) / count * 15;
|
||||
Vector3f offset = SplineHelper.getPos(trunk, (float) i / count * delta + start);
|
||||
if (offset.getY() > max) {
|
||||
if (offset.y() > max) {
|
||||
break;
|
||||
}
|
||||
List<Vector3f> branch = SplineHelper.copySpline(BRANCH);
|
||||
|
@ -98,13 +96,13 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
|
||||
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.75F);
|
||||
for (int y = 0; y < 8; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
|
||||
}
|
||||
|
||||
for (int y = 0; y < 16; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
if (world.isAir(p)) {
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
if (world.isEmptyBlock(p)) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves);
|
||||
}
|
||||
float radius = (1 - y / 16F) * 3F;
|
||||
|
@ -115,8 +113,8 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
for (int z = -rad; z <= rad; z++) {
|
||||
int z2 = z * z;
|
||||
if (x2 + z2 < radius - random.nextFloat() * rad) {
|
||||
BlockPos lp = p.add(x, 0, z);
|
||||
if (world.isAir(lp)) {
|
||||
BlockPos lp = p.offset(x, 0, z);
|
||||
if (world.isEmptyBlock(lp)) {
|
||||
BlocksHelper.setWithoutUpdate(world, lp, leaves);
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +140,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
if (state.getBlock() instanceof LeavesBlock) {
|
||||
int distance = state.getValue(LeavesBlock.DISTANCE);
|
||||
if (d < distance) {
|
||||
info.setState(mut, state.with(LeavesBlock.DISTANCE, d));
|
||||
info.setState(mut, state.setValue(LeavesBlock.DISTANCE, d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +152,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
};
|
||||
Function<PosInfo, BlockState> leavesPost2 = (info) -> {
|
||||
if (info.getState().getBlock() instanceof LeavesBlock) {
|
||||
int distance = info.getState().get(LeavesBlock.DISTANCE);
|
||||
int distance = info.getState().getValue(LeavesBlock.DISTANCE);
|
||||
if (distance > MHelper.randRange(2, 4, random)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
}
|
||||
|
@ -168,7 +166,7 @@ public class GreatNightshadeTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
if (random.nextInt(8) == 0) {
|
||||
return leaves_flower.with(LeavesBlock.DISTANCE, distance);
|
||||
return leaves_flower.setValue(LeavesBlock.DISTANCE, distance);
|
||||
}
|
||||
}
|
||||
return info.getState();
|
||||
|
|
|
@ -2,21 +2,19 @@ package ru.betterend.integration.byg.features;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.LeavesBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.registry.EndTags;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
@ -37,7 +35,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
|
||||
BlockState log = Integrations.BYG.getDefaultState("nightshade_log");
|
||||
|
@ -49,7 +47,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
return log;
|
||||
};
|
||||
Function<BlockState, Boolean> replace = (state) -> {
|
||||
return state.isIn(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
return state.is(EndTags.END_GROUND) || state.getMaterial().equals(Material.PLANT)
|
||||
|| state.getMaterial().isReplaceable();
|
||||
};
|
||||
Function<PosInfo, BlockState> post = (info) -> {
|
||||
|
@ -78,7 +76,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
for (int i = 0; i < count; i++) {
|
||||
float scale = (float) (count - i) / count * 15;
|
||||
Vector3f offset = SplineHelper.getPos(trunk, (float) i / count * delta + start);
|
||||
if (offset.getY() > max) {
|
||||
if (offset.y() > max) {
|
||||
break;
|
||||
}
|
||||
List<Vector3f> branch = SplineHelper.copySpline(BRANCH);
|
||||
|
@ -97,13 +95,13 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
sdf.setReplaceFunction(replace).addPostProcess(post).fillRecursive(world, pos);
|
||||
Vector3f last = SplineHelper.getPos(trunk, trunk.size() - 1.35F);
|
||||
for (int y = 0; y < 8; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
BlocksHelper.setWithoutUpdate(world, p, y == 4 ? wood : log);
|
||||
}
|
||||
|
||||
for (int y = 0; y < 16; y++) {
|
||||
BlockPos p = pos.offset(last.getX() + 0.5, last.getY() + y, last.getZ() + 0.5);
|
||||
if (world.isAir(p)) {
|
||||
BlockPos p = pos.offset(last.x() + 0.5, last.y() + y, last.z() + 0.5);
|
||||
if (world.isEmptyBlock(p)) {
|
||||
BlocksHelper.setWithoutUpdate(world, p, leaves);
|
||||
}
|
||||
float radius = (1 - y / 16F) * 3F;
|
||||
|
@ -114,8 +112,8 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
for (int z = -rad; z <= rad; z++) {
|
||||
int z2 = z * z;
|
||||
if (x2 + z2 < radius - random.nextFloat() * rad) {
|
||||
BlockPos lp = p.add(x, 0, z);
|
||||
if (world.isAir(lp)) {
|
||||
BlockPos lp = p.offset(x, 0, z);
|
||||
if (world.isEmptyBlock(lp)) {
|
||||
BlocksHelper.setWithoutUpdate(world, lp, leaves);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +139,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
if (state.getBlock() instanceof LeavesBlock) {
|
||||
int distance = state.getValue(LeavesBlock.DISTANCE);
|
||||
if (d < distance) {
|
||||
info.setState(mut, state.with(LeavesBlock.DISTANCE, d));
|
||||
info.setState(mut, state.setValue(LeavesBlock.DISTANCE, d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +151,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
};
|
||||
Function<PosInfo, BlockState> leavesPost2 = (info) -> {
|
||||
if (info.getState().getBlock() instanceof LeavesBlock) {
|
||||
int distance = info.getState().get(LeavesBlock.DISTANCE);
|
||||
int distance = info.getState().getValue(LeavesBlock.DISTANCE);
|
||||
if (distance > MHelper.randRange(2, 4, random)) {
|
||||
return Blocks.AIR.defaultBlockState();
|
||||
}
|
||||
|
@ -167,7 +165,7 @@ public class NightshadeRedwoodTreeFeature extends DefaultFeature {
|
|||
}
|
||||
}
|
||||
if (random.nextInt(8) == 0) {
|
||||
return leaves_flower.with(LeavesBlock.DISTANCE, distance);
|
||||
return leaves_flower.setValue(LeavesBlock.DISTANCE, distance);
|
||||
}
|
||||
}
|
||||
return info.getState();
|
||||
|
|
|
@ -3,19 +3,17 @@ package ru.betterend.integration.byg.features;
|
|||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.math.Vector3f;
|
||||
import ru.betterend.integration.Integrations;
|
||||
import ru.betterend.noise.OpenSimplexNoise;
|
||||
import ru.betterend.registry.EndTags;
|
||||
|
@ -38,9 +36,9 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
@Override
|
||||
public boolean place(WorldGenLevel world, ChunkGenerator chunkGenerator, Random random, BlockPos pos,
|
||||
NoneFeatureConfiguration config) {
|
||||
if (!world.getBlockState(pos.below()).getBlock().isIn(EndTags.END_GROUND))
|
||||
if (!world.getBlockState(pos.below()).getBlock().is(EndTags.END_GROUND))
|
||||
return false;
|
||||
if (!world.getBlockState(pos.down(4)).getBlock().isIn(EndTags.GEN_TERRAIN))
|
||||
if (!world.getBlockState(pos.below(4)).getBlock().is(EndTags.GEN_TERRAIN))
|
||||
return false;
|
||||
|
||||
BlockState stem = Integrations.BYG.getDefaultState("bulbis_stem");
|
||||
|
@ -50,7 +48,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
BlockState glow = Integrations.BYG.getDefaultState("purple_shroomlight");
|
||||
|
||||
Function<BlockState, Boolean> replacement = (state) -> {
|
||||
if (state.equals(stem) || state.equals(wood) || state.isIn(EndTags.END_GROUND)
|
||||
if (state.equals(stem) || state.equals(wood) || state.is(EndTags.END_GROUND)
|
||||
|| state.getMaterial().equals(Material.PLANT)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -67,7 +65,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SDF sdf = null;
|
||||
int x1 = ((pos.getX() >> 4) << 4) - 16;
|
||||
int z1 = ((pos.getZ() >> 4) << 4) - 16;
|
||||
Box limits = new Box(x1, pos.getY() - 5, z1, x1 + 47, pos.getY() + size * 2, z1 + 47);
|
||||
AABB limits = new AABB(x1, pos.getY() - 5, z1, x1 + 47, pos.getY() + size * 2, z1 + 47);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float angle = (float) i / (float) count * MHelper.PI2 + MHelper.randRange(0, var, random) + start;
|
||||
List<Vector3f> spline = SplineHelper.copySpline(SPLINE);
|
||||
|
@ -140,12 +138,12 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
List<Vector3f> side = SplineHelper.copySpline(SIDE);
|
||||
SplineHelper.rotateSpline(side, angle);
|
||||
SplineHelper.scale(side, scale * radius);
|
||||
BlockPos p = pos.offset(point.getX() + 0.5F, point.getY() + 0.5F, point.getZ() + 0.5F);
|
||||
BlockPos p = pos.offset(point.x() + 0.5F, point.y() + 0.5F, point.z() + 0.5F);
|
||||
SplineHelper.fillSplineForce(side, world, wood, p, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
sphere.fillArea(world, pos, new Box(pos.up((int) offsetY)).expand(radius * 1.3F));
|
||||
sphere.fillArea(world, pos, new AABB(pos.above((int) offsetY)).inflate(radius * 1.3F));
|
||||
}
|
||||
|
||||
private void makeRoots(WorldGenLevel world, BlockPos pos, float radius, Random random, BlockState wood,
|
||||
|
@ -159,7 +157,7 @@ public class OldBulbisTreeFeature extends DefaultFeature {
|
|||
SplineHelper.rotateSpline(branch, angle);
|
||||
SplineHelper.scale(branch, scale);
|
||||
Vector3f last = branch.get(branch.size() - 1);
|
||||
if (world.getBlockState(pos.offset(last.getX(), last.getY(), last.getZ())).isIn(EndTags.GEN_TERRAIN)) {
|
||||
if (world.getBlockState(pos.offset(last.x(), last.y(), last.z())).is(EndTags.GEN_TERRAIN)) {
|
||||
SplineHelper.fillSpline(branch, world, wood, pos, replacement);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue