Skip to content

Commit

Permalink
Added Juices and compact egg block
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanoren committed Apr 21, 2021
1 parent d3a14fa commit d26bc9e
Show file tree
Hide file tree
Showing 44 changed files with 4,807 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.11.3

# Mod Properties
mod_version = 0.0.7+1.16-alpha
mod_version = 0.0.8+1.16-alpha
maven_group = net.arcano.arcanaflavor
archives_base_name = arcana-flavor

Expand Down
20 changes: 20 additions & 0 deletions src/main/java/net/arcano/arcanaflavor/items/AFBlock.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package net.arcano.arcanaflavor.items;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;

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

@SuppressWarnings("deprecation")
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return Block.createCuboidShape(1.0D, 1.0D,1.0D,15.0D, 16.0D, 15.0D);
}
}
55 changes: 39 additions & 16 deletions src/main/java/net/arcano/arcanaflavor/items/AFDrinkable.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.passive.FoxEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUsage;
import net.minecraft.item.Items;
import net.minecraft.item.*;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;

public class AFDrinkable extends Item {
Expand All @@ -20,21 +20,49 @@ public AFDrinkable(Settings settings) {
}

public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
super.finishUsing(stack, world, user);
if (user instanceof ServerPlayerEntity){
ServerPlayerEntity serverPlayerEntity = (ServerPlayerEntity) user;
Criteria.CONSUME_ITEM.trigger(serverPlayerEntity, stack);
serverPlayerEntity.incrementStat(Stats.USED.getOrCreateStat(this));
}

if (user instanceof PlayerEntity && !((PlayerEntity)user).abilities.creativeMode){
stack.decrement(1);
}

if(!world.isClient && this.getName().toString().contains("milk")){
user.clearStatusEffects();
}

return stack.isEmpty() ? new ItemStack(Items.GLASS_BOTTLE) : stack;
if(!world.isClient && this.getName().toString().contains("chorus")){
double d = user.getX();
double e = user.getY();
double f = user.getZ();

for(int i = 0; i < 16; ++i) {
double g = user.getX() + (user.getRandom().nextDouble() - 0.5D) * 16.0D;
double h = MathHelper.clamp(user.getY() + (double)(user.getRandom().nextInt(16) - 8), 0.0D, world.getDimensionHeight() - 1);
double j = user.getZ() + (user.getRandom().nextDouble() - 0.5D) * 16.0D;
if (user.hasVehicle()) {
user.stopRiding();
}

if (user.teleport(g, h, j, true)) {
SoundEvent soundEvent = user instanceof FoxEntity ? SoundEvents.ENTITY_FOX_TELEPORT : SoundEvents.ITEM_CHORUS_FRUIT_TELEPORT;
world.playSound(null, d, e, f, soundEvent, SoundCategory.PLAYERS, 1.0F, 1.0F);
user.playSound(soundEvent, 1.0F, 1.0F);
break;
}
}

if (user instanceof PlayerEntity) {
((PlayerEntity)user).getItemCooldownManager().set(this, 20);
}
}

if(user instanceof PlayerEntity){
((PlayerEntity) user).inventory.insertStack(new ItemStack(Items.GLASS_BOTTLE));
//((PlayerEntity) user).dropItem(new ItemStack(Items.GLASS_BOTTLE), true);
}

return stack;
}

@Override
Expand All @@ -46,9 +74,4 @@ public int getMaxUseTime(ItemStack stack) {
public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}
18 changes: 17 additions & 1 deletion src/main/java/net/arcano/arcanaflavor/items/AFFood.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ public class AFFood {

//Drinks
public static final Item MILK_BOTTLE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(1).saturationModifier(1).build()));
.food(new FoodComponent.Builder().hunger(1).saturationModifier(1).alwaysEdible().build()));
public static final Item APPLE_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(6).saturationModifier(3).build()));
public static final Item BEETROOT_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(3).saturationModifier(2).build()));
public static final Item BERRY_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(4).saturationModifier(1).build()));
public static final Item CACTUS_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(3).saturationModifier(1).build()));
public static final Item CARROT_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(5).saturationModifier(4).build()));
public static final Item CHORUS_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(6).saturationModifier(3).alwaysEdible().build()));
public static final Item MELON_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(4).saturationModifier(4).build()));
public static final Item SEA_PICKLE_JUICE = new AFDrinkable(new Item.Settings().group(ItemGroup.FOOD)
.food(new FoodComponent.Builder().hunger(3).saturationModifier(1).build()));

}
8 changes: 8 additions & 0 deletions src/main/java/net/arcano/arcanaflavor/items/AFItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package net.arcano.arcanaflavor.items;

import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;

public class AFItem {
public static final Item EGG_CARTON = new Item(new Item.Settings().group(ItemGroup.MISC).maxCount(16));
}
5 changes: 5 additions & 0 deletions src/main/java/net/arcano/arcanaflavor/registry/AFBlocks.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
package net.arcano.arcanaflavor.registry;

import net.arcano.arcanaflavor.ArcanaFlavor;
import net.arcano.arcanaflavor.items.AFBlock;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.Material;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

public class AFBlocks extends Block{
public static final Block COOKING_CAULDRON = new Block(AbstractBlock.Settings.of(Material.METAL).strength(2.0F, 2.0F));
public static final Block EGG_CARTON_BLOCK = new AFBlock(AbstractBlock.Settings.of(Material.SOLID_ORGANIC)
.strength(0.2F, 0.2F).sounds(BlockSoundGroup.WART_BLOCK));

public AFBlocks(Settings settings) {
super(settings);
}

public static void registerBlocks(){
Registry.register(Registry.BLOCK, new Identifier(ArcanaFlavor.MOD_ID, "cooking_cauldron"), COOKING_CAULDRON);
Registry.register(Registry.BLOCK, new Identifier(ArcanaFlavor.MOD_ID, "egg_carton_block"), EGG_CARTON_BLOCK);
}
}
16 changes: 15 additions & 1 deletion src/main/java/net/arcano/arcanaflavor/registry/AFItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import net.arcano.arcanaflavor.ArcanaFlavor;
import net.arcano.arcanaflavor.items.AFFood;
import net.arcano.arcanaflavor.items.AFItem;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
Expand All @@ -13,6 +14,7 @@ public class AFItems {

//Block Items Init
public static final BlockItem COOKING_CAULDRON = new BlockItem(AFBlocks.COOKING_CAULDRON, new Item.Settings().group(ItemGroup.DECORATIONS));
public static final BlockItem EGG_CARTON_BLOCK = new BlockItem(AFBlocks.EGG_CARTON_BLOCK, new Item.Settings().group(ItemGroup.DECORATIONS));

public static void registerItems(){

Expand Down Expand Up @@ -68,10 +70,22 @@ public static void registerItems(){
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "stuffed_chicken"), AFFood.STUFFED_CHICKEN);

//Drinks
Registry.register(Registry.ITEM,new Identifier(ArcanaFlavor.MOD_ID, "milk_bottle"), AFFood.MILK_BOTTLE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "milk_bottle"), AFFood.MILK_BOTTLE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "apple_juice"), AFFood.APPLE_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "beetroot_juice"), AFFood.BEETROOT_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "berry_juice"), AFFood.BERRY_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "cactus_juice"), AFFood.CACTUS_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "carrot_juice"), AFFood.CARROT_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "chorus_juice"), AFFood.CHORUS_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "melon_juice"), AFFood.MELON_JUICE);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "sea_pickle_juice"), AFFood.SEA_PICKLE_JUICE);

/* *Items* */
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "egg_carton"), AFItem.EGG_CARTON);


/* *Block Items* */
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "cooking_cauldron"), COOKING_CAULDRON);
Registry.register(Registry.ITEM, new Identifier(ArcanaFlavor.MOD_ID, "egg_carton_block"), EGG_CARTON_BLOCK);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "arcanaflavor:block/egg_carton_block"
}
}
}
11 changes: 11 additions & 0 deletions src/main/resources/assets/arcanaflavor/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
"item.arcanaflavor.stuffed_chicken": "Stuffed Chicken",

"item.arcanaflavor.milk_bottle": "Milk Bottle",
"item.arcanaflavor.apple_juice": "Apple Juice",
"item.arcanaflavor.beetroot_juice": "Beetroot Juice",
"item.arcanaflavor.berry_juice": "Sweet Berry Juice",
"item.arcanaflavor.cactus_juice": "Cactus Juice",
"item.arcanaflavor.carrot_juice": "Carrot Juice",
"item.arcanaflavor.chorus_juice": "Chorus Juice",
"item.arcanaflavor.melon_juice": "Melon Juice",
"item.arcanaflavor.sea_pickle_juice": "Sea Pickle Juice",

"item.arcanaflavor.egg_carton": "Egg Carton",
"block.arcanaflavor.egg_carton_block": "Egg Carton Block",

"block.arcanaflavor.cooking_cauldron": "Cooking Cauldron"
}
11 changes: 11 additions & 0 deletions src/main/resources/assets/arcanaflavor/lang/pt_br.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
"item.arcanaflavor.stuffed_chicken": "Frango recheado",

"item.arcanaflavor.milk_bottle": "Frasco de Leite",
"item.arcanaflavor.apple_juice": "Suco de maçã",
"item.arcanaflavor.beetroot_juice": "Suco de beterraba",
"item.arcanaflavor.berry_juice": "Suco de frutinhas",
"item.arcanaflavor.cactus_juice": "Suco de cacto",
"item.arcanaflavor.carrot_juice": "Suco de cenoura",
"item.arcanaflavor.chorus_juice": "Suco do coro",
"item.arcanaflavor.melon_juice": "Suco de melancia",
"item.arcanaflavor.sea_pickle_juice": "Suco de pepino do mar",

"item.arcanaflavor.egg_carton": "Cartela de ovos",
"block.arcanaflavor.egg_carton_block": "Bloco de cartelas de ovos",

"block.arcanaflavor.cooking_cauldron": "Caldeirão de Cozinha"
}
Loading

0 comments on commit d26bc9e

Please sign in to comment.