15
15
* You should have received a copy of the GNU General Public License
16
16
* along with this program. If not, see <https://www.gnu.org/licenses>.
17
17
*
18
- * Linking this mod statically or dynamically with second
18
+ * Linking this mod statically or dynamically with other
19
19
* modules is making a combined work based on this mod.
20
20
* Thus, the terms and conditions of the GNU General Public License cover the whole combination.
21
21
*
25
25
* and with code included in the standard release of Minecraft under All Rights Reserved (or
26
26
* modified versions of such code, with unchanged license).
27
27
* You may copy and distribute such a system following the terms of the GNU GPL for this mod
28
- * and the licenses of the second code concerned.
28
+ * and the licenses of the other code concerned.
29
29
*
30
30
* Note that people who make modified versions of this mod are not obligated to grant
31
31
* this special exception for their modified versions; it is their choice whether to do so.
36
36
37
37
import com .mojang .blaze3d .systems .RenderSystem ;
38
38
import com .mojang .blaze3d .vertex .VertexConsumer ;
39
+ import ladysnake .requiem .api .v1 .possession .PossessionComponent ;
39
40
import ladysnake .requiem .client .render .RequiemRenderPhases ;
41
+ import ladysnake .requiem .common .particle .RequiemSoundParticleEffect ;
40
42
import net .minecraft .client .MinecraftClient ;
41
43
import net .minecraft .client .particle .Particle ;
42
44
import net .minecraft .client .particle .ParticleFactory ;
47
49
import net .minecraft .client .render .VertexConsumerProvider ;
48
50
import net .minecraft .client .world .ClientWorld ;
49
51
import net .minecraft .entity .player .PlayerEntity ;
50
- import net .minecraft .particle .DefaultParticleType ;
51
52
import net .minecraft .util .math .Axis ;
52
53
import net .minecraft .util .math .MathHelper ;
53
54
import net .minecraft .util .math .Vec3d ;
56
57
import org .lwjgl .opengl .GL11 ;
57
58
import org .quiltmc .loader .api .minecraft .ClientOnly ;
58
59
59
- public class SoundParticle extends SpriteBillboardParticle {
60
- private final SpriteProvider spriteProvider ;
60
+ import java .awt .*;
61
61
62
+ public class SoundParticle extends SpriteBillboardParticle {
63
+ public final SpriteProvider spriteProvider ;
64
+ private float red ;
65
+ private float green ;
66
+ private float blue ;
67
+ //private final ParticleTextureSheet sheet;
62
68
//TODO: by:Redfan2: think about which VertexConsumer to use to not conflict with Darkness fog effect
63
- private static final VertexConsumerProvider .Immediate soundVertexConsumerProvider = MinecraftClient .getInstance ().getBufferBuilders ().getEntityVertexConsumers ();
69
+ private static final VertexConsumerProvider .Immediate soundVertexConsumerProvider = MinecraftClient .getInstance ().getBufferBuilders ().getEntityVertexConsumers ();
70
+ //Tessellator.getInstance().getBufferBuilder()
71
+ //Doesnt render: Investigate: VertexConsumerProvider.immediate(new BufferBuilder(RequiemRenderPhases.GHOST_PARTICLE_LAYER.getExpectedBufferSize()));
64
72
65
- public SoundParticle (ClientWorld world , double x , double y , double z , double velocityX , double velocityY , double velocityZ , SpriteProvider spriteProvider ) {
73
+ public SoundParticle (ClientWorld world , double x , double y , double z , double velocityX , double velocityY , double velocityZ , SpriteProvider spriteProvider , int color ) {
66
74
super (world , x , y , z , velocityX , velocityY , velocityZ );
67
75
this .spriteProvider = spriteProvider ;
68
76
this .setSpriteForAge (spriteProvider );
69
-
77
+ //Testing
78
+ Color tempColor = Color .BLUE ;
79
+ this .green = tempColor .getGreen ();
80
+ //this.sheet=new TextureSheet(spriteProvider);
81
+ //Tessellator.getInstance().getBufferBuilder().
82
+ this .red = tempColor .getRed ();
83
+ this .blue = tempColor .getBlue ();
70
84
this .maxAge = 10 ;
71
85
this .collidesWithWorld = false ;
72
86
}
73
87
74
88
@ Override
75
89
public void buildGeometry (VertexConsumer vertexConsumer , Camera camera , float tickDelta ) {
76
- if (camera .getFocusedEntity () instanceof PlayerEntity ) {
90
+ if (camera .getFocusedEntity () instanceof PlayerEntity player && player .getComponent (PossessionComponent .KEY ).isPossessionOngoing ()) {
91
+ //TODO Disabled for testing if (player.getComponent(PossessionComponent.KEY).getHost() instanceof WardenEntity) {
77
92
VertexConsumer actualConsumer = soundVertexConsumerProvider .getBuffer (RequiemRenderPhases .GHOST_PARTICLE_LAYER );
78
93
79
94
RenderSystem .disableDepthTest ();
@@ -112,9 +127,6 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti
112
127
int l = 15728880 ;
113
128
float alpha = 1 ;
114
129
115
- float red = 1f ;
116
- float green = 1f ;
117
- float blue = 1f ;
118
130
actualConsumer .vertex (Vec3fs [0 ].x (), Vec3fs [0 ].y (), Vec3fs [0 ].z ()).uv (maxU , maxV ).color (red , green , blue , alpha ).light (l ).next ();
119
131
actualConsumer .vertex (Vec3fs [1 ].x (), Vec3fs [1 ].y (), Vec3fs [1 ].z ()).uv (maxU , minV ).color (red , green , blue , alpha ).light (l ).next ();
120
132
actualConsumer .vertex (Vec3fs [2 ].x (), Vec3fs [2 ].y (), Vec3fs [2 ].z ()).uv (minU , minV ).color (red , green , blue , alpha ).light (l ).next ();
@@ -124,7 +136,7 @@ public void buildGeometry(VertexConsumer vertexConsumer, Camera camera, float ti
124
136
soundVertexConsumerProvider .draw ();
125
137
RenderSystem .enableDepthTest ();
126
138
RenderSystem .depthFunc (GL11 .GL_LEQUAL );
127
-
139
+ //}
128
140
} else {
129
141
this .markDead ();
130
142
}
@@ -148,19 +160,20 @@ public void tick() {
148
160
}
149
161
150
162
@ ClientOnly
151
- public static class Factory implements ParticleFactory <DefaultParticleType > {
152
- private final SpriteProvider spriteProvider ;
163
+ public static class Factory implements ParticleFactory <RequiemSoundParticleEffect > {
164
+ private final SpriteProvider factorySpriteProvider ;
153
165
154
166
public Factory (SpriteProvider spriteProvider ) {
155
- this .spriteProvider = spriteProvider ;
167
+ this .factorySpriteProvider = spriteProvider ;
156
168
}
157
169
158
- public Particle createParticle (DefaultParticleType defaultParticleType , ClientWorld clientWorld , double d , double e , double f , double g , double h , double i ) {
159
- return new SoundParticle (clientWorld , d , e , f , g , h , i , this .spriteProvider );
170
+ @ Override
171
+ public Particle createParticle (RequiemSoundParticleEffect particleEffect , ClientWorld clientWorld , double d , double e , double f , double g , double h , double i ) {
172
+ return new SoundParticle (clientWorld , d , e , f , g , h , i , this .factorySpriteProvider , particleEffect .getColor ());
160
173
}
161
174
}
162
175
163
- //Stolen using Linkie
176
+ //Stolen using Linkie from Minecraft itself as it doesn't exist on JOML Quaternions
164
177
public void hamiltonProduct (Quaternionf first , Quaternionf second ) {
165
178
float var2 = first .x ();
166
179
float var3 = first .y ();
0 commit comments