Removed Property Dependencies
This commit is contained in:
parent
93a0be3c8b
commit
acd5ce5d65
43 changed files with 119 additions and 150 deletions
|
@ -12,6 +12,7 @@ import net.minecraft.client.resources.model.UnbakedModel;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PickaxeItem;
|
||||
import net.minecraft.world.level.block.AnvilBlock;
|
||||
|
@ -27,8 +28,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -44,7 +43,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
|
|||
public IntegerProperty durability;
|
||||
|
||||
public BaseAnvilBlock(MaterialColor color) {
|
||||
this(FabricBlockSettings.copyOf(Blocks.ANVIL).color(color));
|
||||
this(Properties.copy(Blocks.ANVIL).color(color));
|
||||
}
|
||||
|
||||
public BaseAnvilBlock(BlockBehaviour.Properties properties) {
|
||||
|
@ -97,7 +96,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
|
||||
return new BaseAnvilItem(this, settings);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -43,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
||||
public BaseBarrelBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source).noOcclusion());
|
||||
this(Properties.copy(source).noOcclusion());
|
||||
}
|
||||
|
||||
public BaseBarrelBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|||
|
||||
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;
|
||||
|
@ -27,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseBookshelfBlock extends BaseBlock {
|
||||
public BaseBookshelfBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source));
|
||||
this(Properties.copy(source));
|
||||
}
|
||||
|
||||
public BaseBookshelfBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -21,7 +21,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;
|
||||
|
@ -31,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseChainBlock extends ChainBlock implements BlockModelProvider, RenderLayerProvider {
|
||||
public BaseChainBlock(MaterialColor color) {
|
||||
this(FabricBlockSettings.copyOf(Blocks.CHAIN).color(color));
|
||||
this(Properties.copy(Blocks.CHAIN).color(color));
|
||||
}
|
||||
|
||||
public BaseChainBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -19,7 +19,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.List;
|
||||
import java.util.Optional;
|
||||
|
@ -29,7 +28,7 @@ public class BaseChestBlock extends ChestBlock implements BlockModelProvider {
|
|||
private final Block parent;
|
||||
|
||||
public BaseChestBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).noOcclusion(), () -> BaseBlockEntities.CHEST);
|
||||
super(Properties.copy(source).noOcclusion(), () -> BaseBlockEntities.CHEST);
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseComposterBlock extends ComposterBlock implements BlockModelProvider {
|
||||
public BaseComposterBlock(Block source) {
|
||||
super(Properties.of(source.defaultBlockState().getMaterial()));
|
||||
super(Properties.copy(source));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.HashMap;
|
||||
|
@ -26,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseCraftingTableBlock extends CraftingTableBlock implements BlockModelProvider {
|
||||
public BaseCraftingTableBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source));
|
||||
this(Properties.copy(source));
|
||||
}
|
||||
|
||||
public BaseCraftingTableBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -29,7 +29,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;
|
||||
|
@ -39,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseDoorBlock extends DoorBlock implements RenderLayerProvider, BlockModelProvider, TagProvider {
|
||||
public BaseDoorBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source).strength(3F, 3F).noOcclusion());
|
||||
this(Properties.copy(source).strength(3F, 3F).noOcclusion());
|
||||
}
|
||||
|
||||
public BaseDoorBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -18,7 +18,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;
|
||||
|
@ -30,7 +29,7 @@ public class BaseFenceBlock extends FenceBlock implements BlockModelProvider {
|
|||
private final Block parent;
|
||||
|
||||
public BaseFenceBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).noOcclusion());
|
||||
super(Properties.copy(source).noOcclusion());
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|||
|
||||
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;
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -43,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseFurnaceBlock extends FurnaceBlock implements BlockModelProvider, RenderLayerProvider {
|
||||
public BaseFurnaceBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source).luminance(state -> state.getValue(LIT) ? 13 : 0));
|
||||
this(Properties.copy(source).lightLevel(state -> state.getValue(LIT) ? 13 : 0));
|
||||
}
|
||||
|
||||
public BaseFurnaceBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -17,7 +17,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;
|
||||
|
@ -29,7 +28,7 @@ public class BaseGateBlock extends FenceGateBlock implements BlockModelProvider
|
|||
private final Block parent;
|
||||
|
||||
public BaseGateBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).noOcclusion());
|
||||
super(Properties.copy(source).noOcclusion());
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|||
|
||||
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;
|
||||
|
@ -28,9 +27,9 @@ public class BaseGlassBlock extends BaseBlockNotFull implements AddMineablePicka
|
|||
}
|
||||
|
||||
public BaseGlassBlock(Block block, float resistance) {
|
||||
super(FabricBlockSettings.copyOf(block)
|
||||
.resistance(resistance)
|
||||
.nonOpaque()
|
||||
super(Properties.copy(block)
|
||||
.explosionResistance(resistance)
|
||||
.noOcclusion()
|
||||
.isSuffocating((arg1, arg2, arg3) -> false)
|
||||
.isViewBlocking((arg1, arg2, arg3) -> false));
|
||||
}
|
||||
|
|
|
@ -19,7 +19,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;
|
||||
|
@ -29,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseLadderBlock extends LadderBlock implements RenderLayerProvider, BlockModelProvider {
|
||||
public BaseLadderBlock(Block block) {
|
||||
this(FabricBlockSettings.copyOf(block).noOcclusion());
|
||||
this(Properties.copy(block).noOcclusion());
|
||||
}
|
||||
|
||||
public BaseLadderBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -27,8 +27,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;
|
||||
|
@ -38,17 +36,17 @@ 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 Properties makeLeaves(MaterialColor color) {
|
||||
return 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(Block sapling, MaterialColor color, Consumer<FabricBlockSettings> customizeProperties) {
|
||||
public BaseLeavesBlock(Block sapling, MaterialColor color, Consumer<Properties> customizeProperties) {
|
||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color)));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
@ -57,9 +55,9 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
|||
Block sapling,
|
||||
MaterialColor color,
|
||||
int light,
|
||||
Consumer<FabricBlockSettings> customizeProperties
|
||||
Consumer<Properties> customizeProperties
|
||||
) {
|
||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light)));
|
||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).lightLevel(ignored->light)));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
|
@ -69,7 +67,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(ignored->light));
|
||||
this.sapling = sapling;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,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;
|
||||
|
@ -32,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BaseMetalBarsBlock extends IronBarsBlock implements BlockModelProvider, RenderLayerProvider {
|
||||
public BaseMetalBarsBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source).strength(5.0F, 6.0F).noOcclusion());
|
||||
this(Properties.copy(source).strength(5.0F, 6.0F).noOcclusion());
|
||||
}
|
||||
|
||||
public BaseMetalBarsBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -22,8 +22,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 java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -40,9 +38,9 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
|
|||
|
||||
public BaseOreBlock(Supplier<Item> drop, int minCount, int maxCount, int experience, int miningLevel) {
|
||||
this(
|
||||
FabricBlockSettings
|
||||
Properties
|
||||
.of(Material.STONE, MaterialColor.SAND)
|
||||
.requiresTool()
|
||||
.requiresCorrectToolForDrops()
|
||||
.destroyTime(3F)
|
||||
.explosionResistance(9F)
|
||||
.sound(SoundType.STONE),
|
||||
|
|
|
@ -23,7 +23,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.Maps;
|
||||
|
||||
|
@ -39,7 +38,7 @@ public class BasePathBlock extends BaseBlockNotFull {
|
|||
private Block baseBlock;
|
||||
|
||||
public BasePathBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).isValidSpawn((state, world, pos, type) -> false));
|
||||
super(Properties.copy(source).isValidSpawn((state, world, pos, type) -> false));
|
||||
this.baseBlock = Blocks.DIRT;
|
||||
if (source instanceof BaseTerrainBlock) {
|
||||
BaseTerrainBlock terrain = (BaseTerrainBlock) source;
|
||||
|
|
|
@ -17,7 +17,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;
|
||||
|
@ -29,7 +28,7 @@ public class BasePressurePlateBlock extends PressurePlateBlock implements BlockM
|
|||
private final Block parent;
|
||||
|
||||
public BasePressurePlateBlock(Sensitivity rule, Block source) {
|
||||
super(rule, FabricBlockSettings.copyOf(source).noCollission().noOcclusion().strength(0.5F));
|
||||
super(rule, Properties.copy(source).noCollission().noOcclusion().strength(0.5F));
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,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;
|
||||
|
@ -29,7 +28,7 @@ public class BaseRotatedPillarBlock extends RotatedPillarBlock implements BlockM
|
|||
}
|
||||
|
||||
public BaseRotatedPillarBlock(Block block) {
|
||||
this(FabricBlockSettings.copyOf(block));
|
||||
this(Properties.copy(block));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.minecraft.util.Mth;
|
|||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
|
@ -40,8 +41,6 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -61,7 +60,7 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, Cust
|
|||
private final Block parent;
|
||||
|
||||
public BaseSignBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).strength(1.0F, 1.0F).noCollission().noOcclusion(), WoodType.OAK);
|
||||
super(Properties.copy(source).strength(1.0F, 1.0F).noCollission().noOcclusion(), WoodType.OAK);
|
||||
this.registerDefaultState(this.stateDefinition.any()
|
||||
.setValue(ROTATION, 0)
|
||||
.setValue(FLOOR, false)
|
||||
|
@ -194,7 +193,7 @@ public class BaseSignBlock extends SignBlock implements BlockModelProvider, Cust
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
|
||||
return new BlockItem(this, settings.stacksTo(16));
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.resources.model.UnbakedModel;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SlabBlock;
|
||||
|
@ -21,8 +22,6 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -39,7 +38,7 @@ public class BaseSlabBlock extends SlabBlock implements BlockModelProvider, Cust
|
|||
}
|
||||
|
||||
public BaseSlabBlock(Block source, boolean fireproof) {
|
||||
super(FabricBlockSettings.copyOf(source));
|
||||
super(Properties.copy(source));
|
||||
this.parent = source;
|
||||
this.fireproof = fireproof;
|
||||
}
|
||||
|
@ -90,8 +89,8 @@ public class BaseSlabBlock extends SlabBlock implements BlockModelProvider, Cust
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
|
||||
if (fireproof) settings = settings.fireproof();
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
|
||||
if (fireproof) settings = settings.fireResistant();
|
||||
return new BlockItem(this, settings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import net.minecraft.client.resources.model.UnbakedModel;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.StairBlock;
|
||||
|
@ -22,8 +23,6 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -40,7 +39,7 @@ public class BaseStairsBlock extends StairBlock implements BlockModelProvider, C
|
|||
}
|
||||
|
||||
public BaseStairsBlock(Block source, boolean fireproof) {
|
||||
super(source.defaultBlockState(), FabricBlockSettings.copyOf(source));
|
||||
super(source.defaultBlockState(), Properties.copy(source));
|
||||
this.parent = source;
|
||||
this.fireproof = fireproof;
|
||||
}
|
||||
|
@ -114,8 +113,8 @@ public class BaseStairsBlock extends StairBlock implements BlockModelProvider, C
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings) {
|
||||
if (fireproof) settings = settings.fireproof();
|
||||
public BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings) {
|
||||
if (fireproof) settings = settings.fireResistant();
|
||||
return new BlockItem(this, settings);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,10 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
public class BaseStoneButtonBlock extends BaseButtonBlock {
|
||||
public BaseStoneButtonBlock(Block source) {
|
||||
super(source, FabricBlockSettings.copyOf(source).noOcclusion(), false);
|
||||
super(source, Properties.copy(source).noOcclusion(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,13 +17,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
|
||||
private final Block striped;
|
||||
|
||||
public BaseStripableLogBlock(MaterialColor color, Block striped) {
|
||||
super(FabricBlockSettings.copyOf(striped).color(color));
|
||||
super(Properties.copy(striped).color(color));
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||
|
||||
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.Maps;
|
||||
|
||||
|
@ -54,9 +53,9 @@ public class BaseTerrainBlock extends BaseBlock {
|
|||
private Block pathBlock;
|
||||
|
||||
public BaseTerrainBlock(Block baseBlock, MaterialColor color) {
|
||||
super(FabricBlockSettings
|
||||
.copyOf(baseBlock)
|
||||
.materialColor(color)
|
||||
super(Properties
|
||||
.copy(baseBlock)
|
||||
.color(color)
|
||||
.sound(BlockSounds.TERRAIN_SOUND)
|
||||
.randomTicks()
|
||||
);
|
||||
|
|
|
@ -21,14 +21,13 @@ 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.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BaseTrapdoorBlock extends TrapDoorBlock implements RenderLayerProvider, BlockModelProvider {
|
||||
public BaseTrapdoorBlock(Block source) {
|
||||
this(FabricBlockSettings.copyOf(source).strength(3.0F, 3.0F).noOcclusion());
|
||||
this(Properties.copy(source).strength(3.0F, 3.0F).noOcclusion());
|
||||
}
|
||||
|
||||
public BaseTrapdoorBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -33,8 +33,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;
|
||||
|
@ -59,7 +57,7 @@ public class BaseVineBlock extends BaseBlockNotFull implements RenderLayerProvid
|
|||
|
||||
public BaseVineBlock(int light, boolean bottomOnly, Function<Properties, Properties> propMod) {
|
||||
this(
|
||||
propMod.apply(FabricBlockSettings
|
||||
propMod.apply(Properties
|
||||
.of(Material.PLANT)
|
||||
.sound(SoundType.GRASS)
|
||||
.lightLevel((state) -> bottomOnly ? state.getValue(SHAPE) == TripleShape.BOTTOM
|
||||
|
|
|
@ -19,7 +19,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;
|
||||
|
@ -31,7 +30,7 @@ public class BaseWallBlock extends WallBlock implements BlockModelProvider {
|
|||
private final Block parent;
|
||||
|
||||
public BaseWallBlock(Block source) {
|
||||
super(FabricBlockSettings.copyOf(source).noOcclusion());
|
||||
super(Properties.copy(source).noOcclusion());
|
||||
this.parent = source;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,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;
|
||||
|
@ -31,7 +30,7 @@ public class BaseWeightedPlateBlock extends WeightedPressurePlateBlock implement
|
|||
public BaseWeightedPlateBlock(Block source) {
|
||||
super(
|
||||
15,
|
||||
FabricBlockSettings.copyOf(source)
|
||||
Properties.copy(source)
|
||||
.noCollission()
|
||||
.noOcclusion()
|
||||
.requiresCorrectToolForDrops()
|
||||
|
|
|
@ -4,11 +4,10 @@ import net.minecraft.sounds.SoundEvent;
|
|||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
public class BaseWoodenButtonBlock extends BaseButtonBlock {
|
||||
public BaseWoodenButtonBlock(Block source) {
|
||||
super(source, FabricBlockSettings.copyOf(source).strength(0.5F, 0.5F).noOcclusion(), true);
|
||||
super(source, Properties.copy(source).strength(0.5F, 0.5F).noOcclusion(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -55,7 +55,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
|
|||
public FeatureSaplingBlock(FeatureSupplier<F, FC> featureSupplier) {
|
||||
this(
|
||||
Properties.of(Material.PLANT)
|
||||
.collidable(false)
|
||||
.noCollission()
|
||||
.instabreak()
|
||||
.sound(SoundType.GRASS)
|
||||
.randomTicks(),
|
||||
|
@ -66,8 +66,8 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
|
|||
public FeatureSaplingBlock(int light, FeatureSupplier<F, FC> featureSupplier) {
|
||||
this(
|
||||
Properties.of(Material.PLANT)
|
||||
.collidable(false)
|
||||
.luminance(light)
|
||||
.noCollission()
|
||||
.lightLevel(ignored->light)
|
||||
.instabreak()
|
||||
.sound(SoundType.GRASS)
|
||||
.randomTicks(),
|
||||
|
@ -87,7 +87,7 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
|
|||
public FeatureSaplingBlock(Function<BlockState, org.betterx.bclib.api.v2.levelgen.features.BCLFeature> featureSupplier) {
|
||||
this(
|
||||
Properties.of(Material.PLANT)
|
||||
.collidable(false)
|
||||
.noCollission()
|
||||
.instabreak()
|
||||
.sound(SoundType.GRASS)
|
||||
.randomTicks(),
|
||||
|
@ -102,8 +102,8 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
|
|||
) {
|
||||
this(
|
||||
Properties.of(Material.PLANT)
|
||||
.collidable(false)
|
||||
.luminance(light)
|
||||
.noCollission()
|
||||
.lightLevel(ignored->light)
|
||||
.instabreak()
|
||||
.sound(SoundType.GRASS)
|
||||
.randomTicks(),
|
||||
|
|
|
@ -16,14 +16,12 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
|
|||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.level.material.MaterialColor;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe {
|
||||
public SimpleLeavesBlock(MaterialColor color) {
|
||||
this(
|
||||
FabricBlockSettings
|
||||
Properties
|
||||
.of(Material.LEAVES)
|
||||
.strength(0.2F)
|
||||
.color(color)
|
||||
|
@ -37,9 +35,9 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
|
|||
|
||||
public SimpleLeavesBlock(MaterialColor color, int light) {
|
||||
this(
|
||||
FabricBlockSettings
|
||||
Properties
|
||||
.of(Material.LEAVES)
|
||||
.luminance(light)
|
||||
.lightLevel(ignored->light)
|
||||
.color(color)
|
||||
.strength(0.2F)
|
||||
.sound(SoundType.GRASS)
|
||||
|
|
|
@ -39,7 +39,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.Map;
|
||||
import java.util.Optional;
|
||||
|
@ -53,7 +52,7 @@ public class StalactiteBlock extends BaseBlockNotFull implements SimpleWaterlogg
|
|||
private static final VoxelShape[] SHAPES;
|
||||
|
||||
public StalactiteBlock(Block source) {
|
||||
this(FabricBlockSettings.copy(source).noOcclusion());
|
||||
this(Properties.copy(source).noOcclusion());
|
||||
}
|
||||
|
||||
public StalactiteBlock(BlockBehaviour.Properties properties) {
|
||||
|
|
|
@ -16,13 +16,12 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.material.MaterialColor;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
|
||||
public class StripableBarkBlock extends BaseBarkBlock {
|
||||
private final Block striped;
|
||||
|
||||
public StripableBarkBlock(MaterialColor color, Block striped) {
|
||||
super(FabricBlockSettings.copyOf(striped).color(color));
|
||||
super(Properties.copy(striped).color(color));
|
||||
this.striped = striped;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
|||
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;
|
||||
|
||||
|
@ -37,7 +36,7 @@ public abstract class UpDownPlantBlock extends BaseBlockNotFull implements Rende
|
|||
private static final VoxelShape SHAPE = box(4, 0, 4, 12, 16, 12);
|
||||
|
||||
public UpDownPlantBlock() {
|
||||
this(FabricBlockSettings
|
||||
this(Properties
|
||||
.of(Material.PLANT)
|
||||
.sound(SoundType.GRASS)
|
||||
.noCollission()
|
||||
|
|
|
@ -12,9 +12,9 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -62,8 +62,8 @@ public abstract class ComplexMaterial {
|
|||
public ComplexMaterial init(BlockRegistry blocksRegistry, ItemRegistry itemsRegistry, PathConfig recipeConfig) {
|
||||
initTags();
|
||||
|
||||
final FabricBlockSettings blockSettings = getBlockSettings();
|
||||
final FabricItemSettings itemSettings = getItemSettings(itemsRegistry);
|
||||
final BlockBehaviour.Properties blockSettings = getBlockSettings();
|
||||
final Item.Properties itemSettings = getItemSettings(itemsRegistry);
|
||||
initDefault(blockSettings, itemSettings);
|
||||
|
||||
getBlockEntries().forEach(entry -> {
|
||||
|
@ -88,10 +88,11 @@ public abstract class ComplexMaterial {
|
|||
/**
|
||||
* Init default content for {@link ComplexMaterial} - blocks and items.
|
||||
*
|
||||
* @param blockSettings {@link FabricBlockSettings} default block settings for this material;
|
||||
* @param itemSettings {@link FabricItemSettings} default item settings for this material.
|
||||
* @param blockSettings {@link BlockBehaviour.Properties} default block settings for this material;
|
||||
* @param itemSettings {@link Item.Properties} default item settings for this material.
|
||||
*/
|
||||
protected abstract void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings);
|
||||
|
||||
protected abstract void initDefault(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings);
|
||||
|
||||
/**
|
||||
* Init custom tags for this {@link ComplexMaterial}, not required.
|
||||
|
@ -178,16 +179,15 @@ public abstract class ComplexMaterial {
|
|||
/**
|
||||
* Get default block settings for this material.
|
||||
*
|
||||
* @return {@link FabricBlockSettings}
|
||||
* @return {@link BlockBehaviour.Properties}
|
||||
*/
|
||||
protected abstract FabricBlockSettings getBlockSettings();
|
||||
|
||||
protected abstract BlockBehaviour.Properties getBlockSettings();
|
||||
/**
|
||||
* Get default item settings for this material.
|
||||
*
|
||||
* @return {@link FabricItemSettings}
|
||||
* @return {@link Item.Properties}
|
||||
*/
|
||||
protected FabricItemSettings getItemSettings(ItemRegistry registry) {
|
||||
protected Item.Properties getItemSettings(ItemRegistry registry) {
|
||||
return registry.makeItemSettings();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,8 @@ 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;
|
||||
|
||||
public class WoodenComplexMaterial extends ComplexMaterial {
|
||||
|
@ -64,10 +62,11 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
|||
this.woodColor = woodColor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected FabricBlockSettings getBlockSettings() {
|
||||
return FabricBlockSettings.copyOf(Blocks.OAK_PLANKS)
|
||||
.mapColor(planksColor);
|
||||
protected BlockBehaviour.Properties getBlockSettings() {
|
||||
return BlockBehaviour.Properties.copy(Blocks.OAK_PLANKS)
|
||||
.color(planksColor);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,13 +81,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<Block> tagBlockLog = getBlockTag(TAG_LOGS);
|
||||
TagKey<Item> tagItemLog = getItemTag(TAG_LOGS);
|
||||
|
||||
|
@ -198,7 +197,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))
|
||||
|
@ -214,7 +213,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
|||
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
|
||||
}
|
||||
|
||||
final protected void initDecorations(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
||||
final protected void initDecorations(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
|
||||
addBlockEntry(new BlockEntry(
|
||||
BLOCK_CRAFTING_TABLE,
|
||||
(complexMaterial, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
|
||||
|
|
|
@ -8,26 +8,25 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class BlockEntry extends ComplexMaterialEntry {
|
||||
final BiFunction<ComplexMaterial, FabricBlockSettings, Block> initFunction;
|
||||
final BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction;
|
||||
final boolean hasItem;
|
||||
|
||||
TagKey<Block>[] blockTags;
|
||||
TagKey<Item>[] itemTags;
|
||||
|
||||
public BlockEntry(String suffix, BiFunction<ComplexMaterial, FabricBlockSettings, Block> initFunction) {
|
||||
public BlockEntry(String suffix, BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction) {
|
||||
this(suffix, true, initFunction);
|
||||
}
|
||||
|
||||
public BlockEntry(
|
||||
String suffix,
|
||||
boolean hasItem,
|
||||
BiFunction<ComplexMaterial, FabricBlockSettings, Block> initFunction
|
||||
BiFunction<ComplexMaterial, BlockBehaviour.Properties, Block> initFunction
|
||||
) {
|
||||
super(suffix);
|
||||
this.initFunction = initFunction;
|
||||
|
@ -44,7 +43,7 @@ public class BlockEntry extends ComplexMaterialEntry {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Block init(ComplexMaterial material, FabricBlockSettings blockSettings, BlockRegistry registry) {
|
||||
public Block init(ComplexMaterial material, BlockBehaviour.Properties blockSettings, BlockRegistry registry) {
|
||||
ResourceLocation location = getLocation(material.getModID(), material.getBaseName());
|
||||
Block block = initFunction.apply(material, blockSettings);
|
||||
if (hasItem) {
|
||||
|
|
|
@ -8,16 +8,14 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
public class ItemEntry extends ComplexMaterialEntry {
|
||||
final BiFunction<ComplexMaterial, FabricItemSettings, Item> initFunction;
|
||||
final BiFunction<ComplexMaterial, Item.Properties, Item> initFunction;
|
||||
|
||||
TagKey<Item>[] itemTags;
|
||||
|
||||
public ItemEntry(String suffix, BiFunction<ComplexMaterial, FabricItemSettings, Item> initFunction) {
|
||||
public ItemEntry(String suffix, BiFunction<ComplexMaterial, Item.Properties, Item> initFunction) {
|
||||
super(suffix);
|
||||
this.initFunction = initFunction;
|
||||
}
|
||||
|
@ -27,7 +25,7 @@ public class ItemEntry extends ComplexMaterialEntry {
|
|||
return this;
|
||||
}
|
||||
|
||||
public Item init(ComplexMaterial material, FabricItemSettings itemSettings, ItemRegistry registry) {
|
||||
public Item init(ComplexMaterial material, Item.Properties itemSettings, ItemRegistry registry) {
|
||||
ResourceLocation location = getLocation(material.getModID(), material.getBaseName());
|
||||
Item item = initFunction.apply(material, itemSettings);
|
||||
registry.register(location, item);
|
||||
|
|
|
@ -2,8 +2,7 @@ package org.betterx.bclib.interfaces;
|
|||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
||||
public interface CustomItemProvider {
|
||||
/**
|
||||
|
@ -11,5 +10,5 @@ public interface CustomItemProvider {
|
|||
*
|
||||
* @return {@link BlockItem}
|
||||
*/
|
||||
BlockItem getCustomItem(ResourceLocation blockID, FabricItemSettings settings);
|
||||
BlockItem getCustomItem(ResourceLocation blockID, Item.Properties settings);
|
||||
}
|
||||
|
|
|
@ -4,13 +4,12 @@ import org.betterx.bclib.interfaces.ItemModelProvider;
|
|||
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.MobBucketItem;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
|
||||
public class BaseBucketItem extends MobBucketItem implements ItemModelProvider {
|
||||
public BaseBucketItem(EntityType<?> type, FabricItemSettings settings) {
|
||||
public BaseBucketItem(EntityType<?> type, Item.Properties settings) {
|
||||
super(type, Fluids.WATER, SoundEvents.BUCKET_EMPTY_FISH, settings.stacksTo(1));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import net.minecraft.world.item.CreativeModeTab;
|
|||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
@ -34,9 +32,9 @@ public abstract class BaseRegistry<T> {
|
|||
|
||||
public abstract void registerItem(ResourceLocation id, Item item);
|
||||
|
||||
public FabricItemSettings makeItemSettings() {
|
||||
FabricItemSettings properties = new FabricItemSettings();
|
||||
return (FabricItemSettings) properties.tab(creativeTab);
|
||||
public Item.Properties makeItemSettings() {
|
||||
Item.Properties properties = new Item.Properties();
|
||||
return properties.tab(creativeTab);
|
||||
}
|
||||
|
||||
private void registerInternal() {
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.world.item.Item;
|
|||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.ColorHelper;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
@ -177,8 +176,23 @@ public class ColorUtil {
|
|||
return HSBtoRGB(FLOAT_BUFFER[0], FLOAT_BUFFER[1], FLOAT_BUFFER[2]);
|
||||
}
|
||||
|
||||
public static int multiplyColor(int color1, int color2) {
|
||||
if (color1 == -1) {
|
||||
return color2;
|
||||
} else if (color2 == -1) {
|
||||
return color1;
|
||||
}
|
||||
|
||||
final int alpha = ((color1 >> 24) & 0xFF) * ((color2 >> 24) & 0xFF) / 0xFF;
|
||||
final int red = ((color1 >> 16) & 0xFF) * ((color2 >> 16) & 0xFF) / 0xFF;
|
||||
final int green = ((color1 >> 8) & 0xFF) * ((color2 >> 8) & 0xFF) / 0xFF;
|
||||
final int blue = (color1 & 0xFF) * (color2 & 0xFF) / 0xFF;
|
||||
|
||||
return (alpha << 24) | (red << 16) | (green << 8) | blue;
|
||||
}
|
||||
|
||||
public static int applyTint(int color, int tint) {
|
||||
return colorBrigtness(ColorHelper.multiplyColor(color, tint), 1.5F);
|
||||
return colorBrigtness(multiplyColor(color, tint), 1.5F);
|
||||
}
|
||||
|
||||
public static int colorDistance(int color1, int color2) {
|
||||
|
|
Loading…
Reference in a new issue