add some crops

This commit is contained in:
yyc12345 2021-04-23 11:29:01 +08:00
parent f958749ed6
commit 01a83e5b2b
72 changed files with 702 additions and 1 deletions

View File

@ -15,12 +15,14 @@ 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.item.AliasedBlockItem;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.world.gen.GenerationStep;
@ -30,6 +32,7 @@ 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.gnosis.*;
public class RegisterManager {
@ -98,6 +101,17 @@ public class RegisterManager {
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));
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 Item RICE_item = new Item(new FabricItemSettings().group(ITEM_GROUP));
// ==================== ore gen
private static ConfiguredFeature<?, ?> OREGEN_MAGICAL_CRYSTAL_CHUNK_ORE = Feature.ORE
.configure(new OreFeatureConfig(
@ -160,6 +174,7 @@ public class RegisterManager {
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);
@ -186,11 +201,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);
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)));
// 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,64 @@
package net.yyc12345.teyvatcraft.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemConvertible;
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.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
public class TeyvatCropBlock extends CropBlock {
protected static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 5.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D)};
private Item seed;
public TeyvatCropBlock(Settings settings) {
super(settings);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return AGE_TO_SHAPE[state.get(this.getAgeProperty())];
}
public void setSeedsItem(Item seed) {
this.seed = seed;
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
if (getAge(state) == getMaxAge()) {
world.setBlockState(pos, this.withAge(0), 2);
dropStacks(state, world, pos);
return ActionResult.CONSUME;
}
return ActionResult.PASS;
}
@Override
public void onLandedUpon(World world, BlockPos pos, Entity entity, float distance) {
super.onLandedUpon(world, pos, entity, distance);
}
@Override
protected ItemConvertible getSeedsItem() {
return seed;
}
}

View File

@ -0,0 +1,28 @@
{
"variants": {
"age=0": {
"model": "teyvatcraft:block/cabbage_stage0"
},
"age=1": {
"model": "teyvatcraft:block/cabbage_stage0"
},
"age=2": {
"model": "teyvatcraft:block/cabbage_stage1"
},
"age=3": {
"model": "teyvatcraft:block/cabbage_stage1"
},
"age=4": {
"model": "teyvatcraft:block/cabbage_stage2"
},
"age=5": {
"model": "teyvatcraft:block/cabbage_stage2"
},
"age=6": {
"model": "teyvatcraft:block/cabbage_stage2"
},
"age=7": {
"model": "teyvatcraft:block/cabbage_stage3"
}
}
}

View File

@ -0,0 +1,28 @@
{
"variants": {
"age=0": {
"model": "teyvatcraft:block/onion_stage0"
},
"age=1": {
"model": "teyvatcraft:block/onion_stage0"
},
"age=2": {
"model": "teyvatcraft:block/onion_stage1"
},
"age=3": {
"model": "teyvatcraft:block/onion_stage1"
},
"age=4": {
"model": "teyvatcraft:block/onion_stage2"
},
"age=5": {
"model": "teyvatcraft:block/onion_stage2"
},
"age=6": {
"model": "teyvatcraft:block/onion_stage2"
},
"age=7": {
"model": "teyvatcraft:block/onion_stage3"
}
}
}

View File

@ -0,0 +1,28 @@
{
"variants": {
"age=0": {
"model": "teyvatcraft:block/raddish_stage0"
},
"age=1": {
"model": "teyvatcraft:block/raddish_stage0"
},
"age=2": {
"model": "teyvatcraft:block/raddish_stage1"
},
"age=3": {
"model": "teyvatcraft:block/raddish_stage1"
},
"age=4": {
"model": "teyvatcraft:block/raddish_stage2"
},
"age=5": {
"model": "teyvatcraft:block/raddish_stage2"
},
"age=6": {
"model": "teyvatcraft:block/raddish_stage2"
},
"age=7": {
"model": "teyvatcraft:block/raddish_stage3"
}
}
}

View File

@ -0,0 +1,28 @@
{
"variants": {
"age=0": {
"model": "teyvatcraft:block/rice_stage0"
},
"age=1": {
"model": "teyvatcraft:block/rice_stage1"
},
"age=2": {
"model": "teyvatcraft:block/rice_stage2"
},
"age=3": {
"model": "teyvatcraft:block/rice_stage3"
},
"age=4": {
"model": "teyvatcraft:block/rice_stage4"
},
"age=5": {
"model": "teyvatcraft:block/rice_stage5"
},
"age=6": {
"model": "teyvatcraft:block/rice_stage6"
},
"age=7": {
"model": "teyvatcraft:block/rice_stage7"
}
}
}

View File

@ -0,0 +1,28 @@
{
"variants": {
"age=0": {
"model": "teyvatcraft:block/tomato_stage0"
},
"age=1": {
"model": "teyvatcraft:block/tomato_stage0"
},
"age=2": {
"model": "teyvatcraft:block/tomato_stage1"
},
"age=3": {
"model": "teyvatcraft:block/tomato_stage1"
},
"age=4": {
"model": "teyvatcraft:block/tomato_stage2"
},
"age=5": {
"model": "teyvatcraft:block/tomato_stage2"
},
"age=6": {
"model": "teyvatcraft:block/tomato_stage2"
},
"age=7": {
"model": "teyvatcraft:block/tomato_stage3"
}
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/cabbage_stage0"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/cabbage_stage1"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/cabbage_stage2"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/cabbage_stage3"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/onion_stage0"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/onion_stage1"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/onion_stage2"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/onion_stage3"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/raddish_stage0"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/raddish_stage1"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/raddish_stage2"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/raddish_stage3"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage0"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage1"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage2"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage3"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage4"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage5"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage6"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/rice_stage7"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/tomato_stage0"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/tomato_stage1"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/tomato_stage2"
}
}

View File

@ -0,0 +1,7 @@
{
"parent": "minecraft:block/crop",
"textures": {
"crop": "teyvatcraft:block/tomato_stage3"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 382 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,48 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:cabbage"
}
]
},
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "teyvatcraft:cabbage"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:cabbage",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View File

@ -0,0 +1,48 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:onion"
}
]
},
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "teyvatcraft:onion"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:onion",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View File

@ -0,0 +1,48 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:raddish"
}
]
},
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "teyvatcraft:raddish"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:raddish",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View File

@ -0,0 +1,66 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:rice",
"properties": {
"age": "7"
}
}
],
"name": "teyvatcraft:rice"
},
{
"type": "minecraft:item",
"name": "teyvatcraft:rice_seed"
}
]
}
]
},
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "teyvatcraft:rice_seed"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:rice",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}

View File

@ -0,0 +1,48 @@
{
"type": "minecraft:block",
"pools": [
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"name": "teyvatcraft:tomato"
}
]
},
{
"rolls": 1.0,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:apply_bonus",
"enchantment": "minecraft:fortune",
"formula": "minecraft:binomial_with_bonus_count",
"parameters": {
"extra": 3,
"probability": 0.5714286
}
}
],
"name": "teyvatcraft:tomato"
}
],
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "teyvatcraft:tomato",
"properties": {
"age": "7"
}
}
]
}
],
"functions": [
{
"function": "minecraft:explosion_decay"
}
]
}