Changing model loading (WIP)

This commit is contained in:
Aleksey 2021-05-22 19:14:52 +03:00
parent 4d2e3d7be6
commit 53c9525c2d
33 changed files with 435 additions and 128 deletions

View file

@ -6,7 +6,6 @@ import java.util.Optional;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
@ -18,6 +17,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import org.jetbrains.annotations.Nullable;
import ru.betterend.client.models.ModelsHelper;
import ru.betterend.client.models.Patterns;
public class EndBookshelfBlock extends BlockBase {
@ -44,10 +44,10 @@ public class EndBookshelfBlock extends BlockBase {
}
@Override
public @Nullable UnbakedModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
public @Nullable BlockModel getBlockModel(ResourceLocation blockId, BlockState blockState) {
Optional<String> pattern = Patterns.createJson(Patterns.BLOCK_BOOKSHELF,
getName(blockId), blockId.getPath());
return pattern.map(BlockModel::fromString).orElse(null);
return ModelsHelper.fromPattern(pattern);
}
private String getName(ResourceLocation blockId) {