Skip to content

Commit

Permalink
Work!
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluelightning26 committed Dec 8, 2024
1 parent 772c3e6 commit 0c78787
Show file tree
Hide file tree
Showing 24 changed files with 293 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/pengi/potatoperks/PotatoPerks.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public void onInitialize() {
ModItems.registerModItems();
ModBlocks.registerModBlocks();

FuelRegistry.INSTANCE.add(ModBlocks.ORANGE_POTATO_BLOCK, 15000);
FuelRegistry.INSTANCE.add(ModBlocks.ORANGE_POTATO_BLOCK, 6000);
}
}
31 changes: 19 additions & 12 deletions src/main/java/net/pengi/potatoperks/block/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
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;
Expand All @@ -14,45 +13,52 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.pengi.potatoperks.PotatoPerks;
import net.pengi.potatoperks.block.custom.PotatoPortal;

import static net.pengi.potatoperks.item.ModItems.PURPLE_POTATO;

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

));

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

));

public static final Block ORANGE_POTATO_BLOCK = registerBlock("orange_potato_block",
new Block(AbstractBlock.Settings.create()
.strength(0.5f)
.requiresTool()
.sounds(BlockSoundGroup.FLOWERING_AZALEA)
.sounds(BlockSoundGroup.FROGLIGHT)
.slipperiness(0.98f)
));

public static final Block PURPLE_POTATO_BLOCK = registerBlock("purple_potato_block",
new Block(AbstractBlock.Settings.create()
.strength(0.5f)
.sounds(BlockSoundGroup.FROGLIGHT)
));

public static final Block PETRIFIED_POTATO_ORE = registerBlock("petrified_potato_ore",
new ExperienceDroppingBlock(UniformIntProvider.create(2,5), AbstractBlock.Settings.create()
.strength(2f)
.requiresTool()
.sounds(BlockSoundGroup.AZALEA_LEAVES)
.sounds(BlockSoundGroup.STONE)
));

public static final Block PURPLE_POTATO_BLOCK = registerBlock("purple_potato_block",
new Block(AbstractBlock.Settings.create()
.strength(0.5f)
public static final Block POTATO_PORTAL = registerBlock("potato_portal",
new PotatoPortal(AbstractBlock.Settings.create()
.strength(1.0f)
.requiresTool()
.sounds(BlockSoundGroup.FLOWERING_AZALEA)
.sounds(BlockSoundGroup.BAMBOO)
));


Expand All @@ -77,6 +83,7 @@ public static void registerModBlocks() {
entries.add(ModBlocks.ORANGE_POTATO_BLOCK);
entries.add(ModBlocks.PETRIFIED_POTATO_ORE);
entries.add(ModBlocks.PURPLE_POTATO_BLOCK);
entries.add(ModBlocks.POTATO_PORTAL);
});
}
}
44 changes: 44 additions & 0 deletions src/main/java/net/pengi/potatoperks/block/custom/PotatoPortal.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package net.pengi.potatoperks.block.custom;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.pengi.potatoperks.item.ModItems;

public class PotatoPortal extends Block {
public PotatoPortal(Settings settings) {
super(settings);
}

@Override
protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player,
BlockHitResult hit) {
world.playSound(player, pos, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.BLOCKS, 1f, 1f);
return ActionResult.SUCCESS;
}

@Override
public void onSteppedOn(World world, BlockPos pos, BlockState state, Entity entity) {
if (entity instanceof ItemEntity itemEntity) {
if(itemEntity.getStack().getItem() == ModItems.COOKED_PINK_POTATO){
itemEntity.setStack(new ItemStack(ModItems.BLUE_POTATO, itemEntity.getStack().getCount()));
}
if(itemEntity.getStack().getItem() == ModItems.COOKED_BLUE_POTATO){
itemEntity.setStack(new ItemStack(ModItems.ORANGE_POTATO, itemEntity.getStack().getCount()));
}
if(itemEntity.getStack().getItem() == ModItems.COOKED_ORANGE_POTATO){
itemEntity.setStack(new ItemStack(ModItems.PURPLE_POTATO, itemEntity.getStack().getCount()));
}
}
super.onSteppedOn(world, pos, state, entity);
}
}
12 changes: 9 additions & 3 deletions src/main/java/net/pengi/potatoperks/item/ModFoodComponents.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@ public class ModFoodComponents {
public static final FoodComponent COOKED_PINK_POTATO = new FoodComponent.Builder()
.nutrition(5)
.saturationModifier(0.5f)
.statusEffect(new StatusEffectInstance(StatusEffects.SPEED, 200), 95f)
.statusEffect(new StatusEffectInstance(StatusEffects.SPEED, 200, 2), 95f)
.build();

public static final FoodComponent COOKED_BLUE_POTATO = new FoodComponent.Builder()
.nutrition(5)
.saturationModifier(0.5f)
.statusEffect(new StatusEffectInstance(StatusEffects.JUMP_BOOST, 200), 95f)
.statusEffect(new StatusEffectInstance(StatusEffects.JUMP_BOOST, 200, 2), 95f)
.build();

public static final FoodComponent COOKED_ORANGE_POTATO = new FoodComponent.Builder()
.nutrition(5)
.saturationModifier(0.5f)
.statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 200), 95f)
.statusEffect(new StatusEffectInstance(StatusEffects.HASTE, 200, 2), 95f)
.build();

public static final FoodComponent COOKED_PURPLE_POTATO = new FoodComponent.Builder()
.nutrition(5)
.saturationModifier(0.5f)
.statusEffect(new StatusEffectInstance(StatusEffects.NIGHT_VISION, 2000, 1), 1.0f)
.build();

}
4 changes: 4 additions & 0 deletions src/main/java/net/pengi/potatoperks/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class ModItems {
public static final Item COOKED_ORANGE_POTATO = registerItem("cooked_orange_potato", new Item
(new Item.Settings().food(ModFoodComponents.COOKED_ORANGE_POTATO)));

public static final Item COOKED_PURPLE_POTATO = registerItem("cooked_purple_potato", new Item
(new Item.Settings().food(ModFoodComponents.COOKED_PURPLE_POTATO)));

private static Item registerItem(String name, Item item) {
return Registry.register(Registries.ITEM, Identifier.of(PotatoPerks.MOD_ID, name), item);
}
Expand All @@ -44,6 +47,7 @@ public static void registerModItems(){
entries.add(COOKED_PINK_POTATO);
entries.add(COOKED_BLUE_POTATO);
entries.add(COOKED_ORANGE_POTATO);
entries.add(COOKED_PURPLE_POTATO);

} );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "potatoperks:block/potato_portal"
}
}
}
6 changes: 4 additions & 2 deletions src/main/resources/assets/potatoperks/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"item.potatoperks.cooked_pink_potato": "Seared Pink Potato",
"item.potatoperks.cooked_blue_potato": "Charred Blue Potato",
"item.potatoperks.cooked_orange_potato": "Scorched Orange Potato",
"item.potatoperks.cooked_purple_potato": "To Add!",
"item.potatoperks.cooked_purple_potato": "Singed Purple 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",
"block.potatoperks.petrified_potato_ore": "Petrified Potato Ore",
"block.potatoperks.purple_potato_block": "Block of Purple Potato"
"block.potatoperks.purple_potato_block": "Block of Purple Potato",

"block.potatoperks.potato_portal": "Potato Portal"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "potatoperks:block/potato_portal"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "potatoperks:item/cooked_purple_potato"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"parent": "potatoperks:block/potato_portal"
}
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"potatoperks:petrified_potato_ore"

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"potatoperks:petrified_potato_ore"

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "potatoperks:blue_potato_block"
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "potatoperks:orange_potato_block"
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:match_tool",
"predicate": {
"predicates": {
"minecraft:enchantments": [
{
"enchantments": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
}
],
"name": "potatoperks:petrified_potato_ore"
},
{
"type": "minecraft:item",
"functions": [
{
"add": false,
"count": {
"type": "minecraft:uniform",
"max": 5.0,
"min": 2.0
},
"function": "minecraft:set_count"
},
{
"enchantment": "minecraft:fortune",
"formula": "minecraft:ore_drops",
"function": "minecraft:apply_bonus"
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "potatoperks:pink_potato"
}
]
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "potatoperks:pink_potato_block"
}
],
"rolls": 1.0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "potatoperks:potato_portal"
}
],
"rolls": 1.0
}
]
}
Loading

0 comments on commit 0c78787

Please sign in to comment.