Work in Progress!

- Added the ability to mark items as WIP
- Added custom descriptions for WIP items
This commit is contained in:
simibubi 2019-12-09 14:58:12 +01:00
parent 1d96f50b9a
commit 6395ce5700
15 changed files with 91 additions and 21 deletions

View File

@ -5,8 +5,8 @@ import java.util.List;
import com.simibubi.create.foundation.block.IBlockWithScrollableValue;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.TooltipHelper;
import com.simibubi.create.modules.contraptions.KineticDebugger;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer;
@ -129,9 +129,11 @@ public class ClientEvents {
return;
if (TooltipHelper.hasTooltip(stack)) {
List<ITextComponent> itemTooltip = event.getToolTip();
List<ITextComponent> toolTip = new ArrayList<>();
toolTip.add(itemTooltip.remove(0));
TooltipHelper.getTooltip(stack).addInformation(toolTip);
event.getToolTip().addAll(1, toolTip);
itemTooltip.addAll(0, toolTip);
}
}

View File

@ -1,9 +1,9 @@
package com.simibubi.create;
import com.simibubi.create.foundation.world.OreGeneration;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.simibubi.create.foundation.world.OreGeneration;
import com.simibubi.create.modules.ModuleLoadedCondition;
import com.simibubi.create.modules.contraptions.TorquePropagator;
import com.simibubi.create.modules.contraptions.receivers.constructs.piston.MovingConstructHandler;
@ -25,7 +25,6 @@ import net.minecraft.village.PointOfInterestType;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;

View File

@ -1,7 +1,7 @@
package com.simibubi.create.foundation.utility;
package com.simibubi.create.foundation.item;
import static com.simibubi.create.CreateConfig.parameters;
import static com.simibubi.create.foundation.utility.TooltipHelper.cutString;
import static com.simibubi.create.foundation.item.TooltipHelper.cutString;
import static net.minecraft.util.text.TextFormatting.AQUA;
import static net.minecraft.util.text.TextFormatting.BLUE;
import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.contraptions.base.IRotate;
import com.simibubi.create.modules.contraptions.base.IRotate.SpeedLevel;
import com.simibubi.create.modules.contraptions.base.IRotate.StressImpact;
@ -68,7 +69,7 @@ public class ItemDescription {
linesOnShift = new ArrayList<>();
linesOnCtrl = new ArrayList<>();
}
public ItemDescription withSummary(String summary) {
add(linesOnShift, cutString(summary, palette.color, palette.hColor));
add(linesOnShift, "");

View File

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.utility;
package com.simibubi.create.foundation.item;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package com.simibubi.create.foundation.utility;
package com.simibubi.create.foundation.item;
import static net.minecraft.util.text.TextFormatting.DARK_GRAY;
@ -8,7 +8,8 @@ import java.util.List;
import java.util.Map;
import com.mojang.bridge.game.Language;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.IModule;
import com.simibubi.create.modules.contraptions.base.IRotate;
@ -110,6 +111,9 @@ public class TooltipHelper {
private static ItemDescription buildToolTip(String translationKey, ItemStack stack) {
IModule module = IModule.of(stack);
if (I18n.format(translationKey).equals("WIP"))
return new WipScription(module.getToolTipColor());
ItemDescription tooltip = new ItemDescription(module.getToolTipColor());
String summaryKey = translationKey + ".summary";
@ -147,7 +151,7 @@ public class TooltipHelper {
}
public static String getTooltipTranslationKey(ItemStack stack) {
return stack.getItem().getTranslationKey() + ".tooltip";
return stack.getItem().getTranslationKey(stack) + ".tooltip";
}
}

View File

@ -0,0 +1,42 @@
package com.simibubi.create.foundation.item;
import java.util.List;
import java.util.Random;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TextFormatting;
public class WipScription extends ItemDescription {
public WipScription(Palette palette) {
super(palette);
add(getLines(), TextFormatting.RED + Lang.translate("tooltip.workInProgress"));
int descriptions = 0;
while (I18n.hasKey("create.tooltip.randomWipDescription" + descriptions++))
;
if (--descriptions > 0) {
int index = new Random().nextInt(descriptions);
String translate = Lang.translate("tooltip.randomWipDescription" + index);
add(getLines(), TooltipHelper.cutString(translate, TextFormatting.DARK_RED, TextFormatting.DARK_RED));
}
}
@Override
public List<ITextComponent> addInformation(List<ITextComponent> tooltip) {
tooltip.set(0, new StringTextComponent(decorateName(tooltip.get(0).getString())));
tooltip.addAll(getLines());
return tooltip;
}
public static String decorateName(String name) {
return TextFormatting.GRAY + "" + TextFormatting.STRIKETHROUGH + name + TextFormatting.GOLD + " "
+ Lang.translate("tooltip.wip");
}
}

View File

@ -3,7 +3,7 @@ package com.simibubi.create.modules;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;

View File

@ -1,6 +1,6 @@
package com.simibubi.create.modules.contraptions.base;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.modules.contraptions.RotationPropagator;
import net.minecraft.block.Block;

View File

@ -8,7 +8,7 @@ import com.simibubi.create.AllBlocks;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import com.simibubi.create.foundation.block.IWithTileEntity;
import com.simibubi.create.foundation.block.SyncedTileEntity;
import com.simibubi.create.foundation.utility.ItemHelper;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.modules.contraptions.base.HorizontalKineticBlock;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.BeltAttachmentState;
import com.simibubi.create.modules.contraptions.relays.belt.AllBeltAttachments.IBeltAttachment;

View File

@ -12,9 +12,9 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.AllPackets;
import com.simibubi.create.Create;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.BlockHelper;
import com.simibubi.create.foundation.utility.ItemDescription;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.Block;

View File

@ -7,7 +7,7 @@ import java.util.Optional;
import com.simibubi.create.foundation.item.AbstractToolItem;
import com.simibubi.create.foundation.item.AllToolTypes;
import com.simibubi.create.foundation.utility.ItemHelper;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;

View File

@ -7,7 +7,7 @@ import java.util.Optional;
import com.simibubi.create.AllRecipes;
import com.simibubi.create.CreateConfig;
import com.simibubi.create.foundation.utility.ItemHelper;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.modules.contraptions.base.ProcessingRecipe;
import com.simibubi.create.modules.contraptions.receivers.SplashingRecipe;
import com.simibubi.create.modules.contraptions.relays.belt.BeltTileEntity;

View File

@ -13,10 +13,10 @@ import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.foundation.block.IWithContainer;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.type.CombinedCountedItemsList;
import com.simibubi.create.foundation.type.CountedItemsList;
import com.simibubi.create.foundation.type.CountedItemsList.ItemStackEntry;
import com.simibubi.create.foundation.utility.ItemHelper;
import com.simibubi.create.modules.logistics.item.CardboardBoxItem;
import com.simibubi.create.modules.logistics.management.LogisticalNetwork;
import com.simibubi.create.modules.logistics.management.base.LogisticalCasingTileEntity;

View File

@ -16,9 +16,9 @@ import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen;
import com.simibubi.create.foundation.gui.widgets.IconButton;
import com.simibubi.create.foundation.gui.widgets.Indicator;
import com.simibubi.create.foundation.gui.widgets.Indicator.State;
import com.simibubi.create.foundation.utility.ItemDescription.Palette;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.item.ItemDescription.Palette;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.TooltipHelper;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket;
import com.simibubi.create.modules.schematics.packet.ConfigureSchematicannonPacket.Option;

View File

@ -401,6 +401,18 @@
"create.tooltip.capacityProvided.medium": "Medium",
"create.tooltip.capacityProvided.high": "Large",
"create.tooltip.wip": "WIP",
"create.tooltip.workInProgress": "Work in progress!",
"create.tooltip.randomWipDescription0": "Please keep this item away from children.",
"create.tooltip.randomWipDescription1": "A baby panda dies everytime you use this item.",
"create.tooltip.randomWipDescription2": "Use at your own risk.",
"create.tooltip.randomWipDescription3": "Nothing to see here, please disperse.",
"create.tooltip.randomWipDescription4": "This item will self-destruct in 10 seconds.",
"create.tooltip.randomWipDescription5": "Believe me, it's useless.",
"create.tooltip.randomWipDescription6": "By using this item, you hereby consent to our disclaimer and agree to its terms.",
"create.tooltip.randomWipDescription7": "This one maybe isn't for you.",
"create.tooltip.randomWipDescription8": "Use it and regret your decision immediately.",
"create.mechanical_mixer.min_ingredients": "Min. Ingredients",
@ -669,6 +681,16 @@
"block.create.flexpeater.tooltip": "FLEX REPEATER",
"block.create.flexpeater.tooltip.summary": "An advanced _Redstone_ _Repeater_ with a _configurable_ _Delay_ up to 30 Minutes.",
"item.create.logistical_controller_calculation.tooltip": "WIP",
"item.create.logistical_controller_request.tooltip": "WIP",
"item.create.logistical_controller_storage.tooltip": "WIP",
"item.create.logistical_controller_supply.tooltip": "WIP",
"item.create.logistical_controller_transactions.tooltip": "WIP",
"block.create.logistical_index.tooltip": "WIP",
"block.create.package_funnel.tooltip": "WIP",
"block.create.logisticians_table.tooltip": "WIP",
"item.create.logistical_dial.tooltip": "WIP",
"itemGroup.create": "Create"
}