Dragon tree prototype (WIP)
This commit is contained in:
parent
30f7f53c7f
commit
3691e4b67e
21 changed files with 324 additions and 15 deletions
|
@ -11,6 +11,6 @@ public class BlockDragonTreeSapling extends BlockFeatureSapling {
|
|||
|
||||
@Override
|
||||
protected Feature<?> getFeature() {
|
||||
return EndFeatures.PYTHADENDRON_TREE.getFeature();
|
||||
return EndFeatures.DRAGON_TREE.getFeature();
|
||||
}
|
||||
}
|
||||
|
|
25
src/main/java/ru/betterend/blocks/BlockShadowGrass.java
Normal file
25
src/main/java/ru/betterend/blocks/BlockShadowGrass.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.MaterialColor;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockShadowGrass extends BlockTerrain {
|
||||
public BlockShadowGrass() {
|
||||
super(MaterialColor.BLACK);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
|
||||
super.randomDisplayTick(state, world, pos, random);
|
||||
if (random.nextInt(32) == 0) {
|
||||
world.addParticle(ParticleTypes.SMOKE, (double) pos.getX() + random.nextDouble(), (double) pos.getY() + 1.1D, (double) pos.getZ() + random.nextDouble(), 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
|
@ -16,6 +17,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.loot.context.LootContext;
|
||||
import net.minecraft.loot.context.LootContextParameters;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
@ -29,7 +31,7 @@ public class BlockTerrain extends BlockBase {
|
|||
private Block pathBlock;
|
||||
|
||||
public BlockTerrain(MaterialColor color) {
|
||||
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSounds.TERRAIN_SOUND));
|
||||
super(FabricBlockSettings.copyOf(Blocks.END_STONE).materialColor(color).sounds(BlockSounds.TERRAIN_SOUND).ticksRandomly());
|
||||
}
|
||||
|
||||
public void setPathBlock(Block roadBlock) {
|
||||
|
@ -59,4 +61,11 @@ public class BlockTerrain extends BlockBase {
|
|||
}
|
||||
return Collections.singletonList(new ItemStack(Blocks.END_STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
||||
if (random.nextInt(16) == 0 && world.getBlockState(pos.up()).getMaterial().blocksLight()) {
|
||||
world.setBlockState(pos, Blocks.END_STONE.getDefaultState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue