Some simple migrations

This commit is contained in:
Frank 2022-07-12 23:54:12 +02:00
parent e935955a3b
commit 7a35017a4d
6 changed files with 22 additions and 28 deletions

View file

@ -10,7 +10,6 @@ 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.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -68,9 +67,9 @@ public class BaseBlock extends Block implements BlockModelProvider {
* @param settings The properties as created by the Block * @param settings The properties as created by the Block
* @return The reconfigured {@code settings} * @return The reconfigured {@code settings}
*/ */
static FabricBlockSettings acceptAndReturn( static Properties acceptAndReturn(
Consumer<FabricBlockSettings> customizeProperties, Consumer<Properties> customizeProperties,
FabricBlockSettings settings Properties settings
) { ) {
customizeProperties.accept(settings); customizeProperties.accept(settings);
return settings; return settings;

View file

@ -16,7 +16,6 @@ import net.minecraft.world.level.storage.loot.LootContext;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -26,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider { public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider {
public BaseComposterBlock(Block source) { public BaseComposterBlock(Block source) {
super(FabricBlockSettings.copyOf(source)); super(Properties.of(source.defaultBlockState().getMaterial()));
} }
@Override @Override

View file

@ -34,8 +34,6 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.util.List; import java.util.List;
@ -47,7 +45,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R
public BaseDoublePlantBlock() { public BaseDoublePlantBlock() {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
.noCollission() .noCollission()
.offsetType(BlockBehaviour.OffsetType.NONE) .offsetType(BlockBehaviour.OffsetType.NONE)
@ -56,7 +54,7 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R
public BaseDoublePlantBlock(int light) { public BaseDoublePlantBlock(int light) {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
.lightLevel((state) -> state.getValue(TOP) ? light : 0) .lightLevel((state) -> state.getValue(TOP) ? light : 0)
.noCollission() .noCollission()

View file

@ -36,7 +36,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import com.google.common.collect.Lists; 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) { public static Properties basePlantSettings(Material mat, int light) {
Properties props = FabricBlockSettings Properties props = Properties
.of(mat) .of(mat)
.sounds(SoundType.GRASS) .sound(SoundType.GRASS)
.noCollision() .noCollission()
.offsetType(BlockBehaviour.OffsetType.XZ); .offsetType(BlockBehaviour.OffsetType.XZ);
if (light > 0) props.lightLevel(s -> light); if (light > 0) props.lightLevel(s -> light);
return props; return props;
@ -103,9 +102,9 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
public BasePlantBlock(boolean replaceable, int light, SettingsExtender propMod) { public BasePlantBlock(boolean replaceable, int light, SettingsExtender propMod) {
this( this(
propMod.amend(FabricBlockSettings propMod.amend(Properties
.of(replaceable ? Material.REPLACEABLE_PLANT : Material.PLANT) .of(replaceable ? Material.REPLACEABLE_PLANT : Material.PLANT)
.luminance(light) .lightLevel((state)->light)
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
.noCollission() .noCollission()
.offsetType(BlockBehaviour.OffsetType.XZ) .offsetType(BlockBehaviour.OffsetType.XZ)

View file

@ -35,7 +35,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -55,7 +54,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
public FeatureSaplingBlock(FeatureSupplier<F, FC> featureSupplier) { public FeatureSaplingBlock(FeatureSupplier<F, FC> featureSupplier) {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.collidable(false) .collidable(false)
.instabreak() .instabreak()
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
@ -66,7 +65,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
public FeatureSaplingBlock(int light, FeatureSupplier<F, FC> featureSupplier) { public FeatureSaplingBlock(int light, FeatureSupplier<F, FC> featureSupplier) {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.collidable(false) .collidable(false)
.luminance(light) .luminance(light)
.instabreak() .instabreak()
@ -87,7 +86,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
@Deprecated(forRemoval = true) @Deprecated(forRemoval = true)
public FeatureSaplingBlock(Function<BlockState, org.betterx.bclib.api.v2.levelgen.features.BCLFeature> featureSupplier) { public FeatureSaplingBlock(Function<BlockState, org.betterx.bclib.api.v2.levelgen.features.BCLFeature> featureSupplier) {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.collidable(false) .collidable(false)
.instabreak() .instabreak()
.sound(SoundType.GRASS) .sound(SoundType.GRASS)
@ -102,7 +101,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
Function<BlockState, org.betterx.bclib.api.v2.levelgen.features.BCLFeature> featureSupplier Function<BlockState, org.betterx.bclib.api.v2.levelgen.features.BCLFeature> featureSupplier
) { ) {
this( this(
FabricBlockSettings.of(Material.PLANT) Properties.of(Material.PLANT)
.collidable(false) .collidable(false)
.luminance(light) .luminance(light)
.instabreak() .instabreak()

View file

@ -14,12 +14,12 @@ import java.util.Map;
interface PresetEditorMixin { interface PresetEditorMixin {
//Make Sure the PresetEditor.EDITORS Field is a mutable List. Allows us to add new Custom WorldPreset UIs in //Make Sure the PresetEditor.EDITORS Field is a mutable List. Allows us to add new Custom WorldPreset UIs in
//WorldPresetsUI //WorldPresetsUI
@Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Ljava/util/Map;of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;")) // @Redirect(method = "<clinit>", at = @At(value = "INVOKE", target = "Ljava/util/Map;of(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;"))
private static <K, V> Map<K, V> bcl_foo(K k1, V v1, K k2, V v2) { // private static <K, V> Map<K, V> bcl_foo(K k1, V v1, K k2, V v2) {
Map<K, V> a = Maps.newHashMap(); // Map<K, V> a = Maps.newHashMap();
a.put(k1, v1); // a.put(k1, v1);
a.put(k2, v2); // a.put(k2, v2);
return a; // return a;
} // }
} }