[SOLVED] My forgetfullness

Hi.

#The problem

So I’ve started to make a simple remake of Tetris, as a break from my main project.

Several minutes in, and I’m experiencing the following problem:
In a converter (static class) I convert standard shapes (enum) into an Array for Vector3fs: Vector3f[] vectors. I use a switch / case for this.
However, I get an error that “The statement is never used”

This is the code:

package shapes;

import com.jme3.math.Vector3f;
import java.lang.reflect.Array;

/**
 *
 * @author MisterCavespider
 */
public class Converter {
    
    public static Vector3f[] convert(TetrisShape t) {
        
        Vector3f[] vectors = (Vector3f[]) Array.newInstance(Vector3f.class, 4);
        
        Vector3f v0 = null;
        Vector3f v1 = null;
        Vector3f v2 = null;
        Vector3f v3 = null;
        
        switch(t) {
            case T_SHAPE: {
                v0 = new Vector3f(3,1,1);
                v1 = new Vector3f(1,1,1);
                v2 = new Vector3f(-1,1,1);
                v3 = new Vector3f(1,-1,1);
            }
            case L_SHAPE: {
                v0= new Vector3f(1,3,1);
                v1= new Vector3f(1,1,1);
                v2= new Vector3f(1,-1,1);
                v3= new Vector3f(-1,-1,1);
            }
        }
        
        vectors[0] = (v0);
        vectors[1] = (v1);
        vectors[2] = (v2);
        vectors[3] = (v3);
        
        return vectors;
    }
    


The problem is in this part:

switch(t) {
        case T_SHAPE: {
            v0 = new Vector3f(3,1,1);
            v1 = new Vector3f(1,1,1);
            v2 = new Vector3f(-1,1,1);
            v3 = new Vector3f(1,-1,1);
        }

#The Solution (kinda)
This problem can be solved by using an else/if-construction, but why doesn’t switch/case work?

#Spider gif

maybe ‘break’ out of the switch statements will help.

Oops.
I always forget that; It works.
:neutral_face:

And btw you can use new Vector3f[4] instead of reflect…

I was just horsing around with what Java offers.