-
Notifications
You must be signed in to change notification settings - Fork 7
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
10 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
src/main/java/io/github/tt432/kitchenkarrot/block/GemCarrotCrop.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,26 @@ | ||
package io.github.tt432.kitchenkarrot.block; | ||
|
||
import io.github.tt432.kitchenkarrot.item.ModBlockItems; | ||
import net.minecraft.world.level.ItemLike; | ||
import net.minecraft.world.level.block.CropBlock; | ||
import net.minecraft.world.level.block.SoundType; | ||
import net.minecraft.world.level.block.state.BlockBehaviour; | ||
import net.minecraft.world.level.material.Material; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class GemCarrotCrop extends CropBlock { | ||
public GemCarrotCrop() { | ||
super(BlockBehaviour.Properties | ||
.of(Material.PLANT) | ||
.sound(SoundType.CROP) | ||
.randomTicks() | ||
.noCollission() | ||
.instabreak()); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
protected ItemLike getBaseSeedId() { | ||
return ModBlockItems.GEM_CARROT.get(); | ||
} | ||
} |
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
21 changes: 21 additions & 0 deletions
21
src/main/java/io/github/tt432/kitchenkarrot/datagen/loottable/ModBlockLootProvider.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,21 @@ | ||
package io.github.tt432.kitchenkarrot.datagen.loottable; | ||
|
||
import io.github.tt432.kitchenkarrot.block.ModBlocks; | ||
import io.github.tt432.kitchenkarrot.item.ModBlockItems; | ||
import net.minecraft.advancements.critereon.StatePropertiesPredicate; | ||
import net.minecraft.data.loot.BlockLoot; | ||
import net.minecraft.world.level.block.Blocks; | ||
import net.minecraft.world.level.block.CropBlock; | ||
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition; | ||
|
||
public class ModBlockLootProvider extends BlockLoot { | ||
|
||
@Override | ||
protected void addTables() { | ||
createCropDrops(ModBlocks.GEM_CARROT.get(), ModBlockItems.GEM_CARROT.get(), ModBlockItems.GEM_CARROT.get(), | ||
LootItemBlockStatePropertyCondition | ||
.hasBlockStateProperties(Blocks.WHEAT) | ||
.setProperties(StatePropertiesPredicate.Builder.properties() | ||
.hasProperty(CropBlock.AGE, 7))); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/io/github/tt432/kitchenkarrot/datagen/loottable/ModLootTableProvider.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,37 @@ | ||
package io.github.tt432.kitchenkarrot.datagen.loottable; | ||
|
||
import com.google.common.collect.ImmutableList; | ||
import com.mojang.datafixers.util.Pair; | ||
import io.github.tt432.kitchenkarrot.Kitchenkarrot; | ||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.loot.LootTableProvider; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.level.storage.loot.LootTable; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
import java.util.function.BiConsumer; | ||
import java.util.function.Consumer; | ||
import java.util.function.Supplier; | ||
|
||
public class ModLootTableProvider extends LootTableProvider { | ||
public ModLootTableProvider(DataGenerator pGenerator) { | ||
super(pGenerator); | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public String getName() { | ||
return super.getName() + ":" + Kitchenkarrot.MOD_ID; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
protected List<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootContextParamSet>> getTables() { | ||
ImmutableList.Builder<Pair<Supplier<Consumer<BiConsumer<ResourceLocation, LootTable.Builder>>>, LootContextParamSet>> builder = new ImmutableList.Builder<>(); | ||
builder.add(Pair.of(ModBlockLootProvider::new, LootContextParamSets.BLOCK)); | ||
return builder.build(); | ||
} | ||
} |
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