This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
generated from NeoForgeMDKs/MDK-1.21-ModDevGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
221 additions
and
12 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/generated/resources/assets/farm_away/models/item/soft_potato.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "farm_away:item/soft_potato" | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/generated/resources/data/farm_away/tags/block/crops/ray.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"values": [ | ||
"farm_away:gerbera_potatoes" | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
src/generated/resources/data/farm_away/tags/item/seeds/ray.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"values": [ | ||
"farm_away:gerbera_potato" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/ho/artisan/farmaway/common/block/EmptyRootBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package ho.artisan.farmaway.common.block; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import ho.artisan.farmaway.common.registry.FAItems; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.ItemLike; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.CropBlock; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.shapes.CollisionContext; | ||
import net.minecraft.world.phys.shapes.VoxelShape; | ||
|
||
public class EmptyRootBlock extends CropBlock { | ||
public static final MapCodec<EmptyRootBlock> CODEC = simpleCodec(EmptyRootBlock::new); | ||
|
||
public MapCodec<EmptyRootBlock> codec() { | ||
return CODEC; | ||
} | ||
public EmptyRootBlock(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@Override | ||
public int getMaxAge() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) { | ||
return false; | ||
} | ||
|
||
protected ItemLike getBaseSeedId() { | ||
return FAItems.EMPTY_ROOT.get(); | ||
} | ||
|
||
protected VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) { | ||
return Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/ho/artisan/farmaway/common/data/FARegistries.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package ho.artisan.farmaway.common.data; | ||
|
||
import ho.artisan.farmaway.FarmAway; | ||
import ho.artisan.farmaway.common.ritual.Ritual; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.ModList; | ||
import net.neoforged.neoforge.registries.DataPackRegistryEvent; | ||
|
||
public class FARegistries { | ||
public static final ResourceKey<Registry<Ritual>> RITUAL = ResourceKey.createRegistryKey(FarmAway.getResourceLocation("ritual")); | ||
public static void bring() { | ||
IEventBus bus = ModList.get().getModContainerById(RITUAL.location().getNamespace()).get().getEventBus(); | ||
bus.addListener(DataPackRegistryEvent.NewRegistry.class, (event) -> event.dataPackRegistry(RITUAL, Ritual.CODEC, Ritual.CODEC)); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/ho/artisan/farmaway/common/data/FARituals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package ho.artisan.farmaway.common.data; | ||
|
||
import ho.artisan.farmaway.FarmAway; | ||
import ho.artisan.farmaway.common.registry.FABlocks; | ||
import ho.artisan.farmaway.common.ritual.Ritual; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.data.worldgen.BootstrapContext; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.level.block.Block; | ||
import net.minecraft.world.level.block.Blocks; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class FARituals { | ||
public static final ResourceKey<Ritual> POTATO_RITUAL = create("potato_ritual"); | ||
|
||
public static void init(BootstrapContext<Ritual> init) { | ||
init.register(POTATO_RITUAL, new Ritual( | ||
Blocks.POTATOES, | ||
Blocks.STONE, | ||
List.of(Blocks.STONE), | ||
FABlocks.STONE_FARMLAND.get() | ||
)); | ||
} | ||
|
||
public static ResourceKey<Ritual> create(String name) { | ||
return ResourceKey.create(FARegistries.RITUAL, FarmAway.getResourceLocation(name)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/ho/artisan/farmaway/common/ritual/Ritual.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package ho.artisan.farmaway.common.ritual; | ||
|
||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import ho.artisan.farmaway.common.data.FARegistries; | ||
import net.minecraft.core.Holder; | ||
import net.minecraft.core.Registry; | ||
import net.minecraft.core.RegistryAccess; | ||
import net.minecraft.core.registries.BuiltInRegistries; | ||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.world.level.block.Block; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
public record Ritual(Holder<Block> centre, Holder<Block> centreOut, List<Holder<Block>> ritualBase, Holder<Block> baseOut) { | ||
public Ritual(Block centre, Block centreOut, List<Block> base, Block baseOut) { | ||
this(Holder.direct(centre), Holder.direct(centreOut), base.stream().map(Holder::direct).toList(), Holder.direct(baseOut)); | ||
} | ||
|
||
public static final Codec<Ritual> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
BuiltInRegistries.BLOCK.holderByNameCodec().fieldOf("centre").forGetter(Ritual::centre), | ||
BuiltInRegistries.BLOCK.holderByNameCodec().fieldOf("centre_out").forGetter(Ritual::centreOut), | ||
BuiltInRegistries.BLOCK.holderByNameCodec().listOf().fieldOf("ritual_base").forGetter(Ritual::ritualBase), | ||
BuiltInRegistries.BLOCK.holderByNameCodec().fieldOf("base_out").forGetter(Ritual::baseOut) | ||
).apply(instance, Ritual::new)); | ||
|
||
public static Optional<Ritual> of(RegistryAccess access, ResourceKey<Ritual> key) { | ||
Registry<Ritual> registry = access.registryOrThrow(FARegistries.RITUAL); | ||
var holder = registry.getHolder(key); | ||
return holder.map(Holder::value); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/ho/artisan/farmaway/common/util/RitualUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ho.artisan.farmaway.common.util; | ||
|
||
import ho.artisan.farmaway.common.ritual.Ritual; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.core.RegistryAccess; | ||
import net.minecraft.resources.ResourceKey; | ||
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.state.BlockState; | ||
|
||
public class RitualUtil { | ||
public static void start(Level level, BlockPos pos, ResourceKey<Ritual> key) { | ||
var r = Ritual.of(level.registryAccess(), key); | ||
if (r.isPresent()) { | ||
var ritual = r.get(); | ||
if (level.getBlockState(pos).getBlock() == ritual.centre()) { | ||
level.setBlock(pos.below(), ritual.baseOut().value().defaultBlockState(), 2); | ||
level.setBlock(pos, ritual.centreOut().value().defaultBlockState(), 2); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/ho/artisan/farmaway/datagen/rotual/FARitualsProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ho.artisan.farmaway.datagen.rotual; | ||
|
||
import ho.artisan.farmaway.FarmAway; | ||
import ho.artisan.farmaway.common.data.FARegistries; | ||
import ho.artisan.farmaway.common.data.FARituals; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.core.RegistrySetBuilder; | ||
import net.minecraft.data.PackOutput; | ||
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class FARitualsProvider extends DatapackBuiltinEntriesProvider { | ||
public static final RegistrySetBuilder BUILDER = new RegistrySetBuilder().add(FARegistries.RITUAL, FARituals::init); | ||
public FARitualsProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> registries) { | ||
super(output, registries, BUILDER, Set.of(FarmAway.MOD_ID)); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+150 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+177 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+213 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+239 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+268 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+283 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+278 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+282 Bytes
src/main/resources/assets/farm_away/textures/block/finally_wheat_stage7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+275 Bytes
src/main/resources/assets/farm_away/textures/item/finally_wheat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.