Added common leaves Tag (paulevsGitch/BetterEnd#303)
This commit is contained in:
parent
073b473840
commit
c2452ebcc3
3 changed files with 22 additions and 7 deletions
|
@ -11,7 +11,7 @@ loader_version= 0.11.6
|
||||||
fabric_version = 0.39.1+1.17
|
fabric_version = 0.39.1+1.17
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.4.1
|
mod_version = 0.4.2
|
||||||
maven_group = ru.bclib
|
maven_group = ru.bclib
|
||||||
archives_base_name = bclib
|
archives_base_name = bclib
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
package ru.bclib.blocks;
|
package ru.bclib.blocks;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||||
import net.minecraft.client.renderer.block.model.BlockModel;
|
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.material.MaterialColor;
|
||||||
import net.minecraft.world.level.storage.loot.LootContext;
|
import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
||||||
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.BlockModelProvider;
|
import ru.bclib.interfaces.BlockModelProvider;
|
||||||
import ru.bclib.interfaces.RenderLayerProvider;
|
import ru.bclib.interfaces.RenderLayerProvider;
|
||||||
import ru.bclib.util.MHelper;
|
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 {
|
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider {
|
||||||
private final Block sapling;
|
protected final Block sapling;
|
||||||
|
|
||||||
private static FabricBlockSettings makeLeaves(MaterialColor color) {
|
private static FabricBlockSettings makeLeaves(MaterialColor color) {
|
||||||
return FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
return FabricBlockSettings.copyOf(Blocks.OAK_LEAVES)
|
||||||
|
@ -37,25 +39,33 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
||||||
.suffocates((state, world, pos) -> false)
|
.suffocates((state, world, pos) -> false)
|
||||||
.blockVision((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) {
|
public BaseLeavesBlock(Block sapling, MaterialColor color, Consumer<FabricBlockSettings> customizeProperties) {
|
||||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color)));
|
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color)));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
|
init(sapling);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light, Consumer<FabricBlockSettings> customizeProperties) {
|
public BaseLeavesBlock(Block sapling, MaterialColor color, int light, Consumer<FabricBlockSettings> customizeProperties) {
|
||||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light)));
|
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light)));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
|
init(sapling);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLeavesBlock(Block sapling, MaterialColor color) {
|
public BaseLeavesBlock(Block sapling, MaterialColor color) {
|
||||||
super(makeLeaves(color));
|
super(makeLeaves(color));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
|
init(sapling);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
||||||
super(makeLeaves(color).lightLevel(light));
|
super(makeLeaves(color).lightLevel(light));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
|
init(sapling);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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.block.SoundType;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
|
import ru.bclib.api.TagAPI;
|
||||||
import ru.bclib.client.render.BCLRenderLayer;
|
import ru.bclib.client.render.BCLRenderLayer;
|
||||||
import ru.bclib.interfaces.RenderLayerProvider;
|
import ru.bclib.interfaces.RenderLayerProvider;
|
||||||
|
|
||||||
|
@ -17,6 +18,8 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
|
||||||
.isValidSpawn((state, world, pos, type) -> false)
|
.isValidSpawn((state, world, pos, type) -> false)
|
||||||
.isSuffocating((state, world, pos) -> false)
|
.isSuffocating((state, world, pos) -> false)
|
||||||
.isViewBlocking((state, world, pos) -> false));
|
.isViewBlocking((state, world, pos) -> false));
|
||||||
|
|
||||||
|
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SimpleLeavesBlock(MaterialColor color, int light) {
|
public SimpleLeavesBlock(MaterialColor color, int light) {
|
||||||
|
@ -29,6 +32,8 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
|
||||||
.isValidSpawn((state, world, pos, type) -> false)
|
.isValidSpawn((state, world, pos, type) -> false)
|
||||||
.isSuffocating((state, world, pos) -> false)
|
.isSuffocating((state, world, pos) -> false)
|
||||||
.isViewBlocking((state, world, pos) -> false));
|
.isViewBlocking((state, world, pos) -> false));
|
||||||
|
|
||||||
|
TagAPI.addTags(this, TagAPI.BLOCK_LEAVES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue