Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sihuai2412 committed Oct 3, 2024
1 parent 596f1bf commit cc6ea8c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,7 @@ protected void addTranslations() {
add(DEMON_CONCH.get(), "恶魔海螺");
add(SKY_MILL.get(), "天磨");
add(WORKSHOP.get(), "工匠作坊");
add(ALCHEMY_TABLE_BLOCK.get(), "炼药桌");
add(BOMB_FISH.get(), "炸弹鱼");

// 功能性方块
Expand Down Expand Up @@ -1994,6 +1995,7 @@ protected void addTranslations() {
add(Foods.FLUTTERING_LAMB_CHOPS.get(), "飘飘羊排");
add(Foods.COOKED_FLUTTERING_LAMB_CHOPS.get(), "熟飘飘羊排");
// 药水
add(VANILLA_POTION.get(), "药水");
add(TerraPotions.GRAVITATION_POTION.get(), "重力药水");
add(TerraPotions.SHINE_POTION.get(), "光环药水");
add(TerraPotions.IRON_SKIN_POTION.get(), "铁皮药水");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.confluence.mod.effect.ModEffects;
import org.confluence.mod.entity.ModEntities;
import org.confluence.mod.item.ModItems;
import org.confluence.mod.item.potion.VanillaPotionItem;

import java.util.Arrays;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -254,6 +255,7 @@ protected void addTranslations() {
add("item.confluence.hand_of_creation.tooltip3", "Increases pickup range for items");
add("item.confluence.step_stool.tooltip", "Press ↑ key to stand higher, and press Shift key to down");
add("item.confluence.step_stool.tooltip2", "Extra Step: %s");
add("item.confluence.vanilla_potion", "Potion");

add("item.confluence.magic_conch.pos", "Pos: [%s, %s, %s]");

Expand Down Expand Up @@ -505,6 +507,7 @@ protected void addTranslations() {
ModItems.ITEMS.getEntries().forEach(item -> {
Item item1 = item.get();
if (item1 instanceof BlockItem) return;
if (item1 instanceof VanillaPotionItem) return;
if (item1 instanceof CustomName customName) {
if (customName.getGenName() != null) {
add(item1, customName.getGenName());
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/confluence/mod/item/ModTabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ public final class ModTabs {
output.accept(CRIMSON_ALTAR.get());
output.accept(SKY_MILL.get());
output.accept(WORKSHOP.get());
output.accept(ALCHEMY_TABLE_BLOCK.get());
})
.build());
}
9 changes: 8 additions & 1 deletion src/main/java/org/confluence/mod/util/ModUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.util.RandomSource;
import net.minecraft.world.Difficulty;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
Expand Down Expand Up @@ -334,7 +335,13 @@ public static void addPotionTooltip(MobEffect effect, List<Component> components
}
components.add(Component.translatable(effect.getDescriptionId()).append(amplifier == 0 ? "" : " ")
.append(Component.translatable(amplifier == 0 ? "" : ("enchantment.level." + (amplifier + 1))))
.append("(" + tickFormat(duration) + ")").withStyle(ChatFormatting.BLUE));
.append("(" + tickFormat(duration) + ")").withStyle(getPotionCategoryColor(effect)));
}

private static ChatFormatting getPotionCategoryColor(MobEffect effect) {
return effect.getCategory().equals(MobEffectCategory.NEUTRAL) ?
ChatFormatting.GRAY : effect.getCategory().equals(MobEffectCategory.BENEFICIAL) ?
ChatFormatting.BLUE : ChatFormatting.RED;
}

public static String tickFormat(int tick){
Expand Down

0 comments on commit cc6ea8c

Please sign in to comment.