Class TEntityRendererElement
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.TElement
io.github.thecsdev.tcdcommons.api.client.gui.other.TBlankElement
io.github.thecsdev.tcdcommons.api.client.gui.other.TEntityRendererElement
- All Implemented Interfaces:
TParentElement
,ITooltipProvider
,IEnableStateProvider
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
TElement.TElementEvent_ChildAR, TElement.TElementEvent_ContextMenu, TElement.TElementEvent_Moved, TElement.TElementEvent_ParentChanged, TElement.TElementEvent_Resized
-
Field Summary
Modifier and TypeFieldDescriptionprotected @Nullable net.minecraft.entity.Entity
protected int
The cached calculated size at which the entity will render.protected boolean
Contains a set of size offsets to apply to entities rendered on the screen with theTEntityRendererElement
.protected double
protected int
The cached center XY coordinates for rendering theentity
.protected int
The cached center XY coordinates for rendering theentity
.protected @Nullable net.minecraft.client.font.MultilineText
protected boolean
Fields inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
alpha, eChildAdded, eChildRemoved, eContextMenu, eMoved, eParentChanged, eResized, height, SP_ALL, SP_INVOKE_EVENT, SP_MOVE_CHILDREN, SP_RELATIVE, SP_UPDATE_TOPMOST, SS_ALL, SS_INVOKE_EVENT, SS_UPDATE_TOPMOST, tooltip, tooltipPositioner, width, x, y, zOffset
Fields inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
MAX_CHILD_NESTING_DEPTH
-
Constructor Summary
ConstructorDescriptionTEntityRendererElement
(int x, int y, int width, int height) TEntityRendererElement
(int x, int y, int width, int height, net.minecraft.entity.EntityType<?> entityType) -
Method Summary
Modifier and TypeMethodDescriptionstatic int
calculateEntityGUISize
(net.minecraft.entity.Entity entity, int viewportSize) Calculates the GUIEntity
size given the viewport size and the entity rendering size offsets.final @Nullable net.minecraft.entity.Entity
static double
getEntityGuiSizeOffset
(net.minecraft.entity.EntityType<?> entityType) Returns an entity size offset usingEntityGuiSizeOffsets
for when an entity is rendered usingTEntityRendererElement
.final double
final @Nullable net.minecraft.entity.EntityType<?>
final boolean
protected final void
Recalculates the values ofentityTextX
andentityTextY
.protected final void
Recalculates the value ofentityDisplaySize
.void
render
(TDrawContext pencil) Renders this GUI element on the screen.final void
setEntity
(@Nullable net.minecraft.entity.Entity entity) final void
setEntity
(@Nullable net.minecraft.entity.EntityType<?> entityType) final void
setEntityScale
(double entityScale) void
setFollowsCursor
(boolean followsCursor) void
setSize
(int width, int height, int flags) protected final void
updateEntityTypeName
(net.minecraft.entity.EntityType<?> entityType) Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.other.TBlankElement
input, input, isFocusable, isHoverable
Methods inherited from class io.github.thecsdev.tcdcommons.api.client.gui.TElement
canBeAddedTo, createContextMenu, getAlpha, getChildren, getEnabled, getHeight, getItemRenderer, getParent, getParentTElement, getParentTScreen, getTextRenderer, getTooltip, getTooltipPositioner, getWidth, getX, getY, getZIndex, getZOffset, isDragging, isEnabled, isEnabledAndVisible, isFocused, isFocusedOrHovered, isHovered, isVisible, move, moveChildren, next, postRender, previous, setAlpha, setPosition, setPosition, setSize, setTooltip, setZOffset, tick, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.thecsdev.tcdcommons.api.client.gui.TParentElement
addChild, addChild, clearChildren, findChild, findLastChild, findParent, findParentTElement, forEachChild, getEndX, getEndY, removeChild, removeChild
-
Field Details
-
entity
@Nullable protected @Nullable net.minecraft.entity.Entity entity -
entityTypeName
@Nullable protected @Nullable net.minecraft.client.font.MultilineText entityTypeName -
entityErrorState
protected boolean entityErrorState -
entityTextX
protected int entityTextXThe cached center XY coordinates for rendering theentity
. tY is for text. -
entityTextY
protected int entityTextYThe cached center XY coordinates for rendering theentity
. tY is for text. -
entityDisplaySize
protected int entityDisplaySizeThe cached calculated size at which the entity will render. -
entityScale
protected double entityScale -
followsCursor
protected boolean followsCursor -
EntityGuiSizeOffsets
Contains a set of size offsets to apply to entities rendered on the screen with theTEntityRendererElement
.
-
-
Constructor Details
-
TEntityRendererElement
public TEntityRendererElement(int x, int y, int width, int height) -
TEntityRendererElement
public TEntityRendererElement(int x, int y, int width, int height, net.minecraft.entity.EntityType<?> entityType)
-
-
Method Details
-
setSize
public void setSize(int width, int height, int flags) -
getEntity
@Nullable public final @Nullable net.minecraft.entity.Entity getEntity() -
getEntityType
@Nullable public final @Nullable net.minecraft.entity.EntityType<?> getEntityType() -
setEntity
public final void setEntity(@Nullable @Nullable net.minecraft.entity.EntityType<?> entityType) -
setEntity
public final void setEntity(@Nullable @Nullable net.minecraft.entity.Entity entity) -
updateEntityTypeName
@Internal protected final void updateEntityTypeName(net.minecraft.entity.EntityType<?> entityType) -
getFollowsCursor
public final boolean getFollowsCursor() -
setFollowsCursor
public void setFollowsCursor(boolean followsCursor) -
getEntityScale
public final double getEntityScale() -
setEntityScale
public final void setEntityScale(double entityScale) -
recalcCache_mobSize
protected final void recalcCache_mobSize()Recalculates the value ofentityDisplaySize
. -
recalcCache_cXY
protected final void recalcCache_cXY()Recalculates the values ofentityTextX
andentityTextY
. -
render
Description copied from interface:TParentElement
Renders this GUI element on the screen.- Specified by:
render
in interfaceTParentElement
- Overrides:
render
in classTBlankElement
- Parameters:
pencil
- TheTDrawContext
.
-
getEntityGuiSizeOffset
public static double getEntityGuiSizeOffset(net.minecraft.entity.EntityType<?> entityType) Returns an entity size offset usingEntityGuiSizeOffsets
for when an entity is rendered usingTEntityRendererElement
. -
calculateEntityGUISize
public static int calculateEntityGUISize(net.minecraft.entity.Entity entity, int viewportSize) Calculates the GUIEntity
size given the viewport size and the entity rendering size offsets.- Parameters:
entity
- The targetEntity
viewportSize
- The smallest viewport size, be it the width or the height.
-