forked from AlexModGuy/AlexsCaves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5a1bb7
commit ae82d91
Showing
7 changed files
with
22 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 10 additions & 14 deletions
24
src/main/java/com/github/alexmodguy/alexscaves/server/item/RadiantEssenceItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,30 @@ | ||
package com.github.alexmodguy.alexscaves.server.item; | ||
|
||
import net.minecraft.ChatFormatting; | ||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.world.effect.MobEffectInstance; | ||
import net.minecraft.world.effect.MobEffects; | ||
import net.minecraft.world.entity.Entity; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.Item; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.item.TooltipFlag; | ||
import net.minecraft.world.level.Level; | ||
|
||
import javax.annotation.Nullable; | ||
import java.util.List; | ||
|
||
public class RadiantEssenceItem extends Item { | ||
|
||
public RadiantEssenceItem() { | ||
super(new Item.Properties().rarity(ACItemRegistry.RARITY_RAINBOW)); | ||
} | ||
|
||
public void inventoryTick(ItemStack itemStack, Level level, Entity entity, int i, boolean b) { | ||
if (!level.isClientSide) { | ||
if (wasThrownByLicowitch(itemStack) && entity.tickCount % 10 == 0) { | ||
itemStack.shrink(1); | ||
if(entity instanceof LivingEntity living){ | ||
living.addEffect(new MobEffectInstance(MobEffects.HUNGER, 3000)); | ||
} | ||
} | ||
public void appendHoverText(ItemStack stack, @Nullable Level worldIn, List<Component> tooltip, TooltipFlag flagIn) { | ||
if(this == ACItemRegistry.LICOWITCH_RADIANT_ESSENCE.get()){ | ||
tooltip.add(Component.translatable("item.alexscaves.licowitch_radiant_essence.desc").withStyle(ChatFormatting.GRAY).withStyle(ChatFormatting.ITALIC)); | ||
} | ||
super.appendHoverText(stack, worldIn, tooltip, flagIn); | ||
} | ||
|
||
public static boolean wasThrownByLicowitch(ItemStack stack) { | ||
CompoundTag compoundtag = stack.getTag(); | ||
return compoundtag != null && compoundtag.getBoolean("ThrownByLicowitch"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/resources/assets/alexscaves/models/item/licowitch_radiant_essence.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "minecraft:item/generated", | ||
"textures": { | ||
"layer0": "alexscaves:item/radiant_essence" | ||
} | ||
} |