add some garbage

This commit is contained in:
2021-04-24 21:28:06 +08:00
parent 1e0d9a52cd
commit 5908788ab0
24 changed files with 520 additions and 355 deletions

View File

@ -1,243 +0,0 @@
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.object.builder.v1.block.FabricMaterialBuilder;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
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.sound.BlockSoundGroup;
import net.minecraft.block.Blocks;
import net.minecraft.util.Rarity;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.OreBlock;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.item.AliasedBlockItem;
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.blocks.*;
import net.yyc12345.teyvatcraft.items.SeedItem;
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 OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 4).requiresTool().strength(4.0F, 4.0F));
public static final Block CRYSTAL_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 3).requiresTool().strength(4.0F, 4.0F));
public static final Block WHITE_IRON_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 2).requiresTool().strength(3.0F, 3.0F));
public static final Block IRON_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 1).requiresTool().strength(3.0F, 3.0F));
public static final Block STARSILVER_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 1).requiresTool().strength(2.0F, 2.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 STARSILVER = 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));
// ==================== crops
public static final Block RICE_block = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).nonOpaque());
public static final Block TOMATO_block = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block ONION_block = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block CABBAGE_block = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block RADDISH_block = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Item RICE_item = new Item(new FabricItemSettings().group(ITEM_GROUP));
public static final Item TOMATO_item = new SeedItem(TOMATO_block, new FabricItemSettings().group(ITEM_GROUP));
public static final Item ONION_item = new SeedItem(ONION_block, new FabricItemSettings().group(ITEM_GROUP));
public static final Item CABBAGE_item = new SeedItem(CABBAGE_block, new FabricItemSettings().group(ITEM_GROUP));
public static final Item RADDISH_item = new SeedItem(RADDISH_block, new FabricItemSettings().group(ITEM_GROUP));
public static final Item RICE_SEED_item = new SeedItem(RICE_block, 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(5); // 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 ConfiguredFeature<?, ?> OREGEN_STARSILVER_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
IRON_CHUNK_ORE.getDefaultState(),
4))
.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);
// ore
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", "starsilver"), STARSILVER);
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.BLOCK, new Identifier("teyvatcraft", "starsilver_ore"), STARSILVER_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)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "starsilver_ore"),
new BlockItem(STARSILVER_ORE, new Item.Settings().group(ITEM_GROUP)));
// crops
((TeyvatCropBlock)RICE_block).setSeedsItem(RICE_SEED_item);
((TeyvatCropBlock)TOMATO_block).setSeedsItem(TOMATO_item);
((TeyvatCropBlock)ONION_block).setSeedsItem(ONION_item);
((TeyvatCropBlock)CABBAGE_block).setSeedsItem(CABBAGE_item);
((TeyvatCropBlock)RADDISH_block).setSeedsItem(RADDISH_item);
BlockRenderLayerMap.INSTANCE.putBlock(RICE_block, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(TOMATO_block, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(ONION_block, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(CABBAGE_block, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(RADDISH_block, RenderLayer.getCutoutMipped());
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice"), RICE_item);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "tomato"), TOMATO_item);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "onion"), ONION_item);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "cabbage"), CABBAGE_item);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "raddish"), RADDISH_item);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice_seed"), RICE_SEED_item);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "rice"), RICE_block);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "tomato"), TOMATO_block);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "onion"), ONION_block);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "cabbage"), CABBAGE_block);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "raddish"), RADDISH_block);
// ore gen
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);
RegisterOreGeneration("oregen_starsilver_ore", OREGEN_STARSILVER_ORE);
}
}

View File

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

View File

@ -0,0 +1,49 @@
package net.yyc12345.teyvatcraft.blocks;
import net.minecraft.block.BlockState;
import net.minecraft.block.SweetBerryBushBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class TeyvatHarvestablePlantBlock extends SweetBerryBushBlock {
private Item droppedItem;
public TeyvatHarvestablePlantBlock(Settings settings, Item droppedItem) {
super(settings);
this.droppedItem = droppedItem;
}
@Override
public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
// revoke sweet berry bush default operation
return;
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
int i = ((Integer)state.get(AGE)).intValue();
boolean bl = (i == 3);
if (!bl && player.getStackInHand(hand).getItem() == Items.BONE_MEAL)
return ActionResult.PASS;
if (i > 1) {
int j = 1 + world.random.nextInt(2);
dropStack(world, pos, new ItemStack((ItemConvertible)droppedItem, j + (bl ? 1 : 0)));
world.playSound(null, pos, SoundEvents.ITEM_SWEET_BERRIES_PICK_FROM_BUSH, SoundCategory.BLOCKS, 1.0F, 0.8F + world.random.nextFloat() * 0.4F);
world.setBlockState(pos, (BlockState)state.with(AGE, Integer.valueOf(1)), 2);
return ActionResult.success(world.isClient);
}
return super.onUse(state, world, pos, player, hand, hit);
}
}

View File

@ -0,0 +1,60 @@
package net.yyc12345.teyvatcraft.init;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricMaterialBuilder;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.OreBlock;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.yyc12345.teyvatcraft.blocks.TeyvatCropBlock;
public class BlocksManager {
// ==================== ore
public static final Block MAGICAL_CRYSTAL_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 4).requiresTool().strength(4.0F, 4.0F));
public static final Block CRYSTAL_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 3).requiresTool().strength(4.0F, 4.0F));
public static final Block WHITE_IRON_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 2).requiresTool().strength(3.0F, 3.0F));
public static final Block IRON_CHUNK_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 1).requiresTool().strength(3.0F, 3.0F));
public static final Block STARSILVER_ORE = new OreBlock(FabricBlockSettings.of(new FabricMaterialBuilder(MaterialColor.STONE).build()).breakByTool(FabricToolTags.PICKAXES, 1).requiresTool().strength(2.0F, 2.0F));
// ==================== crops
public static final Block RICE = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP).nonOpaque());
public static final Block TOMATO = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block ONION = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block CABBAGE = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static final Block RADDISH = new TeyvatCropBlock(FabricBlockSettings.of(Material.PLANT).noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static void RegisterAll() {
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.BLOCK, new Identifier("teyvatcraft", "starsilver_ore"), STARSILVER_ORE);
// crops
((TeyvatCropBlock)RICE).setSeedsItem(ItemsManager.RICE_SEED);
((TeyvatCropBlock)TOMATO).setSeedsItem(ItemsManager.TOMATO);
((TeyvatCropBlock)ONION).setSeedsItem(ItemsManager.ONION);
((TeyvatCropBlock)CABBAGE).setSeedsItem(ItemsManager.CABBAGE);
((TeyvatCropBlock)RADDISH).setSeedsItem(ItemsManager.RADDISH);
BlockRenderLayerMap.INSTANCE.putBlock(RICE, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(TOMATO, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(ONION, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(CABBAGE, RenderLayer.getCutoutMipped());
BlockRenderLayerMap.INSTANCE.putBlock(RADDISH, RenderLayer.getCutoutMipped());
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "rice"), RICE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "tomato"), TOMATO);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "onion"), ONION);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "cabbage"), CABBAGE);
Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "raddish"), RADDISH);
}
}

View File

@ -0,0 +1,7 @@
package net.yyc12345.teyvatcraft.init;
public class DungeonManager {
public static void RegisterAll() {
}
}

View File

@ -0,0 +1,102 @@
package net.yyc12345.teyvatcraft.init;
import net.minecraft.util.registry.Registry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
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.item.Items;
import net.minecraft.util.Rarity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
import static net.minecraft.block.ComposterBlock.ITEM_TO_LEVEL_INCREASE_CHANCE;
import net.yyc12345.teyvatcraft.items.SeedItem;
public class ItemsManager {
public static final ItemGroup ITEM_GROUP = FabricItemGroupBuilder.build(
new Identifier("teyvatcraft", "general"),
() -> new ItemStack(Items.NETHER_STAR));
// ==================== gnosis
public static final Item GNOSIS_DENDRO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_HYDRO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_PYRO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_GEO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_ELECTRO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_ANEMO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
public static final Item GNOSIS_CRYO = new Item(new FabricItemSettings().group(ITEM_GROUP).maxCount(1).rarity(Rarity.EPIC).fireproof());
// ==================== ore
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 STARSILVER = new Item(new FabricItemSettings().group(ITEM_GROUP));
// ==================== weapon enhancement
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));
// ==================== crops
public static final Item RICE = new Item(new FabricItemSettings().group(ITEM_GROUP).food((new FoodComponent.Builder()).hunger(1).saturationModifier(0.3F).build()));
public static final Item TOMATO = new SeedItem(BlocksManager.TOMATO, new FabricItemSettings().group(ITEM_GROUP).food((new FoodComponent.Builder()).hunger(1).saturationModifier(0.3F).build()));
public static final Item ONION = new SeedItem(BlocksManager.ONION, new FabricItemSettings().group(ITEM_GROUP).food((new FoodComponent.Builder()).hunger(1).saturationModifier(0.3F).build()));
public static final Item CABBAGE = new SeedItem(BlocksManager.CABBAGE, new FabricItemSettings().group(ITEM_GROUP).food((new FoodComponent.Builder()).hunger(1).saturationModifier(0.3F).build()));
public static final Item RADDISH = new SeedItem(BlocksManager.RADDISH, new FabricItemSettings().group(ITEM_GROUP).food((new FoodComponent.Builder()).hunger(1).saturationModifier(0.3F).build()));
public static final Item RICE_SEED = new SeedItem(BlocksManager.RICE, new FabricItemSettings().group(ITEM_GROUP));
public static void registerCompostableItem(float levelIncreaseChance, ItemConvertible item) {
ITEM_TO_LEVEL_INCREASE_CHANCE.put(item.asItem(), levelIncreaseChance);
}
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);
// ore
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", "starsilver"), STARSILVER);
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.ITEM, new Identifier("teyvatcraft", "magical_crystal_chunk_ore"),
new BlockItem(BlocksManager.MAGICAL_CRYSTAL_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "crystal_chunk_ore"),
new BlockItem(BlocksManager.CRYSTAL_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "white_iron_chunk_ore"),
new BlockItem(BlocksManager.WHITE_IRON_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "iron_chunk_ore"),
new BlockItem(BlocksManager.IRON_CHUNK_ORE, new Item.Settings().group(ITEM_GROUP)));
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "starsilver_ore"),
new BlockItem(BlocksManager.STARSILVER_ORE, new Item.Settings().group(ITEM_GROUP)));
// crops
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice"), RICE);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "tomato"), TOMATO);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "onion"), ONION);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "cabbage"), CABBAGE);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "raddish"), RADDISH);
Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice_seed"), RICE_SEED);
registerCompostableItem(0.65f, RICE);
registerCompostableItem(0.65f, TOMATO);
registerCompostableItem(0.65f, ONION);
registerCompostableItem(0.65f, CABBAGE);
registerCompostableItem(0.65f, RADDISH);
registerCompostableItem(0.3f, RICE_SEED);
}
}

View File

@ -0,0 +1,80 @@
package net.yyc12345.teyvatcraft.init;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
import net.fabricmc.fabric.api.biome.v1.BiomeSelectors;
import net.minecraft.util.Identifier;
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;
public class TerrainsManager {
// ==================== ore gen
private static ConfiguredFeature<?, ?> OREGEN_MAGICAL_CRYSTAL_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
BlocksManager.MAGICAL_CRYSTAL_CHUNK_ORE.getDefaultState(),
1)) // vein size
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 12)))
.spreadHorizontally()
.repeat(5); // number of veins per chunk
private static ConfiguredFeature<?, ?> OREGEN_CRYSTAL_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
BlocksManager.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,
BlocksManager.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,
BlocksManager.IRON_CHUNK_ORE.getDefaultState(),
8))
.decorate(Decorator.RANGE.configure(new RangeDecoratorConfig(0, 0, 64)))
.spreadHorizontally()
.repeat(24);
private static ConfiguredFeature<?, ?> OREGEN_STARSILVER_ORE = Feature.ORE
.configure(new OreFeatureConfig(
OreFeatureConfig.Rules.BASE_STONE_OVERWORLD,
BlocksManager.IRON_CHUNK_ORE.getDefaultState(),
4))
.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() {
// ore gen
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);
RegisterOreGeneration("oregen_starsilver_ore", OREGEN_STARSILVER_ORE);
}
}

View File

@ -0,0 +1,31 @@
package net.yyc12345.teyvatcraft.init;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import net.minecraft.item.Item;
import net.yyc12345.teyvatcraft.mixin.VillagerAccess;
public class VillagerManager {
public static void RegisterAll() {
// register villager food
ImmutableMap.Builder<Item, Integer> villagerFoodItems = new ImmutableMap.Builder<Item, Integer>().putAll(VillagerAccess.getItemFoodValues());
villagerFoodItems.put(ItemsManager.RICE, ItemsManager.RICE.getFoodComponent().getHunger());
villagerFoodItems.put(ItemsManager.TOMATO, ItemsManager.TOMATO.getFoodComponent().getHunger());
villagerFoodItems.put(ItemsManager.ONION, ItemsManager.ONION.getFoodComponent().getHunger());
villagerFoodItems.put(ItemsManager.CABBAGE, ItemsManager.CABBAGE.getFoodComponent().getHunger());
villagerFoodItems.put(ItemsManager.RADDISH, ItemsManager.RADDISH.getFoodComponent().getHunger());
VillagerAccess.setItemFoodValues(villagerFoodItems.build());
// register villager gatherables
ImmutableSet.Builder<Item> villagerGatherables= new ImmutableSet.Builder<Item>().addAll(VillagerAccess.getGatherableItems());
villagerGatherables.add(ItemsManager.RICE);
villagerGatherables.add(ItemsManager.TOMATO);
villagerGatherables.add(ItemsManager.ONION);
villagerGatherables.add(ItemsManager.CABBAGE);
villagerGatherables.add(ItemsManager.RADDISH);
VillagerAccess.setGatherableItems(villagerGatherables.build());
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisAnemo extends GnosisPrototype {
public GnosisAnemo(Settings settings) {
super(settings);
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisCryo extends GnosisPrototype {
public GnosisCryo(Settings settings) {
super(settings);
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisDendro extends GnosisPrototype {
public GnosisDendro(Settings settings) {
super(settings);
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisElectro extends GnosisPrototype {
public GnosisElectro(Settings settings) {
super(settings);
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisGeo extends GnosisPrototype {
public GnosisGeo(Settings settings) {
super(settings);
}
}

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisHydro extends GnosisPrototype {
public GnosisHydro(Settings settings) {
super(settings);
}
}

View File

@ -1,7 +1,6 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
public class GnosisPrototype extends Item {
public GnosisPrototype(Settings settings) {

View File

@ -1,11 +0,0 @@
package net.yyc12345.teyvatcraft.items.gnosis;
import net.yyc12345.teyvatcraft.items.gnosis.GnosisPrototype;
import net.minecraft.item.Item.Settings;
public class GnosisPyro extends GnosisPrototype {
public GnosisPyro(Settings settings) {
super(settings);
}
}

View File

@ -1,7 +1,6 @@
package net.yyc12345.teyvatcraft.items.vision;
import net.minecraft.item.Item;
import net.minecraft.item.Item.Settings;
public class VisionPrototype extends Item {
public VisionPrototype(Settings settings) {

View File

@ -10,6 +10,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class TeyvatCraftMixin {
@Inject(at = @At("HEAD"), method = "init()V")
private void init(CallbackInfo info) {
System.out.println("This line is printed by an example mod mixin!");
//System.out.println("This line is printed by an example mod mixin!");
}
}

View File

@ -0,0 +1,34 @@
package net.yyc12345.teyvatcraft.mixin;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.Item;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.Map;
import java.util.Set;
@Mixin(VillagerEntity.class)
public interface VillagerAccess {
@Accessor("GATHERABLE_ITEMS")
static Set<Item> getGatherableItems() {
throw new AssertionError();
}
@Accessor("GATHERABLE_ITEMS")
static void setGatherableItems(Set<Item> items) {
throw new AssertionError();
}
@Accessor("ITEM_FOOD_VALUES")
static Map<Item, Integer> getItemFoodValues() {
throw new AssertionError();
}
@Accessor("ITEM_FOOD_VALUES")
static void setItemFoodValues(Map<Item, Integer> food) {
throw new AssertionError();
}
}

View File

@ -6,7 +6,8 @@
"mixins": [
],
"client": [
"TeyvatCraftMixin"
"TeyvatCraftMixin",
"VillagerAccess"
],
"injectors": {
"defaultRequire": 1