From f5d08e8d9a1d8310cfc6980ea21c19acd5909867 Mon Sep 17 00:00:00 2001 From: MCZME <13183052+mczme@user.noreply.gitee.com> Date: Tue, 6 Aug 2024 22:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E8=8C=B6=E6=A0=91,?= =?UTF-8?q?=E8=8C=B6=E5=8F=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../59eb3dbb5f86130e09b3c62d89b9525ee01cf52d | 4 +- .../85f12f813aff948f91f5cd129c0ffa86bcb17361 | 2 + .../resources/assets/lingshi/lang/zh_cn.json | 8 + .../lingshi/loot_table/blocks/tea_leaf.json | 21 +++ .../lingshi/loot_table/blocks/tea_tree.json | 21 +++ .../common/block/RiceSeedlingBlock.java | 1 - .../common/block/RiceSeedlingTopBlock.java | 1 - .../mczme/lingshi/common/block/TeaBlock.java | 73 +++++++++ .../lingshi/common/block/TeaTreeBlock.java | 143 ++++++++++++++++++ .../lingshi/common/data/DataGenerators.java | 7 + .../data/lang/ChineseLanguageProvider.java | 25 +++ .../lingshi/common/data/loot/BlockLoot.java | 6 +- .../lingshi/common/item/RiceSeedlingItem.java | 13 +- .../java/mczme/lingshi/common/item/Tea.java | 9 ++ .../lingshi/common/registry/ModBlocks.java | 12 +- .../lingshi/common/registry/ModItems.java | 3 + .../assets/lingshi/blockstates/tea_leaf.json | 16 ++ .../assets/lingshi/blockstates/tea_tree.json | 16 ++ .../resources/assets/lingshi/lang/zh_cn.json | 7 - .../lingshi/models/block/tea_tree_0.json | 7 + .../lingshi/models/block/tea_tree_1.json | 44 ++++++ .../lingshi/models/block/tea_tree_2.json | 50 ++++++ .../lingshi/models/block/tea_tree_3.json | 81 ++++++++++ .../textures/block/tea_tree_branch.png | Bin 0 -> 318 bytes 24 files changed, 542 insertions(+), 28 deletions(-) create mode 100644 src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 create mode 100644 src/generated/resources/assets/lingshi/lang/zh_cn.json create mode 100644 src/generated/resources/data/lingshi/loot_table/blocks/tea_leaf.json create mode 100644 src/generated/resources/data/lingshi/loot_table/blocks/tea_tree.json create mode 100644 src/main/java/mczme/lingshi/common/block/TeaBlock.java create mode 100644 src/main/java/mczme/lingshi/common/block/TeaTreeBlock.java create mode 100644 src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java create mode 100644 src/main/java/mczme/lingshi/common/item/Tea.java create mode 100644 src/main/resources/assets/lingshi/blockstates/tea_leaf.json create mode 100644 src/main/resources/assets/lingshi/blockstates/tea_tree.json delete mode 100644 src/main/resources/assets/lingshi/lang/zh_cn.json create mode 100644 src/main/resources/assets/lingshi/models/block/tea_tree_0.json create mode 100644 src/main/resources/assets/lingshi/models/block/tea_tree_1.json create mode 100644 src/main/resources/assets/lingshi/models/block/tea_tree_2.json create mode 100644 src/main/resources/assets/lingshi/models/block/tea_tree_3.json create mode 100644 src/main/resources/assets/lingshi/textures/block/tea_tree_branch.png diff --git a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d index 8304c28..7cb2919 100644 --- a/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d +++ b/src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d @@ -1 +1,3 @@ -// 1.21 2024-08-02T19:21:51.9075616 Loot Tables +// 1.21 2024-08-06T21:56:13.9856387 Loot Tables +c843630bb0739aad37078f0119c9cc31f5316c3a data/lingshi/loot_table/blocks/tea_leaf.json +3cd0ced47f090fec162cddcb8b2f75284fa134cb data/lingshi/loot_table/blocks/tea_tree.json diff --git a/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 new file mode 100644 index 0000000..55acdce --- /dev/null +++ b/src/generated/resources/.cache/85f12f813aff948f91f5cd129c0ffa86bcb17361 @@ -0,0 +1,2 @@ +// 1.21 2024-08-06T21:56:13.987637 Languages: zh_cn for mod: lingshi +e555acbe8820b73ef1de654d149cfca34bba5963 assets/lingshi/lang/zh_cn.json diff --git a/src/generated/resources/assets/lingshi/lang/zh_cn.json b/src/generated/resources/assets/lingshi/lang/zh_cn.json new file mode 100644 index 0000000..2c605d2 --- /dev/null +++ b/src/generated/resources/assets/lingshi/lang/zh_cn.json @@ -0,0 +1,8 @@ +{ + "block.lingshi.rice": "稻米", + "block.lingshi.tea_tree": "茶树", + "item.lingshi.rice_of_ear": "稻穗", + "item.lingshi.rice_seedling": "稻苗", + "item.lingshi.tea_leaf": "茶叶", + "lingshi.lingshi_tab": "灵食" +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/loot_table/blocks/tea_leaf.json b/src/generated/resources/data/lingshi/loot_table/blocks/tea_leaf.json new file mode 100644 index 0000000..6a645fc --- /dev/null +++ b/src/generated/resources/data/lingshi/loot_table/blocks/tea_leaf.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "lingshi:tea_leaf" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "lingshi:blocks/tea_leaf" +} \ No newline at end of file diff --git a/src/generated/resources/data/lingshi/loot_table/blocks/tea_tree.json b/src/generated/resources/data/lingshi/loot_table/blocks/tea_tree.json new file mode 100644 index 0000000..5c3837b --- /dev/null +++ b/src/generated/resources/data/lingshi/loot_table/blocks/tea_tree.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "lingshi:tea_tree" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "lingshi:blocks/tea_tree" +} \ No newline at end of file diff --git a/src/main/java/mczme/lingshi/common/block/RiceSeedlingBlock.java b/src/main/java/mczme/lingshi/common/block/RiceSeedlingBlock.java index 340b3cb..209106f 100644 --- a/src/main/java/mczme/lingshi/common/block/RiceSeedlingBlock.java +++ b/src/main/java/mczme/lingshi/common/block/RiceSeedlingBlock.java @@ -20,7 +20,6 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BooleanProperty; -import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.IntegerProperty; import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.FluidState; diff --git a/src/main/java/mczme/lingshi/common/block/RiceSeedlingTopBlock.java b/src/main/java/mczme/lingshi/common/block/RiceSeedlingTopBlock.java index c1a5e4d..f920622 100644 --- a/src/main/java/mczme/lingshi/common/block/RiceSeedlingTopBlock.java +++ b/src/main/java/mczme/lingshi/common/block/RiceSeedlingTopBlock.java @@ -3,7 +3,6 @@ import mczme.lingshi.common.registry.ModBlocks; import mczme.lingshi.common.registry.ModItems; import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.ItemLike; import net.minecraft.world.level.LevelAccessor; diff --git a/src/main/java/mczme/lingshi/common/block/TeaBlock.java b/src/main/java/mczme/lingshi/common/block/TeaBlock.java new file mode 100644 index 0000000..0770839 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/block/TeaBlock.java @@ -0,0 +1,73 @@ +package mczme.lingshi.common.block; + +import mczme.lingshi.common.registry.ModBlocks; +import mczme.lingshi.common.registry.ModItems; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class TeaBlock extends CropBlock { + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + private static final VoxelShape[] SHAPE_BY_AGE = new VoxelShape[]{ + Block.box(0, 0.0, 0, 16.0, 2.0, 16.0), + Block.box(0, 0.0, 0, 16.0, 4.0, 16.0), + Block.box(0, 0.0, 0, 16.0, 6.0, 16.0), + Block.box(0, 0.0, 0, 16.0, 8.0, 16.0) + }; + + public TeaBlock(Properties properties) { + super(properties.randomTicks().noCollission().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY)); + } + + @Override + public IntegerProperty getAgeProperty() { + return AGE; + } + + @Override + public int getAge(BlockState state) { + return state.getValue(this.getAgeProperty()); + } + + @Override + public int getMaxAge() { + return 3; + } + + @Override + public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { + return SHAPE_BY_AGE[this.getAge(state)]; + } + + @Override + public boolean canSurvive(BlockState state, LevelReader level, BlockPos pos) { + return (level.getRawBrightness(pos, 0) >= 8 || level.canSeeSky(pos)) && this.mayPlaceOn(level.getBlockState(pos.below()), level, pos); + } + + @Override + protected ItemLike getBaseSeedId() { + return ModItems.TEA_LEAF.get(); + } + + @Override + protected boolean mayPlaceOn(BlockState state, BlockGetter level, BlockPos pos) { + return state.is(ModBlocks.TEA_TREE.get()); + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder pBuilder) { + pBuilder.add(AGE); + } + +} diff --git a/src/main/java/mczme/lingshi/common/block/TeaTreeBlock.java b/src/main/java/mczme/lingshi/common/block/TeaTreeBlock.java new file mode 100644 index 0000000..b6d6dd2 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/block/TeaTreeBlock.java @@ -0,0 +1,143 @@ +package mczme.lingshi.common.block; + +import com.mojang.serialization.MapCodec; +import mczme.lingshi.common.registry.ModBlocks; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.util.Mth; +import net.minecraft.util.RandomSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelReader; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.BonemealableBlock; +import net.minecraft.world.level.block.BushBlock; +import net.minecraft.world.level.block.SoundType; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.IntegerProperty; +import net.minecraft.world.level.material.PushReaction; +import net.minecraft.world.phys.Vec3; +import net.minecraft.world.phys.shapes.CollisionContext; +import net.minecraft.world.phys.shapes.Shapes; +import net.minecraft.world.phys.shapes.VoxelShape; + +public class TeaTreeBlock extends BushBlock implements BonemealableBlock { + + public static final IntegerProperty AGE = BlockStateProperties.AGE_3; + public static final VoxelShape[] SHAPE = new VoxelShape[]{Block.box(7.0, 0, 7.0, 10, 10, 10), + Shapes.or(Block.box(7.0, 0, 7.0, 10, 8, 10),Block.box(3.5,8,3.5,12.5,14,12.5)), + Shapes.or(Block.box(7.0, 0, 7.0, 10, 6, 10),Block.box(2.0,6,2,14,14,14)), + Shapes.or(Block.box(7.0, 0, 7.0, 10, 5, 10),Block.box(0,5,0,16,16,16))}; + + public TeaTreeBlock(Properties properties) { + super(properties.randomTicks().noCollission().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY)); + this.registerDefaultState(this.defaultBlockState().setValue(AGE, 0)); + } + + @Override + protected MapCodec codec() { + return null; + } + + public IntegerProperty getAgeProperty() { + return AGE; + } + + protected int getAge(BlockState state) { + return state.getValue(this.getAgeProperty()); + } + + public int getMaxAge() { + return 3; + } + + public BlockState getStateForAge(int pAge) { + return this.defaultBlockState().setValue(this.getAgeProperty(), pAge); + } + + @Override + public void randomTick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) { + super.tick(pState, pLevel, pPos, pRandom); + if (!pLevel.isAreaLoaded(pPos, 1)) return; + if (pLevel.getRawBrightness(pPos.above(), 0) >= 6) { + int age = getAge(pState); + if (age <= getMaxAge()) { + float f = 12.0F; + if (net.neoforged.neoforge.common.CommonHooks.canCropGrow(pLevel, pPos, pState, pRandom.nextInt((int) (25.0F / f) + 1) == 0)) { + if (age != getMaxAge()) { + pLevel.setBlock(pPos, this.getStateForAge(age + 1), 2); + net.neoforged.neoforge.common.CommonHooks.fireCropGrowPost(pLevel, pPos, pState); + } else { + TeaBlock topBlock = ModBlocks.TEA_LEAF.get(); + if (topBlock.defaultBlockState().canSurvive(pLevel, pPos.above()) && pLevel.isEmptyBlock(pPos.above())) { + pLevel.setBlockAndUpdate(pPos.above(), topBlock.defaultBlockState()); + net.neoforged.neoforge.common.CommonHooks.fireCropGrowPost(pLevel, pPos, pState); + } + } + } + } + } + } + + @Override + public boolean isValidBonemealTarget(LevelReader pLevel, BlockPos pPos, BlockState pState) { + BlockState upperState = pLevel.getBlockState(pPos.above()); + if (upperState.getBlock() instanceof TeaBlock) { + return !((TeaBlock) upperState.getBlock()).isMaxAge(upperState); + } + return true; + } + + @Override + public boolean isBonemealSuccess(Level pLevel, RandomSource pRandom, BlockPos pPos, BlockState pState) { + return true; + } + + protected int getBonemealAgeIncrease(Level level) { + return Mth.nextInt(level.random, 1, 2); + } + + @Override + public void performBonemeal(ServerLevel pLevel, RandomSource pRandom, BlockPos pPos, BlockState pState) { + int ageGrowth = Math.min(this.getAge(pState) + this.getBonemealAgeIncrease(pLevel), 5); + if (ageGrowth <= this.getMaxAge()) { + pLevel.setBlockAndUpdate(pPos, pState.setValue(AGE, ageGrowth)); + } else { + BlockState top = pLevel.getBlockState(pPos.above()); + if (top.getBlock() == ModBlocks.TEA_LEAF.get()) { + BonemealableBlock growable = (BonemealableBlock) pLevel.getBlockState(pPos.above()).getBlock(); + if (growable.isValidBonemealTarget(pLevel, pPos.above(), top)) { + growable.performBonemeal(pLevel, pLevel.random, pPos.above(), top); + } + } else { + TeaBlock Upper = ModBlocks.TEA_LEAF.get(); + int remainingGrowth = ageGrowth - this.getMaxAge() - 1; + if (Upper.defaultBlockState().canSurvive(pLevel, pPos.above()) && pLevel.isEmptyBlock(pPos.above())) { + pLevel.setBlockAndUpdate(pPos, pState.setValue(AGE, this.getMaxAge())); + pLevel.setBlock(pPos.above(), Upper.defaultBlockState().setValue(TeaBlock.AGE, remainingGrowth), 2); + } + } + } + } + + @Override + protected void entityInside(BlockState pState, Level pLevel, BlockPos pPos, Entity pEntity) { + if (pEntity instanceof LivingEntity) { + pEntity.makeStuckInBlock(pState, new Vec3(0.8F, 0.75, 0.8F)); + } + } + + @Override + protected VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) { + return SHAPE[getAge(pState)]; + } + + @Override + protected void createBlockStateDefinition(StateDefinition.Builder pBuilder) { + pBuilder.add(AGE); + } +} diff --git a/src/main/java/mczme/lingshi/common/data/DataGenerators.java b/src/main/java/mczme/lingshi/common/data/DataGenerators.java index 2bfaeb2..ad74419 100644 --- a/src/main/java/mczme/lingshi/common/data/DataGenerators.java +++ b/src/main/java/mczme/lingshi/common/data/DataGenerators.java @@ -1,5 +1,6 @@ package mczme.lingshi.common.data; +import mczme.lingshi.common.data.lang.ChineseLanguageProvider; import mczme.lingshi.common.data.loot.BlockLoot; import mczme.lingshi.lingshi; import net.minecraft.core.HolderLookup; @@ -34,5 +35,11 @@ public static void onGatherData(GatherDataEvent event) { List.of(new LootTableProvider.SubProviderEntry(BlockLoot::new, LootContextParamSets.BLOCK)), lookupProvider) ); + +// lang datagen + event.getGenerator().addProvider( + event.includeServer(), + new ChineseLanguageProvider(output) + ); } } diff --git a/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java new file mode 100644 index 0000000..6f8ceb7 --- /dev/null +++ b/src/main/java/mczme/lingshi/common/data/lang/ChineseLanguageProvider.java @@ -0,0 +1,25 @@ +package mczme.lingshi.common.data.lang; + +import mczme.lingshi.common.registry.ModItems; +import net.minecraft.data.PackOutput; +import net.neoforged.neoforge.common.data.LanguageProvider; + +import static mczme.lingshi.lingshi.MODID; + +public class ChineseLanguageProvider extends LanguageProvider { + public ChineseLanguageProvider(PackOutput output) { + super(output, MODID, "zh_cn"); + } + + @Override + protected void addTranslations() { + this.add("lingshi.lingshi_tab", "灵食"); + + this.add(ModItems.RICE.get(), "稻米"); + this.add(ModItems.RICE_SEEDLING.get(), "稻苗"); + this.add(ModItems.RICE_OF_EAR.get(),"稻穗"); + + this.add(ModItems.TEA_TREE.get(), "茶树"); + this.add(ModItems.TEA_LEAF.get(), "茶叶"); + } +} diff --git a/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java b/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java index 6848399..b4e083c 100644 --- a/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java +++ b/src/main/java/mczme/lingshi/common/data/loot/BlockLoot.java @@ -12,7 +12,8 @@ public class BlockLoot extends BlockLootSubProvider { public static final Set BLOCK = Set.of( - + ModBlocks.TEA_TREE.get(), + ModBlocks.TEA_LEAF.get() ); public BlockLoot(HolderLookup.Provider lookupProvider) { @@ -22,7 +23,8 @@ public BlockLoot(HolderLookup.Provider lookupProvider) { @Override protected void generate() { - + dropSelf(ModBlocks.TEA_TREE.get()); + dropOther(ModBlocks.TEA_LEAF.get(), ModItems.TEA_LEAF.get()); } @Override diff --git a/src/main/java/mczme/lingshi/common/item/RiceSeedlingItem.java b/src/main/java/mczme/lingshi/common/item/RiceSeedlingItem.java index 990d0a9..c533cf1 100644 --- a/src/main/java/mczme/lingshi/common/item/RiceSeedlingItem.java +++ b/src/main/java/mczme/lingshi/common/item/RiceSeedlingItem.java @@ -1,15 +1,10 @@ package mczme.lingshi.common.item; -import net.minecraft.core.Direction; -import net.minecraft.tags.BlockTags; import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemNameBlockItem; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.FarmBlock; -import net.minecraft.world.level.block.state.BlockState; public class RiceSeedlingItem extends ItemNameBlockItem { public RiceSeedlingItem(Block block, Properties properties) { @@ -19,13 +14,7 @@ public RiceSeedlingItem(Block block, Properties properties) { @Override public InteractionResult useOn(UseOnContext context) { InteractionResult result = this.place(new BlockPlaceContext(context)); - if (result.equals(InteractionResult.FAIL)) { - Player player = context.getPlayer(); - BlockState targetState = context.getLevel().getBlockState(context.getClickedPos()); - if (player != null && context.getClickedFace().equals(Direction.UP) && (targetState.is(BlockTags.DIRT) || targetState.getBlock() instanceof FarmBlock)) { -// player.displayClientMessage(TextUtils.getTranslation("block.rice.invalid_placement"), true); - } - } + return result; } } diff --git a/src/main/java/mczme/lingshi/common/item/Tea.java b/src/main/java/mczme/lingshi/common/item/Tea.java new file mode 100644 index 0000000..d2d930f --- /dev/null +++ b/src/main/java/mczme/lingshi/common/item/Tea.java @@ -0,0 +1,9 @@ +package mczme.lingshi.common.item; + +import net.minecraft.world.item.Item; + +public class Tea extends Item { + public Tea(Properties properties) { + super(properties); + } +} diff --git a/src/main/java/mczme/lingshi/common/registry/ModBlocks.java b/src/main/java/mczme/lingshi/common/registry/ModBlocks.java index 3b13e7d..8724145 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModBlocks.java +++ b/src/main/java/mczme/lingshi/common/registry/ModBlocks.java @@ -2,6 +2,9 @@ import mczme.lingshi.common.block.RiceSeedlingBlock; import mczme.lingshi.common.block.RiceSeedlingTopBlock; +import mczme.lingshi.common.block.TeaBlock; +import mczme.lingshi.common.block.TeaTreeBlock; +import mczme.lingshi.common.item.Tea; import mczme.lingshi.lingshi; import net.minecraft.world.level.block.CropBlock; import net.minecraft.world.level.block.SoundType; @@ -23,10 +26,11 @@ public class ModBlocks { .instabreak() .sound(SoundType.CROP) .pushReaction(PushReaction.DESTROY)); - public static final Supplier RICE_SEEDLING = BLOCKS.registerBlock("rice_seedling", RiceSeedlingBlock::new, - BlockBehaviour.Properties.of()); - public static final Supplier RICE_SEEDING_TOP = BLOCKS.registerBlock("rice_seedling_top", RiceSeedlingTopBlock::new, - BlockBehaviour.Properties.of()); + public static final Supplier RICE_SEEDLING = BLOCKS.registerBlock("rice_seedling", RiceSeedlingBlock::new, BlockBehaviour.Properties.of()); + public static final Supplier RICE_SEEDING_TOP = BLOCKS.registerBlock("rice_seedling_top", RiceSeedlingTopBlock::new, BlockBehaviour.Properties.of()); + + public static final Supplier TEA_TREE = BLOCKS.registerBlock("tea_tree", TeaTreeBlock::new,BlockBehaviour.Properties.of()); + public static final Supplier TEA_LEAF = BLOCKS.registerBlock("tea_leaf", TeaBlock::new,BlockBehaviour.Properties.of()); public static void register(IEventBus modEventBus) { BLOCKS.register(modEventBus); diff --git a/src/main/java/mczme/lingshi/common/registry/ModItems.java b/src/main/java/mczme/lingshi/common/registry/ModItems.java index 9702bdf..6c3639c 100644 --- a/src/main/java/mczme/lingshi/common/registry/ModItems.java +++ b/src/main/java/mczme/lingshi/common/registry/ModItems.java @@ -19,6 +19,9 @@ public class ModItems { public static final Supplier RICE_SEEDLING =registerWithCreateTab("rice_seedling", ()->new RiceSeedlingItem(ModBlocks.RICE_SEEDLING.get(),new Item.Properties())); public static final Supplier RICE_OF_EAR = registerWithCreateTab("rice_of_ear", () -> new Item(new Item.Properties())); + public static final Supplier TEA_TREE = registerWithCreateTab("tea_tree", () -> new BlockItem(ModBlocks.TEA_TREE.get(), new Item.Properties())); + public static final Supplier TEA_LEAF = registerWithCreateTab("tea_leaf", () -> new Item(new Item.Properties())); + private static Supplier registerWithCreateTab(String item_name, Supplier itemSupplier) { Supplier item = ITEMS.register(item_name, itemSupplier); ITEMS_LIST.add(item); diff --git a/src/main/resources/assets/lingshi/blockstates/tea_leaf.json b/src/main/resources/assets/lingshi/blockstates/tea_leaf.json new file mode 100644 index 0000000..85bfd52 --- /dev/null +++ b/src/main/resources/assets/lingshi/blockstates/tea_leaf.json @@ -0,0 +1,16 @@ +{ + "variants": { + "age=0": { + "model": "lingshi:block/riceseedling_age0" + }, + "age=1": { + "model": "lingshi:block/riceseedling_age0" + }, + "age=2": { + "model": "lingshi:block/riceseedling_age0" + }, + "age=3": { + "model": "lingshi:block/riceseedling_age0" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/blockstates/tea_tree.json b/src/main/resources/assets/lingshi/blockstates/tea_tree.json new file mode 100644 index 0000000..1c635e6 --- /dev/null +++ b/src/main/resources/assets/lingshi/blockstates/tea_tree.json @@ -0,0 +1,16 @@ +{ + "variants": { + "age=0": { + "model": "lingshi:block/tea_tree_0" + }, + "age=1": { + "model": "lingshi:block/tea_tree_1" + }, + "age=2": { + "model": "lingshi:block/tea_tree_2" + }, + "age=3": { + "model": "lingshi:block/tea_tree_3" + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/lang/zh_cn.json b/src/main/resources/assets/lingshi/lang/zh_cn.json deleted file mode 100644 index 8e06d42..0000000 --- a/src/main/resources/assets/lingshi/lang/zh_cn.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "lingshi.lingshi_tab": "灵食", - "block.lingshi.rice": "稻米", - "item.lingshi.rice_seedling": "稻苗", - "item.lingshi.rice_of_ear": "稻穗" - -} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/tea_tree_0.json b/src/main/resources/assets/lingshi/models/block/tea_tree_0.json new file mode 100644 index 0000000..c12f521 --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/tea_tree_0.json @@ -0,0 +1,7 @@ +{ + "parent": "block/cross", + "render_type": "minecraft:cutout", + "textures": { + "cross": "lingshi:block/tea_tree_branch" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/tea_tree_1.json b/src/main/resources/assets/lingshi/models/block/tea_tree_1.json new file mode 100644 index 0000000..3fda156 --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/tea_tree_1.json @@ -0,0 +1,44 @@ +{ + "credit": "Made with Blockbench", + "ambientocclusion": false, + "render_type": "minecraft:cutout", + "textures": { + "0": "lingshi:block/tea_tree_branch", + "particle": "lingshi:block/tea_tree_branch" + }, + "elements": [ + { + "from": [8, 0, 0], + "to": [8, 14, 16], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 7, 8]}, + "faces": { + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [0, 0, 8], + "to": [16, 14, 8], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 7, 8]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [3.5, 8, 3.5], + "to": [12.5, 14, 12.5], + "rotation": {"angle": 0, "axis": "y", "origin": [6.5, 10, 6.5]}, + "color": 6, + "faces": { + "north": {"uv": [0, 0, 8, 6], "texture": "#missing"}, + "east": {"uv": [0, 0, 8, 6], "texture": "#missing"}, + "south": {"uv": [0, 0, 8, 6], "texture": "#missing"}, + "west": {"uv": [0, 0, 8, 6], "texture": "#missing"}, + "up": {"uv": [0, 0, 8, 8], "texture": "#missing"}, + "down": {"uv": [0, 0, 8, 8], "texture": "#missing"} + } + } + ], + "display": {} +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/tea_tree_2.json b/src/main/resources/assets/lingshi/models/block/tea_tree_2.json new file mode 100644 index 0000000..afb45d0 --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/tea_tree_2.json @@ -0,0 +1,50 @@ +{ + "credit": "Made with Blockbench", + "render_type": "minecraft:cutout", + "textures": { + "0": "lingshi:block/tea_tree_branch", + "particle": "lingshi:block/tea_tree_branch" + }, + "elements": [ + { + "from": [2, 6, 2], + "to": [14, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 10, 8]}, + "color": 6, + "faces": { + "north": {"uv": [0, 0, 12, 8], "texture": "#missing"}, + "east": {"uv": [0, 0, 12, 8], "texture": "#missing"}, + "south": {"uv": [0, 0, 12, 8], "texture": "#missing"}, + "west": {"uv": [0, 0, 12, 8], "texture": "#missing"}, + "up": {"uv": [0, 0, 12, 12], "texture": "#missing"}, + "down": {"uv": [0, 0, 12, 12], "texture": "#missing"} + } + }, + { + "from": [2.05025, 0, 12.94975], + "to": [18.05025, 14, 12.94975], + "rotation": {"angle": 45, "axis": "y", "origin": [3.05025, 5, 12.94975]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [3.05025, 0, 2.05025], + "to": [3.05025, 14, 18.05025], + "rotation": {"angle": 45, "axis": "y", "origin": [3.05025, 5, 3.05025]}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/models/block/tea_tree_3.json b/src/main/resources/assets/lingshi/models/block/tea_tree_3.json new file mode 100644 index 0000000..30fa195 --- /dev/null +++ b/src/main/resources/assets/lingshi/models/block/tea_tree_3.json @@ -0,0 +1,81 @@ +{ + "parent": "block/block", + "render_type": "minecraft:cutout", + "textures": { + "0": "lingshi:block/tea_tree_branch", + "particle": "lingshi:block/tea_tree_branch" + }, + "elements": [ + { + "from": [0, 16, 0], + "to": [16, 16, 16], + "color": 2, + "faces": { + "up": {"uv": [0, 0, 16, 16], "texture": "#missing", "cullface": "up"}, + "down": {"uv": [0, 16, 16, 0], "texture": "#missing"} + } + }, + { + "from": [0, 5, 0], + "to": [16, 16, 0.01], + "color": 8, + "faces": { + "north": {"uv": [0, 0, 16, 11], "texture": "#missing", "cullface": "north"}, + "south": {"uv": [16, 0, 0, 11], "texture": "#missing"} + } + }, + { + "from": [0, 5, 15.99], + "to": [16, 16, 16], + "color": 7, + "faces": { + "north": {"uv": [16, 0, 0, 11], "texture": "#missing"}, + "south": {"uv": [0, 0, 16, 11], "texture": "#missing", "cullface": "south"} + } + }, + { + "from": [0, 5, 0], + "to": [0.01, 16, 16], + "color": 6, + "faces": { + "east": {"uv": [16, 0, 0, 11], "texture": "#missing"}, + "west": {"uv": [0, 0, 16, 11], "texture": "#missing", "cullface": "west"} + } + }, + { + "from": [15.99, 5, 0], + "to": [16, 16, 16], + "color": 6, + "faces": { + "east": {"uv": [0, 0, 16, 11], "texture": "#missing", "cullface": "east"}, + "west": {"uv": [16, 0, 0, 11], "texture": "#missing"} + } + }, + { + "from": [0.1, 0, 8], + "to": [15.9, 15.9, 8], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8], "rescale": true}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + }, + { + "from": [8, 0, 0.1], + "to": [8, 15.9, 15.9], + "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8], "rescale": true}, + "faces": { + "north": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "east": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "south": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "west": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "up": {"uv": [0, 0, 16, 16], "texture": "#0"}, + "down": {"uv": [0, 0, 16, 16], "texture": "#0"} + } + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/lingshi/textures/block/tea_tree_branch.png b/src/main/resources/assets/lingshi/textures/block/tea_tree_branch.png new file mode 100644 index 0000000000000000000000000000000000000000..2656376e85efdf2ecb5f7b4be0225e8038ffa145 GIT binary patch literal 318 zcmV-E0m1%>P)ysVuQJ!r|z|CjoxERpxsppkyC6cv6Im0iGWob@6Wpe->X@;Ibl% Qr~m)}07*qoM6N<$g0F*!_y7O^ literal 0 HcmV?d00001