Merge remote-tracking branch 'origin/master'
All checks were successful
build / build (push) Successful in 1m15s
All checks were successful
build / build (push) Successful in 1m15s
This commit is contained in:
@ -5,6 +5,6 @@ import net.fabricmc.api.ClientModInitializer;
|
||||
public class SurvivalEnhancedClient implements ClientModInitializer {
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
|
||||
|
||||
}
|
||||
}
|
@ -2,10 +2,23 @@ package wtf.hak;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator;
|
||||
import net.minecraft.registry.Registries;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
import wtf.hak.datagen.*;
|
||||
|
||||
public class SurvivalEnhancedDataGenerator implements DataGeneratorEntrypoint {
|
||||
@Override
|
||||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
|
||||
|
||||
@Override
|
||||
public void onInitializeDataGenerator(FabricDataGenerator generator) {
|
||||
FabricDataGenerator.Pack pack = generator.createPack();
|
||||
|
||||
//System.out.println("MY_BLOCK ID: " + Registries.BLOCK.getId(ModBlocks.TEST_BLOCK));
|
||||
|
||||
pack.addProvider(ModBlockTagProvider::new);
|
||||
pack.addProvider(ModItemTagProvider::new);
|
||||
pack.addProvider(ModModelProvider::new);
|
||||
pack.addProvider(ModLootTableProvider::new);
|
||||
pack.addProvider(ModEngLangProvider::new);
|
||||
//pack.addProvider(ModRecipeProvider::new);
|
||||
}
|
||||
}
|
||||
|
22
src/client/java/wtf/hak/datagen/ModBlockTagProvider.java
Normal file
22
src/client/java/wtf/hak/datagen/ModBlockTagProvider.java
Normal file
@ -0,0 +1,22 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.registry.tag.BlockTags;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
||||
|
||||
public ModBlockTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
||||
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)
|
||||
.add(ModBlocks.TEST_BLOCK);
|
||||
}
|
||||
}
|
19
src/client/java/wtf/hak/datagen/ModEngLangProvider.java
Normal file
19
src/client/java/wtf/hak/datagen/ModEngLangProvider.java
Normal file
@ -0,0 +1,19 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricLanguageProvider;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModEngLangProvider extends FabricLanguageProvider{
|
||||
public ModEngLangProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
|
||||
super(dataOutput, "en_us", registryLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateTranslations(RegistryWrapper.WrapperLookup wrapperLookup, TranslationBuilder translationBuilder) {
|
||||
translationBuilder.add(ModBlocks.TEST_BLOCK.asItem(), "Test Block");
|
||||
}
|
||||
}
|
19
src/client/java/wtf/hak/datagen/ModItemTagProvider.java
Normal file
19
src/client/java/wtf/hak/datagen/ModItemTagProvider.java
Normal file
@ -0,0 +1,19 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
||||
public ModItemTagProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
|
||||
super(output, completableFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
||||
|
||||
}
|
||||
}
|
25
src/client/java/wtf/hak/datagen/ModLootTableProvider.java
Normal file
25
src/client/java/wtf/hak/datagen/ModLootTableProvider.java
Normal file
@ -0,0 +1,25 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricBlockLootTableProvider;
|
||||
import net.minecraft.data.DataOutput;
|
||||
import net.minecraft.loot.LootTable;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModLootTableProvider extends FabricBlockLootTableProvider {
|
||||
|
||||
public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<RegistryWrapper.WrapperLookup> registryLookup) {
|
||||
super(dataOutput, registryLookup);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate() {
|
||||
addDrop(ModBlocks.TEST_BLOCK);
|
||||
}
|
||||
}
|
23
src/client/java/wtf/hak/datagen/ModModelProvider.java
Normal file
23
src/client/java/wtf/hak/datagen/ModModelProvider.java
Normal file
@ -0,0 +1,23 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider;
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.minecraft.client.data.BlockStateModelGenerator;
|
||||
import net.minecraft.client.data.ItemModelGenerator;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
|
||||
public class ModModelProvider extends FabricModelProvider {
|
||||
public ModModelProvider(FabricDataOutput output) {
|
||||
super(output);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
|
||||
blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.TEST_BLOCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
|
||||
|
||||
}
|
||||
}
|
26
src/client/java/wtf/hak/datagen/ModRecipeProvider.java
Normal file
26
src/client/java/wtf/hak/datagen/ModRecipeProvider.java
Normal file
@ -0,0 +1,26 @@
|
||||
package wtf.hak.datagen;
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||
import net.minecraft.data.recipe.RecipeExporter;
|
||||
import net.minecraft.data.recipe.RecipeGenerator;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class ModRecipeProvider extends FabricRecipeProvider {
|
||||
public ModRecipeProvider(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> registriesFuture) {
|
||||
super(output, registriesFuture);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RecipeGenerator getRecipeGenerator(RegistryWrapper.WrapperLookup wrapperLookup, RecipeExporter recipeExporter) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
// 1.21.5 -999999999-01-01T00:00:00 SurvivalEnhanced/Block Loot Tables
|
||||
6d3d52fa8e565a8270b6ed73f2d41c45eb8f8ae1 data/survivalenhanced/loot_table/blocks/test_block.json
|
@ -0,0 +1 @@
|
||||
// 1.21.5 -999999999-01-01T00:00:00 SurvivalEnhanced/Tags for minecraft:item
|
@ -0,0 +1,2 @@
|
||||
// 1.21.5 -999999999-01-01T00:00:00 SurvivalEnhanced/Tags for minecraft:block
|
||||
5bfebfdb385a11ef08214d202811caf3d2ece770 data/minecraft/tags/block/mineable/pickaxe.json
|
@ -0,0 +1,4 @@
|
||||
// 1.21.5 -999999999-01-01T00:00:00 SurvivalEnhanced/Model Definitions
|
||||
8a4568413ceea79afb6cd12a04d134475dc0a5dd assets/survivalenhanced/blockstates/test_block.json
|
||||
4bf1b27ded399c3be7cd77d2c4687ea7771cd9eb assets/survivalenhanced/items/test_block.json
|
||||
2c21fa4746f154853402115ecd8a85816b163592 assets/survivalenhanced/models/block/test_block.json
|
@ -0,0 +1,2 @@
|
||||
// 1.21.5 -999999999-01-01T00:00:00 SurvivalEnhanced/Language (en_us)
|
||||
f92cdd9c2f07e8456fcc5d8040adfbcc626bbdcb assets/survivalenhanced/lang/en_us.json
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "survivalenhanced:block/test_block"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"model": {
|
||||
"type": "minecraft:model",
|
||||
"model": "survivalenhanced:block/test_block"
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"item.survivalenhanced.test_block": "Test Block"
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"parent": "minecraft:block/cube_all",
|
||||
"textures": {
|
||||
"all": "survivalenhanced:block/test_block"
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"values": [
|
||||
"survivalenhanced:test_block"
|
||||
]
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"bonus_rolls": 0.0,
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "survivalenhanced:test_block"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
]
|
||||
}
|
@ -4,21 +4,15 @@ import net.fabricmc.api.ModInitializer;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import wtf.hak.blocks.ModBlocks;
|
||||
|
||||
public class SurvivalEnhanced implements ModInitializer {
|
||||
public static final String MOD_ID = "survivalenhanced";
|
||||
|
||||
// This logger is used to write text to the console and the log file.
|
||||
// It is considered best practice to use your mod id as the logger's name.
|
||||
// That way, it's clear which mod wrote info, warnings, and errors.
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
// This code runs as soon as Minecraft is in a mod-load-ready state.
|
||||
// However, some things (like resources) may still be uninitialized.
|
||||
// Proceed with mild caution.
|
||||
|
||||
LOGGER.info("Hello Fabric world!");
|
||||
ModBlocks.registerBlocks();
|
||||
}
|
||||
}
|
62
src/main/java/wtf/hak/blocks/ModBlocks.java
Normal file
62
src/main/java/wtf/hak/blocks/ModBlocks.java
Normal file
@ -0,0 +1,62 @@
|
||||
package wtf.hak.blocks;
|
||||
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ChestBlock;
|
||||
import net.minecraft.block.TestBlock;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
import wtf.hak.SurvivalEnhanced;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ModBlocks {
|
||||
|
||||
public static Block TEST_BLOCK;
|
||||
|
||||
private static Block register(String name, Function<AbstractBlock.Settings, Block> blockFactory, AbstractBlock.Settings settings, boolean shouldRegisterItem) {
|
||||
// Create a registry key for the block
|
||||
RegistryKey<Block> blockKey = keyOfBlock(name);
|
||||
// Create the block instance
|
||||
Block block = blockFactory.apply(settings.registryKey(blockKey));
|
||||
|
||||
// Sometimes, you may not want to register an item for the block.
|
||||
// Eg: if it's a technical block like `minecraft:moving_piston` or `minecraft:end_gateway`
|
||||
if (shouldRegisterItem) {
|
||||
// Items need to be registered with a different type of registry key, but the ID
|
||||
// can be the same.
|
||||
RegistryKey<Item> itemKey = keyOfItem(name);
|
||||
|
||||
BlockItem blockItem = new BlockItem(block, new Item.Settings().registryKey(itemKey));
|
||||
Registry.register(Registries.ITEM, itemKey, blockItem);
|
||||
}
|
||||
|
||||
return Registry.register(Registries.BLOCK, blockKey, block);
|
||||
}
|
||||
|
||||
private static RegistryKey<Block> keyOfBlock(String name) {
|
||||
return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(SurvivalEnhanced.MOD_ID, name));
|
||||
}
|
||||
|
||||
private static RegistryKey<Item> keyOfItem(String name) {
|
||||
return RegistryKey.of(RegistryKeys.ITEM, Identifier.of(SurvivalEnhanced.MOD_ID, name));
|
||||
}
|
||||
|
||||
public static void registerBlocks(){
|
||||
TEST_BLOCK = register("test_block",
|
||||
TestBlock::new,
|
||||
AbstractBlock.Settings.create().strength(1f).requiresTool(),
|
||||
true);
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> entries.add(TEST_BLOCK));
|
||||
}
|
||||
|
||||
}
|
10
src/main/java/wtf/hak/blocks/TestBlock.java
Normal file
10
src/main/java/wtf/hak/blocks/TestBlock.java
Normal file
@ -0,0 +1,10 @@
|
||||
package wtf.hak.blocks;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
public class TestBlock extends Block {
|
||||
|
||||
public TestBlock(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 269 B |
Reference in New Issue
Block a user