fix all face rotations!

This commit is contained in:
Meredith Espinosa 2019-06-18 14:39:26 -07:00
parent 56ee01d42b
commit f52e43efe6
2 changed files with 47 additions and 47 deletions

View File

@ -10,7 +10,7 @@ import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
public class SlopeTestEntity extends BlockEntity implements BlockEntityClientSerializable { public class SlopeTestEntity extends BlockEntity implements BlockEntityClientSerializable {
private Block renderedBlock = Blocks.OAK_PLANKS; private Block renderedBlock = Blocks.DIAMOND_ORE;
public SlopeTestEntity() { public SlopeTestEntity() {
super(SlopeTest.SLOPE_ENTITY); super(SlopeTest.SLOPE_ENTITY);

View File

@ -60,22 +60,22 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
buffer.vertex(1f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case SOUTH: case SOUTH:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
break; break;
case EAST: case EAST:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case WEST: case WEST:
buffer.vertex(0f, 1f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
default: default:
break; break;
} }
@ -84,28 +84,28 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
public static void drawLeftSide(Direction dir, Sprite sprite, BufferBuilder buffer) { public static void drawLeftSide(Direction dir, Sprite sprite, BufferBuilder buffer) {
switch(dir) { switch(dir) {
case NORTH: case NORTH:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case SOUTH: case SOUTH:
buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
break; break;
case EAST: case EAST:
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case WEST: case WEST:
buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
default: default:
break; break;
} }
@ -114,10 +114,10 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
public static void drawRightSide(Direction dir, Sprite sprite, BufferBuilder buffer) { public static void drawRightSide(Direction dir, Sprite sprite, BufferBuilder buffer) {
switch(dir) { switch(dir) {
case NORTH: case NORTH:
buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
break; break;
case SOUTH: case SOUTH:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
@ -132,10 +132,10 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case WEST: case WEST:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
default: default:
break; break;
} }
@ -150,10 +150,10 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
break; break;
case SOUTH: case SOUTH:
buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
break; break;
case EAST: case EAST:
buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
@ -162,19 +162,19 @@ public class SlopeTestRenderer extends BlockEntityRenderer<SlopeTestEntity> {
buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
break; break;
case WEST: case WEST:
buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 1f, 0f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 1f, 0f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
default: default:
break; break;
} }
} }
public static void drawBottom(Sprite sprite, BufferBuilder buffer) { public static void drawBottom(Sprite sprite, BufferBuilder buffer) {
buffer.vertex(0f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 0f).texture(sprite.getMinU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 0f).texture(sprite.getMaxU(), sprite.getMaxV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(1f, 0f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(1f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
buffer.vertex(0f, 0f, 1f).texture(sprite.getMaxU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next(); buffer.vertex(0f, 0f, 1f).texture(sprite.getMinU(), sprite.getMinV()).color(1f, 1f, 1f, 1f).next();
} }
} }