From 97533734295c267b93a52b10b14b77f2ff87da91 Mon Sep 17 00:00:00 2001 From: Frank Date: Tue, 12 Jul 2022 23:54:12 +0200 Subject: [PATCH] Started to removed FabricBlockSettings Helper --- .../org/betterx/bclib/blocks/BaseBlock.java | 7 +++--- .../bclib/blocks/BaseComposterBlock.java | 3 +-- .../bclib/blocks/BaseDoublePlantBlock.java | 6 ++--- .../betterx/bclib/blocks/BaseLeavesBlock.java | 9 ++++++-- .../betterx/bclib/blocks/BasePlantBlock.java | 11 ++++----- .../bclib/blocks/FeatureSaplingBlock.java | 23 +++++++++---------- 6 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/betterx/bclib/blocks/BaseBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseBlock.java index ddea5ed0..5482a865 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseBlock.java @@ -10,7 +10,6 @@ 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.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import java.util.Collections; import java.util.List; @@ -68,9 +67,9 @@ public class BaseBlock extends Block implements BlockModelProvider { * @param settings The properties as created by the Block * @return The reconfigured {@code settings} */ - static FabricBlockSettings acceptAndReturn( - Consumer customizeProperties, - FabricBlockSettings settings + static Properties acceptAndReturn( + Consumer customizeProperties, + Properties settings ) { customizeProperties.accept(settings); return settings; diff --git a/src/main/java/org/betterx/bclib/blocks/BaseComposterBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseComposterBlock.java index a019f4f5..07143bb1 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseComposterBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseComposterBlock.java @@ -16,7 +16,6 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import java.util.Collections; import java.util.List; @@ -26,7 +25,7 @@ import org.jetbrains.annotations.Nullable; public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider { public BaseComposterBlock(Block source) { - super(FabricBlockSettings.copyOf(source)); + super(Properties.of(source.defaultBlockState().getMaterial())); } @Override diff --git a/src/main/java/org/betterx/bclib/blocks/BaseDoublePlantBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseDoublePlantBlock.java index 8930ec6c..1646c093 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseDoublePlantBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseDoublePlantBlock.java @@ -34,8 +34,6 @@ import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; - import com.google.common.collect.Lists; import java.util.List; @@ -47,7 +45,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R public BaseDoublePlantBlock() { this( - FabricBlockSettings.of(Material.PLANT) + Properties.of(Material.PLANT) .sound(SoundType.GRASS) .noCollission() .offsetType(BlockBehaviour.OffsetType.NONE) @@ -56,7 +54,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R public BaseDoublePlantBlock(int light) { this( - FabricBlockSettings.of(Material.PLANT) + Properties.of(Material.PLANT) .sound(SoundType.GRASS) .lightLevel((state) -> state.getValue(TOP) ? light : 0) .noCollission() diff --git a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java index 2b774c35..36c3f7c5 100644 --- a/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BaseLeavesBlock.java @@ -22,6 +22,7 @@ import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.storage.loot.LootContext; @@ -48,7 +49,11 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, .blockVision((state, world, pos) -> false); } - public BaseLeavesBlock(Block sapling, MaterialColor color, Consumer customizeProperties) { + public BaseLeavesBlock( + Block sapling, + MaterialColor color, + Consumer customizeProperties + ) { super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color))); this.sapling = sapling; } @@ -57,7 +62,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, Block sapling, MaterialColor color, int light, - Consumer customizeProperties + Consumer customizeProperties ) { super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light))); this.sapling = sapling; diff --git a/src/main/java/org/betterx/bclib/blocks/BasePlantBlock.java b/src/main/java/org/betterx/bclib/blocks/BasePlantBlock.java index c0173ee1..fdcc3cc4 100644 --- a/src/main/java/org/betterx/bclib/blocks/BasePlantBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/BasePlantBlock.java @@ -36,7 +36,6 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import com.google.common.collect.Lists; @@ -62,10 +61,10 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL } public static Properties basePlantSettings(Material mat, int light) { - Properties props = FabricBlockSettings + Properties props = Properties .of(mat) - .sounds(SoundType.GRASS) - .noCollision() + .sound(SoundType.GRASS) + .noCollission() .offsetType(BlockBehaviour.OffsetType.XZ); if (light > 0) props.lightLevel(s -> light); return props; @@ -103,9 +102,9 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL @Deprecated(forRemoval = true) public BasePlantBlock(boolean replaceable, int light, SettingsExtender propMod) { this( - propMod.amend(FabricBlockSettings + propMod.amend(Properties .of(replaceable ? Material.REPLACEABLE_PLANT : Material.PLANT) - .luminance(light) + .lightLevel((state)->light) .sound(SoundType.GRASS) .noCollission() .offsetType(BlockBehaviour.OffsetType.XZ) diff --git a/src/main/java/org/betterx/bclib/blocks/FeatureSaplingBlock.java b/src/main/java/org/betterx/bclib/blocks/FeatureSaplingBlock.java index ac5d0f12..075d4736 100644 --- a/src/main/java/org/betterx/bclib/blocks/FeatureSaplingBlock.java +++ b/src/main/java/org/betterx/bclib/blocks/FeatureSaplingBlock.java @@ -33,7 +33,6 @@ import net.minecraft.world.phys.shapes.VoxelShape; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import java.util.Collections; import java.util.List; @@ -52,23 +51,23 @@ public class FeatureSaplingBlock, FC extends FeatureConfig public FeatureSaplingBlock(FeatureSupplier featureSupplier) { this( - FabricBlockSettings.of(Material.PLANT) - .collidable(false) - .instabreak() - .sound(SoundType.GRASS) - .randomTicks(), + BlockBehaviour.Properties.of(Material.PLANT) + .noCollission() + .instabreak() + .sound(SoundType.GRASS) + .randomTicks(), featureSupplier ); } public FeatureSaplingBlock(int light, FeatureSupplier featureSupplier) { this( - FabricBlockSettings.of(Material.PLANT) - .collidable(false) - .luminance(light) - .instabreak() - .sound(SoundType.GRASS) - .randomTicks(), + BlockBehaviour.Properties.of(Material.PLANT) + .noCollission() + .lightLevel(state -> light) + .instabreak() + .sound(SoundType.GRASS) + .randomTicks(), featureSupplier ); }