mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-06-02 18:59:19 +02:00
"API" to allow forcing the goggle overlay to show
This commit is contained in:
parent
d66170c8fe
commit
fca9cb7553
|
@ -57,8 +57,7 @@ public class GoggleOverlayRenderer {
|
|||
if (mc.options.hideGui || mc.gameMode.getPlayerMode() == GameType.SPECTATOR)
|
||||
return;
|
||||
|
||||
HitResult objectMouseOver = mc.hitResult;
|
||||
if (!(objectMouseOver instanceof BlockHitResult)) {
|
||||
if (!(mc.hitResult instanceof BlockHitResult result)) {
|
||||
lastHovered = null;
|
||||
hoverTicks = 0;
|
||||
return;
|
||||
|
@ -72,7 +71,6 @@ public class GoggleOverlayRenderer {
|
|||
return;
|
||||
}
|
||||
|
||||
BlockHitResult result = (BlockHitResult) objectMouseOver;
|
||||
ClientLevel world = mc.level;
|
||||
BlockPos pos = result.getBlockPos();
|
||||
|
||||
|
@ -95,12 +93,15 @@ public class GoggleOverlayRenderer {
|
|||
|
||||
List<Component> tooltip = new ArrayList<>();
|
||||
|
||||
if (hasGoggleInformation && wearingGoggles) {
|
||||
boolean isShifting = mc.player.isShiftKeyDown();
|
||||
|
||||
if (hasGoggleInformation) {
|
||||
IHaveGoggleInformation gte = (IHaveGoggleInformation) be;
|
||||
goggleAddedInformation = gte.addToGoggleTooltip(tooltip, isShifting);
|
||||
item = gte.getIcon(isShifting);
|
||||
|
||||
if (wearingGoggles || gte.forcedGoggleOverlay()) {
|
||||
boolean isShifting = mc.player.isShiftKeyDown();
|
||||
|
||||
goggleAddedInformation = gte.addToGoggleTooltip(tooltip, isShifting);
|
||||
item = gte.getIcon(isShifting);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasHoveringInformation) {
|
||||
|
|
|
@ -53,6 +53,16 @@ public interface IHaveGoggleInformation {
|
|||
return AllItems.GOGGLES.asStack();
|
||||
}
|
||||
|
||||
/**
|
||||
* this method will be called when looking at a BlockEntity that implemented this
|
||||
* interface
|
||||
* <p>
|
||||
* return true if the goggle overlay should show up no matter what, even when goggle wearing predicates aren't true.
|
||||
*/
|
||||
default boolean forcedGoggleOverlay() {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean containedFluidTooltip(List<Component> tooltip, boolean isPlayerSneaking,
|
||||
LazyOptional<IFluidHandler> handler) {
|
||||
Optional<IFluidHandler> resolve = handler.resolve();
|
||||
|
|
Loading…
Reference in a new issue