generated from NeoForgeMDKs/MDK-1.21-NeoGradle
-
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
MCZME
committed
Aug 1, 2024
1 parent
083b765
commit 3e87ecf
Showing
12 changed files
with
263 additions
and
199 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
src/generated/resources/.cache/59eb3dbb5f86130e09b3c62d89b9525ee01cf52d
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,2 @@ | ||
// 1.21 2024-08-01T22:24:42.609971 Loot Tables | ||
b82daccc5f953aaa0327a61f85766c8394427685 data/lingshi/loot_table/blocks/rice.json |
21 changes: 21 additions & 0 deletions
21
src/generated/resources/data/lingshi/loot_table/blocks/rice.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,21 @@ | ||
{ | ||
"type": "minecraft:block", | ||
"pools": [ | ||
{ | ||
"bonus_rolls": 0.0, | ||
"conditions": [ | ||
{ | ||
"condition": "minecraft:survives_explosion" | ||
} | ||
], | ||
"entries": [ | ||
{ | ||
"type": "minecraft:item", | ||
"name": "lingshi:rice" | ||
} | ||
], | ||
"rolls": 1.0 | ||
} | ||
], | ||
"random_sequence": "lingshi:blocks/rice" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
src/main/java/mczme/lingshi/common/block/RiceSeedling.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,56 @@ | ||
package mczme.lingshi.common.block; | ||
|
||
import com.mojang.serialization.MapCodec; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerLevel; | ||
import net.minecraft.util.RandomSource; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.level.BlockGetter; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.LevelAccessor; | ||
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.LiquidBlockContainer; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraft.world.level.material.FluidState; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class RiceSeedling extends BushBlock implements BonemealableBlock, LiquidBlockContainer { | ||
|
||
public RiceSeedling(Properties properties) { | ||
super(properties); | ||
} | ||
|
||
@Override | ||
protected MapCodec<? extends BushBlock> codec() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isValidBonemealTarget(LevelReader pLevel, BlockPos pPos, BlockState pState) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isBonemealSuccess(Level pLevel, RandomSource pRandom, BlockPos pPos, BlockState pState) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public void performBonemeal(ServerLevel pLevel, RandomSource pRandom, BlockPos pPos, BlockState pState) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean canPlaceLiquid(@Nullable Player pPlayer, BlockGetter pLevel, BlockPos pPos, BlockState pState, Fluid pFluid) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean placeLiquid(LevelAccessor pLevel, BlockPos pPos, BlockState pState, FluidState pFluidState) { | ||
return false; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/mczme/lingshi/common/createtab/CreateTabs.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,28 @@ | ||
package mczme.lingshi.common.createtab; | ||
|
||
import mczme.lingshi.common.registry.ModItems; | ||
import net.minecraft.core.registries.Registries; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.item.CreativeModeTab; | ||
import net.minecraft.world.item.CreativeModeTabs; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.neoforge.registries.DeferredHolder; | ||
import net.neoforged.neoforge.registries.DeferredRegister; | ||
|
||
import static mczme.lingshi.lingshi.MODID; | ||
|
||
public class CreateTabs { | ||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID); | ||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> LINGSHI_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder() | ||
.title(Component.translatable("lingshi.lingshi_tab")) //The language key for the title of your CreativeModeTab | ||
.withTabsBefore(CreativeModeTabs.COMBAT) | ||
.icon(() -> ModItems.RICE.get().getDefaultInstance()) | ||
.displayItems((parameters, output) -> { | ||
output.accept(ModItems.RICE.get()); | ||
output.accept(ModItems.RICE_SEEDING.get()); | ||
}).build()); | ||
|
||
public static void register(IEventBus modEventBus) { | ||
CREATIVE_MODE_TABS.register(modEventBus); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/mczme/lingshi/common/data/DataGenerators.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,36 @@ | ||
package mczme.lingshi.common.data; | ||
|
||
import mczme.lingshi.common.data.loot.BlockLoot; | ||
import mczme.lingshi.lingshi; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.PackOutput; | ||
import net.minecraft.data.loot.LootTableProvider; | ||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; | ||
import net.neoforged.bus.api.SubscribeEvent; | ||
import net.neoforged.fml.common.EventBusSubscriber; | ||
import net.neoforged.neoforge.common.data.ExistingFileHelper; | ||
import net.neoforged.neoforge.data.event.GatherDataEvent; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD, modid = lingshi.MODID) | ||
public class DataGenerators { | ||
|
||
@SubscribeEvent | ||
public static void onGatherData(GatherDataEvent event) { | ||
|
||
DataGenerator generator = event.getGenerator(); | ||
PackOutput output = generator.getPackOutput(); | ||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper(); | ||
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider(); | ||
|
||
// block loot | ||
event.getGenerator().addProvider( | ||
event.includeServer(), | ||
new LootTableProvider(output, Set.of(), List.of(new LootTableProvider.SubProviderEntry(BlockLoot::new, LootContextParamSets.BLOCK)),lookupProvider) | ||
); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/mczme/lingshi/common/data/loot/BlockLoot.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,31 @@ | ||
package mczme.lingshi.common.data.loot; | ||
|
||
import mczme.lingshi.common.registry.ModBlocks; | ||
import net.minecraft.core.HolderLookup; | ||
import net.minecraft.data.loot.BlockLootSubProvider; | ||
import net.minecraft.world.flag.FeatureFlags; | ||
import net.minecraft.world.level.block.Block; | ||
|
||
import java.util.Set; | ||
|
||
public class BlockLoot extends BlockLootSubProvider { | ||
|
||
public static final Set<Block> BLOCK = Set.of( | ||
ModBlocks.RICE.get() | ||
); | ||
|
||
public BlockLoot(HolderLookup.Provider lookupProvider) { | ||
super(Set.of(), FeatureFlags.DEFAULT_FLAGS,lookupProvider); | ||
} | ||
|
||
|
||
@Override | ||
protected void generate() { | ||
this.dropSelf(ModBlocks.RICE.get()); | ||
} | ||
|
||
@Override | ||
protected Iterable<Block> getKnownBlocks() { | ||
return BLOCK; | ||
} | ||
} |
Oops, something went wrong.