This commit is contained in:
Frank 2021-10-18 19:52:32 +02:00
parent 073b473840
commit c2452ebcc3
3 changed files with 22 additions and 7 deletions

View file

@ -11,7 +11,7 @@ loader_version= 0.11.6
fabric_version = 0.39.1+1.17
# Mod Properties
mod_version = 0.4.1
mod_version = 0.4.2
maven_group = ru.bclib
archives_base_name = bclib

View file

@ -1,6 +1,11 @@
package ru.bclib.blocks;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.client.renderer.block.model.BlockModel;
@ -15,17 +20,14 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import ru.bclib.api.TagAPI;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.BlockModelProvider;
import ru.bclib.interfaces.RenderLayerProvider;
import ru.bclib.util.MHelper;
import java.util.Collections;
import java.util.List;
import java.util.function.Consumer;
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider {
private final Block sapling;
protected final Block sapling;
private static FabricBlockSettings makeLeaves(MaterialColor color) {
return FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
@ -37,25 +39,33 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
.suffocates((state, world, pos) -> false)
.blockVision((state, world, pos) -> false);
}
private void init(Block sapling) {
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
}
public BaseLeavesBlock(Block sapling, MaterialColor color, Consumer<FabricBlockSettings> customizeProperties) {
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color)));
this.sapling = sapling;
init(sapling);
}
public BaseLeavesBlock(Block sapling, MaterialColor color, int light, Consumer<FabricBlockSettings> customizeProperties) {
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light)));
this.sapling = sapling;
init(sapling);
}
public BaseLeavesBlock(Block sapling, MaterialColor color) {
super(makeLeaves(color));
this.sapling = sapling;
init(sapling);
}
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
super(makeLeaves(color).lightLevel(light));
this.sapling = sapling;
init(sapling);
}
@Override

View file

@ -4,6 +4,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import ru.bclib.api.TagAPI;
import ru.bclib.client.render.BCLRenderLayer;
import ru.bclib.interfaces.RenderLayerProvider;
@ -17,6 +18,8 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false));
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
}
public SimpleLeavesBlock(MaterialColor color, int light) {
@ -29,6 +32,8 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
.isValidSpawn((state, world, pos, type) -> false)
.isSuffocating((state, world, pos) -> false)
.isViewBlocking((state, world, pos) -> false));
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
}
@Override