Update NonBlock blocks
This commit is contained in:
parent
bcdb41d6ac
commit
db7efdf7ba
@ -5,7 +5,6 @@ import net.fabricmc.api.ModInitializer;
|
|||||||
|
|
||||||
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
|
import net.fabricmc.fabric.api.registry.CompostingChanceRegistry;
|
||||||
import net.fabricmc.fabric.api.registry.FuelRegistryEvents;
|
import net.fabricmc.fabric.api.registry.FuelRegistryEvents;
|
||||||
import net.minecraft.item.FuelRegistry;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -33,11 +32,11 @@ public class Learning implements ModInitializer {
|
|||||||
|
|
||||||
LOGGER.info("Adding Fuel registries...");
|
LOGGER.info("Adding Fuel registries...");
|
||||||
FuelRegistryEvents.BUILD.register(((builder, context) -> {
|
FuelRegistryEvents.BUILD.register(((builder, context) -> {
|
||||||
builder.add(CustomItems.overcookedToast, 6000);
|
builder.add(CustomItems.OVERCOOKED_TOAST, 6000);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
LOGGER.info("Adding Compostable registries...");
|
LOGGER.info("Adding Compostable registries...");
|
||||||
CompostingChanceRegistry.INSTANCE.add(CustomItems.toast, 0.3f);
|
CompostingChanceRegistry.INSTANCE.add(CustomItems.TOAST, 0.3f);
|
||||||
CompostingChanceRegistry.INSTANCE.add(CustomItems.bakedToast, 0.5f);
|
CompostingChanceRegistry.INSTANCE.add(CustomItems.BAKED_TOAST, 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
12
src/main/java/com/learning/LearningClient.java
Normal file
12
src/main/java/com/learning/LearningClient.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package com.learning;
|
||||||
|
|
||||||
|
import com.learning.block.CustomBlocks;
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||||
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
|
||||||
|
public class LearningClient implements ClientModInitializer {
|
||||||
|
public void onInitializeClient() {
|
||||||
|
BlockRenderLayerMap.INSTANCE.putBlock(CustomBlocks.DENSITY_GLASS_DOOR, RenderLayer.getCutout());
|
||||||
|
}
|
||||||
|
}
|
@ -2,14 +2,14 @@ package com.learning.block;
|
|||||||
|
|
||||||
import com.learning.Learning;
|
import com.learning.Learning;
|
||||||
|
|
||||||
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.registry.Registry;
|
import net.minecraft.registry.Registry;
|
||||||
import net.minecraft.registry.RegistryKey;
|
import net.minecraft.registry.RegistryKey;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.registry.RegistryKeys;
|
||||||
import net.minecraft.block.AbstractBlock;
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class CustomBlocks {
|
public class CustomBlocks {
|
||||||
@ -17,21 +17,47 @@ public class CustomBlocks {
|
|||||||
Learning.LOGGER.info("Registering blocks...");
|
Learning.LOGGER.info("Registering blocks...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Block testBlock = register("test_block");
|
public static final Block TEST_BLOCK = register("test_block");
|
||||||
public static final Block damageBlock = register("damage_block", DamageBlock::new, AbstractBlock.Settings.create().requiresTool());
|
public static final Block DAMAGE_BLOCK = register("damage_block", DamageBlock::new, AbstractBlock.Settings.create().requiresTool());
|
||||||
public static final Block transformBlock = register("transform_block", TransformBlock::new);
|
public static final Block TRANSFORM_BLOCK = register("transform_block", TransformBlock::new);
|
||||||
|
public static final Block DENSITY_GLASS = register("density_glass");
|
||||||
|
|
||||||
|
public static final Block DENSITY_GLASS_STAIRS = register("density_glass_stairs", StairsBlock::new,
|
||||||
|
DENSITY_GLASS.getDefaultState(), AbstractBlock.Settings.create().requiresTool().strength(2f));
|
||||||
|
public static final Block DENSITY_GLASS_FENCE = register("density_glass_fence", FenceBlock::new, AbstractBlock.Settings.create().requiresTool().strength(2f));
|
||||||
|
public static final Block DENSITY_GLASS_FENCE_GATE = register("density_glass_gate", FenceGateBlock::new,
|
||||||
|
WoodType.OAK, AbstractBlock.Settings.create().requiresTool().strength(2f));
|
||||||
|
public static final Block DENSITY_GLASS_SLAB = register("density_glass_slab", SlabBlock::new, AbstractBlock.Settings.create().requiresTool().strength(2f).noCollision());
|
||||||
|
public static final Block DENSITY_GLASS_DOOR = register("density_glass_door", (AbstractBlock.Settings blockSettings) -> new DoorBlock(BlockSetType.IRON, blockSettings),
|
||||||
|
AbstractBlock.Settings.create().requiresTool().strength(2f).nonOpaque());
|
||||||
|
|
||||||
public static Block register(String blockId) {
|
public static Block register(String blockId) {
|
||||||
return register(blockId, Block::new, AbstractBlock.Settings.create());
|
return register(blockId, Block::new, AbstractBlock.Settings.create().strength(2f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block register(String blockId, Function<AbstractBlock.Settings, Block> factory) {
|
public static Block register(String blockId, Function<AbstractBlock.Settings, Block> factory) {
|
||||||
return register(blockId, factory, AbstractBlock.Settings.create());
|
return register(blockId, factory, AbstractBlock.Settings.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for BlockState, BlockSettings register
|
||||||
|
public static Block register(String blockId, BiFunction<BlockState, AbstractBlock.Settings, Block> factory, BlockState blockState, AbstractBlock.Settings settings) {
|
||||||
|
RegistryKey<Block> key = keyOf(blockId);
|
||||||
|
return register(key, factory.apply(blockState, settings.registryKey(key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// for WoodType, BlockSettings register
|
||||||
|
public static Block register(String blockId, BiFunction<WoodType, AbstractBlock.Settings, Block> factory, WoodType woodType, AbstractBlock.Settings settings) {
|
||||||
|
RegistryKey<Block> key = keyOf(blockId);
|
||||||
|
return register(key, factory.apply(woodType, settings.registryKey(key)));
|
||||||
|
}
|
||||||
|
|
||||||
public static Block register(String blockId, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings) {
|
public static Block register(String blockId, Function<AbstractBlock.Settings, Block> factory, AbstractBlock.Settings settings) {
|
||||||
RegistryKey<Block> key = keyOf(blockId);
|
RegistryKey<Block> key = keyOf(blockId);
|
||||||
return Registry.register(Registries.BLOCK, key, factory.apply(settings.registryKey(key)));
|
return register(key, factory.apply(settings.registryKey(key)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Block register(RegistryKey<Block> key, Block block) {
|
||||||
|
return Registry.register(Registries.BLOCK, key, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RegistryKey<Block> keyOf(String blockId) {
|
private static RegistryKey<Block> keyOf(String blockId) {
|
||||||
|
@ -37,7 +37,9 @@ public class DamageBlock extends Block {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||||
player.sendMessage(Text.translatable("block.learning.damage_block.on_use"), false);
|
if (!world.isClient()) {
|
||||||
|
player.sendMessage(Text.translatable("block.learning.damage_block.on_use"), false);
|
||||||
|
}
|
||||||
return ActionResult.SUCCESS;
|
return ActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
package com.learning.datagen;
|
package com.learning.datagen;
|
||||||
|
|
||||||
import com.learning.block.CustomBlocks;
|
import com.learning.block.CustomBlocks;
|
||||||
import com.learning.item.CustomItems;
|
|
||||||
import com.learning.util.ModTags;
|
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.registry.RegistryKey;
|
|
||||||
import net.minecraft.registry.RegistryWrapper;
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
import net.minecraft.registry.tag.BlockTags;
|
import net.minecraft.registry.tag.BlockTags;
|
||||||
|
|
||||||
@ -21,6 +17,9 @@ public class ModBlockTagProvider extends FabricTagProvider.BlockTagProvider {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
||||||
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)
|
getOrCreateTagBuilder(BlockTags.PICKAXE_MINEABLE)
|
||||||
.add(CustomBlocks.damageBlock);
|
.add(CustomBlocks.DAMAGE_BLOCK);
|
||||||
|
|
||||||
|
getOrCreateTagBuilder(BlockTags.FENCE_GATES).add(CustomBlocks.DENSITY_GLASS_FENCE_GATE);
|
||||||
|
getOrCreateTagBuilder(BlockTags.FENCES).add(CustomBlocks.DENSITY_GLASS_FENCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,6 @@ public class ModItemTagProvider extends FabricTagProvider.ItemTagProvider {
|
|||||||
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
protected void configure(RegistryWrapper.WrapperLookup wrapperLookup) {
|
||||||
getOrCreateTagBuilder(ModTags.ItemTags.DIAMOND_TRANSFORMABLE)
|
getOrCreateTagBuilder(ModTags.ItemTags.DIAMOND_TRANSFORMABLE)
|
||||||
.add(Items.DIAMOND)
|
.add(Items.DIAMOND)
|
||||||
.add(CustomItems.bakedToast);
|
.add(CustomItems.BAKED_TOAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,12 @@ public class ModLootTableProvider extends FabricBlockLootTableProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate() {
|
public void generate() {
|
||||||
addDrop(CustomBlocks.transformBlock);
|
addDrop(CustomBlocks.TRANSFORM_BLOCK);
|
||||||
addDrop(CustomBlocks.damageBlock);
|
addDrop(CustomBlocks.DAMAGE_BLOCK);
|
||||||
|
addDrop(CustomBlocks.DENSITY_GLASS_FENCE_GATE);
|
||||||
|
addDrop(CustomBlocks.DENSITY_GLASS_FENCE);
|
||||||
|
addDrop(CustomBlocks.DENSITY_GLASS_DOOR, doorDrops(CustomBlocks.DENSITY_GLASS_DOOR));
|
||||||
|
addDrop(CustomBlocks.DENSITY_GLASS_STAIRS);
|
||||||
|
addDrop(CustomBlocks.DENSITY_GLASS_SLAB, slabDrops(CustomBlocks.DENSITY_GLASS_SLAB));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,15 +23,23 @@ public class ModModelProvider extends FabricModelProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
|
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
|
||||||
blockStateModelGenerator.registerSingleton(CustomBlocks.damageBlock, TexturedModel.makeFactory(this::blockOnlySideTop, Models.CUBE_BOTTOM_TOP));
|
blockStateModelGenerator.registerSingleton(CustomBlocks.DAMAGE_BLOCK, TexturedModel.makeFactory(this::blockOnlySideTop, Models.CUBE_BOTTOM_TOP));
|
||||||
blockStateModelGenerator.registerSingleton(CustomBlocks.transformBlock, TexturedModel.makeFactory(this::blockOnlySideTop, Models.CUBE_BOTTOM_TOP));
|
blockStateModelGenerator.registerSingleton(CustomBlocks.TRANSFORM_BLOCK, TexturedModel.makeFactory(this::blockOnlySideTop, Models.CUBE_BOTTOM_TOP));
|
||||||
|
|
||||||
|
BlockStateModelGenerator.BlockTexturePool densityGlassPool = blockStateModelGenerator.registerCubeAllModelTexturePool(CustomBlocks.DENSITY_GLASS);
|
||||||
|
densityGlassPool.fence(CustomBlocks.DENSITY_GLASS_FENCE);
|
||||||
|
densityGlassPool.slab(CustomBlocks.DENSITY_GLASS_SLAB);
|
||||||
|
densityGlassPool.fenceGate(CustomBlocks.DENSITY_GLASS_FENCE_GATE);
|
||||||
|
densityGlassPool.stairs(CustomBlocks.DENSITY_GLASS_STAIRS);
|
||||||
|
blockStateModelGenerator.registerDoor(CustomBlocks.DENSITY_GLASS_DOOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
|
public void generateItemModels(ItemModelGenerator itemModelGenerator) {
|
||||||
itemModelGenerator.register(CustomItems.overcookedToast, Models.GENERATED);
|
itemModelGenerator.register(CustomItems.OVERCOOKED_TOAST, Models.GENERATED);
|
||||||
itemModelGenerator.register(CustomItems.bakedToast, Models.GENERATED);
|
itemModelGenerator.register(CustomItems.BAKED_TOAST, Models.GENERATED);
|
||||||
itemModelGenerator.register(CustomItems.toast, Models.GENERATED);
|
itemModelGenerator.register(CustomItems.TOAST, Models.GENERATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,14 +3,10 @@ package com.learning.datagen;
|
|||||||
import com.learning.item.CustomItems;
|
import com.learning.item.CustomItems;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
|
||||||
import net.minecraft.data.recipe.CookingRecipeJsonBuilder;
|
|
||||||
import net.minecraft.data.recipe.RecipeExporter;
|
import net.minecraft.data.recipe.RecipeExporter;
|
||||||
import net.minecraft.data.recipe.RecipeGenerator;
|
import net.minecraft.data.recipe.RecipeGenerator;
|
||||||
import net.minecraft.data.recipe.ShapedRecipeJsonBuilder;
|
|
||||||
import net.minecraft.item.ItemConvertible;
|
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.recipe.*;
|
import net.minecraft.recipe.Ingredient;
|
||||||
import net.minecraft.recipe.book.CookingRecipeCategory;
|
|
||||||
import net.minecraft.recipe.book.RecipeCategory;
|
import net.minecraft.recipe.book.RecipeCategory;
|
||||||
import net.minecraft.registry.RegistryWrapper;
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
|
||||||
@ -28,10 +24,10 @@ public class ModRecipeProvider extends FabricRecipeProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate() {
|
public void generate() {
|
||||||
offerSmelting(List.of(CustomItems.toast), RecipeCategory.FOOD, CustomItems.bakedToast, 0.35f, 200, "toast_furnace");
|
offerSmelting(List.of(CustomItems.TOAST), RecipeCategory.FOOD, CustomItems.BAKED_TOAST, 0.35f, 200, "toast_furnace");
|
||||||
offerSmelting(List.of(CustomItems.bakedToast), RecipeCategory.FOOD, CustomItems.overcookedToast, 0.35f, 200, "toast_furnace");
|
offerSmelting(List.of(CustomItems.BAKED_TOAST), RecipeCategory.FOOD, CustomItems.OVERCOOKED_TOAST, 0.35f, 200, "toast_furnace");
|
||||||
|
|
||||||
createShaped(RecipeCategory.MISC, CustomItems.damageBlock, 4)
|
createShaped(RecipeCategory.MISC, CustomItems.DAMAGE_BLOCK, 4)
|
||||||
.pattern("SSS")
|
.pattern("SSS")
|
||||||
.pattern("BRB")
|
.pattern("BRB")
|
||||||
.pattern("BBB")
|
.pattern("BBB")
|
||||||
@ -40,6 +36,27 @@ public class ModRecipeProvider extends FabricRecipeProvider {
|
|||||||
.input('R', Items.RED_DYE)
|
.input('R', Items.RED_DYE)
|
||||||
.criterion(hasItem(Items.IRON_SWORD), conditionsFromItem(Items.IRON_SWORD))
|
.criterion(hasItem(Items.IRON_SWORD), conditionsFromItem(Items.IRON_SWORD))
|
||||||
.offerTo(exporter);
|
.offerTo(exporter);
|
||||||
|
|
||||||
|
createShapeless(RecipeCategory.BUILDING_BLOCKS, CustomItems.DENSITY_GLASS)
|
||||||
|
.input(Items.GLASS)
|
||||||
|
.input(Items.OBSIDIAN)
|
||||||
|
.criterion(hasItem(Items.OBSIDIAN), conditionsFromItem(Items.OBSIDIAN))
|
||||||
|
.offerTo(exporter);
|
||||||
|
|
||||||
|
createFenceRecipe(CustomItems.DENSITY_GLASS_FENCE, Ingredient.ofItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.criterion(hasItem(CustomItems.DENSITY_GLASS), conditionsFromItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.offerTo(exporter);
|
||||||
|
createFenceGateRecipe(CustomItems.DENSITY_GLASS_FENCE_GATE, Ingredient.ofItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.criterion(hasItem(CustomItems.DENSITY_GLASS), conditionsFromItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.offerTo(exporter);
|
||||||
|
createStairsRecipe(CustomItems.DENSITY_GLASS_STAIRS, Ingredient.ofItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.criterion(hasItem(CustomItems.DENSITY_GLASS), conditionsFromItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.offerTo(exporter);
|
||||||
|
offerSlabRecipe(RecipeCategory.BUILDING_BLOCKS, CustomItems.DENSITY_GLASS_SLAB, CustomItems.DENSITY_GLASS);
|
||||||
|
createDoorRecipe(CustomItems.DENSITY_GLASS_DOOR, Ingredient.ofItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.criterion(hasItem(CustomItems.DENSITY_GLASS), conditionsFromItem(CustomItems.DENSITY_GLASS))
|
||||||
|
.offerTo(exporter);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -28,9 +28,11 @@ public class CustomItems {
|
|||||||
Learning.LOGGER.info("Registering Items...");
|
Learning.LOGGER.info("Registering Items...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item toast = register("toast", Toast::new, new Item.Settings().food(Foods.toastFood));
|
public static Item TEST_ITEM = register("test_item");
|
||||||
public static Item bakedToast = register("baked_toast", BakedToast::new, new Item.Settings().food(Foods.bakedToastFood, ConsumableComponents.food().consumeSeconds(0.8f).build()));
|
|
||||||
public static Item overcookedToast = register(keyOf("overcooked_toast"), new Item(new Item.Settings().registryKey(keyOf("overcooked_toast"))) {
|
public static Item TOAST = register("toast", Toast::new, new Item.Settings().food(Foods.toastFood));
|
||||||
|
public static Item BAKED_TOAST = register("baked_toast", BakedToast::new, new Item.Settings().food(Foods.bakedToastFood, ConsumableComponents.food().consumeSeconds(0.8f).build()));
|
||||||
|
public static Item OVERCOOKED_TOAST = register(keyOf("overcooked_toast"), new Item(new Item.Settings().registryKey(keyOf("overcooked_toast"))) {
|
||||||
@Override
|
@Override
|
||||||
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
|
public void appendTooltip(ItemStack stack, TooltipContext context, List<Text> tooltip, TooltipType type) {
|
||||||
tooltip.add(Text.translatable("toolTip.learning.overcooked_toast").formatted(Formatting.GRAY));
|
tooltip.add(Text.translatable("toolTip.learning.overcooked_toast").formatted(Formatting.GRAY));
|
||||||
@ -38,10 +40,18 @@ public class CustomItems {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
public static Item damageBlock = register(CustomBlocks.damageBlock, false);
|
public static Item DAMAGE_BLOCK = register(CustomBlocks.DAMAGE_BLOCK, false);
|
||||||
public static Item transformBlock = register(CustomBlocks.transformBlock, false);
|
public static Item TRANSFORM_BLOCK = register(CustomBlocks.TRANSFORM_BLOCK, false);
|
||||||
|
public static Item DENSITY_GLASS = register(CustomBlocks.DENSITY_GLASS, false);
|
||||||
|
public static Item DENSITY_GLASS_DOOR = register(CustomBlocks.DENSITY_GLASS_DOOR, false);
|
||||||
|
public static Item DENSITY_GLASS_STAIRS = register(CustomBlocks.DENSITY_GLASS_STAIRS, false);
|
||||||
|
public static Item DENSITY_GLASS_FENCE = register(CustomBlocks.DENSITY_GLASS_FENCE, false);
|
||||||
|
public static Item DENSITY_GLASS_SLAB = register(CustomBlocks.DENSITY_GLASS_SLAB, false);
|
||||||
|
public static Item DENSITY_GLASS_FENCE_GATE = register(CustomBlocks.DENSITY_GLASS_FENCE_GATE, false);
|
||||||
|
|
||||||
private static Item register(Block block, Boolean useItemTranslateKey) {
|
|
||||||
|
|
||||||
|
private static Item register(Block block, Boolean useItemTranslateKey) { // Block register
|
||||||
if (Registries.BLOCK.getKey(block).isPresent()) {
|
if (Registries.BLOCK.getKey(block).isPresent()) {
|
||||||
RegistryKey<Item> key = keyOf(Registries.BLOCK.getKey(block).get());
|
RegistryKey<Item> key = keyOf(Registries.BLOCK.getKey(block).get());
|
||||||
Item.Settings settings = new Item.Settings().registryKey(key);
|
Item.Settings settings = new Item.Settings().registryKey(key);
|
||||||
|
@ -18,19 +18,25 @@ public class CustomItemGroup {
|
|||||||
Learning.LOGGER.info("Registering ItemGroup...");
|
Learning.LOGGER.info("Registering ItemGroup...");
|
||||||
Learning.LOGGER.info("Registering item into ItemGroups...");
|
Learning.LOGGER.info("Registering item into ItemGroups...");
|
||||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(
|
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FOOD_AND_DRINK).register(
|
||||||
register -> register.add(CustomItems.toast)
|
register -> register.add(CustomItems.TOAST)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ItemGroup customItemGroup = register("custom_itemgroup", ItemGroup.create(null, -1)
|
public static ItemGroup customItemGroup = register("custom_itemgroup", ItemGroup.create(null, -1)
|
||||||
.icon(() -> new ItemStack(CustomItems.toast))
|
.icon(() -> new ItemStack(CustomItems.TOAST))
|
||||||
.displayName(Text.translatable("itemGroup.learning.custom_itemgroup"))
|
.displayName(Text.translatable("itemGroup.learning.custom_itemgroup"))
|
||||||
.entries((displayContext, entries) -> {
|
.entries((displayContext, entries) -> {
|
||||||
entries.add(CustomItems.toast);
|
entries.add(CustomItems.TOAST);
|
||||||
entries.add(CustomItems.bakedToast);
|
entries.add(CustomItems.BAKED_TOAST);
|
||||||
entries.add(CustomItems.overcookedToast);
|
entries.add(CustomItems.OVERCOOKED_TOAST);
|
||||||
entries.add(CustomItems.damageBlock);
|
entries.add(CustomItems.DAMAGE_BLOCK);
|
||||||
entries.add(CustomItems.transformBlock);
|
entries.add(CustomItems.TRANSFORM_BLOCK);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS_DOOR);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS_FENCE);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS_FENCE_GATE);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS_STAIRS);
|
||||||
|
entries.add(CustomItems.DENSITY_GLASS_SLAB);
|
||||||
})
|
})
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
"block.learning.damage_block": "Damage Block",
|
"block.learning.damage_block": "Damage Block",
|
||||||
"block.learning.damage_block.on_use": "Make 5 damage per hurt.",
|
"block.learning.damage_block.on_use": "Make 5 damage per hurt.",
|
||||||
"block.learning.transform_block": "Transform Block",
|
"block.learning.transform_block": "Transform Block",
|
||||||
|
"block.learning.density_glass": "Density Glass",
|
||||||
|
"block.learning.density_glass_gate": "Density Glass",
|
||||||
|
"block.learning.density_glass_fence": "Density Glass Fence",
|
||||||
|
"block.learning.density_glass_door": "Density Glass Door",
|
||||||
|
"block.learning.density_glass_slab": "Density Glass Slab",
|
||||||
|
"block.learning.density_glass_stairs": "Density Glass Stairs",
|
||||||
|
|
||||||
"itemGroup.learning.custom_itemgroup": "My Dear...",
|
"itemGroup.learning.custom_itemgroup": "My Dear...",
|
||||||
|
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 237 B |
@ -18,6 +18,9 @@
|
|||||||
"main": [
|
"main": [
|
||||||
"com.learning.Learning"
|
"com.learning.Learning"
|
||||||
],
|
],
|
||||||
|
"client": [
|
||||||
|
"com.learning.LearningClient"
|
||||||
|
],
|
||||||
"fabric-datagen": [
|
"fabric-datagen": [
|
||||||
"com.learning.LearningDataGenerator"
|
"com.learning.LearningDataGenerator"
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user