From 56845ebc1947bb897f90c747c0f20f93cabdffb4 Mon Sep 17 00:00:00 2001 From: Frank Date: Mon, 1 Aug 2022 01:31:38 +0200 Subject: [PATCH] [Change] Removed FabricItem-/FabricBlockSettings dependency --- .../betterx/bclib/blocks/BaseLeavesBlock.java | 20 +++++++++---------- .../WoodenComplexMaterial.java | 10 +++++----- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java index 36c3f7c5..69018546 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java @@ -28,8 +28,6 @@ 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 net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; - import com.google.common.collect.Lists; import java.util.Collections; @@ -39,14 +37,14 @@ import java.util.function.Consumer; public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe { protected final Block sapling; - private static FabricBlockSettings makeLeaves(MaterialColor color) { - return FabricBlockSettings - .copyOf(Blocks.OAK_LEAVES) - .mapColor(color) + private static BlockBehaviour.Properties makeLeaves(MaterialColor color) { + return BlockBehaviour.Properties + .copy(Blocks.OAK_LEAVES) + .color(color) //.requiresTool() - .allowsSpawning((state, world, pos, type) -> false) - .suffocates((state, world, pos) -> false) - .blockVision((state, world, pos) -> false); + .isValidSpawn((state, world, pos, type) -> false) + .isSuffocating((state, world, pos) -> false) + .isViewBlocking((state, world, pos) -> false); } public BaseLeavesBlock( @@ -64,7 +62,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, int light, Consumer customizeProperties ) { - super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light))); + super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).lightLevel(state -> light))); this.sapling = sapling; } @@ -74,7 +72,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, } public BaseLeavesBlock(Block sapling, MaterialColor color, int light) { - super(makeLeaves(color).luminance(light)); + super(makeLeaves(color).lightLevel(state -> light)); this.sapling = sapling; } diff --git a/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java b/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java index 519aebb3..5c1b4eff 100644 --- a/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java +++ b/src/main/java/org/betterx/bclib/complexmaterials/WoodenComplexMaterial.java @@ -18,9 +18,9 @@ import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.material.MaterialColor; -import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; @@ -83,13 +83,13 @@ public class WoodenComplexMaterial extends ComplexMaterial { } @Override - protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { + protected void initDefault(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) { initBase(blockSettings, itemSettings); initStorage(blockSettings, itemSettings); initDecorations(blockSettings, itemSettings); } - final protected void initBase(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { + final protected void initBase(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) { TagKey tagBlockLog = getBlockTag(TAG_LOGS); TagKey tagItemLog = getItemTag(TAG_LOGS); @@ -199,7 +199,7 @@ public class WoodenComplexMaterial extends ComplexMaterial { .setItemTags(ItemTags.SIGNS)); } - final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { + final protected void initStorage(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) { addBlockEntry(new BlockEntry( BLOCK_CHEST, (complexMaterial, settings) -> new BaseChestBlock(getBlock(BLOCK_PLANKS)) @@ -215,7 +215,7 @@ public class WoodenComplexMaterial extends ComplexMaterial { .setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL)); } - protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) { + protected void initDecorations(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) { addBlockEntry(new BlockEntry( BLOCK_CRAFTING_TABLE, (cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))