Teneanea improvements and leaves

This commit is contained in:
paulevsGitch 2020-11-26 15:16:53 +03:00
parent e3d5065e12
commit 5ee7a94ef6
28 changed files with 469 additions and 54 deletions

View file

@ -29,6 +29,8 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
public static final Vec3i[] COLORS; public static final Vec3i[] COLORS;
private static final int MIN_DROP = 1; private static final int MIN_DROP = 1;
private static final int MAX_DROP = 4; private static final int MAX_DROP = 4;
private static final BlockColorProvider BLOCK_PROVIDER;
private static final ItemColorProvider ITEM_PROVIDER;
public AuroraCrystalBlock() { public AuroraCrystalBlock() {
super(FabricBlockSettings.of(Material.GLASS) super(FabricBlockSettings.of(Material.GLASS)
@ -43,30 +45,12 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
@Override @Override
public BlockColorProvider getProvider() { public BlockColorProvider getProvider() {
return (state, world, pos, tintIndex) -> { return BLOCK_PROVIDER;
long i = (long) pos.getX() + (long) pos.getY() + (long) pos.getZ();
double delta = i * 0.1;
int index = MHelper.floor(delta);
int index2 = (index + 1) & 3;
delta -= index;
index &= 3;
Vec3i color1 = COLORS[index];
Vec3i color2 = COLORS[index2];
int r = MHelper.floor(MathHelper.lerp(delta, color1.getX(), color2.getX()));
int g = MHelper.floor(MathHelper.lerp(delta, color1.getY(), color2.getY()));
int b = MHelper.floor(MathHelper.lerp(delta, color1.getZ(), color2.getZ()));
return MHelper.color(r, g, b);
};
} }
@Override @Override
public ItemColorProvider getItemProvider() { public ItemColorProvider getItemProvider() {
return (stack, tintIndex) -> { return ITEM_PROVIDER;
return MHelper.color(COLORS[3].getX(), COLORS[3].getY(), COLORS[3].getZ());
};
} }
@Override @Override
@ -106,5 +90,27 @@ public class AuroraCrystalBlock extends AbstractGlassBlock implements IRenderTyp
new Vec3i(120, 255, 168), new Vec3i(120, 255, 168),
new Vec3i(243, 58, 255) new Vec3i(243, 58, 255)
}; };
BLOCK_PROVIDER = (state, world, pos, tintIndex) -> {
long i = (long) pos.getX() + (long) pos.getY() + (long) pos.getZ();
double delta = i * 0.1;
int index = MHelper.floor(delta);
int index2 = (index + 1) & 3;
delta -= index;
index &= 3;
Vec3i color1 = COLORS[index];
Vec3i color2 = COLORS[index2];
int r = MHelper.floor(MathHelper.lerp(delta, color1.getX(), color2.getX()));
int g = MHelper.floor(MathHelper.lerp(delta, color1.getY(), color2.getY()));
int b = MHelper.floor(MathHelper.lerp(delta, color1.getZ(), color2.getZ()));
return MHelper.color(r, g, b);
};
ITEM_PROVIDER = (stack, tintIndex) -> {
return MHelper.color(COLORS[3].getX(), COLORS[3].getY(), COLORS[3].getZ());
};
} }
} }

View file

@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockGlowingFur; import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.blocks.basis.BlockPlantWithAge; import ru.betterend.blocks.basis.BlockPlantWithAge;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
@ -34,11 +34,11 @@ public class BlockBlueVineSeed extends BlockPlantWithAge {
for (Direction dir: BlocksHelper.HORIZONTAL) { for (Direction dir: BlocksHelper.HORIZONTAL) {
BlockPos p = pos.offset(dir); BlockPos p = pos.offset(dir);
if (world.isAir(p)) { if (world.isAir(p)) {
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir)); BlocksHelper.setWithoutUpdate(world, p, EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockFur.FACING, dir));
} }
} }
if (world.isAir(pos.up())) { if (world.isAir(pos.up())) {
BlocksHelper.setWithoutUpdate(world, pos.up(), EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.UP)); BlocksHelper.setWithoutUpdate(world, pos.up(), EndBlocks.BLUE_VINE_FUR.getDefaultState().with(BlockFur.FACING, Direction.UP));
} }
} }

View file

@ -0,0 +1,60 @@
package ru.betterend.blocks;
import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.client.color.item.ItemColorProvider;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
import ru.betterend.blocks.basis.BlockVine;
import ru.betterend.interfaces.IColorProvider;
import ru.betterend.util.MHelper;
public class BlockTenaneaFlowers extends BlockVine implements IColorProvider {
private static final BlockColorProvider BLOCK_PROVIDER;
private static final ItemColorProvider ITEM_PROVIDER;
public static final Vec3i[] COLORS;
public BlockTenaneaFlowers() {
super(15);
}
@Override
public BlockColorProvider getProvider() {
return BLOCK_PROVIDER;
}
@Override
public ItemColorProvider getItemProvider() {
return ITEM_PROVIDER;
}
static {
COLORS = new Vec3i[] {
new Vec3i(250, 111, 222),
new Vec3i(167, 89, 255),
new Vec3i(120, 207, 239),
new Vec3i(255, 87, 182)
};
BLOCK_PROVIDER = (state, world, pos, tintIndex) -> {
long i = (MHelper.getRandom(pos.getX(), pos.getZ()) & 63) + pos.getY();
double delta = i * 0.1;
int index = MHelper.floor(delta);
int index2 = (index + 1) & 3;
delta -= index;
index &= 3;
Vec3i color1 = COLORS[index];
Vec3i color2 = COLORS[index2];
int r = MHelper.floor(MathHelper.lerp(delta, color1.getX(), color2.getX()));
int g = MHelper.floor(MathHelper.lerp(delta, color1.getY(), color2.getY()));
int b = MHelper.floor(MathHelper.lerp(delta, color1.getZ(), color2.getZ()));
return MHelper.color(r, g, b);
};
ITEM_PROVIDER = (stack, tintIndex) -> {
return MHelper.color(COLORS[0].getX(), COLORS[0].getY(), COLORS[0].getZ());
};
}
}

View file

@ -24,6 +24,7 @@ import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager; import net.minecraft.state.StateManager;
import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties; import net.minecraft.state.property.Properties;
import net.minecraft.tag.BlockTags;
import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockMirror;
import net.minecraft.util.BlockRotation; import net.minecraft.util.BlockRotation;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -38,13 +39,24 @@ import ru.betterend.interfaces.IRenderTypeable;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
public class BlockGlowingFur extends BlockBaseNotFull implements IRenderTypeable { public class BlockFur extends BlockBaseNotFull implements IRenderTypeable {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
public static final DirectionProperty FACING = Properties.FACING; public static final DirectionProperty FACING = Properties.FACING;
private final ItemConvertible drop; private final ItemConvertible drop;
private final int dropChance; private final int dropChance;
public BlockGlowingFur(ItemConvertible drop, int dropChance) { public BlockFur(ItemConvertible drop, int light, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.WET_GRASS)
.luminance(light)
.breakByHand(true)
.noCollision());
this.drop = drop;
this.dropChance = dropChance;
}
public BlockFur(ItemConvertible drop, int dropChance) {
super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT) super(FabricBlockSettings.of(Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS) .breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.WET_GRASS) .sounds(BlockSoundGroup.WET_GRASS)
@ -86,7 +98,7 @@ public class BlockGlowingFur extends BlockBaseNotFull implements IRenderTypeable
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
Direction direction = (Direction) state.get(FACING); Direction direction = (Direction) state.get(FACING);
BlockPos blockPos = pos.offset(direction.getOpposite()); BlockPos blockPos = pos.offset(direction.getOpposite());
return sideCoversSmallSquare(world, blockPos, direction); return sideCoversSmallSquare(world, blockPos, direction) || world.getBlockState(pos).isIn(BlockTags.LEAVES);
} }
@Override @Override

View file

@ -11,6 +11,9 @@ import net.minecraft.block.Material;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.loot.context.LootContext; import net.minecraft.loot.context.LootContext;
import net.minecraft.sound.BlockSoundGroup; import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.WorldView;
public class BlockWallMushroom extends BlockWallPlant { public class BlockWallMushroom extends BlockWallPlant {
public BlockWallMushroom(int light) { public BlockWallMushroom(int light) {
@ -28,4 +31,9 @@ public class BlockWallMushroom extends BlockWallPlant {
public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDroppedStacks(BlockState state, LootContext.Builder builder) {
return Lists.newArrayList(new ItemStack(this)); return Lists.newArrayList(new ItemStack(this));
} }
@Override
public boolean isSupport(WorldView world, BlockPos pos, BlockState blockState, Direction direction) {
return blockState.getMaterial().isSolid() && blockState.isSideSolidFullSquare(world, pos, direction);
}
} }

View file

@ -35,6 +35,7 @@ import ru.betterend.blocks.BlockPath;
import ru.betterend.blocks.BlockPythadendronSapling; import ru.betterend.blocks.BlockPythadendronSapling;
import ru.betterend.blocks.BlockShadowBerry; import ru.betterend.blocks.BlockShadowBerry;
import ru.betterend.blocks.BlockShadowGrass; import ru.betterend.blocks.BlockShadowGrass;
import ru.betterend.blocks.BlockTenaneaFlowers;
import ru.betterend.blocks.BlockTenaneaSapling; import ru.betterend.blocks.BlockTenaneaSapling;
import ru.betterend.blocks.BlockTerrain; import ru.betterend.blocks.BlockTerrain;
import ru.betterend.blocks.BlockTerrainPlant; import ru.betterend.blocks.BlockTerrainPlant;
@ -49,7 +50,7 @@ import ru.betterend.blocks.InfusionPedestal;
import ru.betterend.blocks.PedestalVanilla; import ru.betterend.blocks.PedestalVanilla;
import ru.betterend.blocks.RunedFlavolite; import ru.betterend.blocks.RunedFlavolite;
import ru.betterend.blocks.TerminiteBlock; import ru.betterend.blocks.TerminiteBlock;
import ru.betterend.blocks.basis.BlockGlowingFur; import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.blocks.basis.BlockLeaves; import ru.betterend.blocks.basis.BlockLeaves;
import ru.betterend.blocks.basis.BlockOre; import ru.betterend.blocks.basis.BlockOre;
import ru.betterend.blocks.basis.BlockSimpleLeaves; import ru.betterend.blocks.basis.BlockSimpleLeaves;
@ -95,11 +96,11 @@ public class EndBlocks {
public static final Block QUARTZ_PEDESTAL = registerBlock("quartz_pedestal", new PedestalVanilla(Blocks.QUARTZ_BLOCK)); public static final Block QUARTZ_PEDESTAL = registerBlock("quartz_pedestal", new PedestalVanilla(Blocks.QUARTZ_BLOCK));
public static final Block PURPUR_PEDESTAL = registerBlock("purpur_pedestal", new PedestalVanilla(Blocks.PURPUR_BLOCK)); public static final Block PURPUR_PEDESTAL = registerBlock("purpur_pedestal", new PedestalVanilla(Blocks.PURPUR_BLOCK));
// Wooden Materials // // Wooden Materials And Trees //
public static final Block MOSSY_GLOWSHROOM_SAPLING = registerBlock("mossy_glowshroom_sapling", new BlockMossyGlowshroomSapling()); public static final Block MOSSY_GLOWSHROOM_SAPLING = registerBlock("mossy_glowshroom_sapling", new BlockMossyGlowshroomSapling());
public static final Block MOSSY_GLOWSHROOM_CAP = registerBlock("mossy_glowshroom_cap", new BlockMossyGlowshroomCap()); public static final Block MOSSY_GLOWSHROOM_CAP = registerBlock("mossy_glowshroom_cap", new BlockMossyGlowshroomCap());
public static final Block MOSSY_GLOWSHROOM_HYMENOPHORE = registerBlock("mossy_glowshroom_hymenophore", new BlockMossyGlowshroomHymenophore()); public static final Block MOSSY_GLOWSHROOM_HYMENOPHORE = registerBlock("mossy_glowshroom_hymenophore", new BlockMossyGlowshroomHymenophore());
public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock("mossy_glowshroom_fur", new BlockGlowingFur(MOSSY_GLOWSHROOM_SAPLING, 16)); public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock("mossy_glowshroom_fur", new BlockFur(MOSSY_GLOWSHROOM_SAPLING, 15, 16));
public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD); public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD);
public static final Block PYTHADENDRON_SAPLING = registerBlock("pythadendron_sapling", new BlockPythadendronSapling()); public static final Block PYTHADENDRON_SAPLING = registerBlock("pythadendron_sapling", new BlockPythadendronSapling());
@ -122,7 +123,8 @@ public class EndBlocks {
public static final Block TENANEA_SAPLING = registerBlock("tenanea_sapling", new BlockTenaneaSapling()); public static final Block TENANEA_SAPLING = registerBlock("tenanea_sapling", new BlockTenaneaSapling());
public static final Block TENANEA_LEAVES = registerBlock("tenanea_leaves", new BlockLeaves(TENANEA_SAPLING, MaterialColor.PINK)); public static final Block TENANEA_LEAVES = registerBlock("tenanea_leaves", new BlockLeaves(TENANEA_SAPLING, MaterialColor.PINK));
public static final Block TENANEA_FLOWERS = registerBlock("tenanea_flowers", new BlockVine(15)); public static final Block TENANEA_FLOWERS = registerBlock("tenanea_flowers", new BlockTenaneaFlowers());
public static final Block TENANEA_OUTER_LEAVES = registerBlock("tenanea_outer_leaves", new BlockFur(TENANEA_SAPLING, 32));
public static final WoodenMaterial TENANEA = new WoodenMaterial("tenanea", MaterialColor.PINK, MaterialColor.PINK); public static final WoodenMaterial TENANEA = new WoodenMaterial("tenanea", MaterialColor.PINK, MaterialColor.PINK);
// Small Plants // // Small Plants //
@ -137,7 +139,7 @@ public class EndBlocks {
public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlockBlueVineSeed()); public static final Block BLUE_VINE_SEED = registerBlock("blue_vine_seed", new BlockBlueVineSeed());
public static final Block BLUE_VINE = registerBlockNI("blue_vine", new BlockBlueVine()); public static final Block BLUE_VINE = registerBlockNI("blue_vine", new BlockBlueVine());
public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlockBlueVineLantern()); public static final Block BLUE_VINE_LANTERN = registerBlock("blue_vine_lantern", new BlockBlueVineLantern());
public static final Block BLUE_VINE_FUR = registerBlock("blue_vine_fur", new BlockGlowingFur(BLUE_VINE_SEED, 3)); public static final Block BLUE_VINE_FUR = registerBlock("blue_vine_fur", new BlockFur(BLUE_VINE_SEED, 15, 3));
public static final Block BUBBLE_CORAL = registerBlock("bubble_coral", new BlockBubbleCoral()); public static final Block BUBBLE_CORAL = registerBlock("bubble_coral", new BlockBubbleCoral());
public static final Block END_LILY = registerBlockNI("end_lily", new BlockEndLily()); public static final Block END_LILY = registerBlockNI("end_lily", new BlockEndLily());

View file

@ -23,7 +23,7 @@ import net.minecraft.util.math.Vec3i;
import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldAccess;
import ru.betterend.blocks.BlockBlueVine; import ru.betterend.blocks.BlockBlueVine;
import ru.betterend.blocks.basis.BlockDoublePlant; import ru.betterend.blocks.basis.BlockDoublePlant;
import ru.betterend.blocks.basis.BlockGlowingFur; import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.blocks.basis.BlockVine; import ru.betterend.blocks.basis.BlockVine;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
@ -153,7 +153,7 @@ public class BlocksHelper {
POS.setY(y); POS.setY(y);
state = world.getBlockState(POS); state = world.getBlockState(POS);
if (state.getBlock() instanceof BlockGlowingFur) { if (state.getBlock() instanceof BlockFur) {
doubleCheck.add(POS.toImmutable()); doubleCheck.add(POS.toImmutable());
} }
// Liquids // Liquids

View file

@ -113,6 +113,12 @@ public class MHelper {
return x1 * x2 + y1 * y2; return x1 * x2 + y1 * y2;
} }
public static int getRandom(int x, int z) {
int h = x * 374761393 + z * 668265263;
h = (h ^ (h >> 13)) * 1274126177;
return h ^ (h >> 16);
}
public static int getSeed(int seed, int x, int y) { public static int getSeed(int seed, int x, int y) {
int h = seed + x * 374761393 + y * 668265263; int h = seed + x * 374761393 + y * 668265263;
h = (h ^ (h >> 13)) * 1274126177; h = (h ^ (h >> 13)) * 1274126177;

View file

@ -13,7 +13,7 @@ import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockMossyGlowshroomCap; import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.basis.BlockGlowingFur; import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
@ -103,12 +103,12 @@ public class MossyGlowshroomFeature extends DefaultFeature {
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
for (Direction dir: BlocksHelper.HORIZONTAL) { for (Direction dir: BlocksHelper.HORIZONTAL) {
if (info.getState(dir) == AIR) { if (info.getState(dir) == AIR) {
info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir)); info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockFur.FACING, dir));
} }
} }
if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN)); info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockFur.FACING, Direction.DOWN));
} }
} }
return info.getState(); return info.getState();

View file

@ -18,6 +18,7 @@ import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig; import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockProperties; import ru.betterend.blocks.BlockProperties;
import ru.betterend.blocks.BlockProperties.TripleShape; import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags; import ru.betterend.registry.EndTags;
@ -54,7 +55,7 @@ public class TenaneaFeature extends DefaultFeature {
SplineHelper.offsetParts(spline, random, 1F, 0, 1F); SplineHelper.offsetParts(spline, random, 1F, 0, 1F);
SplineHelper.fillSpline(spline, world, EndBlocks.TENANEA.bark.getDefaultState(), pos, REPLACE); SplineHelper.fillSpline(spline, world, EndBlocks.TENANEA.bark.getDefaultState(), pos, REPLACE);
Vector3f last = spline.get(spline.size() - 1); Vector3f last = spline.get(spline.size() - 1);
float leavesRadius = (size * 0.3F + MHelper.randRange(0.8F, 1.5F, random)); float leavesRadius = (size * 0.3F + MHelper.randRange(0.8F, 1.5F, random)) * 1.4F;
OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong()); OpenSimplexNoise noise = new OpenSimplexNoise(random.nextLong());
leavesBall(world, pos.add(last.getX(), last.getY(), last.getZ()), leavesRadius, random, noise); leavesBall(world, pos.add(last.getX(), last.getY(), last.getZ()), leavesRadius, random, noise);
} }
@ -67,14 +68,30 @@ public class TenaneaFeature extends DefaultFeature {
SDF sub = new SDFScale().setScale(5).setSource(sphere); SDF sub = new SDFScale().setScale(5).setSource(sphere);
sub = new SDFTranslate().setTranslate(0, -radius * 5, 0).setSource(sub); sub = new SDFTranslate().setTranslate(0, -radius * 5, 0).setSource(sub);
sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub); sphere = new SDFSubtraction().setSourceA(sphere).setSourceB(sub);
sphere = new SDFScale3D().setScale(1, 0.5F, 1).setSource(sphere); sphere = new SDFScale3D().setScale(1, 0.75F, 1).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 1F; }).setSource(sphere); sphere = new SDFDisplacement().setFunction((vec) -> { return (float) noise.eval(vec.getX() * 0.2, vec.getY() * 0.2, vec.getZ() * 0.2) * 2F; }).setSource(sphere);
sphere = new SDFDisplacement().setFunction((vec) -> { return random.nextFloat() * 3F - 1.5F; }).setSource(sphere); sphere = new SDFDisplacement().setFunction((vec) -> { return MHelper.randRange(-1.5F, 1.5F, random); }).setSource(sphere);
Mutable mut = new Mutable(); Mutable mut = new Mutable();
for (Direction d1: BlocksHelper.HORIZONTAL) {
BlockPos p = mut.set(pos).move(Direction.UP).move(d1).toImmutable();
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.TENANEA.bark.getDefaultState());
for (Direction d2: BlocksHelper.HORIZONTAL) {
mut.set(p).move(Direction.UP).move(d2);
BlocksHelper.setWithoutUpdate(world, p, EndBlocks.TENANEA.bark.getDefaultState());
}
}
BlockState outer = EndBlocks.TENANEA_OUTER_LEAVES.getDefaultState();
List<BlockPos> support = Lists.newArrayList(); List<BlockPos> support = Lists.newArrayList();
sphere.setPostProcess((info) -> { sphere.setPostProcess((info) -> {
if (random.nextBoolean() && info.getStateDown().isAir()) { if (info.getStateDown().isAir()) {
support.add(info.getPos().toImmutable()); if (random.nextBoolean()) {
support.add(info.getPos().toImmutable());
}
else {
info.setState(info.getPos().down(), outer.with(BlockFur.FACING, Direction.DOWN));
}
} }
if (random.nextInt(5) == 0) { if (random.nextInt(5) == 0) {
for (Direction dir: Direction.values()) { for (Direction dir: Direction.values()) {
@ -84,6 +101,16 @@ public class TenaneaFeature extends DefaultFeature {
} }
} }
info.setState(EndBlocks.TENANEA.bark.getDefaultState()); info.setState(EndBlocks.TENANEA.bark.getDefaultState());
}
if (info.getState().isOf(EndBlocks.TENANEA_LEAVES)) {
for (Direction d: BlocksHelper.HORIZONTAL) {
if (info.getState(d).isAir()) {
info.setState(info.getPos().offset(d), outer.with(BlockFur.FACING, Direction.DOWN));
}
}
}
else if (EndBlocks.TENANEA.isTreeLog(info.getState())) {
for (int x = -6; x < 7; x++) { for (int x = -6; x < 7; x++) {
int ax = Math.abs(x); int ax = Math.abs(x);
mut.setX(x + info.getPos().getX()); mut.setX(x + info.getPos().getX());

View file

@ -7,7 +7,7 @@ import net.minecraft.client.util.math.Vector3f;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import ru.betterend.blocks.BlockMossyGlowshroomCap; import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.basis.BlockGlowingFur; import ru.betterend.blocks.basis.BlockFur;
import ru.betterend.noise.OpenSimplexNoise; import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.EndBlocks; import ru.betterend.registry.EndBlocks;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
@ -111,12 +111,12 @@ public class StructureGiantMossyGlowshroom extends SDFStructureFeature {
else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { else if (info.getState().getBlock() == EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
for (Direction dir: BlocksHelper.HORIZONTAL) { for (Direction dir: BlocksHelper.HORIZONTAL) {
if (info.getState(dir) == AIR) { if (info.getState(dir) == AIR) {
info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, dir)); info.setBlockPos(info.getPos().offset(dir), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockFur.FACING, dir));
} }
} }
if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) { if (info.getStateDown().getBlock() != EndBlocks.MOSSY_GLOWSHROOM_HYMENOPHORE) {
info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.DOWN)); info.setBlockPos(info.getPos().down(), EndBlocks.MOSSY_GLOWSHROOM_FUR.getDefaultState().with(BlockFur.FACING, Direction.DOWN));
} }
} }
return info.getState(); return info.getState();

View file

@ -0,0 +1,10 @@
{
"variants": {
"facing=up": { "model": "betterend:block/tenanea_outer_leaves" },
"facing=down": { "model": "betterend:block/tenanea_outer_leaves", "x": 180 },
"facing=north": { "model": "betterend:block/tenanea_outer_leaves", "x": 90 },
"facing=south": { "model": "betterend:block/tenanea_outer_leaves", "x": 90, "y": 180 },
"facing=east": { "model": "betterend:block/tenanea_outer_leaves", "x": 90, "y": 90 },
"facing=west": { "model": "betterend:block/tenanea_outer_leaves", "x": 90, "y": 270 }
}
}

View file

@ -0,0 +1,29 @@
{
"textures": {
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 }
}
}
]
}

View file

@ -0,0 +1,29 @@
{
"textures": {
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 }
}
}
]
}

View file

@ -1,5 +1,5 @@
{ {
"parent": "betterend:block/cross_no_distortion", "parent": "betterend:block/cross_no_distortion_tinted",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers_bottom" "texture": "betterend:block/tenanea_flowers_bottom"
} }

View file

@ -1,5 +1,5 @@
{ {
"parent": "betterend:block/cross_no_distortion_inverted", "parent": "betterend:block/cross_no_distortion_inverted_tinted",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers_bottom" "texture": "betterend:block/tenanea_flowers_bottom"
} }

View file

@ -1,5 +1,5 @@
{ {
"parent": "betterend:block/cross_no_distortion", "parent": "betterend:block/cross_no_distortion_tinted",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers" "texture": "betterend:block/tenanea_flowers"
} }

View file

@ -1,5 +1,5 @@
{ {
"parent": "betterend:block/cross_no_distortion_inverted", "parent": "betterend:block/cross_no_distortion_inverted_tinted",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers" "texture": "betterend:block/tenanea_flowers"
} }

View file

@ -1,6 +1,53 @@
{ {
"parent": "betterend:block/cross_no_distortion",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers_top" "texture": "betterend:block/tenanea_flowers_top",
} "stem": "betterend:block/tenanea_flowers_top_stem",
} "particle": "#texture"
},
"elements": [
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#stem" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#stem" }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#stem" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#stem" }
}
}
]
}

View file

@ -1,6 +1,59 @@
{ {
"parent": "betterend:block/cross_no_distortion_inverted", "parent": "betterend:block/cross_no_distortion_inverted_tinted",
"textures": { "textures": {
"texture": "betterend:block/tenanea_flowers_top" "texture": "betterend:block/tenanea_flowers_top"
} }
} }
{
"textures": {
"texture": "betterend:block/tenanea_flowers_top",
"stem": "betterend:block/tenanea_flowers_top_stem",
"particle": "#texture"
},
"elements": [
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "tintindex": 0 }
}
},
{
"__comment": "PlaneX1",
"from": [ 2.375, 0, 2.25 ],
"to": [ 2.376, 16, 18.25 ],
"rotation": { "origin": [ 2.375, 0, 2.25 ], "axis": "y", "angle": 45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#stem" },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#stem" }
}
},
{
"__comment": "PlaneX1",
"from": [ 13.75, 0, 2.25 ],
"to": [ 13.751, 16, 18.25 ],
"rotation": { "origin": [ 13.75, 0, 2.25 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 16, 0, 0, 16 ], "texture": "#stem" },
"east": { "uv": [ 16, 0, 0, 16 ], "texture": "#stem" }
}
}
]
}

View file

@ -0,0 +1,120 @@
{
"__comment": "Designed by Paulevs with Cubik Studio - https://cubik.studio",
"textures": {
"particle": "betterend:block/tenanea_outer_leaves",
"texture": "betterend:block/tenanea_outer_leaves",
"spore": "betterend:block/tenanea_outer_leaves"
},
"elements": [
{
"__comment": "PlaneY1",
"from": [ 0, -0.001, -10 ],
"to": [ 16, 0, 6 ],
"rotation": { "origin": [ 0, 0, 6 ], "axis": "x", "angle": 22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, 0, 10 ],
"to": [ 16, 0.001, 26 ],
"rotation": { "origin": [ 0, 0, 10 ], "axis": "x", "angle": -22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture" },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY4",
"from": [ 10, -0.001, 0 ],
"to": [ 26, 0, 16 ],
"rotation": { "origin": [ 10, 0, 16 ], "axis": "z", "angle": 22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 90 },
"up": { "uv": [ 0, 16, 16, 0 ], "texture": "#texture", "rotation": 270 }
}
},
{
"__comment": "PlaneY4",
"from": [ -10, 0, 2 ],
"to": [ 6, 0.001, 18 ],
"rotation": { "origin": [ 6, 0, 18 ], "axis": "z", "angle": -22.5 },
"shade": false,
"faces": {
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 270 },
"up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "rotation": 270 }
}
},
{
"__comment": "PlaneX6",
"from": [ 0, 0, -6.5 ],
"to": [ 0.001, 16, 16 ],
"rotation": { "origin": [ 0, 16, 16 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#spore" },
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#spore" }
}
},
{
"__comment": "PlaneX6",
"from": [ -6.5, 0, 15.999 ],
"to": [ 16, 16, 16 ],
"rotation": { "origin": [ 16, 16, 16 ], "axis": "y", "angle": -45 },
"shade": false,
"faces": {
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#spore" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#spore" }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, -0.001, -9 ],
"to": [ 16, 0, 7 ],
"rotation": { "origin": [ 0, 0, 7 ], "axis": "x", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "rotation": 180 },
"up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" }
}
},
{
"__comment": "PlaneY1",
"from": [ 0, 0, 9 ],
"to": [ 16, 0.001, 25 ],
"rotation": { "origin": [ 0, 0, 9 ], "axis": "x", "angle": -45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture" },
"up": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "rotation": 180 }
}
},
{
"__comment": "PlaneY4",
"from": [ 9, -0.001, 0 ],
"to": [ 25, 0, 16 ],
"rotation": { "origin": [ 9, 0, 16 ], "axis": "z", "angle": 45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "rotation": 90 },
"up": { "uv": [ 16, 16, 0, 0 ], "texture": "#texture", "rotation": 270 }
}
},
{
"__comment": "PlaneY4",
"from": [ -9, 0, 2 ],
"to": [ 7, 0.001, 18 ],
"rotation": { "origin": [ 7, 0, 18 ], "axis": "z", "angle": -45 },
"shade": false,
"faces": {
"down": { "uv": [ 16, 0, 0, 16 ], "texture": "#texture", "rotation": 270 },
"up": { "uv": [ 0, 0, 16, 16 ], "texture": "#texture", "rotation": 270 }
}
}
]
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/tenanea_outer_leaves"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB