Fix Tooltips on 1.16

This commit is contained in:
simibubi 2021-03-30 16:32:19 +02:00
parent 358ff25031
commit c2f3ebbf72
2 changed files with 20 additions and 2 deletions

View File

@ -9,6 +9,8 @@ import com.simibubi.create.AllFluids;
import com.simibubi.create.Create;
import com.simibubi.create.CreateClient;
import com.simibubi.create.content.contraptions.KineticDebugger;
import com.simibubi.create.content.contraptions.base.IRotate;
import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionHandler;
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisRangeDisplay;
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher;
@ -27,6 +29,7 @@ import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperR
import com.simibubi.create.content.logistics.block.depot.EjectorTargetHandler;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInteractionPointHandler;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.ItemDescription;
import com.simibubi.create.foundation.item.TooltipHelper;
import com.simibubi.create.foundation.networking.AllPackets;
import com.simibubi.create.foundation.networking.LeftClickPacket;
@ -52,9 +55,11 @@ import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@ -224,6 +229,19 @@ public class ClientEvents {
.addInformation(toolTip);
itemTooltip.addAll(0, toolTip);
}
if (stack.getItem() instanceof BlockItem) {
BlockItem item = (BlockItem) stack.getItem();
if (item.getBlock() instanceof IRotate || item.getBlock() instanceof EngineBlock) {
List<ITextComponent> kineticStats = ItemDescription.getKineticStats(item.getBlock());
if (!kineticStats.isEmpty()) {
event.getToolTip()
.add(new StringTextComponent(""));
event.getToolTip()
.addAll(kineticStats);
}
}
}
PonderTooltipHandler.addToTooltip(event.getToolTip(), stack);
}

View File

@ -217,7 +217,7 @@ public class ItemDescription {
if (hasControls) {
IFormattableTextComponent tabBuilder = new StringTextComponent("");
tabBuilder.append(new StringTextComponent(holdCtrl[0]).formatted(DARK_GRAY));
tabBuilder.append(keyCtrl.formatted(ctrl? WHITE : GRAY));
tabBuilder.append(keyCtrl.copy().formatted(ctrl? WHITE : GRAY));
tabBuilder.append(new StringTextComponent(holdCtrl[1]).formatted(DARK_GRAY));
list.add(0, tabBuilder);
}
@ -225,7 +225,7 @@ public class ItemDescription {
if (hasDescription) {
IFormattableTextComponent tabBuilder = new StringTextComponent("");
tabBuilder.append(new StringTextComponent(holdDesc[0]).formatted(DARK_GRAY));
tabBuilder.append(keyShift.formatted(shift? WHITE : GRAY));
tabBuilder.append(keyShift.copy().formatted(shift? WHITE : GRAY));
tabBuilder.append(new StringTextComponent(holdDesc[1]).formatted(DARK_GRAY));
list.add(0, tabBuilder);
}