2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.api.ritual;
|
2015-10-31 13:47:43 -07:00
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
|
|
|
|
2015-12-29 13:00:26 -08:00
|
|
|
/**
|
|
|
|
* Used to set a {@link EnumRuneType} type to a given {@link BlockPos}
|
|
|
|
* for usage in Ritual creation.
|
|
|
|
*/
|
2015-10-31 13:47:43 -07:00
|
|
|
@Getter
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
public class RitualComponent {
|
|
|
|
|
|
|
|
private final BlockPos offset;
|
|
|
|
private final EnumRuneType runeType;
|
|
|
|
|
|
|
|
public int getX(EnumFacing direction) {
|
|
|
|
switch (direction) {
|
|
|
|
case EAST:
|
|
|
|
return -this.getOffset().getZ();
|
|
|
|
case SOUTH:
|
|
|
|
return -this.getOffset().getX();
|
|
|
|
case WEST:
|
|
|
|
return this.getOffset().getZ();
|
|
|
|
default:
|
|
|
|
return this.getOffset().getX();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getZ(EnumFacing direction) {
|
|
|
|
switch (direction) {
|
|
|
|
case EAST:
|
|
|
|
return this.getOffset().getX();
|
|
|
|
case SOUTH:
|
|
|
|
return -this.getOffset().getZ();
|
|
|
|
case WEST:
|
|
|
|
return -this.getOffset().getX();
|
|
|
|
default:
|
|
|
|
return this.getOffset().getZ();
|
|
|
|
}
|
|
|
|
}
|
2015-12-29 09:10:03 -05:00
|
|
|
|
|
|
|
public BlockPos getOffset(EnumFacing direction) {
|
|
|
|
return new BlockPos(getX(direction), offset.getY(), getZ(direction));
|
|
|
|
}
|
2015-10-31 13:47:43 -07:00
|
|
|
}
|