Block constructors refactoring and fixes

This commit is contained in:
paulevsGitch 2021-12-04 10:32:48 +03:00
parent 3dacd0727f
commit f8eb65d600
18 changed files with 161 additions and 113 deletions

View file

@ -2,6 +2,7 @@ package ru.bclib.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.api.TagAPI;
@ -10,29 +11,37 @@ import ru.bclib.interfaces.RenderLayerProvider;
public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerProvider {
public SimpleLeavesBlock(MaterialColor color) {
super(FabricBlockSettings.of(Material.LEAVES)
.strength(0.2F)
.color(color)
.sound(SoundType.GRASS)
.noOcclusion()
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false));
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
this(
FabricBlockSettings
.of(Material.LEAVES)
.strength(0.2F)
.color(color)
.sound(SoundType.GRASS)
.noOcclusion()
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false)
);
}
public SimpleLeavesBlock(MaterialColor color, int light) {
super(FabricBlockSettings.of(Material.LEAVES)
.luminance(light)
.color(color)
.strength(0.2F)
.sound(SoundType.GRASS)
.noOcclusion()
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false));
this(
FabricBlockSettings
.of(Material.LEAVES)
.luminance(light)
.color(color)
.strength(0.2F)
.sound(SoundType.GRASS)
.noOcclusion()
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false)
);
}
public SimpleLeavesBlock(BlockBehaviour.Properties properties) {
super(properties);
// TODO handle all tags instead of adding them like this
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
}