Skip to content

Commit

Permalink
tweak a couple of things
Browse files Browse the repository at this point in the history
temporarily remove the busted tooltip mixin
  • Loading branch information
Andrew6rant committed Jan 5, 2023
1 parent 5dce4e0 commit 3838521
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 68 deletions.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ repositories {
includeGroup "com.jamieswhiteshirt"
}
}
maven {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
content {
includeGroup 'maven.modrinth'
}
}
}

dependencies {
Expand All @@ -43,7 +50,7 @@ dependencies {

modImplementation "curse.maven:iceberg-539382:3675784"

include modImplementation('com.github.ZsoltMolnarrr:ProjectileDamage:1.18.2-1.0.2-2')
modImplementation "maven.modrinth:projectile-damage-attribute:3.0.0+1.18.2-fabric"
}

processResources {
Expand Down
24 changes: 9 additions & 15 deletions src/main/java/Andrew6rant/tiered/api/AttributeTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;

import java.util.List;

/**
* Stores information on an AttributeModifier template applied to an ItemStack.
*
Expand All @@ -35,19 +37,15 @@ public class AttributeTemplate {
@SerializedName("optional_equipment_slots")
private final EquipmentSlot[] optionalEquipmentSlots;

//@SerializedName("size")
//private final String size;

//@SerializedName("rarity")
//private final String rarity;
@SerializedName("tooltip")
private final List<Object> tooltip;

public AttributeTemplate(String attributeTypeID, EntityAttributeModifier entityAttributeModifier, EquipmentSlot[] requiredEquipmentSlots, EquipmentSlot[] optionalEquipmentSlots) {
public AttributeTemplate(String attributeTypeID, EntityAttributeModifier entityAttributeModifier, EquipmentSlot[] requiredEquipmentSlots, EquipmentSlot[] optionalEquipmentSlots, List<Object> tooltip) {
this.attributeTypeID = attributeTypeID;
this.entityAttributeModifier = entityAttributeModifier;
this.requiredEquipmentSlots = requiredEquipmentSlots;
this.optionalEquipmentSlots = optionalEquipmentSlots;
//this.size = size;
//this.rarity = rarity;
this.tooltip = tooltip;
}

public EquipmentSlot[] getRequiredEquipmentSlots() {
Expand All @@ -62,13 +60,9 @@ public String getAttributeTypeID() {
return attributeTypeID;
}

/*public String getSize() {
return size;
}*/

/*public String getRarity() {
return rarity;
}*/
public List<Object> getTooltip() {
return tooltip;
}

/**
* Uses this {@link AttributeTemplate} to create an {@link EntityAttributeModifier}, which is placed into the given {@link Multimap}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private void onTick(CallbackInfo ci) {
}
// this will update the player's health when switching items
if (this.getHealth() != this.getMaxHealth()) {
//System.out.println("Health: " + this.getHealth());
this.setHealth(this.getHealth());
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package Andrew6rant.tiered.mixin.client;

import Andrew6rant.tiered.api.AttributeTemplate;
import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap;
import Andrew6rant.tiered.Tiered;
Expand All @@ -14,6 +15,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.MutableText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting;
Expand Down Expand Up @@ -95,7 +97,7 @@ private void getNameMixin(CallbackInfoReturnable<Text> info) {

if (potentialAttribute != null) {
if(!potentialAttribute.getAttributes().get(0).getAttributeTypeID().equals("none")) {
info.setReturnValue(new TranslatableText(potentialAttribute.getID() + ".label").append(" ").append(info.getReturnValue()).setStyle(potentialAttribute.getStyle()));
info.setReturnValue(new TranslatableText(potentialAttribute.getID().split("_")[0] + ".name").append(" ").append(info.getReturnValue()).setStyle(potentialAttribute.getStyle()));
}
}

Expand All @@ -105,6 +107,8 @@ private void getNameMixin(CallbackInfoReturnable<Text> info) {
method = "getTooltip",
at = @At(value = "RETURN", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
private void test(PlayerEntity player, TooltipContext context, CallbackInfoReturnable<List<Text>> cir) {
/*
if (isTiered && this.hasNbt() && this.getSubNbt(Tiered.NBT_SUBTAG_KEY) != null) { // only run on tiered items
List<Text> list = cir.getReturnValue();
List<Text> badlyFormattedList = new ArrayList<>();
Expand Down Expand Up @@ -199,6 +203,21 @@ private void test(PlayerEntity player, TooltipContext context, CallbackInfoRetur
}
}
}
//for (Text text : list) {
// System.out.println(text);
//}
//System.out.println("-------");
Identifier tier = new Identifier(getOrCreateSubNbt(Tiered.NBT_SUBTAG_KEY).getString(Tiered.NBT_SUBTAG_DATA_KEY));
PotentialAttribute potentialAttribute = Tiered.ATTRIBUTE_DATA_LOADER.getItemAttributes().get(tier);
for (AttributeTemplate attribute : potentialAttribute.getAttributes()) {
if (attribute.getTooltip() != null) {
List<Object> tooltips = attribute.getTooltip();
for (Object tooltip : tooltips.subList(1, tooltips.size())) {
list.add(new TranslatableText((String) tooltip).setStyle((Style) tooltips.get(0)));
}
}
}
}
*/
}
}
82 changes: 42 additions & 40 deletions src/main/resources/assets/tiered/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,68 +36,70 @@
"//": "--- Held Item Modifiers ---",

"///": "Junk",
"tiered:blighted.label": "Blighted",
"tiered:blunted.label": "Blunted",
"tiered:cursed.label": "Cursed",
"tiered:dull.label": "Dull",
"tiered:slow.label": "Slow",
"tiered:sluggish.label": "Sluggish",
"tiered:unlucky.label": "Unlucky",
"tiered:blighted.name": "Blighted",
"tiered:blunted.name": "Blunted",
"tiered:cursed.name": "Cursed",
"tiered:dull.name": "Dull",
"tiered:slow.name": "Slow",
"tiered:sluggish.name": "Sluggish",
"tiered:unlucky.name": "Unlucky",

"///": "Common",
"tiered:critical.label": "Critical",
"tiered:hasteful.label": "Hasteful",
"tiered:keen.label": "Keen",
"tiered:lucky.label": "Lucky",
"tiered:pointed.label": "Pointed",
"tiered:quick.label": "Quick",
"tiered:sharp.label": "Sharp",
"tiered:critical.name": "Critical",
"tiered:hasteful.name": "Hasteful",
"tiered:keen.name": "Keen",
"tiered:lucky.name": "Lucky",
"tiered:pointed.name": "Pointed",
"tiered:quick.name": "Quick",
"tiered:sharp.name": "Sharp",

"///": "Uncommon",
"tiered:blessed.label": "Blessed",
"tiered:extended.label": "Extended",
"tiered:large.label": "Large",
"tiered:massive.label": "Massive",
"tiered:small.label": "Small",
"tiered:swift.label": "Swift",
"tiered:tiny.label": "Tiny",
"tiered:blessed.name": "Blessed",
"tiered:extended.name": "Extended",
"tiered:large.name": "Large",
"tiered:massive.name": "Massive",
"tiered:small.name": "Small",
"tiered:swift.name": "Swift",
"tiered:tiny.name": "Tiny",

"///": "Rare",
"tiered:brutal.label": "Brutal",
"tiered:gargantuan.label": "Gargantuan",
"tiered:hallowed.label": "Hallowed",
"tiered:nimble.label": "Nimble",
"tiered:brutal.name": "Brutal",
"tiered:gargantuan.name": "Gargantuan",
"tiered:hallowed.name": "Hallowed",
"tiered:nimble.name": "Nimble",

"///": "Epic",
"tiered:breakneck.label": "Breakneck",
"tiered:daring.label": "Daring",
"tiered:sacred.label": "Sacred",
"tiered:breakneck.name": "Breakneck",
"tiered:daring.name": "Daring",
"tiered:sacred.name": "Sacred",

"///": "Legendary",
"tiered:exalted.label": "Exalted",
"tiered:exalted.name": "Exalted",

"//": "--- Armor Modifiers ---",

"///": "Junk",
"tiered:dented.label": "Dented",
"tiered:leaded.label": "Leaded",
"tiered:dented.name": "Dented",
"tiered:leaded.name": "Leaded",

"///": "Common",
"tiered:armored.label": "Armored",
"tiered:brisk.label": "Brisk",
"tiered:fleeting.label": "Fleeting",
"tiered:heavy.label": "Heavy",
"tiered:armored.name": "Armored",
"tiered:brisk.name": "Brisk",
"tiered:fleeting.name": "Fleeting",
"tiered:heavy.name": "Heavy",

"///": "Uncommon",
"tiered:reinforced.label": "Reinforced",
"tiered:steppy.label": "Steppy",
"tiered:reinforced.name": "Reinforced",
"tiered:steppy.name": "Steppy",

"///": "Rare",
"tiered:fortified.label": "Fortified",
"tiered:unchained.label": "Unchained",
"tiered:fortified.name": "Fortified",
"tiered:unchained.name": "Unchained",

"///": "Epic",
"tiered:resilient.label": "Resilient",
"tiered:resilient.name": "Resilient",
"tiered:architects.name": "Architect's",
"tiered:architects.tooltip": "Only affects Reach, not Attack Range",

"///": "Legendary"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
{ "tag": "c:chestplates" },
{ "tag": "c:leggings" },
{ "tag": "c:boots" },
{ "tag": "c:shields" },
{ "tag": "minecraft:planks" }
{ "tag": "c:shields" }
],
"style": {
"color": "green"
"color": "gray"
},
"weight": 0,
"tooltip_image": [3],
"tooltip_border": ["FF55FF55"],
"weight": 20,
"tooltip_image": [6],
"tooltip_border": ["00100010"],
"reforge_cost": 0,
"attributes": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"id": "tiered:architects",
"verifiers": [
{ "tag": "c:helmets" },
{ "tag": "c:chestplates" },
{ "tag": "c:leggings" }
],
"style": {
"color": "light_purple"
},
"weight": 200,
"tooltip_image": [4],
"tooltip_border": ["FF996922"],
"reforge_cost": 21,
"attributes": [
{
"type": "reach-entity-attributes:reach",
"tooltip": ["tiered:architects.tooltip"],
"modifier": {
"name": "tiered:architects",
"operation": "ADDITION",
"amount": 2
},
"optional_equipment_slots": [
"LEGS",
"CHEST",
"HEAD"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"id": "tiered:architects_boots",
"verifiers": [
{ "tag": "c:boots" }
],
"style": {
"color": "light_purple"
},
"weight": 200,
"tooltip_image": [4],
"tooltip_border": ["FF996922"],
"reforge_cost": 21,
"attributes": [
{
"type": "reach-entity-attributes:reach",
"tooltip": ["light_purple", "tiered:architects.tooltip"],
"modifier": {
"name": "no_tooltip",
"operation": "ADDITION",
"amount": 2
},
"optional_equipment_slots": [
"FEET"
]
},
{
"type": "stepheightentityattribute:stepheight",
"modifier": {
"name": "tiered:architects_boots",
"operation": "ADDITION",
"amount": 0.5
},
"optional_equipment_slots": [
"FEET"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"color": "light_purple"
},
"weight": 2,
"tooltip_image": [0, 1, 2, 3, 4, 500],
"tooltip_image": [4],
"tooltip_border": ["FF996922"],
"reforge_cost": 21,
"attributes": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"id": "tiered:builders",
"verifiers": [
{ "tag": "c:helmets" },
{ "tag": "c:chestplates" },
{ "tag": "c:leggings" },
{ "tag": "c:boots" }
],
"style": {
"color": "aqua"
},
"weight": 3,
"tooltip_image": [3],
"tooltip_border": ["FF7FFFFF"],
"reforge_cost": 13,
"attributes": [
{
"type": "reach-entity-attributes:reach",
"modifier": {
"name": "tiered:builders",
"operation": "ADDITION",
"amount": 1
},
"optional_equipment_slots": [
"FEET",
"LEGS",
"CHEST",
"HEAD"
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"color": "aqua"
},
"weight": 3,
"tooltip_image": [0, 1, 2, 3, 4],
"tooltip_image": [3],
"tooltip_border": ["FF7FFFFF"],
"reforge_cost": 13,
"attributes": [
Expand Down
Loading

0 comments on commit 3838521

Please sign in to comment.