net.minecraft.tag.BlockTags Java Examples
The following examples show how to use
net.minecraft.tag.BlockTags.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MixinBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 6 votes |
@Override public Set<Identifier> getTags() { if (cachedTags == null || tagVersion != BlockTagsAccessor.getLatestVersion()) { this.cachedTags = new HashSet<>(); for (final Map.Entry<Identifier, Tag<Block>> entry : BlockTags.getContainer().getEntries().entrySet()) { if (entry.getValue().contains((Block) (Object) this)) { cachedTags.add(entry.getKey()); } } this.tagVersion = BlockTagsAccessor.getLatestVersion(); } return this.cachedTags; }
Example #2
Source File: Protocol_1_15_2.java From multiconnect with MIT License | 6 votes |
@Override public void addExtraItemTags(TagRegistry<Item> tags, TagRegistry<Block> blockTags) { copyBlocks(tags, blockTags, ItemTags.CRIMSON_STEMS, BlockTags.CRIMSON_STEMS); copyBlocks(tags, blockTags, ItemTags.WARPED_STEMS, BlockTags.WARPED_STEMS); copyBlocks(tags, blockTags, ItemTags.LOGS_THAT_BURN, BlockTags.LOGS_THAT_BURN); copyBlocks(tags, blockTags, ItemTags.GOLD_ORES, BlockTags.GOLD_ORES); copyBlocks(tags, blockTags, ItemTags.SOUL_FIRE_BASE_BLOCKS, BlockTags.SOUL_FIRE_BASE_BLOCKS); tags.addTag(ItemTags.CREEPER_DROP_MUSIC_DISCS, ItemTags.MUSIC_DISCS); tags.add(ItemTags.BEACON_PAYMENT_ITEMS, Items.EMERALD, Items.DIAMOND, Items.GOLD_INGOT, Items.IRON_INGOT); tags.add(ItemTags.PIGLIN_REPELLENTS); tags.add(ItemTags.PIGLIN_LOVED); tags.add(ItemTags.NON_FLAMMABLE_WOOD); tags.add(ItemTags.STONE_TOOL_MATERIALS, Items.COBBLESTONE); tags.add(ItemTags.FURNACE_MATERIALS, Items.COBBLESTONE); super.addExtraItemTags(tags, blockTags); }
Example #3
Source File: Protocol_1_13_2.java From multiconnect with MIT License | 6 votes |
@Override public void addExtraBlockTags(TagRegistry<Block> tags) { tags.add(BlockTags.WOODEN_FENCES, Blocks.OAK_FENCE, Blocks.ACACIA_FENCE, Blocks.DARK_OAK_FENCE, Blocks.SPRUCE_FENCE, Blocks.BIRCH_FENCE, Blocks.JUNGLE_FENCE); tags.add(BlockTags.SMALL_FLOWERS, Blocks.DANDELION, Blocks.POPPY, Blocks.BLUE_ORCHID, Blocks.ALLIUM, Blocks.AZURE_BLUET, Blocks.RED_TULIP, Blocks.ORANGE_TULIP, Blocks.WHITE_TULIP, Blocks.PINK_TULIP, Blocks.OXEYE_DAISY); tags.addTag(BlockTags.ENDERMAN_HOLDABLE, BlockTags.SMALL_FLOWERS); tags.add(BlockTags.WALLS, Blocks.COBBLESTONE_WALL, Blocks.MOSSY_COBBLESTONE_WALL, Blocks.BRICK_WALL, Blocks.PRISMARINE_WALL, Blocks.RED_SANDSTONE_WALL, Blocks.MOSSY_STONE_BRICK_WALL, Blocks.GRANITE_WALL, Blocks.STONE_BRICK_WALL, Blocks.NETHER_BRICK_WALL, Blocks.ANDESITE_WALL, Blocks.RED_NETHER_BRICK_WALL, Blocks.SANDSTONE_WALL, Blocks.END_STONE_BRICK_WALL, Blocks.DIORITE_WALL); tags.add(BlockTags.BAMBOO_PLANTABLE_ON); tags.add(BlockTags.STANDING_SIGNS, Blocks.OAK_SIGN, Blocks.SPRUCE_SIGN, Blocks.BIRCH_SIGN, Blocks.ACACIA_SIGN, Blocks.JUNGLE_SIGN, Blocks.DARK_OAK_SIGN); tags.add(BlockTags.WALL_SIGNS, Blocks.OAK_WALL_SIGN, Blocks.SPRUCE_WALL_SIGN, Blocks.BIRCH_WALL_SIGN, Blocks.ACACIA_WALL_SIGN, Blocks.JUNGLE_WALL_SIGN, Blocks.DARK_OAK_WALL_SIGN); tags.addTag(BlockTags.SIGNS, BlockTags.STANDING_SIGNS); tags.addTag(BlockTags.SIGNS, BlockTags.WALL_SIGNS); tags.add(BlockTags.BEDS, Blocks.RED_BED, Blocks.BLACK_BED, Blocks.BLUE_BED, Blocks.BROWN_BED, Blocks.CYAN_BED, Blocks.GRAY_BED, Blocks.GREEN_BED, Blocks.LIGHT_BLUE_BED, Blocks.LIGHT_GRAY_BED, Blocks.LIME_BED, Blocks.MAGENTA_BED, Blocks.ORANGE_BED, Blocks.PINK_BED, Blocks.PURPLE_BED, Blocks.WHITE_BED, Blocks.YELLOW_BED); tags.addTag(BlockTags.FENCES, BlockTags.WOODEN_FENCES); tags.add(BlockTags.FENCES, Blocks.NETHER_BRICK_FENCE); tags.add(BlockTags.DRAGON_IMMUNE, Blocks.BARRIER, Blocks.BEDROCK, Blocks.END_PORTAL, Blocks.END_PORTAL_FRAME, Blocks.END_GATEWAY, Blocks.COMMAND_BLOCK, Blocks.REPEATING_COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.STRUCTURE_BLOCK, Blocks.JIGSAW, Blocks.MOVING_PISTON, Blocks.OBSIDIAN, Blocks.END_STONE, Blocks.IRON_BARS); tags.add(BlockTags.WITHER_IMMUNE, Blocks.BARRIER, Blocks.BEDROCK, Blocks.END_PORTAL, Blocks.END_PORTAL_FRAME, Blocks.END_GATEWAY, Blocks.COMMAND_BLOCK, Blocks.REPEATING_COMMAND_BLOCK, Blocks.CHAIN_COMMAND_BLOCK, Blocks.STRUCTURE_BLOCK, Blocks.JIGSAW, Blocks.MOVING_PISTON); super.addExtraBlockTags(tags); }
Example #4
Source File: LivingEntityMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 6 votes |
@Inject( method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/damage/DamageSource;getAttacker()Lnet/minecraft/entity/Entity;", shift = At.Shift.BEFORE) ) private void convertSandToSoulsand(DamageSource damageSource_1, CallbackInfo ci) { if (!CarpetExtraSettings.mobInFireConvertsSandToSoulsand) return; BlockPos pos = new BlockPos(this.getX(), this.getY(), this.getZ()); BlockState statePos = this.world.getBlockState(pos); BlockPos below = pos.down(1); BlockState stateBelow = this.world.getBlockState(below); if (statePos.getBlock() == Blocks.FIRE && stateBelow.getBlock().matches(BlockTags.SAND)) { this.world.setBlockState(below, Blocks.SOUL_SAND.getDefaultState()); } }
Example #5
Source File: HopperMinecartEntity_transferItemsOutFeatureMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 6 votes |
private Vec3d getBlockBelowCartOffset(){ BlockState blockState_1 = this.world.getBlockState(new BlockPos(MathHelper.floor(this.getX()), MathHelper.floor(this.getY()), MathHelper.floor(this.getZ()))); if (blockState_1.matches(BlockTags.RAILS)) { RailShape railShape = (RailShape)blockState_1.get(((AbstractRailBlock)blockState_1.getBlock()).getShapeProperty()); switch (railShape){ case ASCENDING_EAST: return ascending_east_offset; case ASCENDING_WEST: return ascending_west_offset; case ASCENDING_NORTH: return ascending_north_offset; case ASCENDING_SOUTH: return ascending_south_offset; default: return upwardVec; } } return upwardVec; }
Example #6
Source File: CoralBlockMixin.java From fabric-carpet with MIT License | 5 votes |
public void grow(ServerWorld worldIn, Random random, BlockPos pos, BlockState blockUnder) { CoralFeature coral; int variant = random.nextInt(3); if (variant == 0) coral = new CoralClawFeature(DefaultFeatureConfig::deserialize); else if (variant == 1) coral = new CoralTreeFeature(DefaultFeatureConfig::deserialize); else coral = new CoralMushroomFeature(DefaultFeatureConfig::deserialize); MaterialColor color = blockUnder.getTopMaterialColor(worldIn, pos); BlockState proper_block = blockUnder; for (Block block: BlockTags.CORAL_BLOCKS.values()) { proper_block = block.getDefaultState(); if (proper_block.getTopMaterialColor(worldIn,pos) == color) { break; } } worldIn.setBlockState(pos, Blocks.WATER.getDefaultState(), 4); if (!((CoralFeatureInterface)coral).growSpecific(worldIn, random, pos, proper_block)) { worldIn.setBlockState(pos, blockUnder, 3); } else { if (worldIn.random.nextInt(10)==0) { BlockPos randomPos = pos.add(worldIn.random.nextInt(16)-8,worldIn.random.nextInt(8),worldIn.random.nextInt(16)-8 ); if (BlockTags.CORAL_BLOCKS.contains(worldIn.getBlockState(randomPos).getBlock())) { worldIn.setBlockState(randomPos, Blocks.WET_SPONGE.getDefaultState(), 3); } } } }
Example #7
Source File: DeaderBushFeature.java From the-hallow with MIT License | 5 votes |
@Override public boolean generate(IWorld world, ChunkGenerator<? extends ChunkGeneratorConfig> generator, Random random, BlockPos pos, DefaultFeatureConfig config) { for (BlockState state1 = world.getBlockState(pos); (state1.isAir() || state1.matches(BlockTags.LEAVES)) && pos.getY() > 0; state1 = world.getBlockState(pos)) { pos = pos.down(); } for (int int_1 = 0; int_1 < 4; ++int_1) { BlockPos pos2 = pos.add(random.nextInt(8) - random.nextInt(8), random.nextInt(4) - random.nextInt(4), random.nextInt(8) - random.nextInt(8)); if (world.isAir(pos2) && state.canPlaceAt(world, pos2)) { world.setBlockState(pos2, state, 2); } } return true; }
Example #8
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 5 votes |
/** * Determines if this block is can be destroyed by the specified entities normal behavior. * * @param state The current state * @param world The current world * @param pos Block position in world * @return True to allow the entity to destroy this block */ default boolean canEntityDestroy(BlockState state, BlockView world, BlockPos pos, Entity entity) { if (entity instanceof EnderDragonEntity) { return !BlockTags.DRAGON_IMMUNE.contains(this.getBlock()); } else if ((entity instanceof WitherEntity) || (entity instanceof WitherSkullEntity)) { return ((IForgeBlockState) state).isAir(world, pos) || WitherEntity.canDestroy(state); } return true; }
Example #9
Source File: FallingBlockEntityMixin.java From carpet-extra with GNU Lesser General Public License v3.0 | 5 votes |
@Inject( method = "tick", at = @At(value = "INVOKE", shift = At.Shift.AFTER, ordinal = 1, target = "Lnet/minecraft/entity/FallingBlockEntity;setVelocity(Lnet/minecraft/util/math/Vec3d;)V"), locals = LocalCapture.CAPTURE_FAILHARD, cancellable = true ) private void onTick(CallbackInfo ci, Block block_1, BlockPos blockPos_2, boolean b1, boolean bl2, BlockState blockState_1) { if (block_1.matches(BlockTags.ANVIL)) { if (CarpetExtraSettings.renewablePackedIce && this.world.getBlockState(new BlockPos(this.getX(), this.getY() - 0.059999999776482582D, this.getZ())).getBlock() == Blocks.ICE) { if (iceCount < 2) { world.breakBlock(blockPos_2.down(), false, null); this.onGround = false; iceCount++; ci.cancel(); } else { world.setBlockState(blockPos_2.down(), Blocks.PACKED_ICE.getDefaultState(), 3); world.playLevelEvent(2001, blockPos_2.down(), Block.getRawIdFromState(Blocks.PACKED_ICE.getDefaultState())); } } else if (CarpetExtraSettings.renewableSand && this.world.getBlockState(new BlockPos(this.getX(), this.getY() - 0.06, this.getZ())).getBlock() == Blocks.COBBLESTONE) { world.breakBlock(blockPos_2.down(1), false); world.setBlockState(blockPos_2.down(1), Blocks.SAND.getDefaultState(), 3); } } }
Example #10
Source File: Protocol_1_14_4.java From multiconnect with MIT License | 5 votes |
@Override public void addExtraItemTags(TagRegistry<Item> tags, TagRegistry<Block> blockTags) { copyBlocks(tags, blockTags, ItemTags.TALL_FLOWERS, BlockTags.TALL_FLOWERS); copyBlocks(tags, blockTags, ItemTags.FLOWERS, BlockTags.FLOWERS); tags.add(ItemTags.LECTERN_BOOKS, Items.WRITTEN_BOOK, Items.WRITABLE_BOOK); super.addExtraItemTags(tags, blockTags); }
Example #11
Source File: Protocol_1_14_4.java From multiconnect with MIT License | 5 votes |
@Override public void addExtraBlockTags(TagRegistry<Block> tags) { tags.add(BlockTags.TALL_FLOWERS, Blocks.SUNFLOWER, Blocks.LILAC, Blocks.PEONY, Blocks.ROSE_BUSH); tags.addTag(BlockTags.FLOWERS, BlockTags.SMALL_FLOWERS); tags.addTag(BlockTags.FLOWERS, BlockTags.TALL_FLOWERS); tags.add(BlockTags.BEEHIVES); tags.add(BlockTags.CROPS, Blocks.BEETROOTS, Blocks.CARROTS, Blocks.POTATOES, Blocks.WHEAT, Blocks.MELON_STEM, Blocks.PUMPKIN_STEM); tags.add(BlockTags.BEE_GROWABLES); tags.add(BlockTags.SHULKER_BOXES, Blocks.SHULKER_BOX, Blocks.BLACK_SHULKER_BOX, Blocks.BLUE_SHULKER_BOX, Blocks.BROWN_SHULKER_BOX, Blocks.CYAN_SHULKER_BOX, Blocks.GRAY_SHULKER_BOX, Blocks.GREEN_SHULKER_BOX, Blocks.LIGHT_BLUE_SHULKER_BOX, Blocks.LIGHT_GRAY_SHULKER_BOX, Blocks.LIME_SHULKER_BOX, Blocks.MAGENTA_SHULKER_BOX, Blocks.ORANGE_SHULKER_BOX, Blocks.PINK_SHULKER_BOX, Blocks.PURPLE_SHULKER_BOX, Blocks.RED_SHULKER_BOX, Blocks.WHITE_SHULKER_BOX, Blocks.YELLOW_SHULKER_BOX); tags.add(BlockTags.PORTALS, Blocks.NETHER_PORTAL, Blocks.END_PORTAL, Blocks.END_GATEWAY); super.addExtraBlockTags(tags); }
Example #12
Source File: Protocol_1_13_2.java From multiconnect with MIT License | 5 votes |
@Override public void addExtraItemTags(TagRegistry<Item> tags, TagRegistry<Block> blockTags) { copyBlocks(tags, blockTags, ItemTags.WOODEN_FENCES, BlockTags.WOODEN_FENCES); copyBlocks(tags, blockTags, ItemTags.WALLS, BlockTags.WALLS); copyBlocks(tags, blockTags, ItemTags.SMALL_FLOWERS, BlockTags.SMALL_FLOWERS); copyBlocks(tags, blockTags, ItemTags.BEDS, BlockTags.BEDS); copyBlocks(tags, blockTags, ItemTags.FENCES, BlockTags.FENCES); copyBlocks(tags, blockTags, ItemTags.SIGNS, BlockTags.STANDING_SIGNS); tags.add(ItemTags.MUSIC_DISCS, Items.MUSIC_DISC_13, Items.MUSIC_DISC_CAT, Items.MUSIC_DISC_BLOCKS, Items.MUSIC_DISC_CHIRP, Items.MUSIC_DISC_FAR, Items.MUSIC_DISC_MALL, Items.MUSIC_DISC_MELLOHI, Items.MUSIC_DISC_STAL, Items.MUSIC_DISC_STRAD, Items.MUSIC_DISC_WARD, Items.MUSIC_DISC_11, Items.MUSIC_DISC_WAIT); tags.add(ItemTags.COALS, Items.COAL, Items.CHARCOAL); tags.add(ItemTags.ARROWS, Items.ARROW, Items.TIPPED_ARROW, Items.SPECTRAL_ARROW); super.addExtraItemTags(tags, blockTags); }
Example #13
Source File: Protocol_1_15_2.java From multiconnect with MIT License | 5 votes |
@Override public void addExtraBlockTags(TagRegistry<Block> tags) { tags.add(BlockTags.CRIMSON_STEMS); tags.add(BlockTags.WARPED_STEMS); tags.addTag(BlockTags.LOGS_THAT_BURN, BlockTags.LOGS); tags.add(BlockTags.STONE_PRESSURE_PLATES, Blocks.STONE_PRESSURE_PLATE); tags.addTag(BlockTags.PRESSURE_PLATES, BlockTags.WOODEN_PRESSURE_PLATES); tags.addTag(BlockTags.PRESSURE_PLATES, BlockTags.STONE_PRESSURE_PLATES); tags.add(BlockTags.WITHER_SUMMON_BASE_BLOCKS, Blocks.SOUL_SAND); tags.add(BlockTags.FIRE, Blocks.FIRE); tags.add(BlockTags.NYLIUM); tags.add(BlockTags.WART_BLOCKS); tags.add(BlockTags.BEACON_BASE_BLOCKS, Blocks.EMERALD_BLOCK, Blocks.DIAMOND_BLOCK, Blocks.GOLD_BLOCK, Blocks.IRON_BLOCK); tags.add(BlockTags.SOUL_SPEED_BLOCKS); tags.add(BlockTags.WALL_POST_OVERRIDE, Blocks.REDSTONE_TORCH, Blocks.TRIPWIRE); tags.addTag(BlockTags.WALL_POST_OVERRIDE, BlockTags.SIGNS); tags.addTag(BlockTags.WALL_POST_OVERRIDE, BlockTags.BANNERS); tags.addTag(BlockTags.WALL_POST_OVERRIDE, BlockTags.PRESSURE_PLATES); tags.add(BlockTags.CLIMBABLE, Blocks.LADDER, Blocks.VINE, Blocks.SCAFFOLDING); tags.add(BlockTags.PIGLIN_REPELLENTS); tags.add(BlockTags.HOGLIN_REPELLENTS); tags.add(BlockTags.GOLD_ORES, Blocks.GOLD_ORE); tags.add(BlockTags.SOUL_FIRE_BASE_BLOCKS); tags.add(BlockTags.NON_FLAMMABLE_WOOD); tags.add(BlockTags.STRIDER_WARM_BLOCKS); tags.add(BlockTags.CAMPFIRES, Blocks.CAMPFIRE); tags.add(BlockTags.GUARDED_BY_PIGLINS); tags.addTag(BlockTags.PREVENT_MOB_SPAWNING_INSIDE, BlockTags.RAILS); tags.add(BlockTags.FENCE_GATES, Blocks.ACACIA_FENCE_GATE, Blocks.BIRCH_FENCE_GATE, Blocks.DARK_OAK_FENCE_GATE, Blocks.JUNGLE_FENCE_GATE, Blocks.OAK_FENCE, Blocks.SPRUCE_FENCE_GATE); tags.addTag(BlockTags.UNSTABLE_BOTTOM_CENTER, BlockTags.FENCE_GATES); tags.add(BlockTags.INFINIBURN_OVERWORLD, Blocks.NETHERRACK, Blocks.MAGMA_BLOCK); tags.addTag(BlockTags.INFINIBURN_NETHER, BlockTags.INFINIBURN_OVERWORLD); tags.addTag(BlockTags.INFINIBURN_END, BlockTags.INFINIBURN_OVERWORLD); tags.add(BlockTags.INFINIBURN_END, Blocks.BEDROCK); super.addExtraBlockTags(tags); }
Example #14
Source File: Protocol_1_13.java From multiconnect with MIT License | 5 votes |
@Override public void addExtraBlockTags(TagRegistry<Block> tags) { tags.add(BlockTags.UNDERWATER_BONEMEALS, Blocks.SEAGRASS); tags.addTag(BlockTags.UNDERWATER_BONEMEALS, BlockTags.CORALS); tags.addTag(BlockTags.UNDERWATER_BONEMEALS, BlockTags.WALL_CORALS); tags.add(BlockTags.CORAL_PLANTS, Blocks.TUBE_CORAL, Blocks.BRAIN_CORAL, Blocks.BUBBLE_CORAL, Blocks.FIRE_CORAL, Blocks.HORN_CORAL); super.addExtraBlockTags(tags); }
Example #15
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 2 votes |
/** * Used during tree growth to determine if newly generated leaves can replace this block. * * @param state The current state * @param world The current world * @param pos Block position in world * @return true if this block can be replaced by growing leaves. */ default boolean canBeReplacedByLeaves(BlockState state, CollisionView world, BlockPos pos) { return isAir(state, world, pos) || state.matches(BlockTags.LEAVES); }
Example #16
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 2 votes |
/** * Used during tree growth to determine if newly generated logs can replace this block. * * @param state The current state * @param world The current world * @param pos Block position in world * @return true if this block can be replaced by growing leaves. */ default boolean canBeReplacedByLogs(BlockState state, CollisionView world, BlockPos pos) { return (isAir(state, world, pos) || state.matches(BlockTags.LEAVES)) || this == Blocks.GRASS_BLOCK || Block.isNaturalDirt(getBlock()) || getBlock().matches(BlockTags.LOGS) || getBlock().matches(BlockTags.SAPLINGS) || this == Blocks.VINE; }
Example #17
Source File: IForgeBlock.java From patchwork-api with GNU Lesser General Public License v2.1 | 2 votes |
/** * Determines if this block's collision box should be treated as though it can extend above its block space. * Use this to replicate fence and wall behavior. */ default boolean collisionExtendsVertically(BlockState state, BlockView world, BlockPos pos, Entity collidingEntity) { return getBlock().matches(BlockTags.FENCES) || getBlock().matches(BlockTags.WALLS) || getBlock() instanceof FenceGateBlock; }