More translations for TR & RC
This commit is contained in:
parent
c41be06bf1
commit
81aa7e7ec2
4 changed files with 24 additions and 8 deletions
|
@ -25,6 +25,7 @@
|
|||
package techreborn.blockentity.storage.item;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -435,8 +436,12 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity implement
|
|||
.append(
|
||||
new LiteralText(String.valueOf(this.getMaxCapacity()))
|
||||
.formatted(Formatting.GOLD)
|
||||
.append(" items (")
|
||||
.append(" ")
|
||||
.append(I18n.translate("techreborn.tooltip.unit.items"))
|
||||
.append(" (")
|
||||
.append(String.valueOf(this.getMaxCapacity() / 64))
|
||||
.append(" ")
|
||||
.append(I18n.translate("techreborn.tooltip.unit.stacks"))
|
||||
.append(")")
|
||||
)
|
||||
);
|
||||
|
|
|
@ -133,14 +133,16 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
}
|
||||
} else {
|
||||
try {
|
||||
if ((block instanceof BlockEntityProvider) && Registry.BLOCK.getId(block).getNamespace().contains("techreborn")) {
|
||||
if ((block instanceof BlockEntityProvider) && isTRBlock(block)) {
|
||||
BlockEntity blockEntity = ((BlockEntityProvider) block).createBlockEntity(MinecraftClient.getInstance().world);
|
||||
boolean hasData = false;
|
||||
if (stack.hasTag() && stack.getTag().contains("blockEntity_data")) {
|
||||
CompoundTag blockEntityData = stack.getTag().getCompound("blockEntity_data");
|
||||
blockEntity.fromTag(blockEntity.getCachedState(), blockEntityData);
|
||||
hasData = true;
|
||||
tooltipLines.add(new LiteralText("Block data contained").formatted(Formatting.DARK_GREEN));
|
||||
if (stack.hasTag() && stack.getOrCreateTag().contains("blockEntity_data")) {
|
||||
CompoundTag blockEntityData = stack.getOrCreateTag().getCompound("blockEntity_data");
|
||||
if (blockEntity != null) {
|
||||
blockEntity.fromTag(block.getDefaultState(), blockEntityData);
|
||||
hasData = true;
|
||||
tooltipLines.add(new LiteralText(I18n.translate("techreborn.tooltip.has_data")).formatted(Formatting.DARK_GREEN));
|
||||
}
|
||||
}
|
||||
if (blockEntity instanceof IListInfoProvider) {
|
||||
((IListInfoProvider) blockEntity).addInfo(tooltipLines, false, hasData);
|
||||
|
@ -156,6 +158,10 @@ public class StackToolTipHandler implements ItemTooltipCallback {
|
|||
return Registry.ITEM.getId(item).getNamespace().equals("techreborn");
|
||||
}
|
||||
|
||||
private boolean isTRBlock(Block block){
|
||||
return Registry.BLOCK.getId(block).getNamespace().contains("techreborn");
|
||||
}
|
||||
|
||||
public int percentage(int MaxValue, int CurrentValue) {
|
||||
if (CurrentValue == 0)
|
||||
return 0;
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.fabricmc.fabric.api.tool.attribute.v1.DynamicAttributeTool;
|
|||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.item.TooltipContext;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
|
@ -137,7 +138,7 @@ public class OmniToolItem extends PickaxeItem implements EnergyHolder, ItemDurab
|
|||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void appendTooltip(ItemStack stack, @Nullable World worldIn, List<Text> tooltip, TooltipContext flagIn) {
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + "Swiss Army Knife"));
|
||||
tooltip.add(new LiteralText(Formatting.YELLOW + I18n.translate("techreborn.tooltip.omnitool_motto")));
|
||||
}
|
||||
|
||||
// ItemDurabilityExtensions
|
||||
|
|
|
@ -825,10 +825,14 @@
|
|||
"techreborn.tooltip.unit.capacity": "Capacity: ",
|
||||
"techreborn.tooltip.unit.empty": "Empty",
|
||||
"techreborn.tooltip.unit.divider": " of ",
|
||||
"techreborn.tooltip.unit.items": "items",
|
||||
"techreborn.tooltip.unit.stacks": "stacks",
|
||||
"techreborn.tooltip.painting_tool.select": "Shift right click on block to set style",
|
||||
"techreborn.tooltip.painting_tool.apply": "Right click on covered cable to apply",
|
||||
"techreborn.tooltip.cable.can_cover": "Can be covered with wooden plates",
|
||||
"techreborn.tooltip.more_info": "Hold Shift for more info",
|
||||
"techreborn.tooltip.has_data": "Stored data",
|
||||
"techreborn.tooltip.omnitool_motto" : "Swiss Army Knife",
|
||||
|
||||
"_comment23": "ManualUI",
|
||||
"techreborn.manual.wiki": "Online wiki",
|
||||
|
|
Loading…
Add table
Reference in a new issue