This commit is contained in:
Sunskimmer822 2022-03-18 13:39:37 -07:00
parent 6db112d9eb
commit c5eeafadd6
2 changed files with 37 additions and 0 deletions

View File

@ -102,6 +102,9 @@ public class Shitmod implements ModInitializer {
public static final Item BLAZE_METAL_SHOVEL_CASING = new blazeMetalShovelCasing(new Item.Settings().fireproof().group(Shitmod.GENERAL_GROUP));
public static final Item BLAZE_METAL_HOE_CASING = new blazeMetalHoeCasing(new Item.Settings().fireproof().group(Shitmod.GENERAL_GROUP));
public static final Item POTATO_CHIPS = new potatoChips(new Item.Settings().group(ItemGroup.FOOD));
@Override
public void onInitialize() {
@ -172,6 +175,8 @@ public class Shitmod implements ModInitializer {
Registry.register(Registry.ITEM, new Identifier("shitmod", "blaze_metal_hoe_casing"), BLAZE_METAL_HOE_CASING);
Registry.register(Registry.ITEM, new Identifier("shitmod", "potato_chip"), POTATO_CHIPS);
CustomPortalBuilder.beginPortal()
.frameBlock(Shitmod.FABRIC_BLOCK)
.lightWithItem(Shitmod.BLAZE_METAL_INGOT)

View File

@ -0,0 +1,32 @@
package net.serenas.shitmod;
import net.minecraft.entity.effect.StatusEffectInstance;
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.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
public class potatoChips extends Item {
public potatoChips(Settings settings) {
super(settings);
}
int potatoChipsConsumed = 0;
@Override
public TypedActionResult<ItemStack> use(World World, PlayerEntity PlayerEntity, Hand Hand) {
PlayerEntity.getHungerManager().add(1, 0f);
PlayerEntity.getStackInHand(Hand).decrement(1);
potatoChipsConsumed++;
if (potatoChipsConsumed == 69) {
PlayerEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 20 * 15, 4));
potatoChipsConsumed -= 69;
}
return new TypedActionResult<ItemStack>(ActionResult.SUCCESS, PlayerEntity.getStackInHand(Hand));
}
}