This commit is contained in:
yyc12345 2021-04-21 22:23:51 +08:00
parent 814dd17539
commit e9bda0415b
40 changed files with 407 additions and 75 deletions

View File

@ -0,0 +1,176 @@
package net.yyc12345.teyvatcraft;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.util.Identifier;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Blocks;
import net.minecraft.util.Rarity;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.world.gen.GenerationStep;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
import net.yyc12345.teyvatcraft.items.gnosis.*;
public class RegisterManager {
public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(
new Identifier("teyvatcraft", "general"),
() -> new ItemStack(Blocks.COBBLESTONE));
// ==================== gnosis
public static final GnosisDendro GNOSIS_DENDRO = new GnosisDendro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisHydro GNOSIS_HYDRO = new GnosisHydro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisPyro GNOSIS_PYRO = new GnosisPyro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisGeo GNOSIS_GEO = new GnosisGeo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisElectro GNOSIS_ELECTRO = new GnosisElectro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisAnemo GNOSIS_ANEMO = new GnosisAnemo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisCryo GNOSIS_CRYO = new GnosisCryo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
// ==================== ore
public static final Block MAGICAL_CRYSTAL_CHUNK_ORE = new Block(FabricBlockSettings.of(Material.METAL).hardness(4.0f));
public static final Block CRYSTAL_CHUNK_ORE = new Block(FabricBlockSettings.of(Material.METAL).hardness(4.0f));
public static final Block WHITE_IRON_CHUNK_ORE = new Block(FabricBlockSettings.of(Material.METAL).hardness(4.0f));
public static final Block IRON_CHUNK_ORE = new Block(FabricBlockSettings.of(Material.STONE).hardness(4.0f));
public static final Item MAGICAL_CRYSTAL_CHUNK = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item CRYSTAL_CHUNK = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item WHITE_IRON_CHUNK = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item IRON_CHUNK = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item MYSTIC_ENHANCEMENT_ORE = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item FINE_ENHANCEMENT_ORE = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item ENHANCEMENT_ORE = new Item(new FabricItemSettings().group(ITEM_GROUP));
// ==================== ore gen
private static ConfiguredFeature<?, ?> OREGEN_MAGICAL_CRYSTAL_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
MAGICAL_CRYSTAL_CHUNK_ORE.getDefaultState(),
1)) // vein size
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 12)))
.spreadHorizontally()
.repeat(1); // number of veins per chunk
private static ConfiguredFeature<?, ?> OREGEN_CRYSTAL_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
CRYSTAL_CHUNK_ORE.getDefaultState(),
4))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 32)))
.spreadHorizontally()
.repeat(12);
private static ConfiguredFeature<?, ?> OREGEN_WHITE_IRON_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
WHITE_IRON_CHUNK_ORE.getDefaultState(),
4))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 64)))
.spreadHorizontally()
.repeat(24);
private static ConfiguredFeature<?, ?> OREGEN_IRON_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
IRON_CHUNK_ORE.getDefaultState(),
8))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 64)))
.spreadHorizontally()
.repeat(24);
private static void RegisterOreGeneration(String mIdentifier, ConfiguredFeature<?, ?> genStasticas) {
RegistryKey<ConfiguredFeature<?, ?>> regKey = RegistryKey.of(Registry.CONFIGURED_FEATURE_WORLDGEN,
new Identifier("teyvatcraft", mIdentifier));
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, regKey.getValue(), genStasticas);
BiomeModifications.addFeature(BiomeSelectors.foundInOverworld(), GenerationStep.Feature.UNDERGROUND_ORES, regKey);
}
public static void RegisterAll() {
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_dendro"), GNOSIS_DENDRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_hydro"), GNOSIS_HYDRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_pyro"), GNOSIS_PYRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_geo"), GNOSIS_GEO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_electro"), GNOSIS_ELECTRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_anemo"), GNOSIS_ANEMO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_cryo"), GNOSIS_CRYO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "magical_crystal_chunk"), MAGICAL_CRYSTAL_CHUNK);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "crystal_chunk"), CRYSTAL_CHUNK);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "white_iron_chunk"), WHITE_IRON_CHUNK);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "iron_chunk"), IRON_CHUNK);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "mystic_enhancement_ore"), MYSTIC_ENHANCEMENT_ORE);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "fine_enhancement_ore"), FINE_ENHANCEMENT_ORE);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "enhancement_ore"), ENHANCEMENT_ORE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "magical_crystal_chunk_ore"), MAGICAL_CRYSTAL_CHUNK_ORE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "crystal_chunk_ore"), CRYSTAL_CHUNK_ORE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "white_iron_chunk_ore"), WHITE_IRON_CHUNK_ORE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "iron_chunk_ore"), IRON_CHUNK_ORE);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "magical_crystal_chunk_ore"),
new BlockItem(MAGICAL_CRYSTAL_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "crystal_chunk_ore"),
new BlockItem(CRYSTAL_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "white_iron_chunk_ore"),
new BlockItem(WHITE_IRON_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "iron_chunk_ore"),
new BlockItem(IRON_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
RegisterOreGeneration("oregen_magical_crystal_ore", OREGEN_MAGICAL_CRYSTAL_CHUNK_ORE);
RegisterOreGeneration("oregen_crystal_ore", OREGEN_CRYSTAL_CHUNK_ORE);
RegisterOreGeneration("oregen_white_iron_ore", OREGEN_WHITE_IRON_CHUNK_ORE);
RegisterOreGeneration("oregen_iron_ore", OREGEN_IRON_CHUNK_ORE);
}
}

View File

@ -1,11 +1,11 @@
package net.yyc12345.teyvatcraft; package net.yyc12345.teyvatcraft;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.yyc12345.teyvatcraft.items.ItemsManager; import net.yyc12345.teyvatcraft.RegisterManager;
public class TeyvatCraft implements ModInitializer { public class TeyvatCraft implements ModInitializer {
@Override @Override
public void onInitialize() { public void onInitialize() {
ItemsManager.RegisterAll(); RegisterManager.RegisterAll();
} }
} }

View File

@ -1,71 +0,0 @@
package net.yyc12345.teyvatcraft.items;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.util.Identifier;
import net.minecraft.item.ItemGroup;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.minecraft.item.ItemStack;
import net.minecraft.block.Blocks;
import net.minecraft.util.Rarity;
import net.yyc12345.teyvatcraft.items.gnosis.*;
public class ItemsManager {
public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(
new Identifier("teyvatcraft", "general"),
() -> new ItemStack(Blocks.COBBLESTONE));
// ==================== gnosis
public static final GnosisDendro GNOSIS_DENDRO = new GnosisDendro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisHydro GNOSIS_HYDRO = new GnosisHydro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisPyro GNOSIS_PYRO = new GnosisPyro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisGeo GNOSIS_GEO = new GnosisGeo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisElectro GNOSIS_ELECTRO = new GnosisElectro(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisAnemo GNOSIS_ANEMO = new GnosisAnemo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static final GnosisCryo GNOSIS_CRYO = new GnosisCryo(
new FabricItemSettings()
.group(ITEM_GROUP)
.maxCount(1)
.rarity(Rarity.EPIC)
);
public static void RegisterAll() {
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_dendro"), GNOSIS_DENDRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_hydro"), GNOSIS_HYDRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_pyro"), GNOSIS_PYRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_geo"), GNOSIS_GEO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_electro"), GNOSIS_ELECTRO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_anemo"), GNOSIS_ANEMO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "gnosis_cryo"), GNOSIS_CRYO);
}
}

View File

@ -0,0 +1,15 @@
package net.yyc12345.teyvatcraft.world;
import net.minecraft.block.Blocks;
import net.minecraft.world.gen.decorator.Decorator;
import net.minecraft.world.gen.decorator.RangeDecoratorConfig;
import net.minecraft.world.gen.feature.ConfiguredFeature;
import net.minecraft.world.gen.feature.Feature;
import net.minecraft.world.gen.feature.OreFeatureConfig;
public class OreGenerate {
public void RegisterAll() {
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "teyvatcraft:block/crystal_chunk_ore"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "teyvatcraft:block/iron_chunk_ore"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "teyvatcraft:block/magical_crystal_chunk_ore"
}
}
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "teyvatcraft:block/white_iron_chunk_ore"
}
}
}

View File

@ -1,10 +1,25 @@
{ {
"itemGroup.teyvatcraft.general": "Genshin Impact", "itemGroup.teyvatcraft.general": "Genshin Impact",
"item.teyvatcraft.gnosis_dendro": "Dendro Gnosis", "item.teyvatcraft.gnosis_dendro": "Dendro Gnosis",
"item.teyvatcraft.gnosis_hydro": "Hydro Gnosis", "item.teyvatcraft.gnosis_hydro": "Hydro Gnosis",
"item.teyvatcraft.gnosis_pyro": "Pyro Gnosis", "item.teyvatcraft.gnosis_pyro": "Pyro Gnosis",
"item.teyvatcraft.gnosis_geo": "Geo Gnosis", "item.teyvatcraft.gnosis_geo": "Geo Gnosis",
"item.teyvatcraft.gnosis_electro": "Electro Gnosis", "item.teyvatcraft.gnosis_electro": "Electro Gnosis",
"item.teyvatcraft.gnosis_anemo": "Anemo Gnosis", "item.teyvatcraft.gnosis_anemo": "Anemo Gnosis",
"item.teyvatcraft.gnosis_cryo": "Cryo Gnosis" "item.teyvatcraft.gnosis_cryo": "Cryo Gnosis",
"item.teyvatcraft.magical_crystal_chunk": "Magical Crystal Chunk",
"item.teyvatcraft.crystal_chunk": "Crystal Chunk",
"item.teyvatcraft.white_iron_chunk": "White Iron Chunk",
"item.teyvatcraft.iron_chunk": "Iron Chunk",
"item.teyvatcraft.mystic_enhancement_ore": "Mystic Enhancement Ore",
"item.teyvatcraft.fine_enhancement_ore": "Fine Enhancement Ore",
"item.teyvatcraft.enhancement_ore": "Enhancement Ore",
"block.teyvatcraft.magical_crystal_chunk_ore": "Magical Crystal Chunk Ore",
"block.teyvatcraft.crystal_chunk_ore": "Crystal Chunk Ore",
"block.teyvatcraft.white_iron_chunk_ore": "White Iron Chunk Ore",
"block.teyvatcraft.iron_chunk_ore": "Iron Chunk Ore"
} }

View File

@ -1,10 +1,25 @@
{ {
"itemGroup.teyvatcraft.general": "原神", "itemGroup.teyvatcraft.general": "原神",
"item.teyvatcraft.gnosis_dendro": "神之心 - 草", "item.teyvatcraft.gnosis_dendro": "神之心 - 草",
"item.teyvatcraft.gnosis_hydro": "神之心 - 水", "item.teyvatcraft.gnosis_hydro": "神之心 - 水",
"item.teyvatcraft.gnosis_pyro": "神之心 - 火", "item.teyvatcraft.gnosis_pyro": "神之心 - 火",
"item.teyvatcraft.gnosis_geo": "神之心 - 岩", "item.teyvatcraft.gnosis_geo": "神之心 - 岩",
"item.teyvatcraft.gnosis_electro": "神之心 - 雷", "item.teyvatcraft.gnosis_electro": "神之心 - 雷",
"item.teyvatcraft.gnosis_anemo": "神之心 - 风", "item.teyvatcraft.gnosis_anemo": "神之心 - 风",
"item.teyvatcraft.gnosis_cryo": "神之心 - 冰" "item.teyvatcraft.gnosis_cryo": "神之心 - 冰",
"item.teyvatcraft.magical_crystal_chunk": "魔晶块",
"item.teyvatcraft.crystal_chunk": "水晶块",
"item.teyvatcraft.white_iron_chunk": "白铁块",
"item.teyvatcraft.iron_chunk": "铁块",
"item.teyvatcraft.mystic_enhancement_ore": "精锻用魔矿",
"item.teyvatcraft.fine_enhancement_ore": "精锻用良矿",
"item.teyvatcraft.enhancement_ore": "精锻用杂矿",
"block.teyvatcraft.magical_crystal_chunk_ore": "魔晶块矿石",
"block.teyvatcraft.crystal_chunk_ore": "水晶块矿石",
"block.teyvatcraft.white_iron_chunk_ore": "白铁块矿石",
"block.teyvatcraft.iron_chunk_ore": "铁块矿石"
} }

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:crystal_chunk"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:iron_chunk"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:magical_crystal_chunk"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,19 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:white_iron_chunk"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "teyvatcraft:block/crystal_chunk_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "teyvatcraft:block/iron_chunk_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "teyvatcraft:block/magical_crystal_chunk_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "teyvatcraft:block/white_iron_chunk_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/crystal_chunk"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "teyvatcraft:block/crystal_chunk_ore"
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/enhancement_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/fine_enhancement_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/iron_chunk"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "teyvatcraft:block/iron_chunk_ore"
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/magical_crystal_chunk"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "teyvatcraft:block/magical_crystal_chunk_ore"
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/mystic_enhancement_ore"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "teyvatcraft:item/white_iron_chunk"
}
}

View File

@ -0,0 +1,3 @@
{
"parent": "teyvatcraft:block/white_iron_chunk_ore"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB