diff --git a/src/main/java/net/yyc12345/teyvatcraft/RegisterManager.java b/src/main/java/net/yyc12345/teyvatcraft/RegisterManager.java index 25ee098..7e2f988 100644 --- a/src/main/java/net/yyc12345/teyvatcraft/RegisterManager.java +++ b/src/main/java/net/yyc12345/teyvatcraft/RegisterManager.java @@ -10,6 +10,7 @@ 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; @@ -22,6 +23,7 @@ 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; @@ -33,6 +35,7 @@ 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 { @@ -102,15 +105,18 @@ public class RegisterManager { 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)); - 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 final Item RICE_SEED = new AliasedBlockItem(RICE_block, new FabricItemSettings().group(ITEM_GROUP)); + 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 @@ -201,25 +207,31 @@ public class RegisterManager { Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "starsilver_ore"), new BlockItem(STARSILVER_ORE, new Item.Settings().group(ITEM_GROUP))); - // crops - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice_seed"), RICE_SEED); - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "rice"), RICE_item); + ((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); - ((TeyvatCropBlock)RICE_block).setSeedsItem(RICE_SEED); Registry.register(Registry.BLOCK, new Identifier("teyvatcraft", "rice"), RICE_block); - 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); - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "tomato"), - new BlockItem(TOMATO, new Item.Settings().group(ITEM_GROUP))); - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "onion"), - new BlockItem(ONION, new Item.Settings().group(ITEM_GROUP))); - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "cabbage"), - new BlockItem(CABBAGE, new Item.Settings().group(ITEM_GROUP))); - Registry.register(Registry.ITEM, new Identifier("teyvatcraft", "raddish"), - new BlockItem(RADDISH, new Item.Settings().group(ITEM_GROUP))); + 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); diff --git a/src/main/java/net/yyc12345/teyvatcraft/items/SeedItem.java b/src/main/java/net/yyc12345/teyvatcraft/items/SeedItem.java new file mode 100644 index 0000000..1b16a21 --- /dev/null +++ b/src/main/java/net/yyc12345/teyvatcraft/items/SeedItem.java @@ -0,0 +1,12 @@ +package net.yyc12345.teyvatcraft.items; + +import net.minecraft.block.Block; +import net.minecraft.item.AliasedBlockItem; +import net.yyc12345.teyvatcraft.blocks.TeyvatCropBlock; + +public class SeedItem extends AliasedBlockItem { + public SeedItem(Block block, Settings settings) { + super(block, settings); + ((TeyvatCropBlock) block).setSeedsItem(this); + } +} diff --git a/src/main/resources/assets/teyvatcraft/lang/en_us.json b/src/main/resources/assets/teyvatcraft/lang/en_us.json index 003019e..8f20a55 100644 --- a/src/main/resources/assets/teyvatcraft/lang/en_us.json +++ b/src/main/resources/assets/teyvatcraft/lang/en_us.json @@ -23,5 +23,19 @@ "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", - "block.teyvatcraft.starsilver_ore": "Starsilver Ore" + "block.teyvatcraft.starsilver_ore": "Starsilver Ore", + + "block.teyvatcraft.rice": "Rice", + "block.teyvatcraft.tomato": "Tomato", + "block.teyvatcraft.onion": "Onion", + "block.teyvatcraft.cabbage": "Cabbage", + "block.teyvatcraft.raddish": "Raddish", + "block.teyvatcraft.rice_seed": "Rice Seed", + + "item.teyvatcraft.rice": "Rice", + "item.teyvatcraft.tomato": "Tomato", + "item.teyvatcraft.onion": "Onion", + "item.teyvatcraft.cabbage": "Cabbage", + "item.teyvatcraft.raddish": "Raddish", + "item.teyvatcraft.rice_seed": "Rice Seed" } \ No newline at end of file diff --git a/src/main/resources/assets/teyvatcraft/lang/zh_cn.json b/src/main/resources/assets/teyvatcraft/lang/zh_cn.json index cbc8853..7b5876c 100644 --- a/src/main/resources/assets/teyvatcraft/lang/zh_cn.json +++ b/src/main/resources/assets/teyvatcraft/lang/zh_cn.json @@ -23,5 +23,19 @@ "block.teyvatcraft.crystal_chunk_ore": "水晶块原矿", "block.teyvatcraft.white_iron_chunk_ore": "白铁块原矿", "block.teyvatcraft.iron_chunk_ore": "铁块原矿", - "block.teyvatcraft.starsilver_ore": "星银矿石原矿" + "block.teyvatcraft.starsilver_ore": "星银矿石原矿", + + "block.teyvatcraft.rice": "Rice", + "block.teyvatcraft.tomato": "Tomato", + "block.teyvatcraft.onion": "Onion", + "block.teyvatcraft.cabbage": "Cabbage", + "block.teyvatcraft.raddish": "Raddish", + "block.teyvatcraft.rice_seed": "Rice Seed", + + "item.teyvatcraft.rice": "Rice", + "item.teyvatcraft.tomato": "Tomato", + "item.teyvatcraft.onion": "Onion", + "item.teyvatcraft.cabbage": "Cabbage", + "item.teyvatcraft.raddish": "Raddish", + "item.teyvatcraft.rice_seed": "Rice Seed" } \ No newline at end of file diff --git a/src/main/resources/assets/teyvatcraft/textures/block/onion_stage3.png b/src/main/resources/assets/teyvatcraft/textures/block/onion_stage3.png index b2472d3..4586baf 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/onion_stage3.png and b/src/main/resources/assets/teyvatcraft/textures/block/onion_stage3.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/raddish_stage3.png b/src/main/resources/assets/teyvatcraft/textures/block/raddish_stage3.png index 80d050a..9cda132 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/raddish_stage3.png and b/src/main/resources/assets/teyvatcraft/textures/block/raddish_stage3.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage3.png b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage3.png index b2a1e91..b38718d 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage3.png and b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage3.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage4.png b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage4.png index 867c64a..789f582 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage4.png and b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage4.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage5.png b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage5.png index 8bb08de..6b1fe2f 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage5.png and b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage5.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage6.png b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage6.png index 8c6320a..74016d4 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage6.png and b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage6.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage7.png b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage7.png index c472dfd..f60eea0 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/block/rice_stage7.png and b/src/main/resources/assets/teyvatcraft/textures/block/rice_stage7.png differ diff --git a/src/main/resources/assets/teyvatcraft/textures/item/rice_seed.png b/src/main/resources/assets/teyvatcraft/textures/item/rice_seed.png index f3961f8..b2c5c33 100644 Binary files a/src/main/resources/assets/teyvatcraft/textures/item/rice_seed.png and b/src/main/resources/assets/teyvatcraft/textures/item/rice_seed.png differ