stair meta working

This commit is contained in:
Dr. Maniac, PHD 2022-09-09 15:43:31 -07:00 committed by Vaern
parent c0e116f56a
commit f37ac60423
2 changed files with 32 additions and 9 deletions

View File

@ -154,7 +154,7 @@ abstract public class Feature extends StructureComponent {
}
/**
*
* Get orientation-offset metadata for BlockDecoModel
* @param metadata (0 for facing North, 1 for facing South, 2 for facing West, 3 for facing East)
*/
protected int getDecoModelMeta(int metadata) {
@ -190,7 +190,31 @@ abstract public class Feature extends StructureComponent {
* 1/W: S->W; W->N; N->E; E->S
* 2/N: S->N; W->E; N->S; E->W
* 3/E: S->E; W->S; N->W; E->N
* 0/b00/W, 1/b01/E, 2/b10/N, 3/b11/S
*/
protected int getStairMeta(int metadata) {
switch(this.coordBaseMode) {
default: //South
break;
case 1: //West
if((metadata & 3) < 2) //Flip second bit for E/W
metadata = metadata ^ 2;
else
metadata = metadata ^ 3; //Flip both bits for N/S
break;
case 2: //North
metadata = metadata ^ 1; //Flip first bit
break;
case 3: //East
if((metadata & 3) < 2) //Flip both bits for E/W
metadata = metadata ^ 3;
else //Flip second bit for N/S
metadata = metadata ^ 2;
break;
}
return metadata;
}
/**
* Places door at specified location with orientation-adjusted meta

View File

@ -137,14 +137,13 @@ public class OfficeFeatures {
randomlyFillWithBlocks(world, box, rand, 0.75F, sizeX, 2, 8, sizeX, 2, 9, Blocks.glass_pane);
randomlyFillWithBlocks(world, box, rand, 0.75F, sizeX - 3, 2, sizeZ, sizeX - 2, 2, sizeZ, Blocks.glass_pane);
//Fuwnituwe >w<
//North and south are reversed?????? But east and west aren't????
int stairMetaE = this.getMetadataWithOffset(Blocks.oak_stairs, 1); //East
int stairMetaS = this.getMetadataWithOffset(Blocks.oak_stairs, 2); //*SHOULD* be north, but south
int stairMetaN = this.getMetadataWithOffset(Blocks.oak_stairs, 3); //Ditto, but north :3
int stairMetaWU = this.getMetadataWithOffset(Blocks.oak_stairs, 0) | 4; //West, Upside-down
int stairMetaEU = this.getMetadataWithOffset(Blocks.oak_stairs, 1) | 4; //East, Upside-down
int stairMetaSU = this.getMetadataWithOffset(Blocks.oak_stairs, 2) | 4; //Ditto, but south, Upside-down uwu
int stairMetaNU = this.getMetadataWithOffset(Blocks.oak_stairs, 3) | 4; //Ditto, but north, Upside-down
int stairMetaE = getStairMeta(1); //East
int stairMetaN = getStairMeta(2); //*SHOULD* be north
int stairMetaS = getStairMeta(3); //South :3
int stairMetaWU = getStairMeta(0) | 4; //West, Upside-down
int stairMetaEU = stairMetaE | 4; //East, Upside-down
int stairMetaNU = stairMetaN | 4; //North, Upside-down uwu
int stairMetaSU = stairMetaS | 4; //South, Upside-down
//Desk 1 :3
placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaEU, 1, 1, 4, box);
placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaNU, 2, 1, 4, box);