MaterialColor -> MapColor

This commit is contained in:
Frank 2023-05-17 12:26:47 +02:00
parent 4602596e60
commit c051cc54c2
12 changed files with 34 additions and 35 deletions

View file

@ -22,7 +22,7 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.block.state.properties.IntegerProperty;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
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;
@ -42,7 +42,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION; public static final IntegerProperty DESTRUCTION = BlockProperties.DESTRUCTION;
public IntegerProperty durability; public IntegerProperty durability;
public BaseAnvilBlock(MaterialColor color) { public BaseAnvilBlock(MapColor color) {
this(Properties.copy(Blocks.ANVIL).color(color)); this(Properties.copy(Blocks.ANVIL).color(color));
} }

View file

@ -7,10 +7,9 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -61,7 +60,7 @@ public class BaseBlock extends Block implements BlockModelProvider {
* It is called from Block-Contructors, to allow the augmentation of the blocks * It is called from Block-Contructors, to allow the augmentation of the blocks
* preset properties. * preset properties.
* <p> * <p>
* For example in {@link BaseLeavesBlock#BaseLeavesBlock(Block, MaterialColor, Consumer)} * For example in {@link BaseLeavesBlock#BaseLeavesBlock(Block, MapColor, Consumer)}
* *
* @param customizeProperties A {@link Consumer} to call with the preset properties * @param customizeProperties A {@link Consumer} to call with the preset properties
* @param settings The properties as created by the Block * @param settings The properties as created by the Block

View file

@ -16,7 +16,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.ChainBlock; import net.minecraft.world.level.block.ChainBlock;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.LootContext;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@ -29,7 +29,7 @@ import java.util.Optional;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
public class BaseChainBlock extends ChainBlock implements BlockModelProvider, RenderLayerProvider { public class BaseChainBlock extends ChainBlock implements BlockModelProvider, RenderLayerProvider {
public BaseChainBlock(MaterialColor color) { public BaseChainBlock(MapColor color) {
this(Properties.copy(Blocks.CHAIN).color(color)); this(Properties.copy(Blocks.CHAIN).color(color));
} }

View file

@ -24,7 +24,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LeavesBlock; import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
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;
@ -37,7 +37,7 @@ 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 BlockBehaviour.Properties makeLeaves(MaterialColor color) { private static BlockBehaviour.Properties makeLeaves(MapColor color) {
return BlockBehaviour.Properties return BlockBehaviour.Properties
.copy(Blocks.OAK_LEAVES) .copy(Blocks.OAK_LEAVES)
.color(color) .color(color)
@ -49,7 +49,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
public BaseLeavesBlock( public BaseLeavesBlock(
Block sapling, Block sapling,
MaterialColor color, MapColor color,
Consumer<BlockBehaviour.Properties> customizeProperties Consumer<BlockBehaviour.Properties> customizeProperties
) { ) {
super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color))); super(BaseBlock.acceptAndReturn(customizeProperties, makeLeaves(color)));
@ -58,7 +58,7 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
public BaseLeavesBlock( public BaseLeavesBlock(
Block sapling, Block sapling,
MaterialColor color, MapColor color,
int light, int light,
Consumer<BlockBehaviour.Properties> customizeProperties Consumer<BlockBehaviour.Properties> customizeProperties
) { ) {
@ -66,12 +66,12 @@ public class BaseLeavesBlock extends LeavesBlock implements BlockModelProvider,
this.sapling = sapling; this.sapling = sapling;
} }
public BaseLeavesBlock(Block sapling, MaterialColor color) { public BaseLeavesBlock(Block sapling, MapColor color) {
super(makeLeaves(color)); super(makeLeaves(color));
this.sapling = sapling; this.sapling = sapling;
} }
public BaseLeavesBlock(Block sapling, MaterialColor color, int light) { public BaseLeavesBlock(Block sapling, MapColor color, int light) {
super(makeLeaves(color).lightLevel(state -> light)); super(makeLeaves(color).lightLevel(state -> light));
this.sapling = sapling; this.sapling = sapling;
} }

View file

@ -24,8 +24,8 @@ import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.DropExperienceBlock; import net.minecraft.world.level.block.DropExperienceBlock;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
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;
@ -46,7 +46,7 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
public BaseOreBlock(Supplier<Item> drop, int minCount, int maxCount, int experience, int miningLevel) { public BaseOreBlock(Supplier<Item> drop, int minCount, int maxCount, int experience, int miningLevel) {
this( this(
Properties Properties
.of(Material.STONE, MaterialColor.SAND) .of(Material.STONE, MapColor.SAND)
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.destroyTime(3F) .destroyTime(3F)
.explosionResistance(9F) .explosionResistance(9F)
@ -137,7 +137,7 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
@Override @Override
public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) { public void addTags(List<TagKey<Block>> blockTags, List<TagKey<Item>> itemTags) {
blockTags.add(CommonBlockTags.ORES); blockTags.add(CommonBlockTags.ORES);
if (this.miningLevel == Tiers.STONE.getLevel()) { if (this.miningLevel == Tiers.STONE.getLevel()) {
blockTags.add(BlockTags.NEEDS_STONE_TOOL); blockTags.add(BlockTags.NEEDS_STONE_TOOL);
} else if (this.miningLevel == Tiers.IRON.getLevel()) { } else if (this.miningLevel == Tiers.IRON.getLevel()) {

View file

@ -14,14 +14,14 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.RotatedPillarBlock; import net.minecraft.world.level.block.RotatedPillarBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
public class BaseStripableLogBlock extends BaseRotatedPillarBlock { public class BaseStripableLogBlock extends BaseRotatedPillarBlock {
private final Block striped; private final Block striped;
public BaseStripableLogBlock(MaterialColor color, Block striped) { public BaseStripableLogBlock(MapColor color, Block striped) {
super(Properties.copy(striped).color(color)); super(Properties.copy(striped).color(color));
this.striped = striped; this.striped = striped;
} }

View file

@ -31,7 +31,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SnowLayerBlock; import net.minecraft.world.level.block.SnowLayerBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.lighting.LayerLightEngine; import net.minecraft.world.level.lighting.LayerLightEngine;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
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.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
@ -52,7 +52,7 @@ public class BaseTerrainBlock extends BaseBlock {
private final Block baseBlock; private final Block baseBlock;
private Block pathBlock; private Block pathBlock;
public BaseTerrainBlock(Block baseBlock, MaterialColor color) { public BaseTerrainBlock(Block baseBlock, MapColor color) {
super(Properties super(Properties
.copy(baseBlock) .copy(baseBlock)
.color(color) .color(color)

View file

@ -7,14 +7,14 @@ import net.minecraft.util.FormattedCharSequence;
import net.minecraft.world.item.Tiers; import net.minecraft.world.item.Tiers;
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.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import java.util.List; import java.util.List;
public class LeveledAnvilBlock extends BaseAnvilBlock { public class LeveledAnvilBlock extends BaseAnvilBlock {
protected final int level; protected final int level;
public LeveledAnvilBlock(MaterialColor color, int level) { public LeveledAnvilBlock(MapColor color, int level) {
super(color); super(color);
this.level = level; this.level = level;
} }

View file

@ -13,13 +13,13 @@ import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import java.util.List; import java.util.List;
public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe { public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerProvider, TagProvider, AddMineableShears, AddMineableHoe {
public SimpleLeavesBlock(MaterialColor color) { public SimpleLeavesBlock(MapColor color) {
this( this(
Properties Properties
.of(Material.LEAVES) .of(Material.LEAVES)
@ -33,11 +33,11 @@ public class SimpleLeavesBlock extends BaseBlockNotFull implements RenderLayerPr
); );
} }
public SimpleLeavesBlock(MaterialColor color, int light) { public SimpleLeavesBlock(MapColor color, int light) {
this( this(
Properties Properties
.of(Material.LEAVES) .of(Material.LEAVES)
.lightLevel(ignored->light) .lightLevel(ignored -> light)
.color(color) .color(color)
.strength(0.2F) .strength(0.2F)
.sound(SoundType.GRASS) .sound(SoundType.GRASS)

View file

@ -13,14 +13,14 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
public class StripableBarkBlock extends BaseBarkBlock { public class StripableBarkBlock extends BaseBarkBlock {
private final Block striped; private final Block striped;
public StripableBarkBlock(MaterialColor color, Block striped) { public StripableBarkBlock(MapColor color, Block striped) {
super(Properties.copy(striped).color(color)); super(Properties.copy(striped).color(color));
this.striped = striped; this.striped = striped;
} }

View file

@ -26,7 +26,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
@ -48,7 +48,7 @@ public class TripleTerrainBlock extends BaseTerrainBlock {
this.registerDefaultState(defaultBlockState().setValue(SHAPE, TripleShape.BOTTOM)); this.registerDefaultState(defaultBlockState().setValue(SHAPE, TripleShape.BOTTOM));
} }
public TripleTerrainBlock(Block baseBlock, MaterialColor color) { public TripleTerrainBlock(Block baseBlock, MapColor color) {
super(baseBlock, color); super(baseBlock, color);
this.registerDefaultState(defaultBlockState().setValue(SHAPE, TripleShape.BOTTOM)); this.registerDefaultState(defaultBlockState().setValue(SHAPE, TripleShape.BOTTOM));
} }

View file

@ -21,7 +21,7 @@ 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.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.WoodType; import net.minecraft.world.level.block.state.properties.WoodType;
import net.minecraft.world.level.material.MaterialColor; import net.minecraft.world.level.material.MapColor;
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;
@ -52,8 +52,8 @@ public class WoodenComplexMaterial extends ComplexMaterial {
public static final String TAG_LOGS = "logs"; public static final String TAG_LOGS = "logs";
public final MaterialColor planksColor; public final MapColor planksColor;
public final MaterialColor woodColor; public final MapColor woodColor;
public final WoodType woodType; public final WoodType woodType;
@ -61,8 +61,8 @@ public class WoodenComplexMaterial extends ComplexMaterial {
String modID, String modID,
String baseName, String baseName,
String receipGroupPrefix, String receipGroupPrefix,
MaterialColor woodColor, MapColor woodColor,
MaterialColor planksColor MapColor planksColor
) { ) {
super(modID, baseName, receipGroupPrefix); super(modID, baseName, receipGroupPrefix);
this.planksColor = planksColor; this.planksColor = planksColor;