Start migration

This commit is contained in:
Aleksey 2021-04-08 21:55:07 +03:00
parent 6630ce0cab
commit 47ed597358
491 changed files with 12045 additions and 11953 deletions

View file

@ -4,14 +4,14 @@ import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.world.level.block.AbstractBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.StructureWorldAccess;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.basis.EndPlantWithAgeBlock;
@ -21,15 +21,11 @@ import ru.betterend.util.MHelper;
public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
public GlowingPillarSeedBlock() {
super(FabricBlockSettings.of(Material.PLANT)
.luminance((state) -> { return state.get(AGE) * 3 + 3; })
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.GRASS)
.breakByHand(true)
.ticksRandomly()
.noCollision());
super(FabricBlockSettings.of(Material.PLANT).luminance((state) -> {
return state.getValue(AGE) * 3 + 3;
}).breakByTool(FabricToolTags.SHEARS).sounds(SoundType.GRASS).breakByHand(true).ticksRandomly().noCollision());
}
@Override
public void growAdult(StructureWorldAccess world, Random random, BlockPos pos) {
int height = MHelper.randRange(1, 2, random);
@ -37,37 +33,39 @@ public class GlowingPillarSeedBlock extends EndPlantWithAgeBlock {
if (h < height) {
return;
}
Mutable mut = new Mutable().set(pos);
BlockState roots = EndBlocks.GLOWING_PILLAR_ROOTS.getDefaultState();
MutableBlockPos mut = new MutableBlockPos().set(pos);
BlockState roots = EndBlocks.GLOWING_PILLAR_ROOTS.defaultBlockState();
if (height < 2) {
BlocksHelper.setWithUpdate(world, mut, roots.with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
mut.move(Direction.UP);
}
else {
} else {
BlocksHelper.setWithUpdate(world, mut, roots.with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
mut.move(Direction.UP);
BlocksHelper.setWithUpdate(world, mut, roots.with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
mut.move(Direction.UP);
}
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LUMINOPHOR.getDefaultState().with(BlueVineLanternBlock.NATURAL, true));
for (Direction dir: BlocksHelper.DIRECTIONS) {
BlocksHelper.setWithUpdate(world, mut,
EndBlocks.GLOWING_PILLAR_LUMINOPHOR.defaultBlockState().with(BlueVineLanternBlock.NATURAL, true));
for (Direction dir : BlocksHelper.DIRECTIONS) {
pos = mut.offset(dir);
if (world.isAir(pos)) {
BlocksHelper.setWithUpdate(world, pos, EndBlocks.GLOWING_PILLAR_LEAVES.getDefaultState().with(Properties.FACING, dir));
BlocksHelper.setWithUpdate(world, pos,
EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().with(Properties.FACING, dir));
}
}
mut.move(Direction.UP);
if (world.isAir(mut)) {
BlocksHelper.setWithUpdate(world, mut, EndBlocks.GLOWING_PILLAR_LEAVES.getDefaultState().with(Properties.FACING, Direction.UP));
BlocksHelper.setWithUpdate(world, mut,
EndBlocks.GLOWING_PILLAR_LEAVES.defaultBlockState().with(Properties.FACING, Direction.UP));
}
}
@Override
protected boolean isTerrain(BlockState state) {
return state.isOf(EndBlocks.AMBER_MOSS);
return state.is(EndBlocks.AMBER_MOSS);
}
@Override
public AbstractBlock.OffsetType getOffsetType() {
return AbstractBlock.OffsetType.NONE;