|
| 1 | +package top.ctnstudio.futurefood.datagen; |
| 2 | + |
| 3 | +import net.minecraft.core.Holder; |
| 4 | +import net.minecraft.core.component.DataComponentType; |
| 5 | +import net.minecraft.data.PackOutput; |
| 6 | +import net.minecraft.resources.ResourceKey; |
| 7 | +import net.minecraft.world.damagesource.DamageType; |
| 8 | +import net.minecraft.world.entity.ai.attributes.Attribute; |
| 9 | +import net.minecraft.world.item.Item; |
| 10 | +import net.neoforged.neoforge.common.data.LanguageProvider; |
| 11 | +import net.neoforged.neoforge.registries.DeferredItem; |
| 12 | +import top.ctnstudio.futurefood.client.ModItemTooltipRender; |
| 13 | +import top.ctnstudio.futurefood.client.gui.screen.GluttonyScreen; |
| 14 | +import top.ctnstudio.futurefood.client.gui.screen.ParticleColliderScreen; |
| 15 | +import top.ctnstudio.futurefood.client.gui.widget.energy.EnergyBar; |
| 16 | +import top.ctnstudio.futurefood.common.item.tool.CyberWrenchItem; |
| 17 | +import top.ctnstudio.futurefood.common.item.tool.FoodItem; |
| 18 | +import top.ctnstudio.futurefood.core.FutureFood; |
| 19 | +import top.ctnstudio.futurefood.core.init.ModBlock; |
| 20 | +import top.ctnstudio.futurefood.core.init.ModItem; |
| 21 | + |
| 22 | +import java.util.function.Supplier; |
| 23 | + |
| 24 | +public class DatagenI18EnUS extends LanguageProvider { |
| 25 | + public DatagenI18EnUS(PackOutput output) { |
| 26 | + super(output, FutureFood.ID, "en_us"); |
| 27 | + } |
| 28 | + |
| 29 | + public static String translationKey(String string) { |
| 30 | + return FutureFood.ID + ".configgui." + string; |
| 31 | + } |
| 32 | + |
| 33 | + public static String commentKey(String string) { |
| 34 | + return FutureFood.ID + ".configgui." + string + ".tooltip"; |
| 35 | + } |
| 36 | + |
| 37 | + @Override |
| 38 | + protected void addTranslations() { |
| 39 | + add("itemGroup.futurefood", "Future Food"); |
| 40 | + add(EnergyBar.TOOLTIP, "Energy:%s/%s"); |
| 41 | + add(ModItemTooltipRender.ITEM_TOOLTIP_POSITION, "Pos to:%s %s %s"); |
| 42 | + add(ModItemTooltipRender.ITEM_TOOLTIP_POSITION_EMPTY, "Non block pos."); |
| 43 | + add(ModItemTooltipRender.ITEM_TOOLTIP_ENERGY_STORAGE, "Energy:%s/%s"); |
| 44 | + add(CyberWrenchItem.BINDING_SUCCESS, "Successful! Block pos: x %s y %s z %s"); |
| 45 | + add(CyberWrenchItem.BINDING_CANCEL, "Success cancel! Pos : x %s y %s z %s"); |
| 46 | + add(CyberWrenchItem.BINDING_FAILURE, "Fail, pos: x %s y %s z %s"); |
| 47 | + add(CyberWrenchItem.LINK_SUCCESS, "Success linked! Pos: x %s y %s z %s"); |
| 48 | + add(CyberWrenchItem.LINK_REMOVE, "Discontinue,pos: x %s y %s z %s"); |
| 49 | + add(CyberWrenchItem.LINK_REMOVE_FAILURE, "Failed discontinue,pos: x %s y %s z %s"); |
| 50 | + add(CyberWrenchItem.LINK_FAILURE, "Fail, pos: x %s y %s z %s"); |
| 51 | + add(ParticleColliderScreen.TOOLTIP, "Timeless:%s"); |
| 52 | + add(GluttonyScreen.TOOLTIP, "Timeless:%s"); |
| 53 | + addItem(ModItem.CYBER_WRENCH, "Cyber Wrench"); |
| 54 | + addBlock(ModBlock.QED, "Quantum Energy Diffuser"); |
| 55 | + addBlock(ModBlock.QER, "Quantum Energy Receiver"); |
| 56 | + addBlock(ModBlock.PARTICLE_COLLIDER, "Particle Collider"); |
| 57 | + addBlock(ModBlock.GLUTTONY, "Gluttony"); |
| 58 | + addBlock(ModBlock.BATTERY, "Battery"); |
| 59 | + addBlock(ModBlock.INFINITE_BATTERY, "Infinite Battery"); |
| 60 | + addItem(ModItem.FOOD_ESSENCE, "Food Essence"); |
| 61 | + |
| 62 | + addFood(ModItem.ANTIMATTER_SNACK, "Antimatter Snack", "Delicious snack with extremely high energy density. If you don't eat it in one bite, it may expand in your stomach."); |
| 63 | + addFood(ModItem.STRONGLY_INTERACTING_BREAD, "Strongly Interacting Bread", "If you eat the bread, the bread is also eating you."); |
| 64 | + addFood(ModItem.WEAKLY_INTERACTING_WATER_BOTTLE, "Weakly Interacting Water Bottle", "Drinking it gives you an unprecedented sense of coolness. But are you really drinking it?"); |
| 65 | + addFood(ModItem.LEYDEN_JAR, "Leyden Jar", "Fulled with electricity, maybe not for eating."); |
| 66 | + addFood(ModItem.SCHRODINGERS_CAN, "Schrodingers Can", "We never know what will happen when you open it."); |
| 67 | + addFood(ModItem.WORMHOLE_COOKIE, "Wormhole Cookie", "It can travel through space."); |
| 68 | + addFood(ModItem.POWERED_MILK, "Powered Milk", "It is so solid that you can't even take a bite."); |
| 69 | + addFood(ModItem.ENTROPY_STEW, "Entropy Stew", "A kind of unprecedented sense of chaos."); |
| 70 | + addFood(ModItem.UNPREDICTABLE_CHORUS_FRUIT, "Unpredictable Chorus Fruit", "It is more dangerous than ordinary chorus fruit, it can take you anywhere at will."); |
| 71 | + addFood(ModItem.BLACK_HOLE_CAKE, "Black Hole Cake", "Something wants to suck you in."); |
| 72 | + addFood(ModItem.WHITE_HOLE_CAKE, "White Hole Cake", "Something wants to spit you out."); |
| 73 | + addFood(ModItem.ATOM_COLA, "Atom Cola", "BONK!"); |
| 74 | + |
| 75 | + // addFood(ModItem.NEUTRINO_SOUP, "中微子汤", "你感觉不到它,但它确实存在。"); |
| 76 | + // addFood(ModItem.QUARKS_SALAD, "夸克沙拉", "各种夸克组成的沙拉,味道复杂且难以捉摸。"); |
| 77 | + // addFood(ModItem.HADRON_HAMBURGER, "强子汉堡", "强大的力量,但是代价呢?"); |
| 78 | + // addFood(ModItem.LEPTON_LASAGNA, "轻子千层面", "它就快起飞了,最好把它拴在你的背包里。"); |
| 79 | + // addFood(ModItem.PHOTON_PIE, "光子派", "它以光速滑入你的胃。"); |
| 80 | + // addFood(ModItem.GLUON_GUM, "胶子口香糖", "如果黏在你的鞋上,那你就有福了。"); |
| 81 | + // addFood(ModItem.HIGGS_BOSON_BROWNIE, "希格斯玻色子布朗尼", "感受到质量了吗?"); |
| 82 | + // addFood(ModItem.GRAVITON_GELATO, "引力子冰淇淋", "这是铁砧做的吗?"); |
| 83 | + // addFood(ModItem.PLASMA_SOUP, "等离子体汤", "这汤热得能把你烫伤。"); |
| 84 | + // addFood(ModItem.NEUTRONIUM_STEAK, "中子星牛排", "中子星可以轻松的吃掉你的鱼子酱,但你可没法那么容易吃掉中子星的牛排。"); |
| 85 | + } |
| 86 | + |
| 87 | + public void addConfig(String configKey, String translationDescribe, String commentDescribe) { |
| 88 | + add(translationKey(configKey), translationDescribe); |
| 89 | + add(commentKey(configKey), commentDescribe); |
| 90 | + } |
| 91 | + |
| 92 | + public void addConfig(String configKey, String translationDescribe) { |
| 93 | + add(translationKey(configKey), translationDescribe); |
| 94 | + } |
| 95 | + |
| 96 | + public void addFood(DeferredItem<Item> holder, String name, String tooltip) { |
| 97 | + if (!(holder.get() instanceof FoodItem food)) { |
| 98 | + throw new IllegalArgumentException("Item is not a FoodItem"); |
| 99 | + } |
| 100 | + |
| 101 | + add(holder.get().getDescriptionId(), name); |
| 102 | + add(food.tooltipInfo.get(), tooltip); |
| 103 | + } |
| 104 | + |
| 105 | + public <T> void addAttribute(Supplier<DataComponentType<T>> dataComponentType, String name) { |
| 106 | + add(dataComponentType.get().toString(), name); |
| 107 | + } |
| 108 | + |
| 109 | + /** |
| 110 | + * 生物属性翻译 |
| 111 | + */ |
| 112 | + public void addAttribute(Holder<Attribute> attributeHolder, String name) { |
| 113 | + add(attributeHolder.value().getDescriptionId(), name); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * 死亡消息翻译 |
| 118 | + */ |
| 119 | + public void addDeathMessage(ResourceKey<DamageType> damageType, String name) { |
| 120 | + add("death.attack." + damageType.location().getPath(), name); |
| 121 | + } |
| 122 | + |
| 123 | + /** |
| 124 | + * 玩家死亡消息翻译 |
| 125 | + */ |
| 126 | + public void addPlayerDeathMessage(ResourceKey<DamageType> damageType, String name) { |
| 127 | + add("death.attack." + damageType.location().getPath() + ".player", name); |
| 128 | + } |
| 129 | +} |
0 commit comments