Add none solid covers tag

This commit is contained in:
modmuss50 2022-11-16 21:04:02 +00:00
parent 086e416157
commit 357c86940d
3 changed files with 12 additions and 2 deletions

View file

@ -27,7 +27,9 @@ package techreborn.datagen.tags
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider
import net.fabricmc.fabric.api.mininglevel.v1.FabricMineableTags
import net.fabricmc.fabric.api.tag.convention.v1.ConventionalBlockTags
import net.minecraft.tag.BlockTags
import net.minecraft.util.Identifier
import techreborn.init.TRContent
class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
@ -135,5 +137,9 @@ class TRBlockTagProvider extends FabricTagProvider.BlockTagProvider {
getOrCreateTagBuilder(BlockTags.WOODEN_TRAPDOORS)
.add(TRContent.RUBBER_TRAPDOOR)
getOrCreateTagBuilder(TRContent.BlockTags.NONE_SOLID_COVERS)
.addOptionalTag(new Identifier("ae2", "whitelisted/facades"))
.forceAddTag(ConventionalBlockTags.GLASS_BLOCKS)
}
}

View file

@ -268,6 +268,7 @@ public class TRContent {
public static final TagKey<Block> RUBBER_LOGS = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "rubber_logs"));
public static final TagKey<Block> OMNI_TOOL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/omni_tool"));
public static final TagKey<Block> DRILL_MINEABLE = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "mineable/drill"));
public static final TagKey<Block> NONE_SOLID_COVERS = TagKey.of(Registry.BLOCK_KEY, new Identifier(TechReborn.MOD_ID, "none_solid_covers"));
private BlockTags() {
}

View file

@ -42,6 +42,7 @@ import org.jetbrains.annotations.Nullable;
import techreborn.TechReborn;
import techreborn.blockentity.cable.CableBlockEntity;
import techreborn.blocks.cable.CableBlock;
import techreborn.init.TRContent;
import java.util.List;
@ -59,8 +60,10 @@ public class PaintingToolItem extends Item {
BlockState blockState = context.getWorld().getBlockState(context.getBlockPos());
if (player.isSneaking()) {
if (blockState.isOpaqueFullCube(context.getWorld(), context.getBlockPos())
&& blockState.getBlock().getDefaultState().isOpaqueFullCube(context.getWorld(), context.getBlockPos())) {
boolean opaqueFullCube = blockState.isOpaqueFullCube(context.getWorld(), context.getBlockPos())
&& blockState.getBlock().getDefaultState().isOpaqueFullCube(context.getWorld(), context.getBlockPos());
if (opaqueFullCube || blockState.isIn(TRContent.BlockTags.NONE_SOLID_COVERS)) {
context.getStack().getOrCreateNbt().put("cover", NbtHelper.fromBlockState(blockState));
return ActionResult.SUCCESS;
}