Skip to content

Commit

Permalink
Work of Night of Nov 29
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluelightning26 committed Nov 30, 2024
1 parent 4792671 commit 0793feb
Show file tree
Hide file tree
Showing 20 changed files with 194 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/net/pengi/potatoperks/PotatoPerks.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import net.fabricmc.api.ModInitializer;

import net.pengi.potatoperks.block.ModBlocks;
import net.pengi.potatoperks.item.ModItems;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -11,6 +13,8 @@ public class PotatoPerks implements ModInitializer {

@Override
public void onInitialize() {
ModItems.registerModItems();
ModBlocks.registerModBlocks();

}
}
68 changes: 68 additions & 0 deletions src/main/java/net/pengi/potatoperks/block/ModBlocks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package net.pengi.potatoperks.block;

import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.ExperienceDroppingBlock;
import net.minecraft.block.MapColor;
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.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.pengi.potatoperks.PotatoPerks;

public class ModBlocks {
public static final Block PINK_POTATO_BLOCK = registerBlock("pink_potato_block",
new Block(AbstractBlock.Settings.create()
.strength(1f)
.requiresTool()
.sounds(BlockSoundGroup.FLOWERING_AZALEA)
.velocityMultiplier(1.25f)

));

public static final Block BLUE_POTATO_BLOCK = registerBlock("blue_potato_block",
new Block(AbstractBlock.Settings.create()
.strength(1f)
.requiresTool()
.sounds(BlockSoundGroup.FLOWERING_AZALEA)
.jumpVelocityMultiplier(2f)

));

public static final Block ORANGE_POTATO_BLOCK = registerBlock("orange_potato_block",
new ExperienceDroppingBlock(UniformIntProvider.create(5,10), AbstractBlock.Settings.create()
.strength(1f)
.requiresTool()
.sounds(BlockSoundGroup.FLOWERING_AZALEA)
));





private static Block registerBlock(String name, Block block) {
registerBlockItem(name, block);
return Registry.register(Registries.BLOCK, Identifier.of(PotatoPerks.MOD_ID, name), block);
}

private static void registerBlockItem(String name, Block block) {
Registry.register(Registries.ITEM, Identifier.of(PotatoPerks.MOD_ID, name),
new BlockItem(block, new Item.Settings()));
}


public static void registerModBlocks() {
PotatoPerks.LOGGER.info("Registering Mod Blocks for " + PotatoPerks.MOD_ID);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.BUILDING_BLOCKS).register(entries -> {
entries.add(ModBlocks.PINK_POTATO_BLOCK);
entries.add(ModBlocks.BLUE_POTATO_BLOCK);
entries.add(ModBlocks.ORANGE_POTATO_BLOCK);
});
}
}
29 changes: 29 additions & 0 deletions src/main/java/net/pengi/potatoperks/item/ModItems.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package net.pengi.potatoperks.item;

import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.pengi.potatoperks.PotatoPerks;

public class ModItems {

public static final Item PINK_POTATO = registerItem("pink_potato", new Item(new Item.Settings()));




private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, Identifier.of(PotatoPerks.MOD_ID, name), item);
}

public static void registerModItems(){
PotatoPerks.LOGGER.info("Registering Mod Items for " + PotatoPerks.MOD_ID);

ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(entries -> {
entries.add(PINK_POTATO);
} );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "potatoperks:block/blue_potato_block"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "potatoperks:block/orange_potato_block"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "potatoperks:block/pink_potato_block"
}
}
}
8 changes: 8 additions & 0 deletions src/main/resources/assets/potatoperks/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"item.potatoperks.pink_potato": "Pink Potato",

"block.potatoperks.pink_potato_block": "Block of Pink Potato",
"block.potatoperks.blue_potato_block": "Block of Blue Potato",
"block.potatoperks.orange_potato_block": "Block of Orange Potato"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "potatoperks:block/blue_potato_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "potatoperks:block/orange_potato_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "potatoperks:block/pink_potato_block"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "potatoperks:block/blue_potato_block"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "potatoperks:block/orange_potato_block"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "potatoperks:item/pink_potato"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "potatoperks:block/pink_potato_block"
}
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.
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.
13 changes: 13 additions & 0 deletions src/main/resources/data/potatoperks/recipe/pink_potato.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": "minecraft:crafting_shapeless",
"category": "building",
"ingredients": [
{
"item": "potatoperks:pink_potato_block"
}
],
"result": {
"count": 9,
"id": "potatoperks:pink_potato"
}
}
18 changes: 18 additions & 0 deletions src/main/resources/data/potatoperks/recipe/pink_potato_block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"key": {
"#": {
"item": "potatoperks:pink_potato"
}
},
"pattern": [
"###",
"###",
"###"
],
"result": {
"count": 1,
"id": "potatoperks:pink_potato_block"
}
}

0 comments on commit 0793feb

Please sign in to comment.