This commit is contained in:
paulevsGitch 2020-09-30 12:31:40 +03:00
parent 4703d575c5
commit ba4bc366c8
6 changed files with 14 additions and 21 deletions

View file

@ -1,10 +1,16 @@
package ru.betterend.blocks;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.blocks.basis.BlockFeatureSapling;
import ru.betterend.registry.FeatureRegistry;
public class BlockMossyGlowshroomSapling extends BlockFeatureSapling {
public BlockMossyGlowshroomSapling() {
super(FeatureRegistry.MOSSY_GLOWSHROOM, 7);
super(7);
}
@Override
protected Feature<?> getFeature() {
return FeatureRegistry.MOSSY_GLOWSHROOM.getFeature();
}
}

View file

@ -18,29 +18,25 @@ import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import net.minecraft.world.gen.feature.Feature;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.features.EndFeature;
public class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizable, IRenderTypeable {
public abstract class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizable, IRenderTypeable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 2, 4, 12, 16, 12);
private final EndFeature feature;
public BlockFeatureSapling(EndFeature feature) {
public BlockFeatureSapling() {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.collidable(false)
.breakInstantly()
.sounds(BlockSoundGroup.GRASS)
.ticksRandomly());
this.feature = feature;
}
public BlockFeatureSapling(EndFeature feature, int light) {
public BlockFeatureSapling(int light) {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.collidable(false)
@ -48,8 +44,9 @@ public class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizabl
.sounds(BlockSoundGroup.GRASS)
.lightLevel(light)
.ticksRandomly());
this.feature = feature;
}
protected abstract Feature<?> getFeature();
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
@ -81,10 +78,8 @@ public class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizabl
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
BlocksHelper.setWithoutUpdate(world, pos, Blocks.AIR.getDefaultState());
@SuppressWarnings("unchecked")
Feature<DefaultFeatureConfig> defFeature = (Feature<DefaultFeatureConfig>) feature.getFeature();
defFeature.generate(world, world.getChunkManager().getChunkGenerator(), random, pos, DefaultFeatureConfig.INSTANCE);
BlocksHelper.setWithoutUpdate(world, pos, Blocks.AIR.getDefaultState());
getFeature().generate(world, world.getChunkManager().getChunkGenerator(), random, pos, null);
}
@Override

View file

@ -8,7 +8,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.recipebook.BlastFurnaceRecipeBookScreen;
@ -19,7 +18,6 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.collection.DefaultedList;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
@Environment(EnvType.CLIENT)

View file

@ -3,7 +3,6 @@ package ru.betterend.client.gui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.screenhandler.v1.ScreenHandlerRegistry;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Inventory;
@ -20,7 +19,6 @@ import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import ru.betterend.BetterEnd;
import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;

View file

@ -8,9 +8,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.DefaultBiomeCreator;
import net.minecraft.world.biome.GenerationSettings;
import net.minecraft.world.gen.GenerationStep;
import ru.betterend.registry.FeatureRegistry;
@Mixin(DefaultBiomeCreator.class)
public abstract class DefaultBiomeCreatorMixin {

View file

@ -6,7 +6,6 @@ import net.minecraft.structure.rule.BlockMatchRuleTest;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.ChanceDecoratorConfig;
import net.minecraft.world.gen.decorator.Decorator;