[Change] Removed FabricItem-/FabricBlockSettings dependency
This commit is contained in:
parent
9e3ba00db8
commit
56845ebc19
2 changed files with 14 additions and 16 deletions
|
@ -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.LootContext;
|
||||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
|
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 com.google.common.collect.Lists;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -39,14 +37,14 @@ import java.util.function.Consumer;
|
||||||
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe {
|
public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider, RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe {
|
||||||
protected final Block sapling;
|
protected final Block sapling;
|
||||||
|
|
||||||
private static FabricBlockSettings makeLeaves(MaterialColor color) {
|
private static BlockBehaviour.Properties makeLeaves(MaterialColor color) {
|
||||||
return FabricBlockSettings
|
return BlockBehaviour.Properties
|
||||||
.copyOf(Blocks.OAK_LEAVES)
|
.copy(Blocks.OAK_LEAVES)
|
||||||
.mapColor(color)
|
.color(color)
|
||||||
//.requiresTool()
|
//.requiresTool()
|
||||||
.allowsSpawning((state, world, pos, type) -> false)
|
.isValidSpawn((state, world, pos, type) -> false)
|
||||||
.suffocates((state, world, pos) -> false)
|
.isSuffocating((state, world, pos) -> false)
|
||||||
.blockVision((state, world, pos) -> false);
|
.isViewBlocking((state, world, pos) -> false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLeavesBlock(
|
public BaseLeavesBlock(
|
||||||
|
@ -64,7 +62,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
||||||
int light,
|
int light,
|
||||||
Consumer<BlockBehaviour.Properties> customizeProperties
|
Consumer<BlockBehaviour.Properties> customizeProperties
|
||||||
) {
|
) {
|
||||||
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).luminance(light)));
|
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color).lightLevel(state -> light)));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +72,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) {
|
||||||
super(makeLeaves(color).luminance(light));
|
super(makeLeaves(color).lightLevel(state -> light));
|
||||||
this.sapling = sapling;
|
this.sapling = sapling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
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.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||||
|
|
||||||
|
@ -83,13 +83,13 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initDefault(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
protected void initDefault(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
|
||||||
initBase(blockSettings, itemSettings);
|
initBase(blockSettings, itemSettings);
|
||||||
initStorage(blockSettings, itemSettings);
|
initStorage(blockSettings, itemSettings);
|
||||||
initDecorations(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<Block> tagBlockLog = getBlockTag(TAG_LOGS);
|
||||||
TagKey<Item> tagItemLog = getItemTag(TAG_LOGS);
|
TagKey<Item> tagItemLog = getItemTag(TAG_LOGS);
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
||||||
.setItemTags(ItemTags.SIGNS));
|
.setItemTags(ItemTags.SIGNS));
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected void initStorage(FabricBlockSettings blockSettings, FabricItemSettings itemSettings) {
|
final protected void initStorage(BlockBehaviour.Properties blockSettings, Item.Properties itemSettings) {
|
||||||
addBlockEntry(new BlockEntry(
|
addBlockEntry(new BlockEntry(
|
||||||
BLOCK_CHEST,
|
BLOCK_CHEST,
|
||||||
(complexMaterial, settings) -> new BaseChestBlock(getBlock(BLOCK_PLANKS))
|
(complexMaterial, settings) -> new BaseChestBlock(getBlock(BLOCK_PLANKS))
|
||||||
|
@ -215,7 +215,7 @@ public class WoodenComplexMaterial extends ComplexMaterial {
|
||||||
.setItemTags(CommonItemTags.BARREL, CommonItemTags.WOODEN_BARREL));
|
.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(
|
addBlockEntry(new BlockEntry(
|
||||||
BLOCK_CRAFTING_TABLE,
|
BLOCK_CRAFTING_TABLE,
|
||||||
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
|
(cmx, settings) -> new BaseCraftingTableBlock(getBlock(BLOCK_PLANKS))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue