添加画

image-20231029172543488

image-20231029172640107

添加画

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package net.tutorialmod.painting;

import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.entity.decoration.PaintingVariant;
import net.minecraft.world.level.block.Block;
import net.tutorialmod.TutorialMod;

public class ModPainting {
public static final DeferredRegister<PaintingVariant> PAINTING_VARIANTS = DeferredRegister.create(TutorialMod.MOD_ID, Registries.PAINTING_VARIANT);
public static final RegistrySupplier<PaintingVariant> PLANT = PAINTING_VARIANTS.register("plant",
() -> new PaintingVariant(16, 16));
public static final RegistrySupplier<PaintingVariant> WANDERER = PAINTING_VARIANTS.register("wanderer",
() -> new PaintingVariant(16, 32));
public static final RegistrySupplier<PaintingVariant> SUNSET = PAINTING_VARIANTS.register("sunset",
() -> new PaintingVariant(32, 16));

public static void register(){
PAINTING_VARIANTS.register();
}

}

main类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

package net.tutorialmod;

import com.google.common.base.Suppliers;
import dev.architectury.registry.CreativeTabRegistry;
import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrarManager;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.tutorialmod.block.ModBlock;
import net.tutorialmod.item.ModCreativeTab;
import net.tutorialmod.item.ModItem;
import net.tutorialmod.painting.ModPainting;

import java.util.function.Supplier;

public class TutorialMod {
public static final String MOD_ID = "tutorialmod";
// We can use this if we don't want to use DeferredRegister
public static final Supplier<RegistrarManager> REGISTRIES = Suppliers.memoize(() -> RegistrarManager.get(MOD_ID));

public static void init() {
ModCreativeTab.register();
ModBlock.register();
ModItem.register();
ModPainting.register();

System.out.println(TutorialModExpectPlatform.getConfigDirectory().toAbsolutePath().normalize().toString());
}
}

添加tags

1
2
3
4
5
6
7
{
"values": [
"tutorialmod:wanderer",
"tutorialmod:plant",
"tutorialmod:sunset"
]
}

添加贴图

image-20231029172554282