Skip to content

Commit

Permalink
Various Fixes and Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Axelph237 committed Jul 23, 2021
1 parent 8eebcd0 commit 265b5ff
Show file tree
Hide file tree
Showing 51 changed files with 243 additions and 7 deletions.
14 changes: 9 additions & 5 deletions src/main/java/net/candy/chocolatevanilla/Main.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package net.candy.chocolatevanilla;

import com.ibm.icu.impl.CacheValue;
import net.candy.chocolatevanilla.item.ChocolateMilkBucketItem;
import net.candy.chocolatevanilla.item.DragonSpiritItem;
import net.candy.chocolatevanilla.item.EnchanteaItem;
import net.candy.chocolatevanilla.item.TeaItem;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.*;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
import net.minecraft.util.registry.Registry;

public class Main implements ModInitializer {
Expand All @@ -20,9 +24,9 @@ public class Main implements ModInitializer {
public static final MushroomStewItem BEEF_STROGANOFF = new MushroomStewItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(12).saturationModifier(12F/14F).build()));
public static final Item JAM_SANDWICH = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).build()));
public static final Item HONEY_SANDWICH = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).build()));
public static final Item CHOCOLATE_MILK = new MilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).build()));
public static final Item HOT_CHOCOLATE = new MilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(3F/4F).build()));
public static final Item BUCKET_OF_CHOCOLATE_ICECREAM = new MilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(3F/4F).build()));
public static final ChocolateMilkBucketItem CHOCOLATE_MILK = new ChocolateMilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).build()));
public static final ChocolateMilkBucketItem HOT_CHOCOLATE = new ChocolateMilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(3F/4F).build()));
public static final ChocolateMilkBucketItem BUCKET_OF_CHOCOLATE_ICECREAM = new ChocolateMilkBucketItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(4).saturationModifier(3F/4F).build()));
public static final Item GRILLED_BEETROOT = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(5).saturationModifier(6F/5F).build()));
public static final Item BRAISED_BAMBOO = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(5).saturationModifier(1F).build()));
public static final Item ROASTED_PUMPKIN_SEEDS = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(3).saturationModifier(2F/3F).snack().build()));
Expand All @@ -34,15 +38,15 @@ public class Main implements ModInitializer {
public static final Item SUSHI = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(9).saturationModifier(1F).build()));
public static final TeaItem WATERMELON_AGUA_FRESCA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).build()));
public static final TeaItem CHORUS_FRUIT_AGUA_FRESCA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).build()));
public static final TeaItem ENCHANTEA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(4).saturationModifier(18F/4F).build()));
public static final EnchanteaItem ENCHANTEA = new EnchanteaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).rarity(Rarity.UNCOMMON).food(new FoodComponent.Builder().hunger(4).saturationModifier(18F/4F).build()));
public static final TeaItem ROSE_TEA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).build()));
public static final TeaItem WITHER_ROSE_TEA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(4).saturationModifier(0.5F).statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200, 0), 1F).build()));
public static final Item CANDIED_TULIP_PETALS = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(3).saturationModifier(1F/3F).snack().build()));
public static final MushroomStewItem PUFFERFISH_STEW = new MushroomStewItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(9).saturationModifier(13F/9F).build()));
public static final Item FRIED_EGG = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(4).saturationModifier(4F).build()));
public static final MushroomStewItem SCALDING_STEW = new MushroomStewItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(1).food(new FoodComponent.Builder().hunger(14).saturationModifier(1F).statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200, 0), 1F).build()));
public static final TeaItem SPIKED_BERRY_TEA = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 100, 0), 1F).build()));
public static final TeaItem DRAGONS_SPIRIT = new TeaItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).statusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 200, 0), 1F).build()));
public static final DragonSpiritItem DRAGONS_SPIRIT = new DragonSpiritItem(new FabricItemSettings().group(ItemGroup.FOOD).maxCount(16).rarity(Rarity.UNCOMMON).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).statusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 600, 0), 1F).build()));
public static final Item CHICHARONES = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(8).saturationModifier(7F/8F).snack().build()));
public static final Item JELLIED_ENDER_EYE = new Item(new FabricItemSettings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().hunger(7).saturationModifier(6F/7F).snack().build()));

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package net.candy.chocolatevanilla.item;

import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
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.server.network.ServerPlayerEntity;
import net.minecraft.stat.Stats;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.UseAction;
import net.minecraft.world.World;

public class ChocolateMilkBucketItem extends Item {
private static final int MAX_USE_TIME = 32;

public ChocolateMilkBucketItem(Item.Settings settings) {
super(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).getAbilities().creativeMode) {
stack.decrement(1);
}

if (!world.isClient) {
user.clearStatusEffects();
}

return stack;
}

public int getMaxUseTime(ItemStack stack) {
return 32;
}

public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}

public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package net.candy.chocolatevanilla.item;

import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
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.server.network.ServerPlayerEntity;
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.world.World;

public class DragonSpiritItem extends Item {
private static final int MAX_USE_TIME = 25;

public DragonSpiritItem(Settings settings) {
super(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 (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
} else {
if (user instanceof PlayerEntity && !((PlayerEntity)user).getAbilities().creativeMode) {
ItemStack itemStack = new ItemStack(Items.GLASS_BOTTLE);
PlayerEntity playerEntity = (PlayerEntity)user;
if (!playerEntity.getInventory().insertStack(itemStack)) {
playerEntity.dropItem(itemStack, false);
}
}

return stack;
}
}

public int getMaxUseTime(ItemStack stack) {
return 40;
}

public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}

public SoundEvent getDrinkSound() {
return SoundEvents.ITEM_HONEY_BOTTLE_DRINK;
}

public SoundEvent getEatSound() {
return SoundEvents.ITEM_HONEY_BOTTLE_DRINK;
}

public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}
74 changes: 74 additions & 0 deletions src/main/java/net/candy/chocolatevanilla/item/EnchanteaItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package net.candy.chocolatevanilla.item;

import net.minecraft.advancement.criterion.Criteria;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.effect.StatusEffects;
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.server.network.ServerPlayerEntity;
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.world.World;

public class EnchanteaItem extends Item {
private static final int MAX_USE_TIME = 25;

public boolean hasGlint(ItemStack stack) {
return true;
}

public EnchanteaItem(Item.Settings settings) {
super(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 (stack.isEmpty()) {
return new ItemStack(Items.GLASS_BOTTLE);
} else {
if (user instanceof PlayerEntity && !((PlayerEntity)user).getAbilities().creativeMode) {
ItemStack itemStack = new ItemStack(Items.GLASS_BOTTLE);
PlayerEntity playerEntity = (PlayerEntity)user;
if (!playerEntity.getInventory().insertStack(itemStack)) {
playerEntity.dropItem(itemStack, false);
}
}

return stack;
}
}

public int getMaxUseTime(ItemStack stack) {
return 40;
}

public UseAction getUseAction(ItemStack stack) {
return UseAction.DRINK;
}

public SoundEvent getDrinkSound() {
return SoundEvents.ITEM_HONEY_BOTTLE_DRINK;
}

public SoundEvent getEatSound() {
return SoundEvents.ITEM_HONEY_BOTTLE_DRINK;
}

public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
return ItemUsage.consumeHeldItem(world, user, hand);
}
}

35 changes: 35 additions & 0 deletions src/main/resources/assets/chocolate_vanilla/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"item.chocolate_vanilla.sweet_berry_pie": "Sweet Berry Pie",
"item.chocolate_vanilla.apple_pie": "Apple Pie",
"item.chocolate_vanilla.glow_berry_pie": "Glow Berry Pie",
"item.chocolate_vanilla.carrot_cake": "Carrot Cake",
"item.chocolate_vanilla.beetroot_seed_cake": "Beetroot Seed Cake",
"item.chocolate_vanilla.beef_stroganoff": "Beef Stroganoff",
"item.chocolate_vanilla.jam_sandwich": "Jam Sandwich",
"item.chocolate_vanilla.honey_sandwich": "Honey Sandwich",
"item.chocolate_vanilla.chocolate_milk": "Chocolate Milk",
"item.chocolate_vanilla.hot_chocolate": "Hot Chocolate",
"item.chocolate_vanilla.chocolate_icecream_bucket": "Bucket of Chocolate Icecream",
"item.chocolate_vanilla.grilled_beetroot": "Grilled Beetroot",
"item.chocolate_vanilla.braised_bamboo": "Braised Bamboo",
"item.chocolate_vanilla.roasted_pumpkin_seeds": "Roasted Pumpkin Seeds",
"item.chocolate_vanilla.roasted_melon_seeds": "Roasted Melon Seeds",
"item.chocolate_vanilla.squid_ink_pasta": "Squid Ink Pasta",
"item.chocolate_vanilla.glow_squid_ink_pasta": "Glow Squid Ink Pasta",
"item.chocolate_vanilla.chicken_sandwich": "Chicken Sandwich",
"item.chocolate_vanilla.fish_sandwich": "Fish Sandwich",
"item.chocolate_vanilla.sushi": "Sushi",
"item.chocolate_vanilla.watermelon_juice": "Melon Juice",
"item.chocolate_vanilla.chorus_juice": "Chorus Fruit Juice",
"item.chocolate_vanilla.enchantea": "Enchantea",
"item.chocolate_vanilla.rose_tea": "Rose Tea",
"item.chocolate_vanilla.wither_rose_tea": "Wither Rose Tea",
"item.chocolate_vanilla.candied_petals": "Candied Tulip Petals",
"item.chocolate_vanilla.pufferfish_stew": "Pufferfish Stew",
"item.chocolate_vanilla.fried_egg": "Fried Egg",
"item.chocolate_vanilla.scalding_stew": "Scalding Stew",
"item.chocolate_vanilla.spiked_berry_tea": "Spiked Berry Tea",
"item.chocolate_vanilla.dragon_spirit": "Dragon's Spirit",
"item.chocolate_vanilla.fried_membrane": "Chicharones",
"item.chocolate_vanilla.jellied_ender_eye": "Jellied Eye of Ender"
}
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
Expand Up @@ -5,7 +5,7 @@
"item": "minecraft:bread"
},
{
"item": "minecraft:honey"
"item": "minecraft:honey_bottle"
}
],
"result": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"item": "minecraft:bowl"
},
{
"item": "minecraft:bamboo"
"item": "chocolate_vanilla:braised_bamboo"
},
{
"item": "minecraft:dried_kelp"
Expand Down

0 comments on commit 265b5ff

Please sign in to comment.