Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
CreatureChat
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Public
CreatureChat
Commits
e4b69f03
Commit
e4b69f03
authored
May 25, 2024
by
Jonathan Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Fabulous video bug causing chat bubbles to be invisible
- Shader support (i.e. Iris, etc...) - Updating CHANGELOG
parent
339ead1e
Pipeline
#12308
passed with stages
in 1 minute 39 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
107 additions
and
44 deletions
+107
-44
CHANGELOG.md
CHANGELOG.md
+2
-0
ClientInit.java
src/client/java/com/owlmaddie/ClientInit.java
+1
-1
BubbleRenderer.java
src/client/java/com/owlmaddie/ui/BubbleRenderer.java
+104
-43
No files found.
CHANGELOG.md
View file @
e4b69f03
...
@@ -12,6 +12,8 @@ All notable changes to **CreatureChat** are documented in this file. The format
...
@@ -12,6 +12,8 @@ All notable changes to **CreatureChat** are documented in this file. The format
-
Added Minecraft Forge installation instructions
-
Added Minecraft Forge installation instructions
### Fixed
### Fixed
-
Fabulous video bug causing chat bubbles to be invisible
-
Shader support (i.e. Iris, etc...)
-
Parse OpenAI JSON error messages, to display a more readable error message
-
Parse OpenAI JSON error messages, to display a more readable error message
-
Remove quotes from CreatureChat API error messages
-
Remove quotes from CreatureChat API error messages
-
If OpenAI key is set, switch URL automatically back to OpenAI endpoint
-
If OpenAI key is set, switch URL automatically back to OpenAI endpoint
...
...
src/client/java/com/owlmaddie/ClientInit.java
View file @
e4b69f03
...
@@ -29,7 +29,7 @@ public class ClientInit implements ClientModInitializer {
...
@@ -29,7 +29,7 @@ public class ClientInit implements ClientModInitializer {
ClientPackets
.
register
();
ClientPackets
.
register
();
// Register an event callback to render text bubbles
// Register an event callback to render text bubbles
WorldRenderEvents
.
LAST
.
register
((
context
)
->
{
WorldRenderEvents
.
BEFORE_DEBUG_RENDER
.
register
((
context
)
->
{
BubbleRenderer
.
drawTextAboveEntities
(
context
,
tickCounter
,
context
.
tickDelta
());
BubbleRenderer
.
drawTextAboveEntities
(
context
,
tickCounter
,
context
.
tickDelta
());
});
});
...
...
src/client/java/com/owlmaddie/ui/BubbleRenderer.java
View file @
e4b69f03
...
@@ -41,18 +41,26 @@ public class BubbleRenderer {
...
@@ -41,18 +41,26 @@ public class BubbleRenderer {
public
static
int
DISPLAY_PADDING
=
2
;
public
static
int
DISPLAY_PADDING
=
2
;
public
static
int
animationFrame
=
0
;
public
static
int
animationFrame
=
0
;
public
static
long
lastTick
=
0
;
public
static
long
lastTick
=
0
;
public
static
int
light
=
15728880
;
public
static
int
overlay
=
OverlayTexture
.
DEFAULT_UV
;
public
static
void
drawTextBubbleBackground
(
String
base_name
,
MatrixStack
matrices
,
float
x
,
float
y
,
float
width
,
float
height
,
int
friendship
)
{
public
static
void
drawTextBubbleBackground
(
String
base_name
,
MatrixStack
matrices
,
float
x
,
float
y
,
float
width
,
float
height
,
int
friendship
)
{
RenderSystem
.
enableDepthTest
();
// Set shader & texture
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionColorTexLightmapProgram
);
// Enable depth test and blending
RenderSystem
.
enableBlend
();
RenderSystem
.
enableBlend
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionTexProgram
);
RenderSystem
.
enableDepthTest
();
RenderSystem
.
depthMask
(
true
);
// Prepare the tessellator and buffer
Tessellator
tessellator
=
Tessellator
.
getInstance
();
Tessellator
tessellator
=
Tessellator
.
getInstance
();
BufferBuilder
buffer
=
tessellator
.
getBuffer
();
BufferBuilder
buffer
=
tessellator
.
getBuffer
();
float
z
=
0.01
F
;
float
z
=
0.01
F
;
// Draw UI text background (based on friendship)
// Draw UI text background (based on friendship)
// Draw TOP
if
(
friendship
==
-
3
)
{
if
(
friendship
==
-
3
)
{
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
base_name
+
"-enemy"
));
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
base_name
+
"-enemy"
));
}
else
if
(
friendship
==
3
)
{
}
else
if
(
friendship
==
3
)
{
...
@@ -62,45 +70,64 @@ public class BubbleRenderer {
...
@@ -62,45 +70,64 @@ public class BubbleRenderer {
}
}
drawTexturePart
(
matrices
,
buffer
,
x
-
50
,
y
,
z
,
228
,
40
);
drawTexturePart
(
matrices
,
buffer
,
x
-
50
,
y
,
z
,
228
,
40
);
// Draw MIDDLE
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
"text-middle"
));
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
"text-middle"
));
drawTexturePart
(
matrices
,
buffer
,
x
,
y
+
40
,
z
,
width
,
height
);
drawTexturePart
(
matrices
,
buffer
,
x
,
y
+
40
,
z
,
width
,
height
);
// Draw BOTTOM
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
"text-bottom"
));
RenderSystem
.
setShaderTexture
(
0
,
textures
.
GetUI
(
"text-bottom"
));
drawTexturePart
(
matrices
,
buffer
,
x
,
y
+
40
+
height
,
z
,
width
,
5
);
drawTexturePart
(
matrices
,
buffer
,
x
,
y
+
40
+
height
,
z
,
width
,
5
);
// Disable blending and depth test
RenderSystem
.
disableBlend
();
RenderSystem
.
disableBlend
();
RenderSystem
.
disableDepthTest
();
RenderSystem
.
disableDepthTest
();
}
}
private
static
void
drawTexturePart
(
MatrixStack
matrices
,
BufferBuilder
buffer
,
float
x
,
float
y
,
float
z
,
float
width
,
float
height
)
{
private
static
void
drawTexturePart
(
MatrixStack
matrices
,
BufferBuilder
buffer
,
float
x
,
float
y
,
float
z
,
float
width
,
float
height
)
{
buffer
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_TEXTURE
);
// Define the vertices with color, texture, light, and overlay
buffer
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
0
,
1
).
next
();
// bottom left
Matrix4f
matrix4f
=
matrices
.
peek
().
getPositionMatrix
();
buffer
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
1
,
1
).
next
();
// bottom right
buffer
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
1
,
0
).
next
();
// top right
// Begin drawing quads with the correct vertex format
buffer
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
0
,
0
).
next
();
// top left
buffer
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_COLOR_TEXTURE_LIGHT
);
buffer
.
vertex
(
matrix4f
,
x
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom left
buffer
.
vertex
(
matrix4f
,
x
+
width
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom right
buffer
.
vertex
(
matrix4f
,
x
+
width
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top right
buffer
.
vertex
(
matrix4f
,
x
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top left
Tessellator
.
getInstance
().
draw
();
Tessellator
.
getInstance
().
draw
();
}
}
private
static
void
drawIcon
(
String
ui_icon_name
,
MatrixStack
matrices
,
float
x
,
float
y
,
float
width
,
float
height
)
{
private
static
void
drawIcon
(
String
ui_icon_name
,
MatrixStack
matrices
,
float
x
,
float
y
,
float
width
,
float
height
)
{
// Draw button icon
// Draw button icon
Identifier
button_texture
=
textures
.
GetUI
(
ui_icon_name
);
Identifier
button_texture
=
textures
.
GetUI
(
ui_icon_name
);
// Set shader & texture
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionColorTexLightmapProgram
);
RenderSystem
.
setShaderTexture
(
0
,
button_texture
);
RenderSystem
.
setShaderTexture
(
0
,
button_texture
);
RenderSystem
.
enableDepthTest
();
// Enable depth test and blending
RenderSystem
.
enableBlend
();
RenderSystem
.
enableBlend
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionTexProgram
);
RenderSystem
.
enableDepthTest
();
RenderSystem
.
depthMask
(
true
);
// Prepare the tessellator and buffer
Tessellator
tessellator
=
Tessellator
.
getInstance
();
Tessellator
tessellator
=
Tessellator
.
getInstance
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
BufferBuilder
buffer
=
tessellator
.
getBuffer
();
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_TEXTURE
);
float
z
=
-
0.01
F
;
// Get the current matrix position
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
0
,
1
).
next
();
// bottom left
Matrix4f
matrix4f
=
matrices
.
peek
().
getPositionMatrix
();
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
1
,
1
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
1
,
0
).
next
();
// top right
// Begin drawing quads with the correct vertex format
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
0
,
0
).
next
();
// top left
buffer
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_COLOR_TEXTURE_LIGHT
);
buffer
.
vertex
(
matrix4f
,
x
,
y
+
height
,
0.0
F
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom left
buffer
.
vertex
(
matrix4f
,
x
+
width
,
y
+
height
,
0.0
F
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom right
buffer
.
vertex
(
matrix4f
,
x
+
width
,
y
,
0.0
F
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top right
buffer
.
vertex
(
matrix4f
,
x
,
y
,
0.0
F
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top left
tessellator
.
draw
();
tessellator
.
draw
();
// Disable blending and depth test
RenderSystem
.
disableBlend
();
RenderSystem
.
disableBlend
();
RenderSystem
.
disableDepthTest
();
RenderSystem
.
disableDepthTest
();
}
}
...
@@ -109,25 +136,37 @@ public class BubbleRenderer {
...
@@ -109,25 +136,37 @@ public class BubbleRenderer {
// dynamically calculate friendship ui image name
// dynamically calculate friendship ui image name
String
ui_icon_name
=
"friendship"
+
friendship
;
String
ui_icon_name
=
"friendship"
+
friendship
;
// Draw texture
// Set shader
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionColorTexLightmapProgram
);
// Set texture
Identifier
button_texture
=
textures
.
GetUI
(
ui_icon_name
);
Identifier
button_texture
=
textures
.
GetUI
(
ui_icon_name
);
RenderSystem
.
setShaderTexture
(
0
,
button_texture
);
RenderSystem
.
setShaderTexture
(
0
,
button_texture
);
RenderSystem
.
enableDepthTest
();
// Enable depth test and blending
RenderSystem
.
enableBlend
();
RenderSystem
.
enableBlend
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionTexProgram
);
RenderSystem
.
enableDepthTest
();
RenderSystem
.
depthMask
(
true
);
// Prepare the tessellator and buffer
Tessellator
tessellator
=
Tessellator
.
getInstance
();
Tessellator
tessellator
=
Tessellator
.
getInstance
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_TEXTURE
);
// Get the current matrix position
Matrix4f
matrix4f
=
matrices
.
peek
().
getPositionMatrix
();
// Begin drawing quads with the correct vertex format
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_COLOR_TEXTURE_LIGHT
);
float
z
=
-
0.01
F
;
float
z
=
-
0.01
F
;
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
0
,
1
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
1
,
1
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
1
,
0
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
0
,
0
).
next
();
// top left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top left
tessellator
.
draw
();
tessellator
.
draw
();
// Disable blending and depth test
RenderSystem
.
disableBlend
();
RenderSystem
.
disableBlend
();
RenderSystem
.
disableDepthTest
();
RenderSystem
.
disableDepthTest
();
}
}
...
@@ -143,23 +182,34 @@ public class BubbleRenderer {
...
@@ -143,23 +182,34 @@ public class BubbleRenderer {
return
;
return
;
}
}
// Set shader & texture
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionColorTexLightmapProgram
);
RenderSystem
.
setShaderTexture
(
0
,
entity_id
);
RenderSystem
.
setShaderTexture
(
0
,
entity_id
);
RenderSystem
.
enableDepthTest
();
// Enable depth test and blending
RenderSystem
.
enableBlend
();
RenderSystem
.
enableBlend
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionTexProgram
);
RenderSystem
.
enableDepthTest
();
RenderSystem
.
depthMask
(
true
);
// Prepare the tessellator and buffer
Tessellator
tessellator
=
Tessellator
.
getInstance
();
Tessellator
tessellator
=
Tessellator
.
getInstance
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_TEXTURE
);
// Get the current matrix position
Matrix4f
matrix4f
=
matrices
.
peek
().
getPositionMatrix
();
// Begin drawing quads with the correct vertex format
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_COLOR_TEXTURE_LIGHT
);
float
z
=
-
0.01
F
;
float
z
=
-
0.01
F
;
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
0
,
1
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
1
,
1
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
1
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
1
,
0
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
1
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
0
,
0
).
next
();
// top left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
0
,
0
).
light
(
light
).
overlay
(
overlay
).
next
();
// top left
tessellator
.
draw
();
tessellator
.
draw
();
// Disable blending and depth test
RenderSystem
.
disableBlend
();
RenderSystem
.
disableBlend
();
RenderSystem
.
disableDepthTest
();
RenderSystem
.
disableDepthTest
();
}
}
...
@@ -169,15 +219,25 @@ public class BubbleRenderer {
...
@@ -169,15 +219,25 @@ public class BubbleRenderer {
EntityRenderer
renderer
=
EntityRendererAccessor
.
getEntityRenderer
(
entity
);
EntityRenderer
renderer
=
EntityRendererAccessor
.
getEntityRenderer
(
entity
);
Identifier
playerTexture
=
renderer
.
getTexture
(
entity
);
Identifier
playerTexture
=
renderer
.
getTexture
(
entity
);
// Set shader & texture
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionColorTexLightmapProgram
);
RenderSystem
.
setShaderTexture
(
0
,
playerTexture
);
RenderSystem
.
setShaderTexture
(
0
,
playerTexture
);
RenderSystem
.
enableDepthTest
();
// Enable depth test and blending
RenderSystem
.
enableBlend
();
RenderSystem
.
enableBlend
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
defaultBlendFunc
();
RenderSystem
.
setShader
(
GameRenderer:
:
getPositionTexProgram
);
RenderSystem
.
enableDepthTest
();
RenderSystem
.
depthMask
(
true
);
// Prepare the tessellator and buffer
Tessellator
tessellator
=
Tessellator
.
getInstance
();
Tessellator
tessellator
=
Tessellator
.
getInstance
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
BufferBuilder
bufferBuilder
=
tessellator
.
getBuffer
();
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_TEXTURE
);
// Get the current matrix position
Matrix4f
matrix4f
=
matrices
.
peek
().
getPositionMatrix
();
// Begin drawing quads with the correct vertex format
bufferBuilder
.
begin
(
VertexFormat
.
DrawMode
.
QUADS
,
VertexFormats
.
POSITION_COLOR_TEXTURE_LIGHT
);
// Texture coordinates for the face region (8, 8) to (16, 16) in a 64x64 texture
// Texture coordinates for the face region (8, 8) to (16, 16) in a 64x64 texture
float
textureWidth
=
64.0
F
;
float
textureWidth
=
64.0
F
;
...
@@ -189,10 +249,10 @@ public class BubbleRenderer {
...
@@ -189,10 +249,10 @@ public class BubbleRenderer {
float
z
=
-
0.01
F
;
float
z
=
-
0.01
F
;
// Draw face
// Draw face
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
u1
,
v2
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
u1
,
v2
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom left
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
u2
,
v2
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
u2
,
v2
).
light
(
light
).
overlay
(
overlay
).
next
();
// bottom right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
u2
,
v1
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
x4f
,
x
+
width
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
u2
,
v1
).
light
(
light
).
overlay
(
overlay
).
next
();
// top right
bufferBuilder
.
vertex
(
matri
ces
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
u1
,
v1
).
next
();
// top left
bufferBuilder
.
vertex
(
matri
x4f
,
x
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
u1
,
v1
).
light
(
light
).
overlay
(
overlay
).
next
();
// top left
// Coordinates for the hat (overlay)
// Coordinates for the hat (overlay)
float
hatU1
=
40.0
F
/
textureWidth
;
float
hatU1
=
40.0
F
/
textureWidth
;
...
@@ -204,12 +264,13 @@ public class BubbleRenderer {
...
@@ -204,12 +264,13 @@ public class BubbleRenderer {
z
-=
0.01
F
;
z
-=
0.01
F
;
// Draw hat (overlay)
// Draw hat (overlay)
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
+
height
,
z
).
texture
(
hatU1
,
hatV2
).
next
();
bufferBuilder
.
vertex
(
matrix4f
,
x
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
hatU1
,
hatV2
).
light
(
light
).
overlay
(
overlay
).
next
();
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
+
height
,
z
).
texture
(
hatU2
,
hatV2
).
next
();
bufferBuilder
.
vertex
(
matrix4f
,
x
+
width
,
y
+
height
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
hatU2
,
hatV2
).
light
(
light
).
overlay
(
overlay
).
next
();
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
+
width
,
y
,
z
).
texture
(
hatU2
,
hatV1
).
next
();
bufferBuilder
.
vertex
(
matrix4f
,
x
+
width
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
hatU2
,
hatV1
).
light
(
light
).
overlay
(
overlay
).
next
();
bufferBuilder
.
vertex
(
matrices
.
peek
().
getPositionMatrix
(),
x
,
y
,
z
).
texture
(
hatU1
,
hatV1
).
next
();
bufferBuilder
.
vertex
(
matrix4f
,
x
,
y
,
z
).
color
(
255
,
255
,
255
,
255
).
texture
(
hatU1
,
hatV1
).
light
(
light
).
overlay
(
overlay
).
next
();
tessellator
.
draw
();
tessellator
.
draw
();
// Disable blending and depth test
RenderSystem
.
disableBlend
();
RenderSystem
.
disableBlend
();
RenderSystem
.
disableDepthTest
();
RenderSystem
.
disableDepthTest
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment