diff --git a/src/main/java/ru/betterend/registry/EndBlocks.java b/src/main/java/ru/betterend/registry/EndBlocks.java index 8b0b1070..1d3d59f2 100644 --- a/src/main/java/ru/betterend/registry/EndBlocks.java +++ b/src/main/java/ru/betterend/registry/EndBlocks.java @@ -139,7 +139,7 @@ public class EndBlocks { // Wall Plants // public static final Block PURPLE_POLYPORE = registerBlock("purple_polypore", new BlockWallMushroom(13)); public static final Block TAIL_MOSS = registerBlock("tail_moss", new BlockWallPlant()); - public static final Block CYAN_MOSS = registerBlock("cyan_moss", new BlockWallPlant(13)); + public static final Block CYAN_MOSS = registerBlock("cyan_moss", new BlockWallPlant()); // Crops // public static final Block SHADOW_BERRY = registerBlock("shadow_berry", new BlockShadowBerry()); diff --git a/src/main/java/ru/betterend/util/BlocksHelper.java b/src/main/java/ru/betterend/util/BlocksHelper.java index dfbac0ba..e9fe5398 100644 --- a/src/main/java/ru/betterend/util/BlocksHelper.java +++ b/src/main/java/ru/betterend/util/BlocksHelper.java @@ -24,6 +24,7 @@ import net.minecraft.world.WorldAccess; import ru.betterend.blocks.BlockBlueVine; import ru.betterend.blocks.basis.BlockDoublePlant; import ru.betterend.blocks.basis.BlockGlowingFur; +import ru.betterend.blocks.basis.BlockVine; import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndTags; @@ -147,117 +148,127 @@ public class BlocksHelper { doubleCheck.add(POS.toImmutable()); } - // Chorus - if (state.isOf(Blocks.CHORUS_PLANT)) { - Set ends = Sets.newHashSet(); - Set add = Sets.newHashSet(); - ends.add(POS.toImmutable()); - - for (int i = 0; i < 64 && !ends.isEmpty(); i++) { - ends.forEach((pos) -> { - setWithoutUpdate(world, pos, AIR); - for (Direction dir: HORIZONTAL) { - BlockPos p = pos.offset(dir); + if (!state.canPlaceAt(world, POS)) { + + // Chorus + if (state.isOf(Blocks.CHORUS_PLANT)) { + Set ends = Sets.newHashSet(); + Set add = Sets.newHashSet(); + ends.add(POS.toImmutable()); + + for (int i = 0; i < 64 && !ends.isEmpty(); i++) { + ends.forEach((pos) -> { + setWithoutUpdate(world, pos, AIR); + for (Direction dir : HORIZONTAL) { + BlockPos p = pos.offset(dir); + BlockState st = world.getBlockState(p); + if ((st.isOf(Blocks.CHORUS_PLANT) || st.isOf(Blocks.CHORUS_FLOWER)) && !st.canPlaceAt(world, p)) { + add.add(p); + } + } + BlockPos p = pos.up(); BlockState st = world.getBlockState(p); if ((st.isOf(Blocks.CHORUS_PLANT) || st.isOf(Blocks.CHORUS_FLOWER)) && !st.canPlaceAt(world, p)) { add.add(p); } - } - BlockPos p = pos.up(); - BlockState st = world.getBlockState(p); - if ((st.isOf(Blocks.CHORUS_PLANT) || st.isOf(Blocks.CHORUS_FLOWER)) && !st.canPlaceAt(world, p)) { - add.add(p); - } - }); - ends.clear(); - ends.addAll(add); - add.clear(); + }); + ends.clear(); + ends.addAll(add); + add.clear(); + } } - } - // Liquids - else if (!state.getFluidState().isEmpty()) { - POS.setY(y - 1); - if (world.isAir(POS)) { - POS.setY(y); - while (!world.getFluidState(POS).isEmpty()) { + // Vines + else if (state.getBlock() instanceof BlockVine) { + while (world.getBlockState(POS).getBlock() instanceof BlockVine) { setWithoutUpdate(world, POS, AIR); - POS.setY(POS.getY() + 1); - } - continue; - } - BlockState st; - for (Direction dir: HORIZONTAL) { - if ((st = world.getBlockState(POS.offset(dir))).getMaterial().isReplaceable() && st.getFluidState().isEmpty()) { - world.getFluidTickScheduler().schedule(POS, state.getFluidState().getFluid(), 0); - break; - } - } - if ((st = world.getBlockState(POS.up())).getMaterial().isReplaceable() && st.getFluidState().isEmpty()) { - world.getFluidTickScheduler().schedule(POS, state.getFluidState().getFluid(), 0); - } - } - // Falling blocks - else if (state.getBlock() instanceof FallingBlock) { - BlockState falling = state; - - POS.setY(POS.getY() - 1); - state = world.getBlockState(POS); - - int ray = downRayRep(world, POS.toImmutable(), 64); - if (ray > 32) { - BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState()); - if (world.getRandom().nextBoolean()) { POS.setY(POS.getY() - 1); - state = world.getBlockState(POS); - BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState()); } } - else { - POS.setY(y); - boolean place = true; - for (Direction dir: HORIZONTAL) { - state = world.getBlockState(POS.offset(dir)); - if (!state.getFluidState().isEmpty()) { - BlocksHelper.setWithoutUpdate(world, POS, state); - place = false; + // Liquids + else if (!state.getFluidState().isEmpty()) { + POS.setY(y - 1); + if (world.isAir(POS)) { + POS.setY(y); + while (!world.getFluidState(POS).isEmpty()) { + setWithoutUpdate(world, POS, AIR); + POS.setY(POS.getY() + 1); + } + continue; + } + BlockState st; + for (Direction dir : HORIZONTAL) { + if ((st = world.getBlockState(POS.offset(dir))).getMaterial().isReplaceable() && st.getFluidState().isEmpty()) { + world.getFluidTickScheduler().schedule(POS, state.getFluidState().getFluid(), 0); break; } } - if (place) { - BlocksHelper.setWithoutUpdate(world, POS, AIR); + if ((st = world.getBlockState(POS.up())).getMaterial().isReplaceable() && st.getFluidState().isEmpty()) { + world.getFluidTickScheduler().schedule(POS, state.getFluidState().getFluid(), 0); } - - POS.setY(y - ray); - BlocksHelper.setWithoutUpdate(world, POS, falling); } - } - // Blocks without support - else if (!state.canPlaceAt(world, POS)) { - // Blue Vine - if (state.getBlock() instanceof BlockBlueVine) { - while (state.isOf(EndBlocks.BLUE_VINE) || state.isOf(EndBlocks.BLUE_VINE_LANTERN) || state.isOf(EndBlocks.BLUE_VINE_FUR)) { - BlocksHelper.setWithoutUpdate(world, POS, AIR); - for (Direction dir : HORIZONTAL) { - BlockPos p = POS.offset(dir); - state = world.getBlockState(p); - if (state.getBlock() instanceof BlockGlowingFur) { - BlocksHelper.setWithoutUpdate(world, p, AIR); - } - world.getBlockTickScheduler().schedule(p, world.getBlockState(p).getBlock(), 0); + // Falling blocks + else if (state.getBlock() instanceof FallingBlock) { + BlockState falling = state; + + POS.setY(POS.getY() - 1); + state = world.getBlockState(POS); + + int ray = downRayRep(world, POS.toImmutable(), 64); + if (ray > 32) { + BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState()); + if (world.getRandom().nextBoolean()) { + POS.setY(POS.getY() - 1); + state = world.getBlockState(POS); + BlocksHelper.setWithoutUpdate(world, POS, Blocks.END_STONE.getDefaultState()); } - POS.setY(POS.getY() + 1); - state = world.getBlockState(POS); + } + else { + POS.setY(y); + boolean place = true; + for (Direction dir : HORIZONTAL) { + state = world.getBlockState(POS.offset(dir)); + if (!state.getFluidState().isEmpty()) { + BlocksHelper.setWithoutUpdate(world, POS, state); + place = false; + break; + } + } + if (place) { + BlocksHelper.setWithoutUpdate(world, POS, AIR); + } + + POS.setY(y - ray); + BlocksHelper.setWithoutUpdate(world, POS, falling); } } - // Double plants - if (state.getBlock() instanceof BlockDoublePlant) { - BlocksHelper.setWithoutUpdate(world, POS, AIR); - POS.setY(POS.getY() + 1); - BlocksHelper.setWithoutUpdate(world, POS, AIR); - } - // Other blocks + // Blocks without support else { - BlocksHelper.setWithoutUpdate(world, POS, AIR); + // Blue Vine + if (state.getBlock() instanceof BlockBlueVine) { + while (state.isOf(EndBlocks.BLUE_VINE) || state.isOf(EndBlocks.BLUE_VINE_LANTERN) || state.isOf(EndBlocks.BLUE_VINE_FUR)) { + BlocksHelper.setWithoutUpdate(world, POS, AIR); + for (Direction dir : HORIZONTAL) { + BlockPos p = POS.offset(dir); + state = world.getBlockState(p); + if (state.getBlock() instanceof BlockGlowingFur) { + BlocksHelper.setWithoutUpdate(world, p, AIR); + } + world.getBlockTickScheduler().schedule(p, world.getBlockState(p).getBlock(), 0); + } + POS.setY(POS.getY() + 1); + state = world.getBlockState(POS); + } + } + // Double plants + if (state.getBlock() instanceof BlockDoublePlant) { + BlocksHelper.setWithoutUpdate(world, POS, AIR); + POS.setY(POS.getY() + 1); + BlocksHelper.setWithoutUpdate(world, POS, AIR); + } + // Other blocks + else { + BlocksHelper.setWithoutUpdate(world, POS, AIR); + } } } } diff --git a/src/main/java/ru/betterend/world/features/NBTStructureFeature.java b/src/main/java/ru/betterend/world/features/NBTStructureFeature.java index 0d49d983..3a0aedab 100644 --- a/src/main/java/ru/betterend/world/features/NBTStructureFeature.java +++ b/src/main/java/ru/betterend/world/features/NBTStructureFeature.java @@ -95,12 +95,12 @@ public abstract class NBTStructureFeature extends DefaultFeature { structure.place(world, center, placementData, random); TerrainMerge merge = getTerrainMerge(world, center, random); + int x1 = center.getX(); + int z1 = center.getZ(); + int x2 = x1 + offset.getX(); + int z2 = z1 + offset.getZ(); if (merge != TerrainMerge.NONE) { Mutable mut = new Mutable(); - int x1 = center.getX(); - int z1 = center.getZ(); - int x2 = x1 + offset.getX(); - int z2 = z1 + offset.getZ(); if (x2 < x1) { int a = x1; @@ -119,10 +119,10 @@ public abstract class NBTStructureFeature extends DefaultFeature { mut.setX(x); for (int z = z1; z <= z2; z++) { mut.setZ(z); - mut.setY(posY); + mut.setY(surfMax); BlockState state = world.getBlockState(mut); if (!state.isIn(EndTags.GEN_TERRAIN) && state.isSideSolidFullSquare(world, mut, Direction.DOWN)) { - for (int i = 0; i < 10; i--) { + for (int i = 0; i < 10; i++) { mut.setY(mut.getY() - 1); BlockState stateSt = world.getBlockState(mut); if (!stateSt.isIn(EndTags.GEN_TERRAIN)) { @@ -153,6 +153,7 @@ public abstract class NBTStructureFeature extends DefaultFeature { } } } + BlocksHelper.fixBlocks(world, new BlockPos(x1, center.getY(), z1), new BlockPos(x2, center.getY() + offset.getY(), z2)); return true; } diff --git a/src/main/java/ru/betterend/world/features/bushes/DragonTreeBushFeature.java b/src/main/java/ru/betterend/world/features/bushes/DragonTreeBushFeature.java index a56f8f12..40fc8f13 100644 --- a/src/main/java/ru/betterend/world/features/bushes/DragonTreeBushFeature.java +++ b/src/main/java/ru/betterend/world/features/bushes/DragonTreeBushFeature.java @@ -31,14 +31,26 @@ public class DragonTreeBushFeature extends DefaultFeature { if (world.getBlockState(pos.down()).getBlock() != EndBlocks.SHADOW_GRASS) return false; BlockState leaves = EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1); - float radius = MHelper.randRange(1.8F, 4.5F, random); + float radius = MHelper.randRange(1.8F, 3.5F, random); OpenSimplexNoise noise = new OpenSimplexNoise(random.nextInt()); SDF sphere = new SDFSphere().setRadius(radius).setBlock(EndBlocks.DRAGON_TREE_LEAVES.getDefaultState().with(LeavesBlock.DISTANCE, 1)); sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere); sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 3; }).setSource(sphere); - sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere); + sphere = new SDFDisplacement().setFunction((vec) -> { return MHelper.randRange(-2F, 2F, random); }).setSource(sphere); sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(new SDFTranslate().setTranslate(0, -radius, 0).setSource(sphere)); sphere.setReplaceFunction(REPLACE); + sphere.setPostProcess((info) -> { + if (info.getState().getBlock() instanceof LeavesBlock) { + int distance = info.getPos().getManhattanDistance(pos); + if (distance < 7) { + return info.getState().with(LeavesBlock.DISTANCE, distance); + } + else { + return AIR; + } + } + return info.getState(); + }); sphere.fillRecursive(world, pos); BlocksHelper.setWithoutUpdate(world, pos, EndBlocks.DRAGON_TREE.bark); for (Direction d: Direction.values()) { diff --git a/src/main/resources/assets/betterend/materialmaps/block/cyan_moss.json b/src/main/resources/assets/betterend/materialmaps/block/cyan_moss.json index 1cc4c628..45210670 100644 --- a/src/main/resources/assets/betterend/materialmaps/block/cyan_moss.json +++ b/src/main/resources/assets/betterend/materialmaps/block/cyan_moss.json @@ -1,3 +1,3 @@ { - "defaultMaterial": "betterend:waving_wall_glow_inc" + "defaultMaterial": "betterend:waving_wall" } diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_1.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_1.nbt new file mode 100644 index 00000000..9ba61b15 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_1.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_2.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_2.nbt new file mode 100644 index 00000000..1b585a6f Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/fallen_tree_2.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/library.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/library.nbt new file mode 100644 index 00000000..bf3c0cd0 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/library.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_1.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_1.nbt new file mode 100644 index 00000000..278b78c7 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_1.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_2.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_2.nbt new file mode 100644 index 00000000..acfc4d60 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_2.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_3.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_3.nbt new file mode 100644 index 00000000..1377ae93 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/ruins_3.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/structures.json b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/structures.json new file mode 100644 index 00000000..375709a0 --- /dev/null +++ b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/structures.json @@ -0,0 +1,13 @@ +{ + "structures": [ + { "nbt": "fallen_tree_1", "offsetY": 0, "terrainMerge": "object" }, + { "nbt": "fallen_tree_2", "offsetY": 0, "terrainMerge": "object" }, + { "nbt": "stump_1", "offsetY": 0, "terrainMerge": "object" }, + { "nbt": "stump_2", "offsetY": 0, "terrainMerge": "object" }, + { "nbt": "library", "offsetY": 0, "terrainMerge": "surface" }, + { "nbt": "ruins_1", "offsetY": 0, "terrainMerge": "surface" }, + { "nbt": "ruins_2", "offsetY": 0, "terrainMerge": "surface" }, + { "nbt": "ruins_3", "offsetY": 0, "terrainMerge": "surface" }, + { "nbt": "tree_house", "offsetY": 0, "terrainMerge": "surface" } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_1.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_1.nbt new file mode 100644 index 00000000..60e68687 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_1.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_2.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_2.nbt new file mode 100644 index 00000000..285afc8b Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/stump_2.nbt differ diff --git a/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/tree_house.nbt b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/tree_house.nbt new file mode 100644 index 00000000..fc2eb3d2 Binary files /dev/null and b/src/main/resources/data/betterend/structures/biome/foggy_mushroomland/tree_house.nbt differ