#1913 Improved in-game documentation via tooltips for both machines & upgrades and solar panel exception fix (#1917)

* Overclocker and energy storage tooltip added

* Add default constructor to fix NoSuchMethodException

java.lang.NoSuchMethodException when loading world with existing solar panels

* Base Upgrade tooltips (Might move to reborn core)

* Migrated to tooltip callback and added most machine infos

* Optimize imports of stuff previously touched

* Added more informationtips and cleanup

* Revert itemUpgrade formatting

* Final touches

* Readd easter eggs, multi-line tips and translation updates

Easter egg tooltips are now restricted to only ctrl-hover
This commit is contained in:
Justin Vitale 2019-12-23 09:53:01 +11:00 committed by modmuss50
parent 34074d7a8a
commit 3dbc7feb62
11 changed files with 229 additions and 28 deletions

View file

@ -35,8 +35,8 @@ import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.world.World;
import reborncore.api.blockentity.IUpgrade;
import reborncore.common.recipes.IUpgradeHandler;
import reborncore.common.blockentity.MachineBaseBlockEntity;
import reborncore.common.recipes.IUpgradeHandler;
import techreborn.TechReborn;
import techreborn.init.TRContent;
@ -57,22 +57,21 @@ public class ItemUpgrade extends Item implements IUpgrade {
@Override
public void process(
@Nonnull MachineBaseBlockEntity blockEntity,
@Nullable
IUpgradeHandler handler,
@Nonnull
ItemStack stack) {
@Nonnull MachineBaseBlockEntity blockEntity,
@Nullable
IUpgradeHandler handler,
@Nonnull
ItemStack stack) {
behavior.process(blockEntity, handler, stack);
}
@Environment(EnvType.CLIENT)
@Override
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
if(stack.getItem() == TRContent.Upgrades.SUPERCONDUCTOR.item){
if(Screen.hasShiftDown()){
if (stack.getItem() == TRContent.Upgrades.SUPERCONDUCTOR.item) {
if (Screen.hasControlDown()) {
tooltip.add(new LiteralText(Formatting.GOLD + "Blame obstinate_3 for this"));
}
}
super.appendTooltip(stack, world, tooltip, context);
}
}
}