-
Notifications
You must be signed in to change notification settings - Fork 9
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
b57641b
commit b37a5f0
Showing
61 changed files
with
430 additions
and
406 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package artifality.item; | ||
|
||
import artifality.item.base.ArtifactItem; | ||
import artifality.util.TiersUtils; | ||
import artifality.util.TooltipAppender; | ||
import dev.emi.trinkets.api.Trinket; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.Formatting; | ||
|
||
import java.util.List; | ||
|
||
public class HauntingSoul extends ArtifactItem implements Trinket { | ||
|
||
public HauntingSoul(ArtifactSettings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public void appendTooltipInfo(ItemStack stack, List<Text> tooltip) { | ||
tooltip.add(Text.empty()); | ||
|
||
int max = 120; | ||
if(TiersUtils.getTier(stack) == 2) max = 160; | ||
else if(TiersUtils.getTier(stack) == 3) max = 240; | ||
|
||
tooltip.add(Text.literal(TooltipAppender.ofKey("souls").replaceAll("%", getSouls(stack) + "/" + max)).formatted(Formatting.DARK_GREEN)); | ||
tooltip.add(Text.literal(TooltipAppender.ofKey("extra_damage").replaceAll("%", Integer.toString(getDamageModifier(stack)))).formatted(Formatting.DARK_GREEN)); | ||
} | ||
|
||
public static int getSouls(ItemStack stack) { | ||
var nbt = stack.getOrCreateNbt(); | ||
|
||
if(nbt.contains("HauntingSouls")) { | ||
return nbt.getInt("HauntingSouls"); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
public static int getDamageModifier(ItemStack stack) { | ||
int max = 120; | ||
if(TiersUtils.getTier(stack) == 2) max = 160; | ||
else if(TiersUtils.getTier(stack) == 3) max = 240; | ||
|
||
int souls = getSouls(stack); | ||
|
||
if(souls >= max) return max / 40; | ||
else return souls / 40; | ||
} | ||
|
||
public static void addSoul(ItemStack stack) { | ||
var nbt = stack.getOrCreateNbt(); | ||
|
||
if(nbt.contains("HauntingSouls")) { | ||
int souls = nbt.getInt("HauntingSouls"); | ||
souls++; | ||
nbt.putInt("HauntingSouls", souls); | ||
} | ||
else { | ||
nbt.putInt("HauntingSouls", 1); | ||
} | ||
} | ||
|
||
public static void addSouls(ItemStack stack, int increment) { | ||
var nbt = stack.getOrCreateNbt(); | ||
|
||
if(nbt.contains("HauntingSouls")) { | ||
int souls = nbt.getInt("HauntingSouls"); | ||
souls = souls + increment; | ||
nbt.putInt("HauntingSouls", souls); | ||
} | ||
else { | ||
nbt.putInt("HauntingSouls", increment); | ||
} | ||
} | ||
|
||
public static void setSouls(ItemStack stack, int count) { | ||
var nbt = stack.getOrCreateNbt(); | ||
nbt.putInt("HauntingSouls", count); | ||
} | ||
} |
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
Oops, something went wrong.